public HttpResponseBase TicketReturnList() { string json = string.Empty; try { List<TicketReturnQuery> store = new List<TicketReturnQuery>(); TicketReturnQuery query = new TicketReturnQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25"); int totalCount = 0; if (!string.IsNullOrEmpty(Request.Params["start_date"])) { query.start_date = Convert.ToDateTime(Request.Params["start_date"]); } if (!string.IsNullOrEmpty(Request.Params["end_date"])) { query.end_date = Convert.ToDateTime(Request.Params["end_date"]); } _ticketReturn = new TicketReturnMgr(mySqlConnectionString); store = _ticketReturn.GetTicketReturnList(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, 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; }
public HttpResponseBase SaveTicketReturn() { string json = string.Empty; try { TicketReturnQuery query = new TicketReturnQuery(); if (!string.IsNullOrEmpty(Request.Params["tr_id"])) { query.tr_id = Convert.ToInt32(Request.Params["tr_id"]); } if (!string.IsNullOrEmpty(Request.Params["ticket_master_id"])) { query.ticket_master_id = Convert.ToInt32(Request.Params["ticket_master_id"]); } if (!string.IsNullOrEmpty(Request.Params["tr_note"])) { query.tr_note = (Request.Params["tr_note"]); } if (!string.IsNullOrEmpty(Request.Params["tr_bank_note"])) { query.tr_bank_note = (Request.Params["tr_bank_note"]); } if (!string.IsNullOrEmpty(Request.Params["tr_money"])) { query.tr_money = Convert.ToInt32(Request.Params["tr_money"]); } if (!string.IsNullOrEmpty(Request.Params["trcl_last_money"])) { query.trcl_last_money = Convert.ToInt32(Request.Params["trcl_last_money"]); } if (!string.IsNullOrEmpty(Request.Params["tr_status"])) { query.tr_status = Convert.ToInt32(Request.Params["tr_status"]); } if (!string.IsNullOrEmpty(Request.Params["trcl_last_status"])) { query.trcl_last_status = Convert.ToInt32(Request.Params["trcl_last_status"]); } if (!string.IsNullOrEmpty(Request.Params["tr_reason_type"])) { query.tr_reason_type = (Request.Params["tr_reason_type"]); } query.tr_update_user = (Session["caller"] as Caller).user_id; query.trcl_create_user = (Session["caller"] as Caller).user_id; _ticketReturn = new TicketReturnMgr(mySqlConnectionString); json = _ticketReturn.SaveTicketReturn(query); } 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}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase GetReasonTypeStore() { List<TicketReturnQuery> store = new List<TicketReturnQuery>(); string json = string.Empty; try { _ticketReturn = new TicketReturnMgr(mySqlConnectionString); store = _ticketReturn.GetReasonTypeStore(); json = "{success:true,data:" + JsonConvert.SerializeObject(store, Formatting.Indented) + "}";//返回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}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }