public ActionResult List(int?p) { int DoctorId = int.Parse(System.Web.HttpContext.Current.Request.Cookies["UserId"].Value); Pager pager = new Pager(); pager.table = "CMSYuyue"; pager.strwhere = " YuyueDoctorId=" + DoctorId; pager.PageSize = 10; pager.PageNo = p ?? 1; pager.FieldKey = "YuyueId"; pager.FiledOrder = "YuyueDateTime Desc"; pager = CMSService.SelectAll("Yuyue", pager); List <YuyueDto> list = new List <YuyueDto>(); foreach (DataRow dr in pager.EntityDataTable.Rows) { YuyueDto dto = YuyueMapping.getDTO(dr); list.Add(dto); } pager.Entity = list.AsQueryable(); ViewBag.PageNo = p ?? 1; ViewBag.PageCount = pager.PageCount; ViewBag.RecordCount = pager.Amount; ViewBag.Message = pager.Amount; return(View(pager.Entity)); }
// // GET: /Yuyue/ public ActionResult Index(int?p, int?id) { Pager pager = new Pager(); pager.table = "CMSYuyue"; pager.strwhere = "1=1"; if (id != 0) { pager.strwhere = pager.strwhere + "YuyueDoctorId=" + id; } // pager.strwhere = "YuyueCustomerId=" + id; pager.PageSize = 10; pager.PageNo = p ?? 1; pager.FieldKey = "YuyueId"; pager.FiledOrder = "YuyueDateTime Desc"; pager = CMSService.SelectAll("Yuyue", pager); List <YuyueDto> list = new List <YuyueDto>(); foreach (DataRow dr in pager.EntityDataTable.Rows) { YuyueDto dto = YuyueMapping.getDTO(dr); list.Add(dto); } pager.Entity = list.AsQueryable(); ViewBag.PageNo = p ?? 1; ViewBag.PageCount = pager.PageCount; ViewBag.RecordCount = pager.Amount; ViewBag.Message = pager.Amount; ViewBag.CustomerId = id; ViewBag.CustomerName = MyService.CustomerIdToName("CustomerId=" + id); return(View(pager.Entity)); }
public SqlParameter[] JsonStringToSqlParameter(string jsonString) { SqlParameter[] arParames = new SqlParameter[6]; YuyueDto yuyueDto = JsonHelper.JsonDeserializeBySingleData <YuyueDto>(jsonString); arParames[0] = new SqlParameter("@YuyueId", SqlDbType.Int); arParames[0].Value = yuyueDto.YuyueId; arParames[1] = new SqlParameter("@YuyueDoctorId", SqlDbType.Int); arParames[1].Value = yuyueDto.YuyueDoctorId; arParames[2] = new SqlParameter("@YuyueCustomerId", SqlDbType.Int); arParames[2].Value = yuyueDto.YuyueCustomerId; arParames[3] = new SqlParameter("@YuyueDescription", SqlDbType.Text); arParames[3].Value = yuyueDto.YuyueDescription; arParames[4] = new SqlParameter("@YuyueDateTime", SqlDbType.DateTime); arParames[4].Value = yuyueDto.YuyueDateTime; arParames[5] = new SqlParameter("@YuyueStatus", SqlDbType.VarChar, 50); arParames[5].Value = yuyueDto.YuyueStatus; return(arParames); }
public ActionResult ListByDay(int?p, int?theday) { int DoctorId = int.Parse(System.Web.HttpContext.Current.Request.Cookies["UserId"].Value); Pager pager = new Pager(); pager.table = "CMSYuyue"; DateTime today = System.DateTime.Now.Date; DateTime yesterday = today.AddDays(-1); DateTime tomorrow = today.AddDays(1); if (theday == 0) { ViewBag.Title = "今日预约"; pager.strwhere = " YuyueDoctorId=" + DoctorId + " and " + "datediff(day,'" + today + "',YuyueDateTime) =0"; } if (theday == 1) { ViewBag.Title = "昨日预约"; pager.strwhere = " YuyueDoctorId=" + DoctorId + " and " + "datediff(day,'" + yesterday + "',YuyueDateTime) =0"; } if (theday == 2) { ViewBag.Title = "明日预约"; pager.strwhere = " YuyueDoctorId=" + DoctorId + " and " + "datediff(day,'" + tomorrow + "',YuyueDateTime) =0"; } if (theday == 3) { ViewBag.Title = "全部待诊预约"; pager.strwhere = " YuyueDoctorId=" + DoctorId + " and " + "datediff(day,'" + yesterday + "',YuyueDateTime) >0"; } // pager.strwhere = " YuyueDoctorId=" + DoctorId; pager.PageSize = 10; pager.PageNo = p ?? 1; pager.FieldKey = "YuyueId"; pager.FiledOrder = "YuyueDateTime Desc"; pager = CMSService.SelectAll("Yuyue", pager); List <YuyueDto> list = new List <YuyueDto>(); foreach (DataRow dr in pager.EntityDataTable.Rows) { YuyueDto dto = YuyueMapping.getDTO(dr); list.Add(dto); } pager.Entity = list.AsQueryable(); ViewBag.PageNo = p ?? 1; ViewBag.PageCount = pager.PageCount; ViewBag.RecordCount = pager.Amount; ViewBag.Message = pager.Amount; return(View(pager.Entity)); }
public static YuyueDto getDTO(DataRow dr) { YuyueDto yuyueDto = new YuyueDto(); yuyueDto.YuyueId = int.Parse(dr["YuyueId"].ToString()); yuyueDto.YuyueCustomerId = int.Parse(dr["YuyueCustomerId"].ToString()); yuyueDto.YuyueDoctorId = int.Parse(dr["YuyueDoctorId"].ToString()); yuyueDto.YuyueDateTime = DateTime.Parse(dr["YuyueDateTime"].ToString()); yuyueDto.YuyueStatus = dr["YuyueStatus"].ToString(); yuyueDto.YuyueDescription = dr["YuyueDescription"].ToString(); return(yuyueDto); }
public ActionResult Create(YuyueAddViewModel model) { try { YuyueDto dto = new YuyueDto(); dto.YuyueCustomerId = model.YuyueCustomerId; dto.YuyueDoctorId = model.YuyueDoctorId; dto.YuyueDateTime = model.YuyueTime; dto.YuyueDescription = model.YuyueDescription; dto.YuyueStatus = "待诊"; string JsonString = JsonHelper.JsonSerializerBySingleData(dto); Message msg = CMSService.Insert("Yuyue", JsonString); return(RedirectTo("/Yuyue/Index/0", msg.MessageInfo)); } catch { Message msg = new Message(); msg.MessageInfo = "预约出问题了"; return(RedirectTo("/Yuyue/Create/" + model.YuyueCustomerId, msg.MessageInfo)); } }