public HttpResponseBase GetMoney()
        {
            List<OrderMoneyReturnQuery> stores = new List<OrderMoneyReturnQuery>();
            string json = string.Empty;
            try
            {
                OrderMoneyReturnQuery query = new OrderMoneyReturnQuery();
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//用於分頁的變量
                query.order_id = Convert.ToUInt32(Request.Params["Order_Id"].ToString());
                _tabshow = new TabShowMgr(mySqlConnectionString);
                int totalCount = 0;
                stores = _tabshow.GetMoney(query, out totalCount);
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();

                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";

                json = "{success:true,'msg':'user',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 SaveCSNote()
 {
     OrderMoneyReturnQuery query = new OrderMoneyReturnQuery();
     string json = string.Empty;
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["money_id"]))
         {
             query.money_id = Convert.ToUInt32(Request.Params["money_id"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["cs_note"]))
         {
             query.cs_note = Request.Params["cs_note"].Replace("\n","  "); 
         }
         _orderMoneyReturnMgr = new OrderMoneyReturnMgr(mySqlConnectionString);
         json = _orderMoneyReturnMgr.SaveCSNote(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;
 }
Esempio n. 3
0
        public List<OrderMoneyReturnQuery> GetMoney(OrderMoneyReturnQuery store, out int totalCount)
        {
            StringBuilder sql = new StringBuilder();
            StringBuilder sqlcount = new StringBuilder();

            try
            {
                sql.AppendFormat(@"SELECT omr.money_id,omr.order_id,omr.money_type,pay.parameterName AS moneytype,omr.money_total,CASE omr.money_status WHEN '1' THEN '已退款' ELSE '待退款' END AS states,omr.money_note,omr.money_source,omr.cs_note,");
                sql.AppendFormat(@"omr.bank_name,omr.bank_branch,omr.bank_account,omr.bank_note,omr.account_name,FROM_UNIXTIME(omr.money_createdate) AS createdate,omr.money_updatedate,omr.money_ipfrom ");
                sql.AppendFormat(@"FROM order_money_return omr ");
                sql.AppendFormat(@"LEFT JOIN (SELECT * FROM t_parametersrc WHERE parameterType='payment') pay ON pay.parameterCode=omr.money_type ");
                sql.AppendFormat(@"WHERE omr.order_id={0}  ORDER BY money_createdate ASC, money_id ASC ", store.order_id);

                sqlcount.AppendFormat(@"SELECT count(*) as search_total FROM order_money_return omr LEFT JOIN (SELECT * FROM t_parametersrc WHERE parameterType='payment') pay ON pay.parameterCode=omr.money_type WHERE order_id={0} ", store.order_id);


                totalCount = 0;
                if (store.IsPage)
                {
                    System.Data.DataTable _dt = _access.getDataTable(sqlcount.ToString());
                    if (_dt != null && _dt.Rows.Count > 0)
                    {
                        totalCount = Convert.ToInt32(_dt.Rows[0]["search_total"]);
                    }
                    sql.AppendFormat(" limit {0},{1}", store.Start, store.Limit);

                }
                return _access.getDataTableForObj<OrderMoneyReturnQuery>(sql.ToString());
            }
            catch (Exception ex)
            {


                throw new Exception("TabShowDao-->GetMoney " + ex.Message + sql.ToString(), ex);
            }
        }