public ActionResult Index() { HttpCookie cookies = Request.Cookies["vendor"]; if (cookies != null) { ViewBag.LoginEmail = cookies["email"]; } else { ViewBag.LoginEmail = null; } if (Session["vendor"] != null) { return RedirectToAction("", "home"); } else { string vendorid = Request.QueryString["vendor_id"]; string key = Request.QueryString["key"]; string keysec = string.Empty; if (!string.IsNullOrEmpty(vendorid) && !string.IsNullOrEmpty(key)) { int vendor_id = Convert.ToInt32(vendorid); _vendorImp = new VendorMgr(connectionString); string str = _vendorImp.GetLoginId(vendor_id); HashEncrypt hmd5 = new HashEncrypt(); string mdlogin_id = hmd5.Md5Encrypt(str, "MD5"); keysec = hmd5.Md5Encrypt(mdlogin_id + str, "MD5"); if (key.ToString().Trim() != keysec.ToString().Trim()) { return View(); } else { BLL.gigade.Model.Vendor vendor = new BLL.gigade.Model.Vendor(); BLL.gigade.Model.Vendor ven = new BLL.gigade.Model.Vendor(); vendor.vendor_id = Convert.ToUInt32(vendorid); _vendorImp = new VendorMgr(connectionString); ven = _vendorImp.GetSingle(vendor); ven.vendor_password = ""; Session["vendor"] = ven; Session["lgnName"] = ven.vendor_name_simple; return RedirectToAction("", "home"); } } else { return View(); } } }
public HttpResponseBase GetOrderDetailList() { List<OrderDetailQuery> stores = new List<OrderDetailQuery>(); string json = string.Empty; try { OrderDetailQuery query = new OrderDetailQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 //付款單號 query.Order_Id = Convert.ToUInt32(Request.Params["OrderId"].ToString()); query.isChildItem = 0; _orderDetailMgr = new OrderDetailMgr(mySqlConnectionString); int totalCount = 0; stores = _orderDetailMgr.GetOrderDetailList(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; //listUser是准备转换的对象 //獲取供應商後臺登陸的vendorMd5加密 _vendorImp = new VendorMgr(mySqlConnectionString); foreach (OrderDetailQuery item in stores) { string str = _vendorImp.GetLoginId(Convert.ToInt32(item.Vendor_Id)); if (str != "") { HashEncrypt hmd5 = new HashEncrypt(); string mdlogin_id = hmd5.Md5Encrypt(str, "MD5"); item.VendorMd5 = hmd5.Md5Encrypt(mdlogin_id + str, "MD5"); } if (item.item_mode == 2) { item.subtotal = (item.Single_Money * item.parent_num)-uint.Parse(item.Deduct_Happygo_Money.ToString())-item.Deduct_Welfare-item.Deduct_Bonus; } else { item.subtotal = (item.Single_Money * item.Buy_Num) -uint.Parse( item.Deduct_Happygo_Money.ToString()) - item.Deduct_Welfare - item.Deduct_Bonus; } } json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:true,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
/// <summary> /// 供應商出貨單 /// </summary> /// <returns></returns> public HttpResponseBase OrderWaitDeliverList() { string jsonStr = String.Empty; StringBuilder sb = new StringBuilder(); HashEncrypt hmd5 = new HashEncrypt(); _IOrderSlaveMgr = new OrderSlaveMgr(mySqlConnectionString); _OrderPaymentNcccMgr = new OrderPaymentNcccMgr(mySqlConnectionString); _SinopacMgr = new SinopacDetailMgr(mySqlConnectionString); _vendorImp = new VendorMgr(mySqlConnectionString); try { #region 前提查詢條件 if (!string.IsNullOrEmpty(Request.Params["search_type"]))//查詢條件 { int search_type = int.Parse(Request.Params["search_type"]); string searchcontent = ""; if (!string.IsNullOrEmpty(Request.Params["searchcontent"])) { searchcontent = Request.Params["searchcontent"]; } switch (search_type) { case 1: sb.AppendFormat(" and om.order_id LIKE '%{0}%' ", searchcontent); break; case 2: sb.AppendFormat(" AND om.order_name LIKE '%{0}%' ", searchcontent); break; case 3: sb.AppendFormat(" AND u.user_email LIKE '%{0}%' ", searchcontent); break; case 4: sb.AppendFormat(" AND om.delivery_name LIKE '%{0}%' ", searchcontent); break; case 5: sb.AppendFormat(" AND om.source_trace LIKE '%{0}%' ", searchcontent); break; default: sb.Append(" "); break; } } if (!string.IsNullOrEmpty(Request.Params["search_vendor"]))//供應商條件 { if (int.Parse(Request.Params["search_vendor"]) != 0) { sb.AppendFormat(" AND os.vendor_id = '{0}' ", Request.Params["search_vendor"]); } } #endregion List<OrderSlaveQuery> store = new List<OrderSlaveQuery>(); OrderSlaveQuery query = new OrderSlaveQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 int totalCount = 0; store = _IOrderSlaveMgr.GetOrderWaitDeliver(query, sb.ToString(), out totalCount);//查询出供應商出貨單 int vendor_id = 0; string loginIdStr = string.Empty; string mdlogin_id = string.Empty; StringBuilder Order_id_store = new StringBuilder(); foreach (var item in store) { Order_id_store.AppendFormat("{0},", item.order_id); } string dtSql = "and order_id in(" + Order_id_store.ToString().TrimEnd(',') + ") ";//去查詢DataTable DataTable _dtNccc = _OrderPaymentNcccMgr.OrderPaymentNccc(null, dtSql); DataTable _dtSino = _SinopacMgr.GetSinopacDetai(null, dtSql); // String Sql = "123"; foreach (var item in store) { //組裝用於登錄到供應商後臺的金鑰 vendor_id = Convert.ToInt32(item.vendor_id); loginIdStr = _vendorImp.GetLoginId(vendor_id); mdlogin_id = hmd5.Md5Encrypt(loginIdStr, "MD5"); //http://localhost:32088/?vendor_id=2&key=f32bef1b57de24330d8bf900cee4ba5e item.key = vendorServerPath + "?vendor_id=" + item.vendor_id + "&key=" + hmd5.Md5Encrypt(mdlogin_id + loginIdStr, "MD5"); item.status = "待出貨"; if (item.order_payment == 1)//付款方式为ATM { DataRow[] rows = _dtSino.Select("order_id='" + item.order_id + "'"); if (rows.Count() != 0) { item.pay_time = DateTime.Parse(rows[0]["pay_time"].ToString()).ToString("yyyy/MM/dd HH:mm:ss"); } else { item.pay_time = ""; } } else { DataRow[] rows = _dtNccc.Select("order_id='" + item.order_id + "'"); if (rows.Count() != 0) { item.pay_time = DateTime.Parse(rows[0]["pay_time"].ToString()).ToString("yyyy/MM/dd HH:mm:ss"); } else { item.pay_time = ""; } } } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd"; jsonStr = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); jsonStr = "{success:false,msg:0}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }