//获取每日任务列表 public static void GetReminderList(ServicesSoapClient _ServicesSoapClient, ref EverydayTaskViewModel et, string UserId) { List<Reminder> taskList = new List<Reminder>(); DataSet EverydayTaskDS = _ServicesSoapClient.GetReminder(et.PatientId); DataTable EverydayTaskDT = EverydayTaskDS.Tables[0]; foreach (DataRow dr in EverydayTaskDT.Rows) { Reminder reminder = new Reminder(); reminder.ReminderType = dr["ReminderType"].ToString(); reminder.ReminderTypeName = dr["ReminderTypeName"].ToString(); reminder.ReminderNo = dr["ReminderNo"].ToString(); reminder.Content = dr["Content"].ToString(); reminder.AlertMode = dr["AlertMode"].ToString(); reminder.AlertModeName = dr["AlertModeName"].ToString(); reminder.StartDateTime = Convert.ToDateTime(dr["StartDateTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); reminder.NextDate = Functions.ConvertDate(dr["NextDate"].ToString()); reminder.NextTime = Functions.ConvertTime(dr["NextTime"].ToString()); reminder.Description = dr["Description"].ToString(); reminder.CreatedBy = dr["CreatedBy"].ToString(); if (UserId == reminder.CreatedBy) { reminder.IsAllowed = true; } else { reminder.IsAllowed = false; } taskList.Add(reminder); } et.TodayTask = taskList; }
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); }
public ActionResult EverydayTask(string PatientId) { if (PatientId == null) { PatientId = Session["PatientId"] as String; } else { Session["PatientId"] = PatientId; } var user = Session["CurrentUser"] as UserAndRole; 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); }