コード例 #1
0
        public ActionResult EverydayTask(string UserId)
        {
            var user = Session["CurrentUser"] as UserAndRole;

            if (UserId == null)
            {
                UserId = user.UserId;
            }
            string PatientId = UserId;

            Session["PatientId"] = UserId;
            EverydayTaskViewModel et = new EverydayTaskViewModel();

            et.PatientId = PatientId;
            ETFunctions.GetReminderList(_ServicesSoapClient, ref et, user.UserId);
            et.StartDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            et.ReminderNo    = "0";
            et.CreatedBy     = "";
            ViewBag.ErrorMSG = _ErrorMSG;
            _ErrorMSG        = "";
            return(View(et));
        }
コード例 #2
0
        //[HandleError(View = "EverydayTask", ExceptionType = typeof(Exception))]
        public ActionResult EverydayTask(EverydayTaskViewModel et, FormCollection formCollection)
        {
            var    user       = Session["CurrentUser"] as UserAndRole;
            string _PatientId = Session["PatientId"] as String;

            if (ModelState.IsValid)
            {
                bool flag = false;
                int  type = 0;
                if (et.ReminderNo == "0")
                {
                    type = 1;
                }
                switch (et.AlertModeSelected)
                {
                case "0":     //没有选择提醒方式
                    flag = _ServicesSoapClient.SetReminder(type, _PatientId, et.ReminderNo, Convert.ToInt32(et.ReminderTypeSelected),
                                                           et.Content, et.StartDateTime, user.UserId, et.CreatedBy, user.TerminalName, user.TerminalIP, user.DeviceType);
                    break;

                case "1":    //一次
                    flag = _ServicesSoapClient.SetReminder_Once(type, _PatientId, et.ReminderNo, Convert.ToInt32(et.ReminderTypeSelected),
                                                                et.Content, Convert.ToInt32(et.AlertModeSelected), et.StartDateTime, et.OnceDateTime, et.CreatedBy, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType);
                    break;

                case "2":    //每天
                    for (int i = 0; i <= et.EveryDayNumber; i++)
                    {
                        if (Request.Form["EveryDayTime" + i] != null && Request.Form["EveryDayTime" + i] != "")
                        {
                            flag = _ServicesSoapClient.SetReminder_Everyday(type, _PatientId, et.ReminderNo, Convert.ToInt32(et.ReminderTypeSelected),
                                                                            et.Content, Convert.ToInt32(et.AlertModeSelected), et.StartDateTime, Request.Form["EveryDayTime" + i], et.CreatedBy, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType);
                            type         = 1;
                            et.CreatedBy = user.UserId;
                        }
                    }
                    break;

                case "3":     //每周
                    for (int i = 0; i <= et.WeeklyNumber; i++)
                    {
                        if (Request.Form["WeeklyTime" + i] != null && Request.Form["WeeklyTime" + i] != "")
                        {
                            flag = _ServicesSoapClient.SetReminder_Weekly(type, _PatientId, et.ReminderNo, Convert.ToInt32(et.ReminderTypeSelected),
                                                                          et.Content, Convert.ToInt32(et.AlertModeSelected), et.StartDateTime, Request.Form["WeeklyWeek" + i], Request.Form["WeeklyTime" + i], et.CreatedBy, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType);
                            type         = 1;
                            et.CreatedBy = user.UserId;
                        }
                    }
                    break;

                case "4":     //每月
                    for (int i = 0; i <= et.MonthlyNumber; i++)
                    {
                        if (Request.Form["MonthlyTime" + i] != null && Request.Form["MonthlyTime" + i] != "")
                        {
                            flag = _ServicesSoapClient.SetReminder_Monthly(type, _PatientId, et.ReminderNo, Convert.ToInt32(et.ReminderTypeSelected),
                                                                           et.Content, Convert.ToInt32(et.AlertModeSelected), et.StartDateTime, Request.Form["MonthlyDay" + i], Request.Form["MonthlyTime" + i], et.CreatedBy, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType);
                            type         = 1;
                            et.CreatedBy = user.UserId;
                        }
                    }
                    break;

                case "5":     //每年
                    DateTime annualStartDT = DateTime.Parse(et.StartDateTime);
                    for (int i = 0; i <= et.AnnualNumber; i++)
                    {
                        if (Request.Form["AnnualTime" + i] != null && Request.Form["AnnualTime" + i] != "")
                        {
                            flag = _ServicesSoapClient.SetReminder_Annual(type, _PatientId, et.ReminderNo, Convert.ToInt32(et.ReminderTypeSelected),
                                                                          et.Content, Convert.ToInt32(et.AlertModeSelected), et.StartDateTime, Request.Form["AnnualMonth" + i], Request.Form["AnnualDay" + i], Request.Form["AnnualTime" + i], et.CreatedBy, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType);
                            type         = 1;
                            et.CreatedBy = user.UserId;
                        }
                    }
                    break;

                case "6":     //间隔
                    flag = _ServicesSoapClient.SetReminder_Interval(type, _PatientId, et.ReminderNo, Convert.ToInt32(et.ReminderTypeSelected),
                                                                    et.Content, Convert.ToInt32(et.AlertModeSelected), et.StartDateTime, et.FreqYear, et.FreqMonth, et.FreqDay, et.FreqHour, et.FreqMunite, et.CreatedBy, user.UserId, user.TerminalName, user.TerminalIP, user.DeviceType);
                    break;

                default: break;
                }
                if (!flag)
                {
                    _ErrorMSG = "数据插入失败,请重试!";
                }
                return(RedirectToAction("EverydayTask"));
            }
            else
            {
                ETFunctions.GetReminderList(_ServicesSoapClient, ref et, user.UserId);
            }
            return(View(et));
        }