当前位置: 首页>>代码示例>>C#>>正文


C# Schedule.SetCurrentCultureInfo方法代码示例

本文整理汇总了C#中Schedule.SetCurrentCultureInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Schedule.SetCurrentCultureInfo方法的具体用法?C# Schedule.SetCurrentCultureInfo怎么用?C# Schedule.SetCurrentCultureInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schedule的用法示例。


在下文中一共展示了Schedule.SetCurrentCultureInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Schedule

        public ActionResult Schedule(Params args, Schedule scheduleObject)
        {
            scheduleObject.SetCurrentCultureInfo();
            ActionResult result = null;
            var parentID = Guid.Parse(Session["ParentID"].ToString());
            var scheduleType = (ScheduleType)int.Parse(Session["ScheduleType"].ToString());
            using (var context = new OfficeContext())
            {
                if (args.CurrentAction == "Save")
                {
                    var startTime = DateTime.Parse(args.StartTime.Replace("上午", "AM").Replace("下午", "PM"));
                    var endTime = DateTime.Parse(args.EndTime.Replace("上午", "AM").Replace("下午", "PM"));
                    Seminar appoint = new Seminar()
                    {
                        StartTime = startTime,
                        EndTime = endTime,
                        Subject = args.Subject,
                        Location = args.Location,
                        Description = args.Description,
                        Owner = args.Owner,
                        Priority = args.Priority,
                        Recurrence = args.Recurrence,
                        RecurrenceType = args.RecurrenceType,
                        RecurrenceCount = Convert.ToInt16(args.RecurrenceTypeCount),
                        Reminder = args.Reminder,
                        Categorize = args.Categorize,
                        AllDay = args.AllDay,
                        RecurrenceEndDate = args.RecurrenceEnd != null ? Convert.ToDateTime(args.RecurrenceEnd) : endTime,
                        RecurrenceStartDate = args.RecurrenceStart != null ? Convert.ToDateTime(args.RecurrenceStart) : startTime,
                        RecurrenceRule = args.RecurrenceRules,
                        ParentID = parentID,
                        ScheduleType = scheduleType,
                        CurrentUser = User.Identity.Name
                    };
                    context.Seminars.Add(appoint);
                    context.SaveChanges();
                }
                else if (args.CurrentAction == "EditOccurrence")
                {
                    //SeminarRepository.EditOccurrence(args);
                }
                else if (args.CurrentAction == "Edit")
                {
                    var appid = int.Parse(args.AppID);
                    var point = context.Seminars.Single(s => s.Id == appid);
                    var startTime = DateTime.Parse(args.StartTime.Replace("上午", "AM").Replace("下午", "PM"));
                    var endTime = DateTime.Parse(args.EndTime.Replace("上午", "AM").Replace("下午", "PM"));

                    point.StartTime = startTime;
                    point.EndTime = endTime;
                    point.Subject = args.Subject;
                    point.Location = args.Location;
                    point.Description = args.Description;
                    point.Owner = args.Owner;
                    point.Priority = args.Priority;
                    point.Recurrence = args.Recurrence;
                    point.RecurrenceType = args.RecurrenceType;
                    point.RecurrenceCount = Convert.ToInt16(args.RecurrenceTypeCount);
                    point.Reminder = args.Reminder;
                    point.Categorize = args.Categorize;
                    point.AllDay = args.AllDay;
                    point.RecurrenceEndDate = args.RecurrenceEnd != null ? Convert.ToDateTime(args.RecurrenceEnd) : endTime;
                    point.RecurrenceStartDate = args.RecurrenceStart != null ? Convert.ToDateTime(args.RecurrenceStart) : startTime;
                    point.RecurrenceRule = args.RecurrenceRules;
                    point.ParentID = parentID;
                    point.ScheduleType = scheduleType;
                    point.CurrentUser = User.Identity.Name;
                    //context.Seminars.Add(point);
                    context.SaveChanges();
                }
                else if (args.CurrentAction == "Delete")
                {
                    var appid = int.Parse(args.AppID);
                    var point = context.Seminars.Single(s => s.Id == appid);
                    context.Seminars.Remove(point);
                    context.SaveChanges();
                }
                else if (args.CurrentAction == "DismissAll" || args.CurrentAction == "Dismiss" || args.CurrentAction == "Snooze")
                {
                    //SeminarRepository.ReminderAction(args);
                }

                result = context.Seminars.Where(s => s.ParentID == parentID && s.ScheduleType == (ScheduleType)scheduleType).ToList().ScheduleActions<ScheduleHtmlActionResult>();
            }

            return result;
        }
开发者ID:wanaxe,项目名称:Study,代码行数:87,代码来源:ScheduleController.cs


注:本文中的Schedule.SetCurrentCultureInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。