public HttpResponseBase GetCourseCountList() { CourseQuery query = new CourseQuery(); string json = string.Empty; int isTranInt = 0; try { query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25"); if (!string.IsNullOrEmpty(Request.Params["select_vendor"])) { query.Vendor_Id = int.Parse(Request.Params["select_vendor"]); } if (!string.IsNullOrEmpty(Request.Params["select_content"])) { if (int.TryParse(Request.Params["select_content"].Trim(), out isTranInt)) { query.Course_Id = Convert.ToInt32(Request.Params["select_content"].Trim()); } else { query.Course_Name = (Request.Params["select_content"]).Trim(); } } if (!string.IsNullOrEmpty(Request.Params["start_time"])) { query.Start_Date = Convert.ToDateTime(Convert.ToDateTime(Request.Params["start_time"]).ToString("yyyy-MM-dd 00:00:00")); } if (!string.IsNullOrEmpty(Request.Params["end_time"])) { query.End_Date = Convert.ToDateTime(Convert.ToDateTime(Request.Params["end_time"]).ToString("yyyy-MM-dd 23:59:59")); } int totalCount = 0; _ITicketMaster = new TicketMasterMgr(mySqlConnectionString); DataTable _dt = _ITicketMaster.GetCourseCountList(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(_dt, Formatting.Indented, timeConverter) + "}"; } catch (Exception ex) { Vendor.Log4NetCustom.LogMessage logMessage = new Vendor.Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json.ToString()); this.Response.End(); return this.Response; }
public HttpResponseBase UpdateTicketMaster() { string json = string.Empty; try { TicketMaster tm = new TicketMaster(); _ITicketMaster = new TicketMasterMgr(mySqlConnectionString); if (Request.Params["ticket_master_id"] != "0") { tm.ticket_master_id = int.Parse(Request.Params["ticket_master_id"]); } tm.delivery_name = Request.Params["delivery_name"]; tm.delivery_mobile = Request.Params["delivery_mobile"]; tm.delivery_phone = Request.Params["delivery_phone"]; tm.delivery_address = Request.Params["delivery_address"]; if (!string.IsNullOrEmpty(Request.Params["delivery_zip"])) { tm.delivery_zip = int.Parse(Request.Params["delivery_zip"]); } tm.order_name = Request.Params["order_name"]; tm.order_mobile = Request.Params["order_mobile"]; tm.order_phone = Request.Params["order_phone"]; tm.order_address = Request.Params["order_address"]; if (!string.IsNullOrEmpty(Request.Params["order_zip"])) { tm.order_zip = int.Parse(Request.Params["order_zip"]); } json = _ITicketMaster.Update(tm); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:0}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase CancleOrder() { string json = string.Empty; TicketMasterQuery query = new TicketMasterQuery(); List<TicketMasterQuery> list = new List<TicketMasterQuery>(); try { if (!string.IsNullOrEmpty(Request.Form["rowID"])) { string rowIDs = Request.Form["rowID"]; if (rowIDs.IndexOf("|") != -1) { foreach (string id in rowIDs.Split('|')) { if (!string.IsNullOrEmpty(id)) { query = new TicketMasterQuery(); query.master_status = 90; query.detail_status = 90; query.ticket_master_id = Convert.ToInt32(id); list.Add(query); } } } _ITicketMaster = new TicketMasterMgr(mySqlConnectionString); json = _ITicketMaster.ExecCancelOrder(list); } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{failure:true}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase GetTicketMasterList() { string json = string.Empty; int tranInt = 0; try { List<TicketMasterQuery> store = new List<TicketMasterQuery>(); TicketMasterQuery query = new TicketMasterQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25"); int totalCount = 0; _ITicketMaster = new TicketMasterMgr(mySqlConnectionString); if (!string.IsNullOrEmpty(Request.Params["master_status"])) { query.master_status = int.Parse(Request.Params["master_status"]); } else { query.master_status = -1; } if (!string.IsNullOrEmpty(Request.Params["order_payment"])) { query.order_payment = int.Parse(Request.Params["order_payment"]); } else { query.order_payment = -1; } if (!string.IsNullOrEmpty(Request.Params["ticket_master_id"])) { query.ticket_master_id = int.Parse(Request.Params["ticket_master_id"]); } if (!string.IsNullOrEmpty(Request.Params["order_name"])) { query.order_name = (Request.Params["order_name"]); } if (!string.IsNullOrEmpty(Request.Params["ticket_start"])) { query.order_start = (int)CommonFunction.GetPHPTime(Request.Params["ticket_start"]); } if (!string.IsNullOrEmpty(Request.Params["ticket_end"])) { query.order_end = (int)CommonFunction.GetPHPTime(Request.Params["ticket_end"]); } if (!string.IsNullOrEmpty(Request.Params["bill_check"])) { query.billing_checked = int.Parse(Request.Params["bill_check"]); } if (!string.IsNullOrEmpty(Request.Params["course_search"])) { if (int.TryParse(Request.Params["course_search"], out tranInt)) { query.course_id = tranInt; } else { query.course_name = Request.Params["course_search"]; } } if (!string.IsNullOrEmpty(Request.Params["course_start"])) { query.start_date = DateTime.Parse(Request.Params["course_start"]); } if (!string.IsNullOrEmpty(Request.Params["course_end"])) { query.end_date = DateTime.Parse(Request.Params["course_end"]); } if (!string.IsNullOrEmpty(Request.Params["relation_id"])) { query.ticket_master_id = int.Parse(Request.Params["relation_id"]); } if (!string.IsNullOrEmpty(Request.Params["isSecret"])) { query.isSecret = Request.Params["isSecret"].ToString(); } DataTable dt = _ITicketMaster.GetTicketMasterList(query, out totalCount); #region wasted code //dt.Columns.Add("s_order_createdate", typeof(string)); //for (int i = 0; i < dt.Rows.Count; i++) //{ // if (query.isSecret == "true") // { // dt.Rows[i]["order_name"] = dt.Rows[i]["order_name"].ToString().Substring(0, 1) + "**"; // } // string time = dt.Rows[i]["order_createdate"].ToString(); // DateTime longTime = CommonFunction.GetNetTime(long.Parse(time)); // dt.Rows[i]["s_order_createdate"] = CommonFunction.DateTimeToString(longTime); //} #endregion IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(dt, Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:0}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }