Example #1
0
 /// <summary>
 /// 執行核銷動作
 /// </summary>
 /// <returns></returns>
 public HttpResponseBase DoTicketVerification()
 {
     string json = "{success:false}";
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["ticketId"]))
         {
             _courseTicketMgr = new CourseTicketMgr(mySqlConnectionString);
             CourseTicket store = _courseTicketMgr.Query(new CourseTicket { ticket_id = Convert.ToInt32(Request.Params["ticketId"]) }).FirstOrDefault();
             store.modify_date = DateTime.Now;
             store.modify_user = (Session["caller"] as Caller).user_id;
             if (_courseTicketMgr.TicketVerification(store, 1))//供應商為2,管理員為1
             {
                 json = "{success:true}";
             }
         }
     }
     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);
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Example #2
0
        public HttpResponseBase GetTicketDetail()
        {
            CourseTicket query = new CourseTicket();

            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_ticket"]))
                {

                    if (int.TryParse(Request.Params["select_ticket"].Trim(), out isTranInt))
                    {
                        query.ticket_detail_id = Convert.ToInt32(Request.Params["select_ticket"]);
                    }
                }
                if (!string.IsNullOrEmpty(Request.Params["select_code"]))
                {
                    query.ticket_code = Request.Params["select_code"].Trim();
                }

                if (!string.IsNullOrEmpty(Request.Params["search_status"]))
                {
                    query.flag = Convert.ToInt32(Request.Params["search_status"]);
                }

                int totalCount = 0;
                _courseTicketMgr = new CourseTicketMgr(mySqlConnectionString);
                DataTable _dt = _courseTicketMgr.GetTicketCode(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)
            {
                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,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json.ToString());
            this.Response.End();
            return this.Response;
        }