Ejemplo n.º 1
0
        public HttpResponseBase GetUserInfo()
        {
            string json = string.Empty;
            UsersListQuery store = new UsersListQuery();
            _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
            try
            {
                uint user_id = Convert.ToUInt32(Request.Params["user_id"]);
                // uint user_id = 2341;
                store = _orderMasterMgr.GetUserInfo(user_id);
                store.suser_reg_date = CommonFunction.GetNetTime(store.user_reg_date);
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                json = "{success:true,data:" + JsonConvert.SerializeObject(store, 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,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 2
0
 public HttpResponseBase SaveStatus()
 {
     string json = string.Empty;
     OrderShowMasterQuery query = new OrderShowMasterQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["order_id"]))
         {
             query.order_id = Convert.ToUInt32(Request.Params["order_id"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["order_status"]))
         {
             query.order_status = Convert.ToUInt32(Request.Params["order_status"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["user_username"]))
         {
             query.manager_name = Request.Params["user_username"];
         }
         if (!string.IsNullOrEmpty(Request.Params["status_description"]))
         {//query.manager_name 
             query.status_description = (Session["caller"] as Caller).user_username+ ":" + Request.Params["status_description"];
         }
         System.Net.IPAddress[] addlist = Dns.GetHostByName(Dns.GetHostName()).AddressList;
         if (addlist.Length > 0)
         {
             query.status_ipfrom = addlist[0].ToString();
         }
         query.StatusCreateDate = DateTime.Now;
         _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
         _orderMasterMgr.SaveStatus(query);
         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);
         json = "{success:false}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Ejemplo n.º 3
0
 public HttpResponseBase SaveNoteAdmin()
 {
     string json = string.Empty;
     OrderShowMasterQuery query = new OrderShowMasterQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["order_id"]))
         {
             query.order_id = Convert.ToUInt32(Request.Params["order_id"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["note_admin"]))
         {
             query.note_admin = Request.Params["note_admin"];
         }
         _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
         _orderMasterMgr.SaveNoteAdmin(query);
         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);
         json = "{success:false}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Ejemplo n.º 4
0
        public HttpResponseBase GetData()
        {
            uint orderId =0;
            if(uint.TryParse(Request.Params["order_id"],out orderId))
            {
                orderId = orderId;
            }
            OrderMasterQuery omQuery=new OrderMasterQuery ();
            OrderShowMasterQuery query = new OrderShowMasterQuery();
            string json = string.Empty;
            OrderShowMasterQuery store = new OrderShowMasterQuery();
            _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
            zMgr = new ZipMgr(mySqlConnectionString);
            try
            {
                store = _orderMasterMgr.GetData(orderId);
                uint user_id =(uint)(Session["caller"] as Caller).user_id;
                if (_orderMasterMgr.VerifySession(user_id) > 0)
                {
                    store.is_manage_user = true;
                }
                else
                {
                    store.is_manage_user = false;
                }
                if (!string.IsNullOrEmpty(Request.Params["isSecret"]))
                {
                    if (Request.Params["isSecret"] == "false")
                    {
                        store.isSecret = false;
                    }
                    else
                    {
                        store.isSecret = true;
                    }

                }
                omQuery.Order_Id=orderId;
                store.is_send_product = _orderMasterMgr.IsSendProduct(omQuery);//true可以變更 false不可變更。
                store.is_vendor_deliver = _orderMasterMgr.IsVendorDeliver(orderId);
                store.OrderDatePay = CommonFunction.GetNetTime(store.order_date_pay);
                if (!string.IsNullOrEmpty(store.money_collect_date.ToString()) && store.money_collect_date != 0)
                {
                    store.MoneyCollectDate = CommonFunction.GetNetTime(store.money_collect_date);
                }
                store.NoteOrderModifyTime = CommonFunction.GetNetTime(store.note_order_modify_time);
                store.OrderCreateDate = CommonFunction.GetNetTime(store.order_createdate);
                store.OrderDateClose = CommonFunction.GetNetTime(store.order_date_close);
                double value = Convert.ToDouble(store.deduct_happygo * store.deduct_happygo_convert);
                store.Hg_Nt = Math.Round(value).ToString();
                //地址直接讀取
                store.order_address = zMgr.Getaddress(int.Parse(store.order_zip.ToString())) + store.order_address;
                store.delivery_address = zMgr.Getaddress(int.Parse(store.delivery_zip.ToString())) + store.delivery_address;
                if (store.isSecret)
                {
                    #region 添加資安的字段
                    if (store.order_name.Length > 1)
                    {
                        store.order_name = store.order_name.ToString().Substring(0, 1) + "**";
                    }
                    else
                    {
                        store.order_name = store.order_name.ToString() + "**";
                    }             
                    //if (store.order_mobile.Length > 1)
                    //{
                    //    store.order_mobile = store.order_mobile.ToString().Substring(0, 1) + "****";
                    //}
                    //else
                    //{
                    //    store.order_mobile = store.order_mobile.ToString() + "**";
                    //}
                    if (!string.IsNullOrEmpty(store.order_mobile))
                    {
                        if (!CommonFunction.isMobile(store.order_mobile))
                        {
                            if (store.order_mobile.ToString().Length == 48)
                            {
                                store.order_mobile = EncryptComputer.EncryptDecryptTextByApi(store.order_mobile, false);
                                if (!CommonFunction.isMobile(store.order_mobile))
                                {
                                    //異常記錄
                                    Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                                    logMessage.Content = string.Format("表名:{0},訂單編號:{1},行動電話:{2},Message:{3}", "order_master", store.order_id, store.order_mobile, "訂購人行動電話解密后不滿足正則表達式");
                                    logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                                    log.Error(logMessage);
                                }
                            }
                            else
                            {
                                //異常記錄
                                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                                logMessage.Content = string.Format("表名:{0},訂單編號:{1},行動電話:{2},Message:{3}", "order_master", store.order_id, store.order_mobile, "訂購人行動電話錯誤");
                                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                                log.Error(logMessage);
                            }
                        }
                        if (store.order_mobile.ToString().Length > 3)
                        {
                            store.order_mobile = store.order_mobile.Substring(0, 3) + "***";
                        }
                        else
                        {
                            store.order_mobile = store.order_mobile + "***";
                        }
                    }
                    if (store.order_address.Length > 3)
                    {
                        store.order_address = store.order_address.ToString().Substring(0, 3) + "****";
                    }
                    else
                    {
                        store.order_address = store.order_address.ToString() + "**";
                    }
                    if (store.delivery_name.Length > 1)
                    {
                        store.delivery_name = store.delivery_name.ToString().Substring(0, 1) + "**";
                    }
                    else
                    {
                        store.delivery_name = store.delivery_name.ToString() + "**";
                    }

                    //if (store.delivery_mobile.Length > 1)
                    //{
                    //    store.delivery_mobile = store.delivery_mobile.ToString().Substring(0, 1) + "****";
                    //}
                    //else
                    //{
                    //    store.delivery_mobile = store.delivery_mobile.ToString() + "**";
                    //}
                    if (!string.IsNullOrEmpty(store.delivery_mobile))
                    {
                        if (!CommonFunction.isMobile(store.delivery_mobile))
                        {
                            if (store.delivery_mobile.ToString().Length == 48)
                            {
                                store.delivery_mobile = EncryptComputer.EncryptDecryptTextByApi(store.delivery_mobile, false);
                                if (!CommonFunction.isMobile(store.delivery_mobile))
                                {
                                    //異常記錄
                                    Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                                    logMessage.Content = string.Format("表名:{0},訂單編號:{1},行動電話:{2},Message:{3}", "order_master", store.order_id, store.delivery_mobile, "收貨人行動電話解密后不滿足正則表達式");
                                    logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                                    log.Error(logMessage);
                                }
                            }
                            else
                            {
                                //異常記錄
                                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                                logMessage.Content = string.Format("表名:{0},訂單編號:{1},行動電話:{2},Message:{3}", "order_master", store.order_id, store.delivery_mobile, "收貨人行動電話錯誤");
                                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                                log.Error(logMessage);
                            }
                        }
                        if (store.delivery_mobile.ToString().Length > 3)
                        {
                            store.delivery_mobile = store.delivery_mobile.Substring(0, 3) + "***";
                        }
                        else
                        {
                            store.delivery_mobile = store.delivery_mobile + "***";
                        }
                    }
                    if (store.delivery_address.Length > 3)
                    {
                        store.delivery_address = store.delivery_address.ToString().Substring(0, 3) + "****";
                    }
                    else
                    {
                        store.delivery_address = store.delivery_address.ToString() + "**";
                    }
                    #endregion
                }
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                json = "{success:true,data:" + JsonConvert.SerializeObject(store, 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,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 5
0
 public HttpResponseBase SaveNoteOrder()
 {
     string json = string.Empty;
     OrderShowMasterQuery query = new OrderShowMasterQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["order_id"]))
         {
             query.order_id = Convert.ToUInt32(Request.Params["order_id"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["note_order"]))
         {
             query.note_order = Request.Params["note_order"];
         }
         query.user_id = query.user_id = uint.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString());
         query.NoteOrderModifyTime = DateTime.Now;
         _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
         _orderMasterMgr.SaveNoteOrder(query);
         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);
         json = "{success:false}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Ejemplo n.º 6
0
        public string GetBigOrderNumbersMailBody(OrderMasterQuery query,out bool isShow)
        {
            isShow = false;
            StringBuilder strbody = new StringBuilder();
            strbody.AppendLine("一小時之內數量過多訂單檢查:");
            
            DataTable _newErrorDt = new DataTable();
            _newErrorDt.Columns.Add("訂購人", typeof(String));
            _newErrorDt.Columns.Add("郵箱", typeof(String));
            _newErrorDt.Columns.Add("IP地址", typeof(String));
            _newErrorDt.Columns.Add("訂單編號", typeof(String));
            _newErrorDt.Columns.Add("付款時間", typeof(String));
            _orderMaster = new OrderMasterMgr(mySqlConnectionString);

            DataTable _dtResult = _orderMaster.GetBigOrderNumbers(query);
            if (_dtResult.Rows.Count > 0)
            {
                for (int j = 0; j < _dtResult.Rows.Count; j++)
                {
                    DataRow drtwo = _newErrorDt.NewRow();
                    drtwo[0] = _dtResult.Rows[j][0];
                    drtwo[1] = _dtResult.Rows[j][1];
                    drtwo[2] = _dtResult.Rows[j][2];
                    drtwo[3] = _dtResult.Rows[j][3];
                    drtwo[4] = DateTime.Parse(_dtResult.Rows[j][4].ToString()).ToString("yyyy/MM/dd HH:mm:ss"); 
                    _newErrorDt.Rows.Add(drtwo);
                }

                isShow = true;
            }
            strbody.AppendFormat(GetHtmlByDataTable(_newErrorDt));
            return strbody.ToString();
        }
Ejemplo n.º 7
0
        public void ExportArrorOrderExcel()
        {
            string json = string.Empty;
            DataTable _dt = new DataTable();
            DataTable dtHZ = new DataTable();
            OrderMasterQuery query = new OrderMasterQuery();
            try
            {
                string newExcelName = string.Empty;
                dtHZ.Columns.Add("訂單編號", typeof(String));
                dtHZ.Columns.Add("訂單狀態", typeof(String));
                //  dtHZ.Columns.Add("備註", typeof(String));
                dtHZ.Columns.Add("細項編號", typeof(String));
                dtHZ.Columns.Add("父商品編號", typeof(String));
                dtHZ.Columns.Add("組合包編號", typeof(String));
                dtHZ.Columns.Add("組合方式", typeof(String));
                dtHZ.Columns.Add("細項類型", typeof(String));
                dtHZ.Columns.Add("數量", typeof(String));
                if (!string.IsNullOrEmpty(Request.Params["timestart"]))
                {
                    query.first_time = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Params["timestart"]));
                }
                if (!string.IsNullOrEmpty(Request.Params["timeend"]))
                {
                    query.last_time = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Params["timeend"]));
                }
                _OrderMasterMgr = new OrderMasterMgr(connectionString);
                query.IsPage = false;
                int totalCount = 0;
                _dt = _OrderMasterMgr.ArrorOrderList(query, out totalCount);
                if (!System.IO.Directory.Exists(Server.MapPath(excelPath)))
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(excelPath));
                }
                for (int i = 0; i < _dt.Rows.Count; i++)
                {
                    DataRow dr = dtHZ.NewRow();
                    dr["訂單編號"] = _dt.Rows[i]["order_id"];
                    dr["訂單狀態"] = _dt.Rows[i]["remark"];
                    dr["細項編號"] = _dt.Rows[i]["detail_id"];
                    dr["父商品編號"] = _dt.Rows[i]["parent_id"];
                    dr["組合包編號"] = _dt.Rows[i]["pack_id"];
                    dr["組合方式"] = _dt.Rows[i]["modeName"];
                    switch (_dt.Rows[i]["item_mode"].ToString())
                    {
                        case "0":
                            dr["細項類型"] = "一般商品";
                            break;

                        case "1":
                            dr["細項類型"] = "父商品";
                            break;

                        case "2":
                            dr["細項類型"] = "子商品";
                            break;

                    }

                    dr["數量"] = _dt.Rows[i]["cout"];

                    dtHZ.Rows.Add(dr);
                }
                if (dtHZ.Rows.Count > 0)
                {
                    string fileName = DateTime.Now.ToString("異常訂單表_yyyyMMddHHmmss") + ".xls";
                    MemoryStream ms = ExcelHelperXhf.ExportDT(dtHZ, "");
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
                    Response.BinaryWrite(ms.ToArray());
                }
                else
                {
                    Response.Write("匯出數據不存在");
                }
            }
            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:[]}";
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 商品點擊信息列表
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase BrowseDataList()
        {
            string json = string.Empty;
            DataTable dtBrowseData = new DataTable();
            int totalCount = 0;
            BrowseDataQuery query = new BrowseDataQuery();

            string type=Request.Params["type"];
            string searchContent = Request.Params["searchContent"];
            if (!string.IsNullOrEmpty(type))
            {
                query.type = Convert.ToInt32(type);
            }
            if (!string.IsNullOrEmpty(searchContent))
            {
                query.SearchCondition = searchContent;
            }
            if (!string.IsNullOrEmpty(Request.Params["true"]))
            {
                if (Request.Params["true"] == "true")
                {
                    query.isSecret = true;
                }
                else
                {
                    query.isSecret = false;
                }
            }
            if (!string.IsNullOrEmpty(Request.Params["searchType"]))
            {
                query.SearchType = Convert.ToInt32(Request.Params["searchType"]);
            }
            query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
            query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");

            _IBrowseDataMgr = new BrowseDataMgr(mySqlConnectionString);
            _IProductItemMgr=new ProductItemMgr(mySqlConnectionString);
            _IOrderMasterMgr = new OrderMasterMgr(mySqlConnectionString);

            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
            //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            try
            {
                dtBrowseData = _IBrowseDataMgr.GetBrowseDataList(query, out totalCount);
                if (dtBrowseData.Rows.Count>0)
                {
                    dtBrowseData.Columns.Add("buyCount");
                    for (int i = 0; i < dtBrowseData.Rows.Count; i++)
                    {
                        string user_id = dtBrowseData.Rows[i]["user_id"].ToString();
                        string product_id = dtBrowseData.Rows[i]["product_id"].ToString();
                        string item_id = string.Empty;
                        if (query.isSecret)
                        {
                            dtBrowseData.Rows[i]["user_name"] = dtBrowseData.Rows[i]["user_name"].ToString().Substring(0, 1) + "**";
                        }
                        List<ProductItem> listProductItem = _IProductItemMgr.GetProductItemByID(Convert.ToInt32(product_id));
                        if (listProductItem.Count > 0)
                        {
                            item_id = listProductItem[0].Item_Id.ToString();
                        }
                        OrderMasterQuery orderMasterQuery = new OrderMasterQuery
                        {
                            User_Id = Convert.ToUInt32(dtBrowseData.Rows[i]["user_id"]),
                            Item_Id = Convert.ToInt32(item_id)
                        };
                        dtBrowseData.Rows[i]["buyCount"] = _IOrderMasterMgr.GetBuyCount(orderMasterQuery);
                    }
                    json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(dtBrowseData, Formatting.Indented, timeConverter) + "}";

                }
                else
                {
                    json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(dtBrowseData, Formatting.Indented, timeConverter) + "}";
                    //json = "{success:false,msg:0}";
                }

            }
            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;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 訂單內容
        /// </summary>
        /// <returns></returns>
        public ActionResult OrderDetialList()
        {
            //vendorServerPath
            ViewBag.VendorServerPath = vendorServerPath;
            ViewBag.OrderId = Request.QueryString["Order_Id"] ?? "";//獲取付款單號
            #region 控制List頁面字段顯示與否
            OrderMasterQuery query = new OrderMasterQuery();
            _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
            query.Order_Id = Convert.ToUInt32(Request.QueryString["Order_Id"] ?? "");
            string result = _orderMasterMgr.VerifyData(query.Order_Id);

            string[] preValue = result.Split(';');
            ViewBag.site = preValue[0];
            ViewBag.sinopa = preValue[1];
            ViewBag.channel = preValue[2];
            ViewBag.hncb = preValue[3];
            ViewBag.companyWrite = preValue[4].ToString();
            ViewBag.importTime = CommonFunction.GetNetTime(CommonFunction.GetPHPTime(preValue[5].ToString())).ToString("yyyy-MM-dd HH:mm:ss");
            ViewBag.channelOderId = preValue[6];
            ViewBag.retrieve_mode = preValue[7];
            ViewBag.delivery_same = preValue[8];
            ViewBag.delivery_name = preValue[9];
            ViewBag.c_delivery_gender = preValue[10];
            #endregion
            return View();
        }
Ejemplo n.º 10
0
        public HttpResponseBase CategoryDetialExport()
        {
            string json = string.Empty;
            try
            {
                _OrderMasterMgr = new OrderMasterMgr(connectionString);
                OrderDetailQuery query = new OrderDetailQuery();
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//用於分頁的變量
                DataTable store = new DataTable();
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
                if (!string.IsNullOrEmpty(Request.Params["category_id"]))
                {
                    query.category_id = Convert.ToUInt32(Request.Params["category_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["category_name"]))
                {
                    query.category_name = Request.Params["category_name"];
                }
                if (!string.IsNullOrEmpty(Request.Params["category_status"]))
                {
                    query.category_status = Convert.ToInt32(Request.Params["category_status"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["date_stauts"]))
                {
                    query.date_stauts = Convert.ToInt32(Request.Params["date_stauts"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["date_start"]))
                {
                    query.date_start = Convert.ToDateTime(Request.Params["date_start"]);
                    query.date_start = Convert.ToDateTime(query.date_start.ToString("yyyy-MM-dd 00:00:00"));
                }
                if (!string.IsNullOrEmpty(Request.Params["date_end"]))
                {
                    query.date_end = Convert.ToDateTime(Request.Params["date_end"]);
                    query.date_end = Convert.ToDateTime(query.date_end.ToString("yyyy-MM-dd 23:59:59"));
                }

                int money;
                if (int.TryParse(Request.Params["c_money"], out money))
                {
                    query.c_money = money;
                }
                if (int.TryParse(Request.Params["c_money1"], out money))
                {
                    query.c_money1 = money;
                }

                query.IsPage = false;
                string newExcelName = string.Empty;
                store = _OrderMasterMgr.CagegoryDetialExportInfo(query);
                DataTable dtHZ = GetTableHead(store, 2);
                string[] colname = new string[dtHZ.Columns.Count];
                string name = query.category_name.Replace(".", ".");
                name = name.Replace("/", " ");
                name = name.Replace("。", "­.");
                string filename = query.category_id + name + "-類別訂單明細" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                newExcelName = Server.MapPath(excelPath_export) + filename;
                for (int i = 0; i < dtHZ.Columns.Count; i++)
                {
                    colname[i] = dtHZ.Columns[i].ColumnName;
                }

                if (System.IO.File.Exists(newExcelName))
                {
                    System.IO.File.Delete(newExcelName);
                }
                //newExcelName = newExcelName.Replace("。", "·");
                
                ExcelHelperXhf.ExportDTtoExcel(dtHZ, "", newExcelName);
                json = "{success:true,ExcelName:\'" + filename + "\'}";
            }
            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;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 每日出貨總表
        /// </summary>
        /// <returns>每日出貨數據列表</returns>
        public HttpResponseBase EveryDayShipmentList()
        {
            string json = string.Empty;
            List<OrderMasterQuery> listOrderMaster = new List<OrderMasterQuery>();
            List<OrderMasterQuery> newlistOrderMaster = new List<OrderMasterQuery>();
            OrderMasterQuery query = new OrderMasterQuery();
            try
            {
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
                _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
                if (!string.IsNullOrEmpty(Request.Params["orderDatePayStartTime"]))
                {
                    query.order_date_pay_startTime = Convert.ToDateTime(Request.Params["orderDatePayStartTime"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["orderDatePayEndTime"]))
                {
                    query.order_date_pay_endTime = Convert.ToDateTime(Request.Params["orderDatePayEndTime"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["delays"]))
                {
                    query.delay = int.Parse(Request.Params["delays"]);
                }
                int totalCount = 0;
                listOrderMaster = _orderMasterMgr.GetShipmentList(query, out totalCount);
                for (int i = 0; i < listOrderMaster.Count; i++)
                {
                    if (listOrderMaster[i].combined_mode >= 1 && listOrderMaster[i].item_mode == 1) //將組合商品篩選掉
                    {
                        //listOrderMaster.RemoveAt(i);
                    }
                    else
                    {
                        newlistOrderMaster.Add(listOrderMaster[i]);
                    }
                }

                for (int i = 0; i < newlistOrderMaster.Count; i++)
                {
                    newlistOrderMaster[i].product_name = newlistOrderMaster[i].product_name + newlistOrderMaster[i].product_spec_name;
                    for (int j = 0; j < i; j++)
                    {

                        if (newlistOrderMaster.Count > 0)
                        {
                            if (newlistOrderMaster[j].OrderId == newlistOrderMaster[i].OrderId)
                            {
                                newlistOrderMaster[i].OrderId = 0;
                                if (newlistOrderMaster[j].MoneyCollectDate == newlistOrderMaster[i].MoneyCollectDate)
                                {
                                    newlistOrderMaster[i].MoneyCollectDate = DateTime.MinValue;
                                }
                                if (newlistOrderMaster[j].OrderDatePay == newlistOrderMaster[i].OrderDatePay)
                                {
                                    newlistOrderMaster[i].OrderDatePay = DateTime.MinValue;
                                }
                                if (newlistOrderMaster[j].freight_set == newlistOrderMaster[i].freight_set)
                                {
                                    newlistOrderMaster[i].freight_set = 0;
                                }
                                if (newlistOrderMaster[j].order_name == newlistOrderMaster[i].order_name)
                                {
                                    newlistOrderMaster[i].order_name = "";
                                }
                                if (newlistOrderMaster[j].delivery_name == newlistOrderMaster[i].delivery_name)
                                {
                                    newlistOrderMaster[i].delivery_name = "";
                                }
                                if (newlistOrderMaster[j].type == newlistOrderMaster[i].type)
                                {
                                    newlistOrderMaster[i].type = 0;
                                }
                                if (newlistOrderMaster[j].deliver_id == newlistOrderMaster[i].deliver_id)
                                {
                                    newlistOrderMaster[i].deliver_id = 0;
                                }
                                if (newlistOrderMaster[j].vendor_name_simple == newlistOrderMaster[i].vendor_name_simple)
                                {
                                    newlistOrderMaster[i].vendor_name_simple = "";
                                }
                                if (newlistOrderMaster[j].Order_Status == newlistOrderMaster[i].Order_Status)
                                {
                                    newlistOrderMaster[i].Order_Status = 999;
                                }
                                if (newlistOrderMaster[j].delivery_status == newlistOrderMaster[i].delivery_status)
                                {
                                    newlistOrderMaster[j].delivery_status = 999;
                                }
                                if (newlistOrderMaster[j].note_order == newlistOrderMaster[i].note_order)
                                {
                                    newlistOrderMaster[i].note_order = "";
                                }

                            }

                        }
                    }
                }
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(newlistOrderMaster, 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,msg:0}";
            }
            this.Response.Clear();
            this.Response.Write(json.ToString());
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 12
0
        public void OrderMasterExport()
        {
            string json = string.Empty;
            DataTable _dt = new DataTable();
            DataTable dtHZ = new DataTable();
            OrderMasterQuery query = new OrderMasterQuery();
            try
            {
                string newExcelName = string.Empty;
                dtHZ.Columns.Add("付款單號", typeof(String));
                dtHZ.Columns.Add("訂購人", typeof(String));
                //dtHZ.Columns.Add("收貨人", typeof(String));
                dtHZ.Columns.Add("訂單應收金額", typeof(int)); //A
                dtHZ.Columns.Add("紅利折抵金額", typeof(String));
                dtHZ.Columns.Add("付款方式", typeof(String));
                dtHZ.Columns.Add("請款狀態", typeof(String));//C!=NULL  已經款 C==null 未請款 A=I商品取消
                dtHZ.Columns.Add("付款單成立日期", typeof(String));
                dtHZ.Columns.Add("銀行入帳日期", typeof(String));
                dtHZ.Columns.Add("手續費", typeof(String));//B
                dtHZ.Columns.Add("入帳金額", typeof(String));//C
                dtHZ.Columns.Add("退貨入帳日期", typeof(String));
                dtHZ.Columns.Add("退貨入帳手續費", typeof(String));//N
                dtHZ.Columns.Add("退貨入帳金額", typeof(String));//M
                dtHZ.Columns.Add("入帳總額", typeof(String));//D=B+C+M+N
                dtHZ.Columns.Add("入帳金額差異", typeof(String));//E=A-D
                dtHZ.Columns.Add("開立發票日期", typeof(String));
                dtHZ.Columns.Add("發票銷售額", typeof(String));
                dtHZ.Columns.Add("發票稅額", typeof(String));
                dtHZ.Columns.Add("手開發票日期", typeof(String));
                dtHZ.Columns.Add("手開發票銷售額", typeof(String));
                dtHZ.Columns.Add("手開發票稅額", typeof(String));
                dtHZ.Columns.Add("發票總額", typeof(String));
                dtHZ.Columns.Add("商品取消金額", typeof(String));
                dtHZ.Columns.Add("發票金額差異", typeof(String));
                dtHZ.Columns.Add("備註", typeof(String));
                query.dateType = Convert.ToInt32(Request.Params["dateType"]);
                if (Request.Params["dateType"].ToString() == "1" || Request.Params["dateType"].ToString() == "4" || Request.Params["dateType"].ToString() == "5")
                {
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeStart"]))
                    {
                        query.order_date_pay_startTime = Convert.ToDateTime(Request.Params["orderTimeStart"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeEnd"]))
                    {
                        query.order_date_pay_endTime = Convert.ToDateTime(Request.Params["orderTimeEnd"]);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeStart"]))
                    {
                        query.first_time = Convert.ToUInt32(CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["orderTimeStart"]).ToString("yyyy-MM-dd 00:00:00")));
                    }
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeEnd"]))
                    {
                        query.last_time = Convert.ToUInt32(CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["orderTimeEnd"]).ToString("yyyy-MM-dd 23:59:59")));
                    }
                }

                if (!string.IsNullOrEmpty(Request.Params["order_id"]))
                {
                    query.Order_Id = Convert.ToUInt32(Request.Params["order_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["show_type"]))
                {
                    query.show_type = Convert.ToInt32(Request.Params["show_type"]);
                } if (!string.IsNullOrEmpty(Request.Params["invoice_type"]))
                {
                    query.invoice_type = Convert.ToInt32(Request.Params["invoice_type"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["payment"]))
                {
                    query.Order_Payment = Convert.ToUInt32(Request.Params["payment"]);
                }
                _OrderMasterMgr = new OrderMasterMgr(connectionString);
                _dt = _OrderMasterMgr.OrderMasterExport(query);
                if (_dt.Rows.Count > 0)
                {
                    if (!System.IO.Directory.Exists(Server.MapPath(excelPath)))
                    {
                        System.IO.Directory.CreateDirectory(Server.MapPath(excelPath));
                    }
                    for (int i = 0; i < _dt.Rows.Count; i++)
                    {
                        DataRow dr = dtHZ.NewRow();
                        dr["付款單號"] = _dt.Rows[i]["order_id"];
                        dr["訂購人"] = _dt.Rows[i]["order_name"];
                        dr["訂單應收金額"] = Convert.ToInt32(_dt.Rows[i]["order_amount"]);//A
                        dr["紅利折抵金額"] = _dt.Rows[i]["deduct_card_bonus"];
                        dr["付款方式"] = _dt.Rows[i]["parameterName"];
                        if (!string.IsNullOrEmpty(_dt.Rows[i]["account_collection_money"].ToString()))
                        {
                            dr["請款狀態"] = "已請款";
                        }
                        else
                        {
                            dr["請款狀態"] = "未請款";
                        }

                        dr["付款單成立日期"] = _dt.Rows[i]["ordercreatedate"];
                        if (!string.IsNullOrEmpty(_dt.Rows[i]["account_collection_time"].ToString()))
                        {
                            dr["銀行入帳日期"] = Convert.ToDateTime(_dt.Rows[i]["account_collection_time"]).ToString("yyyy/MM/dd");
                        }
                        dr["手續費"] = _dt.Rows[i]["poundage"];//B
                        dr["入帳金額"] = _dt.Rows[i]["account_collection_money"]; //C
                        if (!string.IsNullOrEmpty(_dt.Rows[i]["return_collection_time"].ToString()))
                        {
                            dr["退貨入帳日期"] = Convert.ToDateTime(_dt.Rows[i]["return_collection_time"]).ToString("yyyy/MM/dd");
                        }
                        dr["退貨入帳手續費"] = _dt.Rows[i]["return_poundage"];
                        dr["退貨入帳金額"] = _dt.Rows[i]["return_collection_money"];
                        dr["入帳總額"] = _dt.Rows[i]["oacamount"];
                        if (!string.IsNullOrEmpty(dr["訂單應收金額"].ToString()) && !string.IsNullOrEmpty(dr["入帳總額"].ToString()))
                        {
                            dr["入帳金額差異"] = Convert.ToInt32(dr["訂單應收金額"].ToString()) - Convert.ToInt32(dr["入帳總額"].ToString());//E=A-D
                        }
                        if (!string.IsNullOrEmpty(_dt.Rows[i]["invoicedate"].ToString()))
                        {
                            dr["開立發票日期"] = _dt.Rows[i]["invoicedate"].ToString();
                        }
                        dr["發票銷售額"] = _dt.Rows[i]["free_tax"];//F
                        dr["發票稅額"] = _dt.Rows[i]["tax_amount"];//G
                        if (!string.IsNullOrEmpty(_dt.Rows[i]["invoice_date_manual"].ToString()))
                        {
                            dr["手開發票日期"] = Convert.ToDateTime(_dt.Rows[i]["invoice_date_manual"]).ToString("yyyy/MM/dd");
                        }
                        dr["手開發票銷售額"] = _dt.Rows[i]["invoice_sale_manual"];//F
                        dr["手開發票稅額"] = _dt.Rows[i]["invoice_tax_manual"];//G
                        dr["發票總額"] = _dt.Rows[i]["imramount"];//F+G
                        //if (!string.IsNullOrEmpty(dr["發票銷售額"].ToString()) && !string.IsNullOrEmpty(dr["發票稅額"].ToString()))
                        //{
                        //    dr["發票總額"] = Convert.ToInt32(dr["發票銷售額"]) + Convert.ToInt32(dr["發票稅額"]);//F+G
                        //}
                        //dr["發票總額"] = Convert.ToInt32(_dt.Rows[i]["sales_amount"]) + Convert.ToInt32(_dt.Rows[i]["free_tax"]);
                        if (Convert.ToInt32(_dt.Rows[i]["money_cancel"]) != 0 && Convert.ToInt32(_dt.Rows[i]["money_return"]) == 0)
                        {
                            dr["商品取消金額"] = _dt.Rows[i]["money_cancel"];//I
                        }
                        if (Convert.ToInt32(_dt.Rows[i]["money_cancel"]) == 0 && Convert.ToInt32(_dt.Rows[i]["money_return"]) != 0)
                        {
                            dr["商品取消金額"] = _dt.Rows[i]["money_return"];
                        }
                        if (dr["訂單應收金額"].ToString() == dr["商品取消金額"].ToString())
                        {
                            dr["請款狀態"] = "商品取消";
                        }
                        dr["發票金額差異"] = _dt.Rows[i]["invoice_diff"];//入帳總額-發票總額
                        //if (!string.IsNullOrEmpty(dr["入帳總額"].ToString()) && !string.IsNullOrEmpty(dr["發票總額"].ToString()))
                        //{
                        //    dr["發票金額差異"] = Convert.ToInt32(dr["入帳總額"].ToString()) - Convert.ToInt32(dr["發票總額"].ToString());//J=E-H
                        //}

                        dr["備註"] = _dt.Rows[i]["remark"]; ;
                        dtHZ.Rows.Add(dr);
                    }
                }
                if (dtHZ.Rows.Count > 0)
                {
                    string fileName = DateTime.Now.ToString("會計入帳時間匯出_yyyyMMddHHmmss") + ".xls";
                    MemoryStream ms = ExcelHelperXhf.ExportDT(dtHZ, "");
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
                    Response.BinaryWrite(ms.ToArray());
                }
                else
                {
                    Response.Write("匯出數據不存在");
                }
            }
            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:[]}";
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 會計手續費、入帳金額等匯總
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase OrderMasterHuiZong()
        {
            string json = string.Empty;
            DataTable _dt = new DataTable();
            OrderMasterQuery query = new OrderMasterQuery();
            try
            {
                query.dateType = Convert.ToInt32(Request.Params["dateType"]);
                if (Request.Params["dateType"].ToString() == "1" || Request.Params["dateType"].ToString() == "4" || Request.Params["dateType"].ToString() == "5")
                {
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeStart"]))
                    {
                        query.order_date_pay_startTime = Convert.ToDateTime(Request.Params["orderTimeStart"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeEnd"]))
                    {
                        query.order_date_pay_endTime = Convert.ToDateTime(Request.Params["orderTimeEnd"]);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeStart"]))
                    {
                        query.first_time = Convert.ToUInt32(CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["orderTimeStart"]).ToString("yyyy-MM-dd 00:00:00")));
                    }
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeEnd"]))
                    {
                        query.last_time = Convert.ToUInt32(CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["orderTimeEnd"]).ToString("yyyy-MM-dd 23:59:59")));
                    }
                }

                if (!string.IsNullOrEmpty(Request.Params["order_id"]))
                {
                    query.Order_Id = Convert.ToUInt32(Request.Params["order_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["show_type"]))
                {
                    query.show_type = Convert.ToInt32(Request.Params["show_type"]);
                } if (!string.IsNullOrEmpty(Request.Params["invoice_type"]))
                {
                    query.invoice_type = Convert.ToInt32(Request.Params["invoice_type"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["payment"]))
                {
                    query.Order_Payment = Convert.ToUInt32(Request.Params["payment"]);
                }
                _OrderMasterMgr = new OrderMasterMgr(connectionString);
                _dt = _OrderMasterMgr.OrderMasterHuiZong(query);
                int ZPoundage = 0;
                int AccountMoney = 0;
                int FreeTax = 0;
                int SalesAmount = 0;
                if (!string.IsNullOrEmpty(_dt.Rows[0]["ZPoundage"].ToString()))
                {
                    ZPoundage = Convert.ToInt32(_dt.Rows[0]["ZPoundage"].ToString());
                }
                if (!string.IsNullOrEmpty(_dt.Rows[0]["AccountCollectionMoney"].ToString()))
                {
                    AccountMoney = Convert.ToInt32(_dt.Rows[0]["AccountCollectionMoney"].ToString());
                }
                if (!string.IsNullOrEmpty(_dt.Rows[0]["FreeTax"].ToString()))
                {
                    FreeTax = Convert.ToInt32(_dt.Rows[0]["FreeTax"].ToString());
                }
                if (!string.IsNullOrEmpty(_dt.Rows[0]["SalesAmount"].ToString()))
                {
                    SalesAmount = Convert.ToInt32(_dt.Rows[0]["SalesAmount"].ToString());
                }
                json = "{success:true,'msg':'" + "手續費:" + GetString(ZPoundage.ToString()) + "','AccountMoney':'" + "入帳金額:" + GetString(AccountMoney.ToString()) + "','ZMoney':'" + "入帳總額:" + GetString((ZPoundage + AccountMoney).ToString()) + "','FreeTax':'" + "發票稅額:" + GetString(SalesAmount.ToString()) + "','SalesAmount':'" + "發票銷售額:" + GetString(FreeTax.ToString()) + "','ZTax':'" + "發票總額:" + GetString((FreeTax + SalesAmount).ToString()).ToString() + "'}";//返回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,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 14
0
        public HttpResponseBase OrderMasterExportList()
        {
            string json = string.Empty;
            DataTable _dt = new DataTable();
            OrderMasterQuery query = new OrderMasterQuery();
            query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
            query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量
            try
            {
                query.dateType = Convert.ToInt32(Request.Params["dateType"]);
                if (Request.Params["dateType"].ToString() == "1" || Request.Params["dateType"].ToString() == "4" || Request.Params["dateType"].ToString() == "5")
                {
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeStart"]))
                    {
                        query.order_date_pay_startTime = Convert.ToDateTime(Request.Params["orderTimeStart"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeEnd"]))
                    {
                        query.order_date_pay_endTime = Convert.ToDateTime(Request.Params["orderTimeEnd"]);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeStart"]))
                    {
                        query.first_time = Convert.ToUInt32(CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["orderTimeStart"]).ToString("yyyy-MM-dd 00:00:00")));
                    }
                    if (!string.IsNullOrEmpty(Request.Params["orderTimeEnd"]))
                    {
                        query.last_time = Convert.ToUInt32(CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["orderTimeEnd"]).ToString("yyyy-MM-dd 23:59:59")));
                    }
                }

                if (!string.IsNullOrEmpty(Request.Params["order_id"]))
                {
                    query.Order_Id = Convert.ToUInt32(Request.Params["order_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["show_type"]))
                {
                    query.show_type = Convert.ToInt32(Request.Params["show_type"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["invoice_type"]))
                {
                    query.invoice_type = Convert.ToInt32(Request.Params["invoice_type"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["payment"]))
                {
                    query.Order_Payment = Convert.ToUInt32(Request.Params["payment"]);
                }
                int totalCount = 0;
                _OrderMasterMgr = new OrderMasterMgr(connectionString);
                _dt = _OrderMasterMgr.OrderMasterExportList(query, out totalCount);
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy/MM/dd";
                json = "{success:true,'msg':'user',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,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 15
0
        public HttpResponseBase ChangePayMent()
        {
            string json = string.Empty;
            OrderMasterQuery query = new OrderMasterQuery();
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["payment"]))
                {
                    query.payment = Request.Params["payment"];
                }

                if (!string.IsNullOrEmpty(Request.Params["delivery"]))
                {
                    query.delivery = Convert.ToInt32(Request.Params["delivery"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["order_id"]))
                {
                    query.Order_Id = Convert.ToUInt32(Request.Params["order_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["delivery_store"]))
                {
                    query.Delivery_Store = Convert.ToUInt32(Request.Params["delivery_store"]);
                }
                System.Net.IPAddress[] addlist = Dns.GetHostByName(Dns.GetHostName()).AddressList;
                query.Order_Ipfrom = addlist[0].ToString();
               query.username = (Session["caller"] as Caller).user_username;
                _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
                 json=   _orderMasterMgr.ChangePayMent(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;
        }
Ejemplo n.º 16
0
        public string GetPayment()
        {
            _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
            _orderReturnMaster = new OrderReturnMasterMgr(mySqlConnectionString);
            string json = string.Empty;
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["order_id"]))
                {
                    OrderMaster om = _orderMasterMgr.GetPaymentById(uint.Parse(Request.Params["order_id"]));
                    //獲取暫存單中atm機 銀行信息 地址信息

                    if (om.Order_Payment == 2)
                    {
                        OrderReturnUserQuery oruQuery = _orderReturnMaster.GetReturnDetailById(om.Order_Id);
                        json = "{success:true,bank_name:" + oruQuery.bank_name + ",bank_branch:" + oruQuery.bank_branch
                            + ",bank_account:" + oruQuery.bank_account + ",account_name:" + oruQuery.account_name + "}";
                    }
                    else
                    {
                        json = "{success:true,order_id:" + om.Order_Id + ",Order_Payment:" + om.Order_Payment + "}";
                    }
                }
            }
            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 = "[]";
            }
            return json;
        }
Ejemplo n.º 17
0
 public HttpResponseBase ModifyDeliveryData()
 {
     string json = string.Empty;
     OrderMasterQuery om = new OrderMasterQuery();
     DeliverMasterQuery dm = new DeliverMasterQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["order_id"]))
         {
             om.Order_Id = Convert.ToUInt32(Request.Params["order_id"].ToString());
         }
         if (!string.IsNullOrEmpty(Request.Params["user_name"]))
         {
             om.delivery_name = Request.Params["user_name"].ToString();
         }
         if (!string.IsNullOrEmpty(Request.Params["user_gender"]))
         {
             om.user_gender = Convert.ToUInt32(Request.Params["user_gender"]);//delivery_gender
         }
         if (!string.IsNullOrEmpty(Request.Params["user_mobile"]))
         {
             om.Delivery_Mobile = Request.Params["user_mobile"].ToString();
         }
         if (!string.IsNullOrEmpty(Request.Params["user_phone"]))
         {
             om.Delivery_Phone = Request.Params["user_phone"].ToString();
         }
         if (!string.IsNullOrEmpty(Request.Params["user_zip"]))
         {
             om.Delivery_Zip = Convert.ToUInt32(Request.Params["user_zip"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["user_address"]))
         {
             om.Delivery_Address = Request.Params["user_address"].ToString();
         }
         om.user_id = Convert.ToUInt32((Session["caller"] as Caller).user_id);
         om.user_name = (Session["caller"] as Caller).user_username;
         System.Net.IPAddress[] addlist = Dns.GetHostByName(Dns.GetHostName()).AddressList;
         om.Order_Ipfrom = addlist[0].ToString();
         _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
         json = _orderMasterMgr.ModifyDeliveryData(om);
     }
     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;
 }
Ejemplo n.º 18
0
        public void ExportReport()
        {
            List<OrderMasterQuery> stores = new List<OrderMasterQuery>();
            OrderMasterQuery query = new OrderMasterQuery();
            DateTime dtime;
            string payment = string.Empty;
            string order_status = string.Empty;
            string detail_status = string.Empty;
            string product_mode = string.Empty;
            string total_amount = string.Empty;
            string invoice_number = string.Empty;
            string invoice_date = string.Empty;
            try
            {
                _orderMasterMgr = new OrderMasterMgr(mySqlConnectionString);
                _orderReturnStatus = new OrderReturnStatusMgr(mySqlConnectionString);
                #region 查詢條件
                string dateOne = Request.Params["dateOne"];
                string dateTwo = Request.Params["dateTwo"];
                if (DateTime.TryParse(Request.Params["dateOne"].ToString(), out dtime))//開始時間
                {
                    query.datestart = dtime;
                }
                if (DateTime.TryParse(Request.Params["dateTwo"].ToString(), out dtime))
                {
                    query.dateend = dtime;
                }

                #endregion
                DataTable dtHZ = new DataTable();
                dtHZ.Columns.Add("會員姓名", typeof(String));
                dtHZ.Columns.Add("購買時間", typeof(String));
                dtHZ.Columns.Add("付款單號", typeof(String));
                dtHZ.Columns.Add("付款方式", typeof(String));
                dtHZ.Columns.Add("購買金額", typeof(String));
                dtHZ.Columns.Add("付款狀態", typeof(String));
                dtHZ.Columns.Add("發票號碼", typeof(String));
                dtHZ.Columns.Add("發票金額", typeof(String));
                dtHZ.Columns.Add("發票開立日期", typeof(String));
                dtHZ.Columns.Add("商品細項編號", typeof(String));
                dtHZ.Columns.Add("訂單狀態", typeof(String));
                dtHZ.Columns.Add("供應商", typeof(String));
                dtHZ.Columns.Add("供應商編碼", typeof(String));
                dtHZ.Columns.Add("品名", typeof(String));
                dtHZ.Columns.Add("數量", typeof(String));
                dtHZ.Columns.Add("購買單價", typeof(String));
                dtHZ.Columns.Add("折抵購物金", typeof(String));
                dtHZ.Columns.Add("抵用卷", typeof(String));
                dtHZ.Columns.Add("總價", typeof(String));
                dtHZ.Columns.Add("成本單價", typeof(String));
                dtHZ.Columns.Add("寄倉費", typeof(String));
                dtHZ.Columns.Add("成本總額", typeof(String));
                dtHZ.Columns.Add("出貨單歸檔期", typeof(String));
                dtHZ.Columns.Add("負責PM", typeof(String));
                dtHZ.Columns.Add("來源ID", typeof(String));
                dtHZ.Columns.Add("來源名稱", typeof(String));
                dtHZ.Columns.Add("出貨方式", typeof(String));
                DataTable _dt = _orderMasterMgr.OrderSerchExport(query);
                for (int i = 0; i < _dt.Rows.Count; i++)
                {
                    if (i != 0)
                    {
                        if (_dt.Rows[i]["order_id"].ToString() == _dt.Rows[i - 1]["order_id"].ToString())
                        {
                            dtHZ.Rows.Add(_orderReturnStatus.GetOrdinaryData(dtHZ, _dt, i));
                        }
                        else
                        {
                            if (i == _dt.Rows.Count - 1)
                            {
                                #region 如果此order_id是最後一條數據
                                dtHZ.Rows.Add(_orderReturnStatus.GetOrdinaryData(dtHZ, _dt, i));
                                DataTable _dtFreight = _orderMasterMgr.GetOrderFreight(Convert.ToUInt32(_dt.Rows[i]["order_id"]));
                                if (_dtFreight != null && _dtFreight.Rows.Count > 0)
                                {
                                    #region 常溫運費
                                    if (Convert.ToInt32(_dtFreight.Rows[0][0]) != 0)//常溫運費
                                    {
                                        dtHZ.Rows.Add(_orderReturnStatus.GetFreightData(dtHZ, _dt, _dtFreight, i,1));

                                    }
                                    #endregion
                                    #region 低溫運費
                                    if (Convert.ToInt32(_dtFreight.Rows[0][1]) != 0)//低溫運費
                                    {
                                        dtHZ.Rows.Add(_orderReturnStatus.GetFreightData(dtHZ, _dt, _dtFreight, i, 2));
                                    }
                                    #endregion
                                }
                                #endregion
                            }
                            else
                            {
                                #region 查上一個order_id是否有運費
                                DataTable _dtFreight02 = _orderMasterMgr.GetOrderFreight(Convert.ToUInt32(_dt.Rows[i - 1]["order_id"]));
                                if (_dtFreight02 != null && _dtFreight02.Rows.Count > 0)
                                {
                                    #region 常溫運費
                                    if (Convert.ToInt32(_dtFreight02.Rows[0][0]) != 0)//常溫運費
                                    {
                                        dtHZ.Rows.Add(_orderReturnStatus.GetFreightData(dtHZ, _dt, _dtFreight02, i - 1,1));

                                    }
                                    #endregion
                                    #region 低溫運費
                                    if (Convert.ToInt32(_dtFreight02.Rows[0][1]) != 0)//低溫運費
                                    {
                                        dtHZ.Rows.Add(_orderReturnStatus.GetFreightData(dtHZ, _dt, _dtFreight02, i - 1,2));
                                    }
                                    #endregion
                                }
                                #endregion
                                #region 查當前order_id
                                dtHZ.Rows.Add(_orderReturnStatus.GetOrdinaryData(dtHZ, _dt, i));
                                #endregion
                            }
                        }
                    }
                    else
                    {
                       dtHZ.Rows.Add(_orderReturnStatus.GetOrdinaryData(dtHZ, _dt, i));
                    }
                }
                string fileName = "會計總表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                MemoryStream ms = ExcelHelperXhf.ExportDT(dtHZ, "");
                Response.AddHeader("Content-Disposition", "attach-ment;filename=" + fileName);
                Response.BinaryWrite(ms.ToArray());
            }
            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);
            }
        }
Ejemplo n.º 19
0
        public string OtherTWPay(OrderMasterQuery query,out bool isShow)
        {
            isShow = false;
            StringBuilder strbody = new StringBuilder();
            strbody.AppendLine("異地付款訂單檢查");

            _orderMaster = new OrderMasterMgr(mySqlConnectionString);

            DataTable _dt = _orderMaster.GetOtherTWPay(query);
            if (_dt.Rows.Count > 0)
            {
                DataTable _newdt = new DataTable();
                _newdt.Columns.Add("訂單編號", typeof(String));
                _newdt.Columns.Add("付款總金額", typeof(String));
                _newdt.Columns.Add("付款時間", typeof(String));
                _newdt.Columns.Add("IP", typeof(String));
                for (int i = 0; i < _dt.Rows.Count; i++)
                {
                    DataRow dr = _newdt.NewRow();
                    dr[0] = _dt.Rows[i][0];
                    dr[1] = _dt.Rows[i][1].ToString();
                    dr[2] = CommonFunction.GetNetTime(Convert.ToInt64(_dt.Rows[i][2])).ToString("yyyy/MM/dd HH:mm:ss");
                    dr[3] = _dt.Rows[i][3].ToString();
                    _newdt.Rows.Add(dr);
                }
                strbody.AppendFormat(GetHtmlByDataTable(_newdt));
                isShow = true;
            }
            return strbody.ToString();
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 匯入會計入帳時間
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase OrderMasterImport()
        {
            string json = string.Empty;//json字符串
            //string shipment = Request.Params["shipment"].ToString();
            //int total = 0;
            try
            {
                if (Request.Files["ImportFileMsg"] != null && Request.Files["ImportFileMsg"].ContentLength > 0)//判斷文件是否為空
                {
                    HttpPostedFileBase excelFile = Request.Files["ImportFileMsg"];//獲取文件流
                    FileManagement fileManagement = new FileManagement();//實例化 FileManagement
                    string fileLastName = excelFile.FileName;
                    string newExcelName = Server.MapPath(excelPath) + "會計賬款實收時間" + fileManagement.NewFileName(excelFile.FileName);//處理文件名,獲取新的文件名
                    excelFile.SaveAs(newExcelName);//上傳文件
                    DataTable dt = new DataTable();
                    NPOI4ExcelHelper helper = new NPOI4ExcelHelper(newExcelName);
                    dt = helper.SheetData();
                    List<OrderAccountCollection> oacli = new List<OrderAccountCollection>();
                    string errorStr = string.Empty;
                    Int64[] orderArr = new Int64[dt.Rows.Count];
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        OrderAccountCollection model = new OrderAccountCollection();
                        uint order_id = 0;
                        if (!string.IsNullOrEmpty(dt.Rows[j][0].ToString()))
                        {
                            if (uint.TryParse(dt.Rows[j][0].ToString(), out  order_id))
                            {
                                model.order_id = order_id;
                            }
                            else
                            {
                                errorStr += (j + 2) + ",";
                                continue;
                            }
                        }
                        else
                        {
                            errorStr += (j + 2) + ",";
                            continue;
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[j][1].ToString()))
                        {
                            DateTime st;
                            if (DateTime.TryParse(dt.Rows[j][1].ToString(), out st))
                            {
                                model.account_collection_time = st;
                            }
                            else
                            {
                                string strtime = Regex.Replace(dt.Rows[j][1].ToString().Trim(), "/(\\s+)|(,)|(-)|(,)|(.)/g", "/");
                                if (DateTime.TryParse(strtime, out st))
                                {
                                    model.account_collection_time = st;
                                }
                                else
                                {
                                    string[] str = dt.Rows[j][1].ToString().Split('/');
                                    int year = 0;
                                    if (str.Length == 3)
                                    {
                                        if (str[2].Length == 2)
                                        {
                                            year = Convert.ToInt32("20" + str[2]);
                                        }
                                        else
                                        {
                                            year = Convert.ToInt32(str[2]);
                                        }
                                        int month = Convert.ToInt32(str[0]);
                                        int day = Convert.ToInt32(str[1]);
                                        if (DateTime.TryParse(year + "/" + month + "/" + day, out st))
                                        {
                                            model.account_collection_time = st;
                                        }
                                        else
                                        {
                                            errorStr += (j + 2) + ",";
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        errorStr += (j + 2) + ",";
                                        continue;
                                    }
                                }
                            }

                            if (!string.IsNullOrEmpty(dt.Rows[j][2].ToString()))
                            {
                                int account_collection_money = 0;
                                if (int.TryParse(dt.Rows[j][2].ToString(), out account_collection_money))
                                {
                                    model.account_collection_money = account_collection_money;
                                }
                                else
                                {
                                    errorStr += (j + 2) + ",";
                                    continue;
                                }
                            }
                            else
                            {
                                errorStr += (j + 2) + ",";
                                continue;
                            }
                            if (!string.IsNullOrEmpty(dt.Rows[j][3].ToString()))
                            {
                                int poundage = 0;
                                if (int.TryParse(dt.Rows[j][3].ToString(), out poundage))
                                {
                                    model.poundage = poundage;
                                }
                                else
                                {
                                    errorStr += (j + 2) + ",";
                                    continue;
                                }
                            }
                            else
                            {
                                errorStr += (j + 2) + ",";
                                continue;
                            }
                        }

                        if (!string.IsNullOrEmpty(dt.Rows[j][4].ToString()))
                        {
                            DateTime streturn;
                            if (DateTime.TryParse(dt.Rows[j][4].ToString(), out streturn))
                            {
                                model.return_collection_time = streturn;
                            }
                            else
                            {
                                string strtimeR = Regex.Replace(dt.Rows[j][4].ToString().Trim(), "/(\\s+)|(,)|(-)|(,)|(.)/g", "/");
                                if (DateTime.TryParse(strtimeR.ToString(), out streturn))
                                {
                                    model.return_collection_time = streturn;
                                }
                                else
                                {
                                    string[] strR = dt.Rows[j][4].ToString().Split('/');
                                    int yearR = 0;
                                    if (strR.Length == 3)
                                    {
                                        if (strR[2].Length == 2)
                                        {
                                            yearR = Convert.ToInt32("20" + strR[2]);
                                        }
                                        else
                                        {
                                            yearR = Convert.ToInt32(strR[2]);
                                        }
                                        int monthR = Convert.ToInt32(strR[0]);
                                        int dayR = Convert.ToInt32(strR[1]);
                                        if (DateTime.TryParse(yearR + "/" + monthR + "/" + dayR, out streturn))
                                        {
                                            model.return_collection_time = streturn;
                                        }
                                        else
                                        {
                                            errorStr += (j + 2) + ",";
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        errorStr += (j + 2) + ",";
                                        continue;
                                    }
                                }
                            }
                            if (!string.IsNullOrEmpty(dt.Rows[j][5].ToString()))
                            {
                                int return_collection_money = 0;
                                if (int.TryParse(dt.Rows[j][5].ToString(), out return_collection_money))
                                {
                                    model.return_collection_money = return_collection_money;
                                }
                                else
                                {
                                    errorStr += (j + 2) + ",";
                                    continue;
                                }
                            }
                            else
                            {
                                errorStr += (j + 2) + ",";
                                continue;
                            }
                            if (!string.IsNullOrEmpty(dt.Rows[j][6].ToString()))
                            {
                                int return_poundage = 0;
                                if (int.TryParse(dt.Rows[j][6].ToString(), out return_poundage))
                                {
                                    model.return_poundage = return_poundage;
                                }
                                else
                                {
                                    errorStr += (j + 2) + ",";
                                    continue;
                                }
                            }
                            else
                            {
                                errorStr += (j + 2) + ",";
                                continue;
                            }
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[j][7].ToString()))
                        {
                            DateTime st;
                            if (DateTime.TryParse(dt.Rows[j][7].ToString(), out st))
                            {
                                model.invoice_date_manual = st;
                            }
                            else
                            {
                                string strtime = Regex.Replace(dt.Rows[j][1].ToString().Trim(), "/(\\s+)|(,)|(-)|(,)|(.)/g", "/");
                                if (DateTime.TryParse(strtime, out st))
                                {
                                    model.invoice_date_manual = st;
                                }
                                else
                                {
                                    string[] str = dt.Rows[j][7].ToString().Split('/');
                                    int year = 0;
                                    if (str.Length == 3)
                                    {
                                        if (str[2].Length == 2)
                                        {
                                            year = Convert.ToInt32("20" + str[2]);
                                        }
                                        else
                                        {
                                            year = Convert.ToInt32(str[2]);
                                        }
                                        int month = Convert.ToInt32(str[0]);
                                        int day = Convert.ToInt32(str[1]);
                                        if (DateTime.TryParse(year + "/" + month + "/" + day, out st))
                                        {
                                            model.invoice_date_manual = st;
                                        }
                                        else
                                        {
                                            errorStr += (j + 2) + ",";
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        errorStr += (j + 2) + ",";
                                        continue;
                                    }
                                }
                            }

                            if (!string.IsNullOrEmpty(dt.Rows[j][8].ToString()))
                            {
                                int invoice_sale_manual = 0;
                                if (int.TryParse(dt.Rows[j][8].ToString(), out invoice_sale_manual))
                                {
                                    model.invoice_sale_manual = invoice_sale_manual;
                                }
                                else
                                {
                                    errorStr += (j + 2) + ",";
                                    continue;
                                }
                            }
                            else
                            {
                                errorStr += (j + 2) + ",";
                                continue;
                            }
                            if (!string.IsNullOrEmpty(dt.Rows[j][9].ToString()))
                            {
                                int invoice_tax_manual = 0;
                                if (int.TryParse(dt.Rows[j][9].ToString(), out invoice_tax_manual))
                                {
                                    model.invoice_tax_manual = invoice_tax_manual;
                                }
                                else
                                {
                                    errorStr += (j + 2) + ",";
                                    continue;
                                }
                            }
                            else
                            {
                                errorStr += (j + 2) + ",";
                                continue;
                            }
                        }
                        model.remark = dt.Rows[j][10].ToString();
                        if (model != null && !(model.account_collection_time == model.return_collection_time && model.account_collection_time == model.invoice_date_manual && model.return_collection_time == DateTime.MinValue))
                        {
                            if (!orderArr.Contains(model.order_id))
                            {
                                orderArr[j] = order_id;
                                oacli.Add(model);
                            }
                            else
                            {
                                errorStr += (j + 2) + ",";
                            }
                        }
                    }
                    int rowsnum = oacli.Count;
                    if (!string.IsNullOrEmpty(errorStr))
                    {
                        errorStr = errorStr.Remove(errorStr.Length - 1);
                    }
                    if (rowsnum > 0)//判斷是否是這個表
                    {
                        _OrderMasterMgr = new OrderMasterMgr(connectionString);

                        int i = _OrderMasterMgr.OrderMasterImport(oacli);
                        if (i > 0)
                        {
                            if (i == 99999)
                            {
                                if (!string.IsNullOrEmpty(errorStr))
                                {
                                    json = "{success:true,msg:\"" + "無數據可匯入!另文件第" + errorStr + "行數據異常\"}";
                                }
                                else
                                {
                                    json = "{success:true,msg:\"" + "無數據可匯入!\"}";
                                }
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(errorStr))
                                {
                                    json = "{success:true,msg:\"" + "匯入成功!另文件第" + errorStr + "行數據異常\"}";
                                }
                                else
                                {
                                    json = "{success:true,msg:\"" + "匯入成功!\"}";
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(errorStr))
                            {
                                json = "{success:true,msg:\"" + "操作失敗!另文件第" + errorStr + "行數據異常\"}";
                            }
                            else
                            {
                                json = "{success:true,msg:\"" + "操作失敗!\"}";
                            }
                        }
                    }
                    else
                    {
                        json = "{success:true,total:0,msg:\"" + "此表內沒有數據或數據有誤,請檢查后再次匯入!" + "\"}";
                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                }
                else//當直接點擊時會產生,
                {
                    json = "{success:true,msg:\"" + "操作失敗!" + "\"}";
                    this.Response.Clear();
                    this.Response.Write(json);
                    this.Response.End();
                    return this.Response;
                }
            }
            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,msg:\"" + "操作失敗!" + "\"}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }