public HttpResponseBase ModifyOrderCancelMasterList()
 {
     List<OrderCancelMaster> stores = new List<OrderCancelMaster>();
     string json = string.Empty;
     try
     {
         OrderCancelMaster query = new OrderCancelMaster();
         query.order_id = Convert.ToUInt32(Request.Form["order_id"]);
         query.cancel_id = Convert.ToUInt32(Request.Form["cancel_id"]);
         query.cancel_status = Convert.ToUInt32(Request.Form["cancel_status"]);
         query.cancel_note = Request.Params["cancel_note"];
         query.bank_note = Request.Params["bank_note"];
         query.cancel_createdate = Convert.ToDateTime(Request.Params["cancel_createdate"]);
         query.cancel_updatedate = Convert.ToDateTime(Request.Params["cancel_updatedate"]);
         System.Net.IPAddress[] ips = Dns.GetHostByName(Dns.GetHostName()).AddressList;
         if (ips.Length > 0)
         {
             query.cancel_ipfrom = ips[0].ToString();
         }
         _orderCancelMgr = new OrderCancelMasterMgr(mySqlConnectionString);
         int result = _orderCancelMgr.Update(query);
         string msg = "";
         switch (result)
         {
             case 1:
                 msg = "bonus not enough!";
                 break;
             case 2:
                 msg = "bonus type error!";
                 break;
             case 3:
                 msg = "取得身分證字號失敗!";
                 break;
             case 4:
                 msg = "扣除HappyGo點數失敗!";
                 break;
             case 5:
                 msg = "bonus type error !";
                 break;
             case 100:
                 msg = "";//操作成功!
                 break;
             default:
                 break;
         }
         if (string.IsNullOrEmpty(msg))
         {
             json = "{success:true}";//返回json數據
         }
         else
         {
             json = "{success:true,msg:\"" + msg + "\"}";
         }
     }
     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,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
 public HttpResponseBase ReturnMsg() 
 {
     string json = string.Empty;
     OrderMaster order = new OrderMaster();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["order_id"]))
        {
            order.Order_Id = uint.Parse(Request.Params["order_id"]);
        }
          _orderCancelMgr = new OrderCancelMasterMgr(mySqlConnectionString);
          int result = _orderCancelMgr.returnMsg(order);
          int msg =0;
          switch (result)
          {
              case 1:
                  msg = 1;
                break;
              case 99:
                msg = 99;
                break;
           
            case 100:
                msg =100;//操作成功!
                break;
            default:
                break;
          }
          json = "{success:true,msg:\"" + msg + "\"}";
     }
     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 GetOrderCancelMasterList()
 {
     List<OrderCancelMaster> stores = new List<OrderCancelMaster>();
     string json = string.Empty;
     try
     {
         int totalCount = 0;
         OrderCancelMaster query = new OrderCancelMaster();
         query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
         query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//
         _orderCancelMgr = new OrderCancelMasterMgr(mySqlConnectionString);
         stores = _orderCancelMgr.GetOrderCancelMasterList(query, out totalCount);
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
         //listUser是准备转换的对象
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, 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:true,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
        public HttpResponseBase ReturnAllOrder()
        {
           string json = string.Empty;
           OrderMaster order = new OrderMaster();
           try{
               if (!string.IsNullOrEmpty(Request.Params["return_order"]))
               {
                   order.Order_Id = uint.Parse(Request.Params["return_order"]);
               }
               if (!string.IsNullOrEmpty(Request.Params["order_note"]))
               {
                   order.Note_Order = Request.Params["order_note"];

               }
               order.User_Id = uint.Parse(((Session["caller"] as Caller).user_id).ToString());
               order.user_name = (Session["caller"] as Caller).user_username;
               System.Net.IPAddress[] addlist = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList;
               if (addlist.Length > 0)
               {
                   order.Order_Ipfrom = addlist[0].ToString();
               }
               _orderCancelMgr = new OrderCancelMasterMgr(mySqlConnectionString);
               int result = _orderCancelMgr.ReturnAllOrder(order);
               string msg = "等待超時";
               switch (result)
               {
                   case 1:
                       msg = "消費者購物金餘額不足,無法扣除給予購物金!";
                       break;
                   case 2:
                       msg = "error master!";
                       break;
                   case 3:
                       msg = "error slave!";
                       break;
                   case 4:
                       msg = "取得身份證字號失敗!";
                       break;
                   case 5:
                       msg = "bonus type error !";
                       break;
                   case 100:
                       msg = "100";//操作成功!
                       break;
                   default:
                       break;
               }
               json = "{success:true,msg:\"" + msg + "\"}";              
            }
            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;
        }