protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.ProductIds = this.Page.Request.QueryString["ProductIds"]; this.StoreId = this.Page.Request.QueryString["StoreId"].ToInt(0); if (this.StoreId < 0 || string.IsNullOrWhiteSpace(this.ProductIds)) { base.GotoResourceNotFound(); } else { StoresInfo storeById = StoresHelper.GetStoreById(this.StoreId); if (storeById != null) { if (!storeById.IsModifyPrice) { this.priceTip.Visible = false; this.hidIsModifyPrice.Value = "0"; } else { decimal?maxPriceRate = storeById.MaxPriceRate; if (maxPriceRate.GetValueOrDefault() > default(decimal) && maxPriceRate.HasValue) { this.priceTip.Visible = true; this.priceTipMessage.Text = $"可设置价格区间为商品价格的{storeById.MinPriceRate.ToNullString()}倍-{storeById.MaxPriceRate.ToNullString()}倍"; this.hidIsModifyPrice.Value = "1"; this.hidMinPriceRate.Value = storeById.MinPriceRate.ToNullString(); this.hidMaxPriceRate.Value = storeById.MaxPriceRate.ToNullString(); } } } this.hidStoreId.Value = this.StoreId.ToString(); this.hidProductIds.Value = this.ProductIds; this.BindProduct(); } } }
protected void btnOK_Click(object sender, EventArgs e) { if (this.IsModifyPrice.SelectedValue) { if (this.txtMinPriceRate.Text.ToDecimal(0) > 100m || this.txtMinPriceRate.Text.ToDecimal(0) < decimal.Zero) { this.ShowMsg("请输入正确的最小价格倍数!", false); return; } if (this.txtMaxPriceRate.Text.ToDecimal(0) > 100m || this.txtMaxPriceRate.Text.ToDecimal(0) < decimal.Zero) { this.ShowMsg("请输入正确的最大价格倍数!", false); return; } if (this.txtMaxPriceRate.Text.ToDecimal(0) < this.txtMinPriceRate.Text.ToDecimal(0)) { this.ShowMsg("最大价格倍数需大于最小价格倍数!", false); return; } } decimal?d = null; decimal?d2 = null; if (this.IsModifyPrice.SelectedValue) { d = (string.IsNullOrEmpty(this.txtMinPriceRate.Text) ? null : new decimal?(this.txtMinPriceRate.Text.ToDecimal(0))); d2 = (string.IsNullOrEmpty(this.txtMaxPriceRate.Text) ? null : new decimal?(this.txtMaxPriceRate.Text.ToDecimal(0))); } StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); storeById.IsShelvesProduct = this.IsShelvesProduct.SelectedValue; storeById.IsModifyPrice = this.IsModifyPrice.SelectedValue; storeById.MinPriceRate = Math.Floor((d * (decimal?)100).ToDecimal(0)) / 100m; storeById.MaxPriceRate = Math.Floor((d2 * (decimal?)100).ToDecimal(0)) / 100m; storeById.IsRequestBlance = this.IsRequestBlance.SelectedValue; StoresHelper.UpdateStore(storeById); this.ShowMsg("保存成功", true); }
public void ClearTradePassword(HttpContext context) { int value = base.GetIntParam(context, "StoreId", false).Value; if (value <= 0) { throw new HidistroAshxException("错误的参数"); } StoresInfo storeById = StoresHelper.GetStoreById(value); if (storeById == null) { throw new HidistroAshxException("错误的门店ID"); } storeById.TradePassword = ""; storeById.TradePasswordSalt = ""; if (StoresHelper.UpdateStore(storeById)) { base.ReturnSuccessResult(context, "清空成功!", 0, true); return; } throw new HidistroAshxException("清空失败!"); }
private void Save() { StringBuilder sbLocalImage = new StringBuilder(); IList <string> list = new List <string>(); StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); if (!storeById.WXState.HasValue) { this.AddWXStore(); } else if (storeById.WXState.HasValue && storeById.WXState.Value.Equals(WXStoreState.Pass)) { IEnumerable <string> enumerable = this.BuildImages(sbLocalImage, list); UpdateStoreData updateStoreData = new UpdateStoreData(); foreach (string item in enumerable) { updateStoreData.business.base_info.photo_list.Add(new Store_Photo { photo_url = item }); } updateStoreData.business.base_info.avg_price = this.txtWXAvgPrice.Text.ToInt(0); updateStoreData.business.base_info.introduction = this.txtWXIntroduction.Text.Trim(); updateStoreData.business.base_info.open_time = this.txtWXOpenTime.Text.Trim(); updateStoreData.business.base_info.recommend = this.txtWXRecommend.Text.Trim(); updateStoreData.business.base_info.poi_id = (storeById.WXPoiId.HasValue ? storeById.WXPoiId.Value.ToString() : string.Empty); updateStoreData.business.base_info.special = this.txtWXSpecial.Text.Trim(); updateStoreData.business.base_info.telephone = this.txtWXTelephone.Text.Trim(); WXStoreHelper.UpdateWXStore(updateStoreData); storeById.StoreImages = ((list.Count == 0) ? string.Empty : string.Join(",", list.ToArray())); StoresHelper.UpdateWXStore(updateStoreData, storeById.StoreId, storeById.StoreImages); } else { this.ShowMsg("微信门店审核中不能修改", false); } }
public async void FillServerInfo() { try { var stores = ServerDTO.VecsClient.GetStores(); IsDetailsLoaded = true; StoresInfo.Clear(); foreach (var store in stores) { var storePass = ""; using (var session = new VecsStoreSession(ServerDTO.VecsClient, store, storePass)) { //store add StoresInfo.Add(store, new CertBagItem() { PrivateKeys = session.GetPrivateKeys().Concat(session.GetEncryptedPrivateKeys()).ToList(), SecretKeys = session.GetSecretKeys().ToList(), Certs = session.GetCertificates().ToList() }); } } CalculateKeyInfo(); } catch (Exception e) { // do nothing in async task. } }
protected void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("4-2")) { if (ispost) { string PathStr = Utils.GetMapPath(config.DataPath.ToString()); string fileExtension = ""; string fileName = ""; string thispath = DateTime.Now.Year + "-" + DateTime.Now.Month; ArrayList filearr = new ArrayList(); int importdata_count = 0; int importdata_count_Stores = 0; int importdata_count_Staff = 0; int importdata_count_StaffB = 0; int importdata_count_All = 0; if (!Directory.Exists(PathStr + thispath)) { Directory.CreateDirectory(PathStr + thispath); } //文件上传 HttpFileCollection files = HttpContext.Current.Request.Files; try { if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { HttpPostedFile postedFile = files[i]; fileName = System.IO.Path.GetFileName(postedFile.FileName); if (Utils.ChkSQL(fileName) != "") { fileExtension = System.IO.Path.GetExtension(fileName).ToLower(); if (fileExtension == ".xls") { postedFile.SaveAs(PathStr + thispath + "/" + fileName); filearr.Add(PathStr + thispath + "/" + fileName); } } } } if (filearr.Count > 0) { StoresInfo si = new StoresInfo(); StaffInfo sfi = new StaffInfo(); StaffInfo sfiB = new StaffInfo(); StaffStoresInfo ssi = new StaffStoresInfo(); YHsysInfo yhi = new YHsysInfo(); RegionInfo ri = new RegionInfo(); string Stores_sCode = ""; string Stores_sName = ""; string Stores_sType = ""; int Stores_YHsysID = 0; int Stores_RegionID = 0; string Staff_Name = ""; string Staff_NameB = ""; DateTime Staff_sDateTime = DateTime.Parse("2009-1-1");//默认值 try { for (int j = 0; j < filearr.Count; j++) { try { DataSet ds = Excels.ExcelToDataTable(filearr[j].ToString()); DataTable dt = new DataTable(); try { dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (dr[0].ToString() != "" && dr[1].ToString() != "")//客户名称 { //客户、门店 Stores_sCode = dr[0].ToString().Trim(); Stores_sName = dr[1].ToString().Trim(); Stores_sType = dr[2].ToString().Trim(); Stores_YHsysID = 0; Stores_RegionID = 0; if (dr[3].ToString().Trim() != "") { yhi = tbYHsysInfo.GetYHsysInfoModelByName(dr[3].ToString().Trim()); if (yhi != null) { Stores_YHsysID = yhi.YHsysID; } } if (dr[5].ToString().Trim() != "") { ri = tbRegionInfo.GetRegionInfoModelLikeName(dr[5].ToString().Trim()); if (ri != null) { Stores_RegionID = ri.RegionID; } } si = tbStoresInfo.GetStoresInfoModelByName(Stores_sName); if (si == null) { si = new StoresInfo(); si.sName = Stores_sName; si.sCode = Stores_sCode; si.sType = Stores_sType; si.YHsysID = Stores_YHsysID; si.RegionID = Stores_RegionID; si.sState = 0; si.sAppendTime = DateTime.Now; si.StoresID = tbStoresInfo.AddStoresInfo(si); importdata_count_Stores++; } else { si.sName = Stores_sName; si.sCode = Stores_sCode; si.sType = Stores_sType; si.YHsysID = Stores_YHsysID; si.RegionID = Stores_RegionID; si.sState = 0; try { tbStoresInfo.UpdateStoresInfo(si); importdata_count_Stores++; } catch { } } //业务员 Staff_Name = dr[6].ToString().Trim(); if (Staff_Name.Trim() != "") { sfi = tbStaffInfo.GetStaffInfoModelByName(Staff_Name.Trim()); if (sfi == null) { sfi = new StaffInfo(); sfi.sName = Staff_Name.Trim(); sfi.sSex = ""; sfi.sType = 1; sfi.sTel = ""; sfi.sState = 0; sfi.sAppendTime = DateTime.Now; sfi.StaffID = tbStaffInfo.AddStaffInfo(sfi); importdata_count_Staff++; } } else { sfi = new StaffInfo(); sfi.StaffID = 0; } //促销员 Staff_NameB = dr[7].ToString().Trim(); if (Staff_NameB.Trim() != "") { sfiB = tbStaffInfo.GetStaffInfoModelByName(Staff_NameB.Trim()); if (sfiB == null) { sfiB = new StaffInfo(); sfiB.sName = Staff_NameB.Trim(); sfiB.sSex = "女"; sfiB.sType = 2; sfiB.sTel = dr[8].ToString().Trim(); sfiB.sState = 0; sfiB.sAppendTime = DateTime.Now; sfiB.StaffID = tbStaffInfo.AddStaffInfo(sfiB); importdata_count_StaffB++; } else { sfiB.sTel = dr[8].ToString().Trim(); tbStaffInfo.UpdateStaffInfo(sfiB); } } else { sfiB = new StaffInfo(); sfiB.StaffID = 0; } if (dr[9].ToString().Trim() != "") { Staff_sDateTime = DateTime.Parse(dr[9].ToString().Trim()); } else { Staff_sDateTime = DateTime.Parse("2009-1-1"); } //人员门店绑定 if (si.StoresID > 0) { ssi.StoresID = si.StoresID; if (sfi.StaffID > 0)//绑定业务员 { ssi.StaffID = sfi.StaffID; ssi.sType = 0; ssi.sDateTime = DateTime.Parse("2009-1-1"); ssi.sAppendTime = DateTime.Now; tbStaffStoresInfo.AddStaffStoresInfo(ssi); importdata_count++; } if (sfiB.StaffID > 0)//绑定促销员 { ssi.StaffID = sfiB.StaffID; ssi.sType = 0; ssi.sDateTime = Staff_sDateTime; ssi.sAppendTime = DateTime.Now; tbStaffStoresInfo.AddStaffStoresInfo(ssi); importdata_count++; } } importdata_count_All++; } } } finally { ds.Clear(); ds.Dispose(); } } catch (Exception ex) { AddErrLine("<b>文件格式错误,请将 Xls 文件用 Excel 另存后再导入!</b>:<br>" + ex); //AddScript("window.setTimeout('history.back(1);',5000);"); } } if (importdata_count > 0) { AddMsgLine("数据导入成功!共导入数据[" + importdata_count_All.ToString() + "]条,门店[" + importdata_count_Stores.ToString() + "]条,业务员[" + importdata_count_Staff.ToString() + "]条,促销员[" + importdata_count_StaffB.ToString() + "]条,绑定上岗记录[" + importdata_count.ToString() + "]条."); AddScript("window.setTimeout('window.parent.HidBox();',5000);"); } else { AddErrLine("系统忙!导入失败!"); //AddScript("window.setTimeout('history.back(1);',1000);"); } } finally { si = null; sfi = null; sfiB = null; ssi = null; yhi = null; ri = null; } } else { AddErrLine("为发现任何数据!导入失败!"); AddScript("window.setTimeout('history.back(1);',1000);"); } } finally { files = null; filearr.Clear(); } } } else { AddErrLine("权限不足!"); AddScript("window.parent.HidBox();"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
public void Stores_do(string Act, string Do, DataTable Dt) { if (ispost) { if (Dt.Rows.Count > 0) { StoresInfo model = new StoresInfo(); for (int i = 0; i < Dt.Rows.Count; i++) { if (Dt.Rows[i]["StoresID"].ToString() != "") { model.StoresID = int.Parse(Dt.Rows[i]["StoresID"].ToString()); } if (Dt.Rows[i]["PaymentSystemID"].ToString() != "") { model.PaymentSystemID = int.Parse(Dt.Rows[i]["PaymentSystemID"].ToString()); } model.PaymentSystemName = Dt.Rows[i]["PaymentSystemName"].ToString(); if (Dt.Rows[i]["PriceClassID"].ToString() != "") { model.PriceClassID = int.Parse(Dt.Rows[i]["PriceClassID"].ToString()); } model.PriceClassName = Dt.Rows[i]["PriceClassName"].ToString(); if (Dt.Rows[i]["CustomersClassID"].ToString() != "") { model.CustomersClassID = int.Parse(Dt.Rows[i]["CustomersClassID"].ToString()); } model.CustomersClassName = Dt.Rows[i]["CustomersClassName"].ToString(); model.sName = Dt.Rows[i]["sName"].ToString(); model.sCode = Dt.Rows[i]["sCode"].ToString(); model.sType = Dt.Rows[i]["sType"].ToString(); model.YHsysName = Dt.Rows[i]["YHsysName"].ToString(); if (Dt.Rows[i]["YHsysID"].ToString() != "") { model.YHsysID = int.Parse(Dt.Rows[i]["YHsysID"].ToString()); } if (Dt.Rows[i]["sIsFZYH"].ToString() != "") { model.sIsFZYH = int.Parse(Dt.Rows[i]["sIsFZYH"].ToString()); } if (Dt.Rows[i]["RegionID"].ToString() != "") { model.RegionID = int.Parse(Dt.Rows[i]["RegionID"].ToString()); } if (Dt.Rows[i]["sState"].ToString() != "") { model.sState = int.Parse(Dt.Rows[i]["sState"].ToString()); } if (Dt.Rows[i]["sAppendTime"].ToString() != "") { model.sAppendTime = DateTime.Parse(Dt.Rows[i]["sAppendTime"].ToString()); } if (Dt.Rows[i]["sDoDay"].ToString() != "") { model.sDoDay = int.Parse(Dt.Rows[i]["sDoDay"].ToString()); } if (Dt.Rows[i]["sDoDayMoney"].ToString() != "") { model.sDoDayMoney = decimal.Parse(Dt.Rows[i]["sDoDayMoney"].ToString()); } model.sContact = Dt.Rows[i]["sContact"].ToString(); model.sTel = Dt.Rows[i]["sTel"].ToString(); model.sAddress = Dt.Rows[i]["sAddress"].ToString(); model.sEmail = Dt.Rows[i]["sEmail"].ToString(); model.sLicense = Dt.Rows[i]["sLicense"].ToString(); StoresInfo modelOld = new StoresInfo(); if (model.sCode.Trim() != "") { modelOld = tbStoresInfo.GetStoresInfoModelByCode(model.sCode); } else { modelOld = tbStoresInfo.GetStoresInfoModelByName(model.sName); } if (modelOld != null) { model.StoresID = modelOld.StoresID; tbStoresInfo.UpdateStoresInfo(model); AddMsgLine(model.sName + "更新"); } else { tbStoresInfo.AddStoresInfo(model); AddMsgLine(model.sName + "新增"); } } } } else { if (Do == "down") { DataTable dt = tbStoresInfo.GetStoresInfoList("").Tables[0]; Public.Excels.TableToExcelForXLSX(dt, "客户列表" + (DateTime.Now).ToString("yyyy-MM-dd") + ".xls"); } } }
/// <summary> /// 增加一条数据 /// </summary> public static int AddStoresInfo(StoresInfo model) { return(DatabaseProvider.GetInstance().AddStoresInfo(model)); }
private void btnAdminLogin_Click(object sender, EventArgs e) { if (this.imgCode.Visible && !HiContext.Current.CheckVerifyCode(this.txtCode.Text.Trim(), "")) { this.ShowMessage("验证码不正确"); } else { ManagerInfo managerInfo = ManagerHelper.ValidLogin(this.txtAdminName.Text, this.txtAdminPassWord.Text); if (managerInfo != null) { if (managerInfo.RoleId == -2) { SiteSettings siteSettings = HiContext.Current.SiteSettings; if (!siteSettings.OpenSupplier) { this.ShowMessage("未开启供应商模块!"); return; } } Task task = Task.Factory.StartNew(delegate { this.DeleteTempFolder(); }); HttpCookie httpCookie = new HttpCookie("popTime"); httpCookie.Value = this.LastActivyTime; HttpCookie httpCookie2 = new HttpCookie("popTimes"); httpCookie2.Value = "0"; HttpCookie httpCookie3 = new HttpCookie("popData"); httpCookie3.Value = ""; HttpContext.Current.Response.Cookies.Add(httpCookie); HttpContext.Current.Response.Cookies.Add(httpCookie2); HttpContext.Current.Response.Cookies.Add(httpCookie3); this.UpdateSiteSettings(); string userData = string.Empty; SystemRoles systemRoles; if (managerInfo.RoleId == 0) { systemRoles = SystemRoles.SystemAdministrator; userData = systemRoles.ToString(); } else if (managerInfo.RoleId == -1) { systemRoles = SystemRoles.StoreAdmin; userData = systemRoles.ToString(); } else if (managerInfo.RoleId == -2) { systemRoles = SystemRoles.SupplierAdmin; userData = systemRoles.ToString(); } else if (managerInfo.RoleId == -3) { systemRoles = SystemRoles.ShoppingGuider; userData = systemRoles.ToString(); } FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, managerInfo.ManagerId.ToString(), DateTime.Now, DateTime.Now.AddMinutes(30.0), false, userData, "/"); string value = FormsAuthentication.Encrypt(ticket); HttpCookie httpCookie4 = new HttpCookie(FormsAuthentication.FormsCookieName, value); httpCookie4.HttpOnly = true; HiContext.Current.Context.Response.Cookies.Add(httpCookie4); this.RemoveCache(); string text = string.Empty; if (!string.IsNullOrEmpty(this.Page.Request.QueryString["returnUrl"])) { text = this.Page.Request.QueryString["returnUrl"]; } if (text == null && this.ReferralLink != null && !string.IsNullOrEmpty(this.ReferralLink.Trim())) { text = this.ReferralLink; } Globals.AppendLog(new Dictionary <string, string>(), "Login:"******"," + managerInfo.RoleId, "", "", "/log/Login.txt"); if (managerInfo.RoleId == -1 || managerInfo.RoleId == -3) { if (managerInfo.Status == 0 && managerInfo.RoleId == -3) { this.ShowMessage("子帐号已被冻结,无法登录!"); return; } StoresInfo storeById = StoresHelper.GetStoreById(managerInfo.StoreId); if (storeById == null || storeById.State == 0) { this.ShowMessage("门店已被关闭,无法登录!"); return; } if (!string.IsNullOrEmpty(text) && text.ToLower().IndexOf("/depot/") >= 0) { this.Page.Response.Redirect(text, true); } else { base.Response.Write("<script language='javascript'>window.parent.location.href='/depot/default.html?v=" + HiContext.Current.Config.Version + "';</script>"); base.Response.End(); } } else if (managerInfo.RoleId == -2) { base.Response.Write("<script language='javascript'>window.parent.location.href='/Supplier/default.html?v=" + HiContext.Current.Config.Version + "';</script>"); base.Response.End(); } else { base.Response.Write("<script language='javascript'>window.parent.location.href='/Admin/default.html?v=" + HiContext.Current.Config.Version + "';</script>"); base.Response.End(); } if (!string.IsNullOrEmpty(text) && (text.ToLower().IndexOf("logout") >= 0 || text.ToLower().IndexOf("register") >= 0 || text.ToLower().IndexOf("votelist") >= 0 || text.ToLower().IndexOf("loginexit") >= 0)) { text = null; } if (text != null) { this.Page.Response.Redirect(text, true); } else { this.Page.Response.Redirect("default.html?v=" + HiContext.Current.Config.Version, true); } } else { this.SetErrorTimes("username"); this.ShowMessage("用户名或密码错误!"); } } }
public void BindData() { StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin); if (storeById == null) { base.Response.Redirect("StoresList.aspx"); } else { string empty = string.Empty; string empty2 = string.Empty; if (!string.IsNullOrEmpty(storeById.WXCategoryName)) { empty = storeById.WXCategoryName.Split(',')[0]; empty2 = storeById.WXCategoryName.Split(',')[1]; } this.editDescription.Text = storeById.Introduce; HiddenField hiddenField = this.hidOldRegion; int num = storeById.RegionId; hiddenField.Value = num.ToString(); IEnumerable <string> values = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3); this.hfProvinceCityArea.Value = string.Join(",", values); HiddenField hiddenField2 = this.hidOldAddress; TrimTextBox trimTextBox = this.txtAddress; string text3 = hiddenField2.Value = (trimTextBox.Text = string.Join(string.Empty, values) + storeById.Address); this.txtContactMan.Text = storeById.ContactMan; IList <DeliveryScopeInfo> storeDeliveryScop = StoresHelper.GetStoreDeliveryScop(storeById.StoreId); string text4 = ""; string text5 = ""; this.chkOfflinePay.Checked = storeById.IsOfflinePay; this.chkOnlinePay.Checked = storeById.IsOnlinePay; this.chkCashOnDelivery.Checked = storeById.IsCashOnDelivery; foreach (DeliveryScopeInfo item in storeDeliveryScop) { text4 = text4 + item.RegionId + ","; text5 = text5 + item.RegionName + ","; } text4 = text4.TrimEnd(','); text5 = text5.TrimEnd(','); this.txtRegionScop.Value = text4; this.txtRegionScopName.Value = text5; this.txtStoresName.Text = storeById.StoreName; this.txtTel.Text = storeById.Tel; this.labStoreUserName.Text = managerInfo.UserName; this.dropRegion.SetSelectedRegionId(storeById.RegionId); this.hidOldImages.Value = storeById.StoreImages; HiddenField hiddenField3 = this.hidOldLatitude; HiddenField hiddenField4 = this.hfLatitude; double? nullable = storeById.Latitude; object text6; double value; if (!nullable.HasValue) { text6 = string.Empty; } else { nullable = storeById.Latitude; value = nullable.Value; text6 = value.ToString(); } text3 = (string)text6; hiddenField4.Value = (string)text6; hiddenField3.Value = text3; HiddenField hiddenField5 = this.hidOldLongitude; HiddenField hiddenField6 = this.hfLongitude; nullable = storeById.Longitude; object text7; if (!nullable.HasValue) { text7 = string.Empty; } else { nullable = storeById.Longitude; value = nullable.Value; text7 = value.ToString(); } text3 = (string)text7; hiddenField6.Value = (string)text7; hiddenField5.Value = text3; if (!string.IsNullOrEmpty(storeById.StoreOpenTime)) { string[] array = storeById.StoreOpenTime.Split('-'); string[] array2 = array[0].Split(':'); this.txtStoreOpenTimeStartH.Text = array2[0]; this.txtStoreOpenTimeStartM.Text = ((array2.Length > 1) ? array2[1] : ""); if (array.Length > 1) { string[] array3 = array[1].Split(':'); this.txtStoreOpenTimeEndH.Text = array3[0]; this.txtStoreOpenTimeEndM.Text = ((array3.Length > 1) ? array3[1] : ""); } } this.chkIsAboveSelf.Checked = storeById.IsAboveSelf; this.chkIsSupportExpress.Checked = storeById.IsSupportExpress; this.chkIsStoreDelive.Checked = storeById.IsStoreDelive; TrimTextBox trimTextBox2 = this.txtServeRadius; nullable = storeById.ServeRadius; trimTextBox2.Text = nullable.ToString(); TrimTextBox trimTextBox3 = this.txtMinOrderPrice; object text8; if (storeById.MinOrderPrice.HasValue) { num = storeById.MinOrderPrice.ToInt(0); text8 = num.ToString(); } else { text8 = ""; } trimTextBox3.Text = (string)text8; TrimTextBox trimTextBox4 = this.txtStoreFreight; object text9; if (storeById.StoreFreight.HasValue) { num = storeById.StoreFreight.ToInt(0); text9 = num.ToString(); } else { text9 = ""; } trimTextBox4.Text = (string)text9; this.txtCommissionRate.Text = storeById.CommissionRate.ToString(); IList <int> storeTags = StoresHelper.GetStoreTags(this.storeId); this.litralStoreTag.SelectedValue = storeTags; if (storeTags != null && storeTags.Count > 0) { foreach (int item2 in storeTags) { TrimTextBox trimTextBox5 = this.txtStoreTag; trimTextBox5.Text = trimTextBox5.Text + item2.ToString() + ","; } this.txtStoreTag.Text = this.txtStoreTag.Text.Substring(0, this.txtStoreTag.Text.Length - 1); } } }
protected override void AttachChildControls() { this.inputPaymentModeId = (HtmlInputHidden)this.FindControl("inputPaymentModeId"); this.inputShippingModeId = (HtmlInputHidden)this.FindControl("inputShippingModeId"); this.hidPaymentId_Podrequest = (HtmlInputHidden)this.FindControl("hidPaymentId_Podrequest"); this.hidPaymentId_Offline = (HtmlInputHidden)this.FindControl("hidPaymentId_Offline"); this.hidGetgoodsOnStores = (HtmlInputHidden)this.FindControl("hidGetgoodsOnStores"); this.hidHasStoresInCity = (HtmlInputHidden)this.FindControl("hidHasStoresInCity"); this.hidDeliveryTime = (HtmlInputHidden)this.FindControl("hidDeliveryTime"); this.hidStoreId = (HtmlInputHidden)this.FindControl("hidStoreId"); this.hidShipAddressId = (HtmlInputHidden)this.FindControl("hidShipAddressId"); this.litStoreName = (Literal)this.FindControl("litStoreName"); this.litAddress = (Literal)this.FindControl("litAddress"); this.litTel = (Literal)this.FindControl("litTel"); this.hidOnlinePayCount = (HtmlInputHidden)this.FindControl("hidOnlinePayCount"); this.hidHasSupplierProduct = (HtmlInputHidden)this.FindControl("hidHasSupplierProduct"); if (!this.Page.IsPostBack) { this.hidHasSupplierProduct.Value = this.hasSupplierProduct.ToString(); this.hidOnlinePayCount.Value = TradeHelper.WapPaymentTypeCount(base.ClientType, this.isFightGroup).ToNullString(); this.hidGetgoodsOnStores.Value = "false"; this.hidHasStoresInCity.Value = "false"; this.hidPaymentId_Podrequest.Value = "0"; int num = 0; int num2 = 0; if (this.from != "countdown" && this.from != "groupbuy" && this.hasSupplierProduct != 1) { if (this.from != "presale" && SalesHelper.IsSupportPodrequest()) { num = 1; this.hidPaymentId_Podrequest.Value = "1"; } if (ShoppingProcessor.IsSupportOfflineRequest()) { this.hidPaymentId_Offline.Value = "2"; num2 = 2; } } if (this.paymentModeId != 0 && this.paymentModeId != num && this.paymentModeId != num2 && this.paymentModeId != -3) { this.paymentModeId = 0; } this.hidDeliveryTime.Value = this.deliveryTime; if (this.paymentModeId == 0) { if (TradeHelper.WapPaymentTypeCount(base.ClientType, this.isFightGroup) > 0) { this.inputPaymentModeId.Value = this.paymentModeId.ToString(); } } else { this.inputPaymentModeId.Value = this.paymentModeId.ToString(); } this.inputShippingModeId.Value = this.shippingModeId.ToString(); int shipAddressId = 0; int.TryParse(this.Page.Request.QueryString["ShipAddressId"].ToNullString(), out shipAddressId); IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(false); int regionId = 0; IList <ShippingAddressInfo> list = new List <ShippingAddressInfo>(); ShippingAddressInfo shippingAddressInfo = null; if (shipAddressId > 0) { shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo a) => a.ShippingId == shipAddressId); if (shippingAddressInfo != null) { regionId = shippingAddressInfo.RegionId; } } else if (shippingAddresses != null && shippingAddresses.Count > 0) { regionId = shippingAddresses.FirstOrDefault().RegionId; } this.hidShipAddressId.Value = shipAddressId.ToString(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.OpenMultStore) { this.hidStoreId.Value = this.storeId.ToString(); if (this.storeId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(this.storeId); this.litStoreName.Text = (string.IsNullOrEmpty(storeById.StoreOpenTime) ? storeById.StoreName : (storeById.StoreName + " [营业时间:" + storeById.StoreOpenTime + "]")); this.litAddress.Text = RegionHelper.GetFullRegion(storeById.RegionId, string.Empty, true, 0) + storeById.Address; this.litTel.Text = storeById.Tel; } if (this.from != "countdown" && this.from != "groupbuy" && this.from != "presale" && this.shoppingCart.LineItems.Count > 0) { string str = this.productSku.Replace(",", "','"); str = "'" + str + "'"; if (ShoppingCartProcessor.CanGetGoodsOnStore(str)) { this.hidGetgoodsOnStores.Value = "true"; bool flag = StoresHelper.HasStoresInCity(str, regionId); this.hidHasStoresInCity.Value = (flag ? "true" : "false"); } } else { this.hidGetgoodsOnStores.Value = "false"; } } } }
private void BindStoreData() { StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); if (storeById == null) { base.Response.Redirect("StoresList.aspx"); } else { IEnumerable <string> values = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3); this.hfProvinceCityArea.Value = string.Join(",", values); this.txtWxAddress.Text = string.Join(string.Empty, values) + storeById.Address; this.hidUploadImages.Value = (string.IsNullOrEmpty(storeById.StoreImages) ? string.Empty : storeById.StoreImages); HiddenField hiddenField = this.hfLatitude; object value; double value2; if (!storeById.Latitude.HasValue) { value = string.Empty; } else { value2 = storeById.Latitude.Value; value = value2.ToString(); } hiddenField.Value = (string)value; HiddenField hiddenField2 = this.hfLongitude; object value3; if (!storeById.Longitude.HasValue) { value3 = string.Empty; } else { value2 = storeById.Longitude.Value; value3 = value2.ToString(); } hiddenField2.Value = (string)value3; TrimTextBox trimTextBox = this.txtWXAvgPrice; int? wXAvgPrice = storeById.WXAvgPrice; object text; if (!wXAvgPrice.HasValue) { text = string.Empty; } else { wXAvgPrice = storeById.WXAvgPrice; text = wXAvgPrice.ToString(); } trimTextBox.Text = (string)text; this.txtWXIntroduction.Text = (string.IsNullOrEmpty(storeById.WXIntroduction) ? string.Empty : storeById.WXIntroduction); this.txtWXOpenTime.Text = (string.IsNullOrEmpty(storeById.WXOpenTime) ? string.Empty : storeById.WXOpenTime); this.txtWXRecommend.Text = (string.IsNullOrEmpty(storeById.WXRecommend) ? string.Empty : storeById.WXRecommend); this.txtWXSpecial.Text = (string.IsNullOrEmpty(storeById.WXSpecial) ? string.Empty : storeById.WXSpecial); this.txtWXTelephone.Text = (string.IsNullOrEmpty(storeById.WXTelephone) ? storeById.Tel : storeById.WXTelephone); string text2 = string.IsNullOrEmpty(storeById.WXCategoryName) ? string.Empty : storeById.WXCategoryName; if (!string.IsNullOrEmpty(text2)) { string selectedValue = text2.Split(',')[0]; string selectedValue2 = text2.Split(',')[1]; this.ddlCategoryParent.SelectedValue = selectedValue; this.BindCategoryChild(); this.ddlCategoryChild.SelectedValue = selectedValue2; } } }
private void BindOrderInfo() { if (this.order.BalanceAmount > decimal.Zero) { this.litBalanceAmount.Text = this.order.BalanceAmount.F2ToString("f2"); } else { this.liBalanceAmount.Visible = false; } SiteSettings masterSettings = SettingsManager.GetMasterSettings(); DateTime? nullable; DateTime dateTime; if (this.order.PreSaleId > 0) { this.litDeposit.Text = this.order.Deposit.F2ToString("f2"); this.litFinal.Text = this.order.FinalPayment.F2ToString("f2"); nullable = this.order.DepositDate; if (nullable.HasValue) { Literal literal = this.litDepositDate; nullable = this.order.DepositDate; literal.Text = nullable.ToString(); } DateTime payDate = this.order.PayDate; if (this.order.PayDate != DateTime.MinValue) { Literal literal2 = this.litFinalDate; dateTime = this.order.PayDate; literal2.Text = dateTime.ToString(); } } if (this.order.ShippingModeId == -2) { this.divStoreAddress.Visible = true; this.divLogists.Visible = false; this.divShipAddress.Visible = false; } else { this.divStoreAddress.Visible = false; this.divLogists.Visible = (this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished); this.divShipAddress.Visible = true; } if (this.order.OrderStatus == OrderStatus.SellerAlreadySent && this.order.ItemStatus == OrderItemStatus.Nomarl) { this.ensureRecieved.Visible = true; } else { this.ensureRecieved.Visible = false; } if ((this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(this.order.ExpressCompanyAbb) && !string.IsNullOrEmpty(this.order.ShipOrderNumber)) { this.lookupTrans.Visible = true; this.lookupTrans.HRef = "MyLogistics.aspx?orderId=" + this.order.OrderId; } else { this.lookupTrans.Visible = false; } if (string.IsNullOrEmpty(this.order.TakeCode) || string.IsNullOrEmpty(masterSettings.HiPOSAppId) || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.Closed) { this.lookupQRCode.Visible = false; } ProductPreSaleInfo productPreSaleInfo = null; int paymentTypeId; if (this.order.OrderStatus == OrderStatus.WaitBuyerPay && this.order.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1) && this.order.PaymentTypeId != -3) { if (this.order.PreSaleId > 0) { productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId); nullable = this.order.DepositDate; if (!nullable.HasValue) { if (productPreSaleInfo.PreSaleEndDate > DateTime.Now) { this.btnToPay.Visible = true; AttributeCollection attributes = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", (this.order.Deposit - this.order.BalanceAmount).F2ToString("f2")); } } else if (!(productPreSaleInfo.PaymentStartDate > DateTime.Now) && !(productPreSaleInfo.PaymentEndDate < DateTime.Now)) { this.btnToPay.Visible = true; AttributeCollection attributes2 = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes2.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", this.order.FinalPayment.F2ToString("f2")); } } else { AttributeCollection attributes3 = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes3.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Visible = true; this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", this.order.GetTotal(true).F2ToString("f2")); if (HiContext.Current.SiteSettings.OpenMultStore && this.order.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime) { StoresInfo storeById = StoresHelper.GetStoreById(this.order.StoreId); dateTime = DateTime.Now; string str = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenStartDate; nullable = (str + " " + dateTime.ToString("HH:mm")).ToDateTime(); DateTime value = nullable.Value; dateTime = DateTime.Now; string str2 = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenEndDate; nullable = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime(); DateTime dateTime2 = nullable.Value; if (dateTime2 <= value) { dateTime2 = dateTime2.AddDays(1.0); } if (DateTime.Now < value || DateTime.Now > dateTime2) { this.btnToPay.Attributes.Add("NeedNotInTimeTip", "1"); } } } if (this.order.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.OfflinePay, 1)) { this.btnToPay.InnerText = "线下支付帮助"; this.btnToPay.HRef = "FinishOrder.aspx?OrderId=" + this.order.OrderId + "&onlyHelp=true"; } } if (this.order.ReducedPromotionAmount <= decimal.Zero) { this.liFullReduction.Visible = false; } this.litShipTo.Text = this.order.ShipTo; this.litPhone.Text = this.order.CellPhone; this.litAddress.Text = this.order.ShippingRegion + this.order.Address; this.litOrderId.Text = this.orderId; Literal literal3 = this.litOrderDate; dateTime = this.order.OrderDate; literal3.Text = dateTime.ToString(); this.litTotalPrice.SetWhenIsNotNull(this.order.GetAmount(false).F2ToString("f2")); this.litOrderStatus.OrderStatusCode = this.order.OrderStatus; this.litOrderStatus.OrderItemStatus = this.order.ItemStatus; this.litOrderStatus.ShipmentModelId = this.order.ShippingModeId; this.litOrderStatus.IsConfirm = this.order.IsConfirm; this.litOrderStatus.Gateway = this.order.Gateway; this.litOrderStatus.PaymentTypeId = this.order.PaymentTypeId; this.litOrderStatus.PreSaleId = this.order.PreSaleId; this.litOrderStatus.DepositDate = this.order.DepositDate; Literal control = this.litPayTime; object value2; if (!(this.order.PayDate != DateTime.MinValue)) { value2 = ""; } else { dateTime = this.order.PayDate; value2 = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); } control.SetWhenIsNotNull((string)value2); HtmlInputHidden control2 = this.orderStatus; paymentTypeId = (int)this.order.OrderStatus; control2.SetWhenIsNotNull(paymentTypeId.ToString()); this.hidOrderId.SetWhenIsNotNull(this.orderId.ToString()); this.litPaymentMode.SetWhenIsNotNull(this.order.PaymentType); this.litShipToDate.SetWhenIsNotNull(this.order.ShipToDate); bool flag = false; if (this.order.OrderStatus == OrderStatus.BuyerAlreadyPaid || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.WaitReview || this.order.OrderStatus == OrderStatus.History) { WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= this.order.GetPayTotal() && this.order.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && this.order.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime) { flag = true; } } this.hidShowRedEnvelope.SetWhenIsNotNull(flag ? "true" : "false"); if (this.order.PreSaleId > 0) { this.litBuildPrice.SetWhenIsNotNull((this.order.Deposit + this.order.FinalPayment).F2ToString("f2")); } else { this.litBuildPrice.SetWhenIsNotNull(this.order.GetPayTotal().F2ToString("f2")); } this.litRemark.SetWhenIsNotNull(this.order.Remark); this.litTakeCode.SetWhenIsNotNull((this.order.ShippingModeId == -2) ? this.order.TakeCode : ""); this.litFreight.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2")); this.litFreight2.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2")); this.giftFreight.Visible = (this.order.LineItems.Count == 0); this.litFullCapacityReduction.SetWhenIsNotNull("-" + this.order.ReducedPromotionAmount.F2ToString("f2")); if (this.order.PreSaleId > 0) { if (productPreSaleInfo == null) { productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId); } nullable = this.order.DepositDate; if (!nullable.HasValue) { this.hidpresaleStaut.Value = "1"; if (this.order.OrderStatus == OrderStatus.Closed) { this.hidpresaleStaut.Value = "6"; } } else if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { this.hidpresaleStaut.Value = "2"; } else if (productPreSaleInfo.PaymentEndDate < DateTime.Now) { if (this.order.PayDate == DateTime.MinValue) { this.hidpresaleStaut.Value = "5"; } else { this.hidpresaleStaut.Value = "4"; } } else if (this.order.PayDate == DateTime.MinValue) { this.hidpresaleStaut.Value = "3"; } else { this.hidpresaleStaut.Value = "4"; } } }
protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-1")) { if (ispost) { int sType = Utils.StrToInt(HTTPRequest.GetString("sType"), 0); string PathStr = Utils.GetMapPath(config.DataPath.ToString()); string fileExtension = ""; string fileName = ""; string thispath = DateTime.Now.Year + "-" + DateTime.Now.Month; ArrayList filearr = new ArrayList(); int importdata_count = 0; if (!Directory.Exists(PathStr + thispath)) { Directory.CreateDirectory(PathStr + thispath); } //文件上传 HttpFileCollection files = HttpContext.Current.Request.Files; try { if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { HttpPostedFile postedFile = files[i]; fileName = System.IO.Path.GetFileName(postedFile.FileName); if (Utils.ChkSQL(fileName) != "") { fileExtension = System.IO.Path.GetExtension(fileName).ToLower(); if (fileExtension == ".xls") { postedFile.SaveAs(PathStr + thispath + "/" + fileName); filearr.Add(PathStr + thispath + "/" + fileName); } } } } if (filearr.Count > 0) { MarketingFeesInfo mi = new MarketingFeesInfo(); StoresInfo si = new StoresInfo(); FeesSubjectInfo fi = new FeesSubjectInfo(); StaffInfo ft = new StaffInfo(); try { for (int j = 0; j < filearr.Count; j++) { try { DataSet ds = Excels.ExcelToDataTable(filearr[j].ToString()); DataTable dt = new DataTable(); try { dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { mi.mAppendTime = DateTime.Now; if (sType == 0)//营销费用 { if (dr[0].ToString() != "" && dr[1].ToString() != "" && dr[2].ToString() != "" && dr[3].ToString() != "" && dr[4].ToString() != "") { if (Utils.IsNumeric(dr[3].ToString())) { si = tbStoresInfo.GetStoresInfoModelByName(dr[2].ToString().Trim()); if (si == null) { si = tbStoresInfo.GetStoresInfoModelByCode(dr[1].ToString().Trim()); } if (si != null) { mi.StoresID = si.StoresID; } fi = tbFeesSubjectInfo.GetFeesSubjectInfoModelByName(dr[4].ToString().Trim()); if (fi != null) { mi.FeesSubjectID = fi.FeesSubjectID; } mi.mRemark = dr[5].ToString().Trim(); mi.mFees = decimal.Parse(Utils.StrToFloat(dr[3].ToString().Trim(), 0).ToString()); mi.mDateTime = DateTime.Parse(dr[0].ToString().Trim()); mi.mType = 0; mi.StaffID = 0; if (tbMarketingFeesInfo.AddMarketingFeesInfo(mi) > 0) { importdata_count++; } } } } if (sType == 1)//公司费用 { if (dr[0].ToString() != "" && dr[1].ToString() != "" && dr[2].ToString() != "" && dr[3].ToString() != "") { if (Utils.IsNumeric(dr[2].ToString())) { mi.StoresID = 0; mi.mDateTime = DateTime.Parse(dr[0].ToString().Trim()); fi = tbFeesSubjectInfo.GetFeesSubjectInfoModelByName(dr[1].ToString().Trim()); if (fi != null) { mi.FeesSubjectID = fi.FeesSubjectID; } mi.mFees = decimal.Parse(Utils.StrToFloat(dr[2].ToString().Trim(), 0).ToString()); ft = tbStaffInfo.GetStaffInfoModelByName(dr[3].ToString().Trim()); if (ft != null) { mi.StaffID = ft.StaffID; } mi.mType = 1; mi.mRemark = dr[4].ToString().Trim(); if (tbMarketingFeesInfo.AddMarketingFeesInfo(mi) > 0) { importdata_count++; } } } } if (sType == 2)//收入 { if (dr[0].ToString() != "" && dr[1].ToString() != "" && dr[2].ToString() != "") { if (Utils.IsNumeric(dr[1].ToString())) { mi.StoresID = 0; mi.mDateTime = DateTime.Parse(dr[0].ToString().Trim()); if (dr[3].ToString().Trim() != "") { fi = tbFeesSubjectInfo.GetFeesSubjectInfoModelByName(dr[3].ToString().Trim()); if (fi != null) { mi.FeesSubjectID = fi.FeesSubjectID; } } else { mi.FeesSubjectID = 0; } mi.mFees = decimal.Parse(Utils.StrToFloat(dr[1].ToString().Trim(), 0).ToString()); ft = tbStaffInfo.GetStaffInfoModelByName(dr[2].ToString().Trim()); if (ft != null) { mi.StaffID = ft.StaffID; } mi.mIsIncomeExpenditure = 1; mi.mType = -1; mi.mRemark = dr[4].ToString().Trim(); if (tbMarketingFeesInfo.AddMarketingFeesInfo(mi) > 0) { importdata_count++; } } } } } } finally { ds.Clear(); ds.Dispose(); } } catch (Exception ex) { AddErrLine("<b>文件格式错误,请将 Xls 文件用 Excel 另存后再导入!</b>:<br>" + ex); //AddScript("window.setTimeout('history.back(1);',5000);"); } } if (importdata_count > 0) { AddMsgLine("数据导入成功!共导入数据[" + importdata_count.ToString() + "]条."); AddScript("window.setTimeout('window.parent.HidBox();',5000);"); } else { AddErrLine("系统忙!导入失败!"); //AddScript("window.setTimeout('history.back(1);',1000);"); } } finally { mi = null; si = null; ft = null; } } else { AddErrLine("为发现任何数据!导入失败!"); AddScript("window.setTimeout('history.back(1);',1000);"); } } finally { files = null; filearr.Clear(); } } } else { AddErrLine("权限不足!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
/// <summary> /// 得到一个对象实体 /// </summary> public StoresInfo GetStoresInfoModelByCode(string sCode) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 StoresID,sName,sCode,sType,RegionID,sState,sAppendTime,YHsysID,sIsFZYH,sContact,sTel,sAddress,sEmail,sLicense,(select yName from tbYHsysInfo where YHsysID=tbStoresInfo.[YHsysID]) as YHsysName,sDoDay,sDoDayMoney,PaymentSystemID,(select pName from tbPaymentSystemInfo where tbPaymentSystemInfo.PaymentSystemID=tbStoresInfo.PaymentSystemID) as PaymentSystemName,CustomersClassID,(select cClassName from tbCustomersClassInfo where CustomersClassID=tbStoresInfo.CustomersClassID) as CustomersClassName,PriceClassID,(select tbPriceClassInfo.pClassName from tbPriceClassInfo where tbPriceClassInfo.PriceClassID=tbStoresInfo.PriceClassID) as PriceClassName from tbStoresInfo "); strSql.Append(" where sCode=@sCode "); SqlParameter[] parameters = { new SqlParameter("@sCode", SqlDbType.VarChar, 50) }; parameters[0].Value = sCode; StoresInfo model = new StoresInfo(); DataSet ds = DbHelper.ExecuteDataset(CommandType.Text, strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["StoresID"].ToString() != "") { model.StoresID = int.Parse(ds.Tables[0].Rows[0]["StoresID"].ToString()); } if (ds.Tables[0].Rows[0]["PaymentSystemID"].ToString() != "") { model.PaymentSystemID = int.Parse(ds.Tables[0].Rows[0]["PaymentSystemID"].ToString()); } model.PaymentSystemName = ds.Tables[0].Rows[0]["PaymentSystemName"].ToString(); if (ds.Tables[0].Rows[0]["PriceClassID"].ToString() != "") { model.PriceClassID = int.Parse(ds.Tables[0].Rows[0]["PriceClassID"].ToString()); } model.PriceClassName = ds.Tables[0].Rows[0]["PriceClassName"].ToString(); if (ds.Tables[0].Rows[0]["CustomersClassID"].ToString() != "") { model.CustomersClassID = int.Parse(ds.Tables[0].Rows[0]["CustomersClassID"].ToString()); } model.CustomersClassName = ds.Tables[0].Rows[0]["CustomersClassName"].ToString(); model.sName = ds.Tables[0].Rows[0]["sName"].ToString(); model.sCode = ds.Tables[0].Rows[0]["sCode"].ToString(); model.sType = ds.Tables[0].Rows[0]["sType"].ToString(); model.YHsysName = ds.Tables[0].Rows[0]["YHsysName"].ToString(); if (ds.Tables[0].Rows[0]["YHsysID"].ToString() != "") { model.YHsysID = int.Parse(ds.Tables[0].Rows[0]["YHsysID"].ToString()); } if (ds.Tables[0].Rows[0]["sIsFZYH"].ToString() != "") { model.sIsFZYH = int.Parse(ds.Tables[0].Rows[0]["sIsFZYH"].ToString()); } if (ds.Tables[0].Rows[0]["RegionID"].ToString() != "") { model.RegionID = int.Parse(ds.Tables[0].Rows[0]["RegionID"].ToString()); } if (ds.Tables[0].Rows[0]["sState"].ToString() != "") { model.sState = int.Parse(ds.Tables[0].Rows[0]["sState"].ToString()); } if (ds.Tables[0].Rows[0]["sAppendTime"].ToString() != "") { model.sAppendTime = DateTime.Parse(ds.Tables[0].Rows[0]["sAppendTime"].ToString()); } if (ds.Tables[0].Rows[0]["sDoDay"].ToString() != "") { model.sDoDay = int.Parse(ds.Tables[0].Rows[0]["sDoDay"].ToString()); } if (ds.Tables[0].Rows[0]["sDoDayMoney"].ToString() != "") { model.sDoDayMoney = decimal.Parse(ds.Tables[0].Rows[0]["sDoDayMoney"].ToString()); } model.sContact = ds.Tables[0].Rows[0]["sContact"].ToString(); model.sTel = ds.Tables[0].Rows[0]["sTel"].ToString(); model.sAddress = ds.Tables[0].Rows[0]["sAddress"].ToString(); model.sEmail = ds.Tables[0].Rows[0]["sEmail"].ToString(); model.sLicense = ds.Tables[0].Rows[0]["sLicense"].ToString(); return(model); } else { return(null); } }
public void bindReturnInfo() { int returnId = this.Page.Request["ReturnId"].ToInt(0); ReturnInfo returnInfo = TradeHelper.GetReturnInfo(returnId); if (returnInfo == null) { this.ShowMsg("退货信息错误!", false); } else { HiddenField hiddenField = this.hidReturnStatus; int num = (int)returnInfo.HandleStatus; hiddenField.Value = num.ToString(); OrderInfo orderInfo = TradeHelper.GetOrderInfo(returnInfo.OrderId); if (orderInfo == null) { this.ShowMsg("错误的订单信息!", false); } else { if (string.IsNullOrEmpty(returnInfo.SkuId)) { this.listPrducts.DataSource = orderInfo.LineItems.Values; } else { Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>(); foreach (LineItemInfo value in orderInfo.LineItems.Values) { if (value.SkuId == returnInfo.SkuId) { dictionary.Add(value.SkuId, value); } } this.listPrducts.DataSource = dictionary.Values; } this.listPrducts.DataBind(); this.litOrderId.Text = orderInfo.PayOrderId; this.litOrderTotal.Text = orderInfo.GetTotal(false).F2ToString("f2"); this.litRefundReason.Text = returnInfo.ReturnReason; this.litRefundTotal.Text = returnInfo.RefundAmount.F2ToString("f2"); this.litRemark.Text = returnInfo.UserRemark; Literal literal = this.litReturnQuantity; num = returnInfo.Quantity; literal.Text = num.ToString(); if (returnInfo.RefundType == RefundTypes.InBankCard) { this.litType.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.RefundType, 0) + "(" + returnInfo.BankName + " " + returnInfo.BankAccountName + " " + returnInfo.BankAccountNo + ")"; } else { this.litType.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.RefundType, 0); } string userCredentials = returnInfo.UserCredentials; if (!string.IsNullOrEmpty(userCredentials)) { string[] array = userCredentials.Split('|'); userCredentials = ""; string[] array2 = array; foreach (string str in array2) { userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str); } this.litImageList.Text = userCredentials; } else { this.divCredentials.Visible = false; } if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund) { this.btnAcceptReturn.Text = "确认退款"; this.btnRefuseReturn.Text = "拒绝退款"; this.AfterSaleType = "退款"; } if (returnInfo.HandleStatus == ReturnStatus.Applied && !orderInfo.IsStoreCollect) { this.btnAcceptReturn.Visible = true; this.btnRefuseReturn.Visible = true; } if (returnInfo.HandleStatus == ReturnStatus.Deliverying && this.UserStoreId > 0 && !orderInfo.IsStoreCollect) { this.btnGetGoods.Visible = true; } if ((orderInfo.StoreId == this.UserStoreId || orderInfo.StoreId <= 0 || (!orderInfo.IsStoreCollect && this.UserStoreId == 0)) && (returnInfo.HandleStatus == ReturnStatus.GetGoods || (returnInfo.HandleStatus == ReturnStatus.Deliverying && orderInfo.StoreId <= 0))) { if (returnInfo.HandleStatus == ReturnStatus.Deliverying) { this.btnFinishReturn.Text = "确认收货并完成退款"; } this.btnFinishReturn.Visible = true; } if (returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) { this.inputPanel.Visible = true; this.showPanel.Visible = false; } else { this.inputPanel.Visible = false; this.showPanel.Visible = true; } if (returnInfo.HandleStatus != 0) { this.txtAdminCellPhone.Visible = false; this.txtAdminShipAddress.Visible = false; this.txtAdminShipTo.Visible = false; this.litAdminCellPhone.Visible = true; this.litAdminShipAddrss.Visible = true; this.litAdminShipTo.Visible = true; this.litAdminCellPhone.Text = returnInfo.AdminCellPhone; this.litAdminShipTo.Text = returnInfo.AdminShipTo; this.litAdminShipAddrss.Text = returnInfo.AdminShipAddress; } else if (orderInfo.SupplierId > 0) { ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(orderInfo.SupplierId); if (defaultGetGoodsShipperBysupplierId != null) { Literal literal2 = this.litAdminShipAddrss; TextBox textBox = this.txtAdminShipAddress; string text3 = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(defaultGetGoodsShipperBysupplierId.RegionId, " ", true, 0) + " " + defaultGetGoodsShipperBysupplierId.Address); Literal literal3 = this.litAdminShipTo; TextBox textBox2 = this.txtAdminShipTo; text3 = (literal3.Text = (textBox2.Text = defaultGetGoodsShipperBysupplierId.ShipperName)); Literal literal4 = this.litAdminCellPhone; TextBox textBox3 = this.txtAdminCellPhone; text3 = (literal4.Text = (textBox3.Text = defaultGetGoodsShipperBysupplierId.CellPhone)); } } else if (orderInfo.StoreId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(orderInfo.StoreId); if (storeById != null) { Literal literal5 = this.litAdminShipAddrss; TextBox textBox4 = this.txtAdminShipAddress; string text3 = literal5.Text = (textBox4.Text = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address); Literal literal6 = this.litAdminShipTo; TextBox textBox5 = this.txtAdminShipTo; text3 = (literal6.Text = (textBox5.Text = storeById.ContactMan)); Literal literal7 = this.litAdminCellPhone; TextBox textBox6 = this.txtAdminCellPhone; text3 = (literal7.Text = (textBox6.Text = storeById.Tel)); } } else { ShippersInfo defaultOrFirstGetGoodShipper = TradeHelper.GetDefaultOrFirstGetGoodShipper(); if (defaultOrFirstGetGoodShipper != null) { Literal literal8 = this.litAdminShipAddrss; TextBox textBox7 = this.txtAdminShipAddress; string text3 = literal8.Text = (textBox7.Text = RegionHelper.GetFullRegion(defaultOrFirstGetGoodShipper.RegionId, " ", true, 0) + " " + defaultOrFirstGetGoodShipper.Address); Literal literal9 = this.litAdminShipTo; TextBox textBox8 = this.txtAdminShipTo; text3 = (literal9.Text = (textBox8.Text = defaultOrFirstGetGoodShipper.ShipperName)); Literal literal10 = this.litAdminCellPhone; TextBox textBox9 = this.txtAdminCellPhone; text3 = (literal10.Text = (textBox9.Text = defaultOrFirstGetGoodShipper.CellPhone)); } } this.litRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2") + "元"; this.txtAdminRemark.Text = returnInfo.AdminRemark; if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund) { this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 3); } else { this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 0); } this.litRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2") + "元"; Literal literal11 = this.txtAfterSaleId; num = returnInfo.ReturnId; literal11.Text = num.ToString(); this.txtPayMoney.Text = orderInfo.GetTotal(false).F2ToString("f2"); this.txtRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2"); HiddenField hiddenField2 = this.hidAfterSaleType; num = (int)returnInfo.AfterSaleType; hiddenField2.Value = num.ToString(); this.hidRefundMaxAmount.Value = orderInfo.GetCanRefundAmount(returnInfo.SkuId, null, 0).F2ToString("f2"); if (returnInfo.AfterSaleType == AfterSaleTypes.ReturnAndRefund && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned)) { this.btnViewLogistic.Visible = true; AttributeCollection attributes = this.btnViewLogistic.Attributes; num = returnInfo.ReturnId; attributes.Add("returnsid", num.ToString()); AttributeCollection attributes2 = this.btnViewLogistic.Attributes; num = returnInfo.ReturnId; attributes2.Add("returnsid", num.ToString()); this.btnViewLogistic.Attributes.Add("expresscompanyname", returnInfo.ExpressCompanyName.ToString()); this.btnViewLogistic.Attributes.Add("shipordernumber", returnInfo.ShipOrderNumber.ToString()); } if (orderInfo.SupplierId > 0) { this.btnGetGoods.Visible = false; } } } }
private void BindOrderInfo() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (this.order.BalanceAmount > decimal.Zero) { this.litBalanceAmount.Text = this.order.BalanceAmount.F2ToString("f2"); } else { this.liBalanceAmount.Visible = false; } DateTime?nullable; DateTime dateTime; if (this.order.PreSaleId > 0) { this.litDeposit.Text = this.order.Deposit.F2ToString("f2"); this.litFinal.Text = this.order.FinalPayment.F2ToString("f2"); nullable = this.order.DepositDate; if (nullable.HasValue) { Literal literal = this.litDepositDate; nullable = this.order.DepositDate; literal.Text = nullable.ToString(); } DateTime payDate = this.order.PayDate; if (this.order.PayDate != DateTime.MinValue) { Literal literal2 = this.litFinalDate; dateTime = this.order.PayDate; literal2.Text = dateTime.ToString(); } } if (this.order.OrderStatus == OrderStatus.SellerAlreadySent && this.order.ItemStatus == OrderItemStatus.Nomarl) { this.ensureRecieved.Visible = true; } else { this.ensureRecieved.Visible = false; } if (this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished) { this.divOrderBtn.Visible = false; } if (string.IsNullOrEmpty(this.order.TakeCode) || string.IsNullOrEmpty(masterSettings.HiPOSAppId) || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.Closed) { this.lookupQRCode.Visible = false; } ProductPreSaleInfo productPreSaleInfo = null; int paymentTypeId; if (this.order.OrderStatus == OrderStatus.WaitBuyerPay && this.order.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1) && this.order.PaymentTypeId != -3) { if (this.order.PreSaleId > 0) { productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId); nullable = this.order.DepositDate; if (!nullable.HasValue) { if (productPreSaleInfo.PreSaleEndDate > DateTime.Now) { this.btnToPay.Visible = true; AttributeCollection attributes = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", (this.order.Deposit - this.order.BalanceAmount).F2ToString("f2")); } } else if (!(productPreSaleInfo.PaymentStartDate > DateTime.Now) && !(productPreSaleInfo.PaymentEndDate < DateTime.Now)) { this.btnToPay.Visible = true; AttributeCollection attributes2 = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes2.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", this.order.FinalPayment.F2ToString("f2")); } } else { AttributeCollection attributes3 = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes3.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Visible = true; this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", this.order.GetTotal(true).F2ToString("f2")); if (HiContext.Current.SiteSettings.OpenMultStore && this.order.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime) { StoresInfo storeById = StoresHelper.GetStoreById(this.order.StoreId); dateTime = DateTime.Now; string str = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenStartDate; nullable = (str + " " + dateTime.ToString("HH:mm")).ToDateTime(); DateTime value = nullable.Value; dateTime = DateTime.Now; string str2 = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenEndDate; nullable = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime(); DateTime dateTime2 = nullable.Value; if (dateTime2 <= value) { dateTime2 = dateTime2.AddDays(1.0); } if (DateTime.Now < value || DateTime.Now > dateTime2) { this.btnToPay.Attributes.Add("NeedNotInTimeTip", "1"); } } } if (this.order.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.OfflinePay, 1)) { this.btnToPay.InnerText = "线下支付帮助"; this.btnToPay.HRef = "FinishOrder.aspx?OrderId=" + this.order.OrderId + "&onlyHelp=true"; } } if (this.order.ReducedPromotionAmount <= decimal.Zero) { this.liFullReduction.Visible = false; } LineItemInfo value2 = this.order.LineItems.FirstOrDefault().Value; string text = "长期有效"; int num; if (!value2.IsValid) { nullable = value2.ValidStartDate; if (nullable.HasValue) { nullable = value2.ValidEndDate; num = (nullable.HasValue ? 1 : 0); goto IL_06a5; } } num = 0; goto IL_06a5; IL_06a5: if (num != 0) { nullable = value2.ValidStartDate; dateTime = nullable.Value; string arg = dateTime.ToString("yyyy-MM-dd"); nullable = value2.ValidEndDate; dateTime = nullable.Value; text = string.Format("有效期 {0} ~ {1}", arg, dateTime.ToString("yyyy-MM-dd")); } this.lit_ValidDate.Text = text; IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(this.order.OrderId); ServiceOrderStatus serviceOrderStatus = this.GetOrderStatus(this.order, orderVerificationItems); this.litOrderStatus.Text = ((Enum)(object)serviceOrderStatus).ToDescription(); this.CreateVerificationCodeQRCode(orderVerificationItems); this.rptVerCode.DataSource = orderVerificationItems; this.rptVerCode.ItemDataBound += this.rptVerCode_ItemDataBound; this.rptVerCode.DataBind(); this.litOrderId.Text = this.orderId; Literal literal3 = this.litOrderDate; dateTime = this.order.OrderDate; literal3.Text = dateTime.ToString(); this.litTotalPrice.SetWhenIsNotNull(this.order.GetAmount(false).F2ToString("f2")); Literal control = this.litPayTime; object value3; if (!(this.order.PayDate != DateTime.MinValue)) { value3 = ""; } else { dateTime = this.order.PayDate; value3 = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); } control.SetWhenIsNotNull((string)value3); HtmlInputHidden control2 = this.orderStatus; paymentTypeId = (int)this.order.OrderStatus; control2.SetWhenIsNotNull(paymentTypeId.ToString()); this.hidOrderId.SetWhenIsNotNull(this.orderId.ToString()); this.litPaymentMode.SetWhenIsNotNull(this.order.PaymentType); this.litShipToDate.SetWhenIsNotNull(this.order.ShipToDate); if (this.order.PreSaleId > 0) { this.litBuildPrice.SetWhenIsNotNull((this.order.Deposit + this.order.FinalPayment).F2ToString("f2")); } else { this.litBuildPrice.SetWhenIsNotNull(this.order.GetPayTotal().F2ToString("f2")); } this.litRemark.SetWhenIsNotNull(this.order.Remark); this.litTakeCode.SetWhenIsNotNull((this.order.ShippingModeId == -2) ? this.order.TakeCode : ""); this.litFreight.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2")); this.litFreight2.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2")); this.litFullCapacityReduction.SetWhenIsNotNull("-" + this.order.ReducedPromotionAmount.F2ToString("f2")); if (this.order.PreSaleId > 0) { if (productPreSaleInfo == null) { productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId); } nullable = this.order.DepositDate; if (!nullable.HasValue) { this.hidpresaleStaut.Value = "1"; if (this.order.OrderStatus == OrderStatus.Closed) { this.hidpresaleStaut.Value = "6"; } } else if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { this.hidpresaleStaut.Value = "2"; } else if (productPreSaleInfo.PaymentEndDate < DateTime.Now) { if (this.order.PayDate == DateTime.MinValue) { this.hidpresaleStaut.Value = "5"; } else { this.hidpresaleStaut.Value = "4"; } } else if (this.order.PayDate == DateTime.MinValue) { this.hidpresaleStaut.Value = "3"; } else { this.hidpresaleStaut.Value = "4"; } } }
private void AddWXStore() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); IList <string> list = new List <string>(); CreateStoreData createStoreData = new CreateStoreData(); string text = this.hidUploadImages.Value.Trim(); string[] array = text.Split(','); for (int i = 0; i < array.Length; i++) { if (!string.IsNullOrEmpty(array[i])) { string item = Globals.SaveFile("depot", array[i], "/Storage/master/", true, false, ""); list.Add(item); } } IEnumerable <string> enumerable = WXStoreHelper.ImageUploadForStore(list); foreach (string item2 in enumerable) { createStoreData.business.base_info.photo_list.Add(new Store_Photo { photo_url = item2 }); } string address = this.txtWxAddress.Text.Trim(); List <string> list2 = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3) .ToList(); list2.ForEach(delegate(string c) { address = address.Replace(c, string.Empty); }); createStoreData.business.base_info.address = address; createStoreData.business.base_info.avg_price = this.txtWXAvgPrice.Text.ToInt(0); createStoreData.business.base_info.branch_name = storeById.StoreName; createStoreData.business.base_info.business_name = masterSettings.SiteName; createStoreData.business.base_info.categories = new string[1] { $"{this.ddlCategoryParent.SelectedValue.Trim()},{this.ddlCategoryChild.SelectedValue.Trim()}" }; createStoreData.business.base_info.city = list2[1]; createStoreData.business.base_info.district = this.hfDistrict.Value; createStoreData.business.base_info.introduction = this.txtWXIntroduction.Text.Trim(); createStoreData.business.base_info.latitude = this.hfLatitude.Value; createStoreData.business.base_info.longitude = this.hfLongitude.Value; createStoreData.business.base_info.offset_type = 1; createStoreData.business.base_info.open_time = this.txtWXOpenTime.Text.Trim(); createStoreData.business.base_info.province = list2[0]; createStoreData.business.base_info.recommend = this.txtWXRecommend.Text.Trim(); createStoreData.business.base_info.special = this.txtWXSpecial.Text.Trim(); createStoreData.business.base_info.telephone = this.txtWXTelephone.Text.Trim(); storeById.StoreImages = ((list.Count == 0) ? string.Empty : string.Join(",", list.ToArray())); createStoreData.business.base_info.sid = this.storeId.ToString(); WxJsonResult wxJsonResult = WXStoreHelper.CreateWXStore(createStoreData); if (wxJsonResult.errcode.Equals(ReturnCode.请求成功)) { StoresHelper.FirstAddWXStore(createStoreData, this.storeId, storeById.StoreImages); } this.ShowMsg("添加成功,等待微信审核", true, "StoresList.aspx"); }
protected override void AttachChildControls() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId)) { this.ShowWapMessage("错误的商品ID", "Default.aspx"); } if (base.ClientType.Equals(ClientType.VShop)) { FightGroupActivitiyModel fightGroupActivitiyModel = VShopHelper.GetFightGroupActivities(new FightGroupActivitiyQuery { PageIndex = 1, PageSize = 1, ProductId = this.productId, Status = EnumFightGroupActivitiyStatus.BeingCarried }).Models.FirstOrDefault(); if (fightGroupActivitiyModel != null) { this.Page.Response.Redirect("FightGroupActivityDetails.aspx?fightGroupActivityId=" + fightGroupActivitiyModel.FightGroupActivityId); } } this.hidStoreId = (HtmlInputHidden)this.FindControl("hidStoreId"); this.hidSupplier = (HtmlInputHidden)this.FindControl("hidSupplier"); this.litSupplierName = (Literal)this.FindControl("litSupplierName"); this.aCountDownUrl = (HyperLink)this.FindControl("aCountDownUrl"); this.aCountDownUrl.Visible = false; this.divCountDownUrl = (HtmlGenericControl)this.FindControl("divCountDownUrl"); this.hidCanTakeOnStore = (HtmlInputHidden)this.FindControl("hidCanTakeOnStore"); this.HasActivitiesToJumpUrl(); this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations"); this.rptProductImages = (WapTemplatedRepeater)this.FindControl("rptProductImages"); this.rptCouponList = (WapTemplatedRepeater)this.FindControl("rptCouponList"); this.rp_guest = (WapTemplatedRepeater)this.FindControl("rp_guest"); this.rp_com = (WapTemplatedRepeater)this.FindControl("rp_com"); this.litProdcutName = (Literal)this.FindControl("litProdcutName"); this.litSalePrice = (Literal)this.FindControl("litSalePrice"); this.litMarketPrice = (Literal)this.FindControl("litMarketPrice"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.litDescription = (Literal)this.FindControl("litDescription"); this.ltlcombinamaininfo = (Literal)this.FindControl("ltlcombinamaininfo"); this.skuSubmitOrder = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder"); this.skuStoreSubmitOrder = (Common_SKUSubmitStoreOrder)this.FindControl("skuStoreSubmitOrder"); this.expandAttr = (Common_ExpandAttributes)this.FindControl("ExpandAttributes"); this.litSoldCount = (Literal)this.FindControl("litSoldCount"); this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount"); this.litReviewsCount = (Literal)this.FindControl("litReviewsCount"); this.litHasCollected = (HtmlInputHidden)this.FindControl("litHasCollected"); this.hidden_skus = (HtmlInputHidden)this.FindControl("hidden_skus"); this.ltlOrderPromotion = (Literal)this.FindControl("ltlOrderPromotion"); this.ltlOrderPromotion2 = (Literal)this.FindControl("ltlOrderPromotion2"); this.ltlProductSendGifts2 = (Literal)this.FindControl("ltlProductSendGifts2"); this.ltlProductSendGifts = (Literal)this.FindControl("ltlProductSendGifts"); this.liOrderPromotions = (HtmlGenericControl)this.FindControl("liOrderPromotions"); this.liOrderPromotions2 = (HtmlGenericControl)this.FindControl("liOrderPromotions2"); this.liProductSendGifts2 = (HtmlGenericControl)this.FindControl("liProductSendGifts2"); this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2"); this.liOrderPromotions_free = (HtmlGenericControl)this.FindControl("liOrderPromotions_free"); this.divActivities = (HtmlGenericControl)this.FindControl("divActivities"); this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2"); this.ltlOrderPromotion_free = (Literal)this.FindControl("ltlOrderPromotion_free"); this.liProductSendGifts = (HtmlGenericControl)this.FindControl("liProductSendGifts"); this.lbUserProductRefer = (UserProductReferLabel)this.FindControl("lbUserProductRefer"); this.divshiptoregion = (HtmlGenericControl)this.FindControl("divshiptoregion"); this.divwaplocateaddress = (HtmlGenericControl)this.FindControl("divwaplocateaddress"); this.promote = (ProductPromote)this.FindControl("ProductPromote"); this.hdAppId = (HtmlInputHidden)this.FindControl("hdAppId"); this.hdTitle = (HtmlInputHidden)this.FindControl("hdTitle"); this.hdDesc = (HtmlInputHidden)this.FindControl("hdDesc"); this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl"); this.hdLink = (HtmlInputHidden)this.FindControl("hdLink"); this.hidCombinaid = (HtmlInputHidden)this.FindControl("hidCombinaid"); this.divConsultationEmpty = (HtmlGenericControl)this.FindControl("divConsultationEmpty"); this.ulConsultations = (HtmlGenericControl)this.FindControl("ulConsultations"); this.divShortDescription = (HtmlGenericControl)this.FindControl("divShortDescription"); this.hidRegionId = (HtmlInputHidden)this.FindControl("hidRegionId"); this.divProductReferral = (HtmlGenericControl)this.FindControl("divProductReferral"); this.hidden_productId = (HtmlInputHidden)this.FindControl("hidden_productId"); this.hidCouponCount = (HtmlInputHidden)this.FindControl("hidCouponCount"); this.hidHasStores = (HtmlInputHidden)this.FindControl("hidHasStores"); this.divPodrequest = (HtmlGenericControl)this.FindControl("divPodrequest"); this.divGuest = (HtmlGenericControl)this.FindControl("divGuest"); this.divcombina = (HtmlGenericControl)this.FindControl("divcombina"); this.hidUnOnSale = (HtmlInputHidden)this.FindControl("hidUnOnSale"); this.hidUnAudit = (HtmlInputHidden)this.FindControl("hidUnAudit"); this.divPhonePrice = (HtmlGenericControl)this.FindControl("divPhonePrice"); this.litPhonePrice = (Literal)this.FindControl("litPhonePrice"); this.spdiscount = (HtmlGenericControl)this.FindControl("spdiscount"); this.ulsupplier = (HtmlGenericControl)this.FindControl("ulsupplier"); this.divGouMai = (HtmlGenericControl)this.FindControl("divGouMai"); this.ltlBottomStatus = (Literal)this.FindControl("ltlBottomStatus"); this.hdAppId.Value = masterSettings.WeixinAppId; this.hidStoreId.Value = this.storeId.ToString(); HtmlInputHidden htmlInputHidden = this.hidRegionId; int num = HiContext.Current.DeliveryScopRegionId; htmlInputHidden.Value = num.ToString(); this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem"); this.hidCartQuantity = (HtmlInputHidden)this.FindControl("txCartQuantity"); this.lblStock = (StockLabel)this.FindControl("lblStock"); this.litUnit = (Literal)this.FindControl("litUnit"); this.lit_IsRefund = (Literal)this.FindControl("lit_IsRefund"); this.lit_IsOverRefund = (Literal)this.FindControl("lit_IsOverRefund"); this.lit_RefundTime = (Literal)this.FindControl("lit_RefundTime"); ProductBrowseInfo wAPProductBrowseInfo = ProductBrowser.GetWAPProductBrowseInfo(this.productId, null, masterSettings.OpenMultStore, 0); StoreProductQuery storeProductQuery = new StoreProductQuery { ProductId = this.productId, StoreId = this.storeId }; string cookie = WebHelper.GetCookie("UserCoordinateCookie", "NewCoordinate"); if (!string.IsNullOrEmpty(cookie)) { string[] array = cookie.Split(','); storeProductQuery.Position = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0)); storeProductQuery.Position.CityId = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0); storeProductQuery.Position.AreaId = WebHelper.GetCookie("UserCoordinateCookie", "RegionId").ToInt(0); } else { storeProductQuery.Position = new PositionInfo(0.0, 0.0); storeProductQuery.Position.CityId = 0; storeProductQuery.Position.AreaId = 0; } this.hidStoreId.Value = this.storeId.ToString(); if (this.storeId > 0) { ProductModel storeProduct = ProductBrowser.GetStoreProduct(storeProductQuery); if (storeProduct == null || storeProduct.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect("ProductDelete.aspx"); return; } if (storeProduct.SaleStatus == ProductSaleStatus.OnStock) { base.GotoResourceNotFound("商品已经入库"); } if (wAPProductBrowseInfo.Product.ProductType != 1.GetHashCode()) { HttpContext.Current.Response.Redirect("ProductDetail?productId=" + this.productId); } if (storeProduct.SaleStatus == ProductSaleStatus.UnSale) { this.hidUnOnSale.Value = "1"; } this.litSalePrice.Text = ((storeProduct.MinSalePrice == storeProduct.MaxSalePrice) ? storeProduct.MinSalePrice.F2ToString("f2") : (storeProduct.MinSalePrice.F2ToString("f2") + "~" + storeProduct.MaxSalePrice.F2ToString("f2"))); this.skuStoreSubmitOrder.IsServiceProduct = true; this.skuStoreSubmitOrder.ProductInfo = storeProduct; this.skuSubmitOrder.Visible = false; } else { if (wAPProductBrowseInfo.Product == null || wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect("ProductDelete.aspx"); return; } if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { base.GotoResourceNotFound("商品已经入库"); } if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale) { this.hidUnOnSale.Value = "1"; } this.litSalePrice.Text = ((wAPProductBrowseInfo.Product.MinSalePrice == wAPProductBrowseInfo.Product.MaxSalePrice) ? wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") : (wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~" + wAPProductBrowseInfo.Product.MaxSalePrice.F2ToString("f2"))); this.skuSubmitOrder.ProductInfo = wAPProductBrowseInfo.Product; this.skuStoreSubmitOrder.Visible = false; } if (masterSettings.OpenMultStore) { if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId)) { this.hidHasStores.Value = "1"; this.hidCanTakeOnStore.Value = "1"; } } else if (masterSettings.IsOpenPickeupInStore && wAPProductBrowseInfo.Product.SupplierId == 0) { this.hidCanTakeOnStore.Value = "1"; } if (SalesHelper.IsSupportPodrequest() && wAPProductBrowseInfo.Product.SupplierId == 0) { this.divPodrequest.Visible = true; } HtmlInputHidden htmlInputHidden2 = this.hidUnAudit; num = (int)wAPProductBrowseInfo.Product.AuditStatus; htmlInputHidden2.Value = num.ToString(); if (this.spdiscount != null && HiContext.Current.User.UserId > 0) { MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId); this.spdiscount.Visible = true; this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>"; } this.lbUserProductRefer.product = wAPProductBrowseInfo.Product; this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.Title) ? wAPProductBrowseInfo.Product.ProductName : wAPProductBrowseInfo.Product.Title); this.hdDesc.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : wAPProductBrowseInfo.Product.ShortDescription); string oldValue = "/storage/master/product/images/"; string newValue = "/storage/master/product/thumbs410/410_"; if (!string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1)) { wAPProductBrowseInfo.Product.ImageUrl1 = wAPProductBrowseInfo.Product.ImageUrl1.ToLower().Replace(oldValue, newValue); } string local = string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) ? SettingsManager.GetMasterSettings().DefaultProductImage : wAPProductBrowseInfo.Product.ImageUrl1; this.hdImgUrl.Value = Globals.FullPath(local); this.hdLink.Value = Globals.FullPath(HttpContext.Current.Request.Url.ToString()); if (this.hidCartQuantity != null) { this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId); } if (this.hidden_productId != null) { this.hidden_productId.Value = this.productId.ToString(); } if (this.promote != null) { this.promote.ProductId = this.productId; } MemberInfo user = HiContext.Current.User; if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || wAPProductBrowseInfo.Product.SubMemberDeduct.HasValue)) { if (!wAPProductBrowseInfo.Product.SubMemberDeduct.HasValue) { goto IL_0ed1; } decimal?subMemberDeduct = wAPProductBrowseInfo.Product.SubMemberDeduct; if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue) { goto IL_0ed1; } } goto IL_0f0b; IL_0ed1: int num2; if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null) { num2 = (user.Referral.IsRepeled ? 1 : 0); goto IL_0f0c; } goto IL_0f0b; IL_0f0b: num2 = 1; goto IL_0f0c; IL_0f0c: if (num2 != 0) { this.divProductReferral.Visible = false; } bool flag = true; if (this.rptProductImages != null) { string locationUrl = "javascript:;"; if (string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl5)) { wAPProductBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage; } DataTable skus = ProductBrowser.GetSkus(this.productId); List <SlideImage> list = new List <SlideImage>(); int supplierId = wAPProductBrowseInfo.Product.SupplierId; if (supplierId > 0) { SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId); if (supplierById != null) { this.hidSupplier.Value = "true"; this.litSupplierName.Text = supplierById.SupplierName; } } else { this.hidSupplier.Value = "false"; flag = false; this.ulsupplier.Style.Add(HtmlTextWriterStyle.Display, "none"); } list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl1, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl2, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl3, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl4, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl5, locationUrl)); this.rptProductImages.DataSource = from item in list where !string.IsNullOrWhiteSpace(item.ImageUrl) select item; this.rptProductImages.DataBind(); } this.litProdcutName.Text = wAPProductBrowseInfo.Product.ProductName; if (wAPProductBrowseInfo.Product.MarketPrice.HasValue) { this.litMarketPrice.SetWhenIsNotNull(wAPProductBrowseInfo.Product.MarketPrice.GetValueOrDefault(decimal.Zero).F2ToString("f2")); } this.litShortDescription.Text = wAPProductBrowseInfo.Product.ShortDescription; this.divShortDescription.Visible = !string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription); if (wAPProductBrowseInfo.Product.IsRefund) { this.lit_IsRefund.Text = "<img src=\"/templates/common/images/service_gou.png\" /><span class=\"c-green\">随时退</span>"; this.lit_IsOverRefund.Text = (wAPProductBrowseInfo.Product.IsOverRefund ? "" : "<img src=\"/templates/common/images/service_cha.png\" /><span class=\"c-orange\">过期不退</span>"); } else { this.lit_IsRefund.Text = "<img src=\"/templates/common/images/service_cha.png\" /><span class=\"c-orange\">不可退</span>"; } if (!wAPProductBrowseInfo.Product.IsValid) { if (wAPProductBrowseInfo.Product.ValidStartDate.HasValue && wAPProductBrowseInfo.Product.ValidEndDate.HasValue) { Literal literal = this.lit_RefundTime; DateTime value = wAPProductBrowseInfo.Product.ValidStartDate.Value; string arg = value.ToString("yyyy/MM/dd"); value = wAPProductBrowseInfo.Product.ValidEndDate.Value; literal.Text = string.Format("{0}-{1}", arg, value.ToString("yyyy/MM/dd")); } } else { this.lit_RefundTime.Text = "长期有效"; } if (this.litDescription != null) { string text = ""; Regex regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase); if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.MobbileDescription)) { text = regex.Replace(wAPProductBrowseInfo.Product.MobbileDescription, ""); } else if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.Description)) { text = regex.Replace(wAPProductBrowseInfo.Product.Description, ""); } text = text.Replace("src", "data-url"); text = text.Replace("vurl", "src"); this.litDescription.Text = text; } Literal control = this.litSoldCount; num = wAPProductBrowseInfo.Product.ShowSaleCounts; control.SetWhenIsNotNull(num.ToString()); if (this.expandAttr != null) { this.expandAttr.ProductId = this.productId; } Literal control2 = this.litConsultationsCount; num = wAPProductBrowseInfo.ConsultationCount; control2.SetWhenIsNotNull(num.ToString()); Literal control3 = this.litReviewsCount; num = wAPProductBrowseInfo.ReviewCount; control3.SetWhenIsNotNull(num.ToString()); MemberInfo user2 = HiContext.Current.User; bool flag2 = false; if (user2 != null) { flag2 = ProductBrowser.CheckHasCollect(user2.UserId, this.productId); } this.litHasCollected.SetWhenIsNotNull(flag2 ? "1" : "0"); this.BindCouponList(); PageTitle.AddSiteNameTitle(wAPProductBrowseInfo.Product.ProductName); this.BindCombinaBuyInfo(); this.BindPromotionInfo(); DataTable dBConsultations = wAPProductBrowseInfo.DBConsultations; for (int i = 0; i < dBConsultations.Rows.Count; i++) { dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString()); } this.rptProductConsultations.DataSource = dBConsultations; this.rptProductConsultations.DataBind(); this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty(); this.ulConsultations.Visible = !dBConsultations.IsNullOrEmpty(); string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.productId); if (!string.IsNullOrEmpty(phonePriceByProductId)) { this.divPhonePrice.Visible = true; decimal num3 = phonePriceByProductId.Split(',')[0].ToDecimal(0); this.litPhonePrice.Text = num3.F2ToString("f2"); decimal num4 = wAPProductBrowseInfo.Product.MinSalePrice - num3; this.litSalePrice.Text = ((num4 > decimal.Zero) ? num4 : decimal.Zero).F2ToString("f2"); this.lbUserProductRefer.MobileExclusive = num3; } if (flag || this.liOrderPromotions.Visible || this.liOrderPromotions_free2.Visible || this.liProductSendGifts.Visible || this.rptCouponList.Visible) { this.divActivities.Visible = true; } else { this.divActivities.Visible = false; } StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); if (storeById != null) { this.ProcessException(storeById); } }
protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("3-4-1")) { steps = HTTPRequest.GetInt("steps", 1); format = HTTPRequest.GetString("format"); act = HTTPRequest.GetString("act"); if (ispost) { string PathStr = Utils.GetMapPath(config.DataPath.ToString()); string fileExtension = ""; string fileName = ""; string thispath = DateTime.Now.Year + "-" + DateTime.Now.Month; ArrayList filearr = new ArrayList(); int importdata_count = 0; string tSName = ""; int sDateTime_S = Utils.StrToInt(HTTPRequest.GetString("sDateTime_S"), 0); sDateTime = Utils.IsDateString(Utils.ChkSQL(HTTPRequest.GetString("sDateTime"))) ? DateTime.Parse(Utils.ChkSQL(HTTPRequest.GetString("sDateTime"))) : DateTime.Now; if (!Directory.Exists(PathStr + thispath)) { Directory.CreateDirectory(PathStr + thispath); } if (steps == 1) { try { //文件上传 HttpFileCollection files = HttpContext.Current.Request.Files; try { if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { HttpPostedFile postedFile = files[i]; fileName = System.IO.Path.GetFileName(postedFile.FileName); if (Utils.ChkSQL(fileName) != "") { fileExtension = System.IO.Path.GetExtension(fileName).ToLower(); if (fileExtension == ".xls") { postedFile.SaveAs(PathStr + thispath + "/" + fileName); filearr.Add(PathStr + thispath + "/" + fileName); } } } } if (filearr.Count > 0) { for (int j = 0; j < filearr.Count; j++) { DataSet ds = Excels.ExcelToDataTable(filearr[j].ToString()); try { dList = ds.Tables[0]; dList.Rows[0].Delete(); dList.AcceptChanges(); steps = 2; break; } finally { ds = null; } } } } finally { files = null; filearr.Clear(); } } catch (Exception ex) { AddErrLine("<b>文件格式错误,请将 Xls 文件用 Excel 另存后再导入!</b>:<br>" + ex); AddScript("window.setTimeout('history.back(1);',5000);"); } } if (format == "Json") { if (steps == 2) { if (act == "add") { string sStoresID = Utils.ChkSQL(HTTPRequest.GetString("sStoresID")).Trim(); string sStoresName = Utils.ChkSQL(HTTPRequest.GetString("sStoresName")).Trim(); string pBarcode = Utils.ChkSQL(HTTPRequest.GetString("pBarcode")).Trim(); string sProductsName = Utils.ChkSQL(HTTPRequest.GetString("sProductsName")).Trim(); string sNum = Utils.ChkSQL(HTTPRequest.GetString("sNum")).Trim(); string sPrice = Utils.ChkSQL(HTTPRequest.GetString("sPrice")).Trim(); string tID = Utils.ChkSQL(HTTPRequest.GetString("tID")).Trim(); tJson = ",\"tID\":\"" + tID + "\""; SalesInfo si = new SalesInfo(); StoresInfo so = new StoresInfo(); ProductsInfo pi = new ProductsInfo(); try { si.sDateTime = sDateTime; si.sAppendTime = DateTime.Now; sStoresName = Utils.ReplaceString(Utils.ReplaceString(sStoresName.ToString().Trim(), "(", "(", false), ")", ")", false); so = tbStoresInfo.GetStoresInfoModelByName(sStoresName); if (so == null) { so = tbStoresInfo.GetStoresInfoModelByCode(sStoresID.ToString().Trim()); } pi = tbProductsInfo.GetProductsInfoModelByName(sProductsName.ToString().Trim()); if (pi == null) { pi = tbProductsInfo.GetProductsInfoModelByBarcode(pBarcode.ToString().Trim()); } if (so != null) { si.StoresID = so.StoresID; si.StoresName = so.sName; } else { si.StoresID = 0; si.StoresName = sStoresName; } if (pi != null) { si.ProductsID = pi.ProductsID; si.ProductsName = pi.pName; } else { si.ProductsID = 0; si.ProductsName = sProductsName; } si.sStoresID = sStoresID; si.sNum = int.Parse(Utils.StrToFloat(sNum, 0).ToString()); if (sPrice.ToString().IndexOf(",") > -1) { si.sPrice = decimal.Parse(sPrice.ToString().Replace(",", "")); } else { si.sPrice = decimal.Parse(sPrice.ToString()); } si.sIsYH = 1; int sID = tbSalesInfo.AddSalesInfo(si); if (sID > 0) { tJson += ",\"sID\":\"" + sID + "\""; AddMsgLine("添加成功!"); } else { AddErrLine("添加失败!"); } } finally { si = null; so = null; pi = null; } } if (act == "del") { try { string sIdStr = HTTPRequest.GetString("sIDStr"); sIdStr = Utils.ReSQLSetTxt(sIdStr); if (sIdStr.Trim() != "") { tbSalesInfo.DeleteSalesInfo(sIdStr, sDateTime); } AddMsgLine("撤销成功!"); } catch (Exception ex) { AddErrLine("撤销失败!"); } } Response.ClearContent(); Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1); Response.Expires = 0; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.ContentType = "application/json"; string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"" + tJson + "}}"; Response.Write(Json_Str); Response.End(); } } } } else { AddErrLine("权限不足!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
private void UpdateStores() { StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin); if (storeById == null) { base.Response.Redirect("StoresList.aspx"); } double num = 0.0; int num2 = 0; int num3 = 0; decimal num4 = default(decimal); string text = ""; string text2 = ""; string Address = ""; string text3 = Globals.StripAllTags(this.txtStoresName.Text.Trim()); Address = Globals.StripAllTags(this.txtAddress.Text); string text4 = Globals.StripAllTags(this.txtRegionScop.Value.Trim()); string text5 = Globals.StripAllTags(this.txtRegionScopName.Value.Trim()); text = this.txtTel.Text; text2 = this.txtContactMan.Text; string[] array = text4.Split(','); string[] array2 = text5.Split(','); IDictionary <int, DeliveryScopeInfo> dictionary = new Dictionary <int, DeliveryScopeInfo>(); for (int i = 0; i < array.Length; i++) { int num5 = 0; if (int.TryParse(array[i], out num5) && array2.Length >= i && dictionary != null && !dictionary.ContainsKey(num5)) { DeliveryScopeInfo deliveryScopeInfo = new DeliveryScopeInfo(); deliveryScopeInfo.RegionId = num5; deliveryScopeInfo.RegionName = array2[i]; deliveryScopeInfo.FullRegionPath = RegionHelper.GetFullPath(num5, true); dictionary.Add(num5, deliveryScopeInfo); } } if (storeById.StoreName != text3 && StoresHelper.ExistStoreName(text3)) { this.ResetForm(storeById.StoreId); this.ShowMsg("门店名称已经存在,请重新输入!", false); } else if (string.Compare(this.txtUserPwd.Text, this.txtUserRePwd.Text) != 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请确保两次输入的密码相同", false); } else if (!this.dropRegion.GetSelectedRegionId().HasValue) { this.ResetForm(storeById.StoreId); this.ShowMsg("请选择店铺所在区域!", false); } else if (text2.Length > 8 || text2.Length < 2) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false); } else if (string.IsNullOrEmpty(this.hfLatitude.Value) || string.IsNullOrEmpty(this.hfLongitude.Value)) { this.ResetForm(storeById.StoreId); this.ShowMsg("请给门店标注定位!", false); } else if (text == "" || !DataHelper.IsTel(text)) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false); } else { if (!string.IsNullOrEmpty(this.txtUserPwd.Text)) { if (this.txtUserPwd.Text.Length < 6 || this.txtUserPwd.Text.Length > 20) { this.ResetForm(storeById.StoreId); this.ShowMsg("密码长度必须在6到20个字符之间!", false); return; } managerInfo.Password = Users.EncodePassword(this.txtUserPwd.Text, managerInfo.PasswordSalt); } if (!this.chkIsSupportExpress.Checked && !this.chkIsAboveSelf.Checked && !this.chkIsStoreDelive.Checked) { this.ResetForm(storeById.StoreId); this.ShowMsg("请选择一种配送方式!", false); } else { if (this.chkIsStoreDelive.Checked) { if (!double.TryParse(this.txtServeRadius.Text.Trim(), out num) || num > 10000.0 || num <= 0.0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的配送半径,为大于0至10000之间的数字!", false); return; } if (!int.TryParse(this.txtStoreFreight.Text.Trim(), out num2) || num2 > 99999999 || num2 < 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的配送费", false); return; } if (!int.TryParse(this.txtMinOrderPrice.Text.Trim(), out num3) || num3 > 99999999 || num3 < 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的起送价", false); return; } } if (!decimal.TryParse(this.txtCommissionRate.Text.Trim(), out num4) || num4 > 100m || num4 < decimal.Zero) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的平台抽佣比例", false); } else if (!this.chkOfflinePay.Checked && !this.chkOnlinePay.Checked && !this.chkCashOnDelivery.Checked) { this.ResetForm(storeById.StoreId); this.ShowMsg("支付方式请至少选择一种", false); } else { storeById.IsOfflinePay = this.chkOfflinePay.Checked; storeById.IsOnlinePay = this.chkOnlinePay.Checked; storeById.IsCashOnDelivery = this.chkCashOnDelivery.Checked; if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartH.Text) || this.txtStoreOpenTimeStartH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartH.Text.ToInt(0) >= 24) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业起始小时", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartM.Text) || this.txtStoreOpenTimeStartM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartM.Text.ToInt(0) >= 60) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业起始分钟", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndH.Text) || this.txtStoreOpenTimeEndH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndH.Text.ToInt(0) >= 24) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业结束小时", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndM.Text) || this.txtStoreOpenTimeEndM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndM.Text.ToInt(0) >= 60) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业结束分钟", false); } else { string empty = string.Empty; DateTime dateTime = DateTime.Now; string text6 = dateTime.ToString("yyyy-MM-dd"); DateTime?nullable = (text6 + " " + this.txtStoreOpenTimeStartH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeStartM.Text.ToInt(0)).ToDateTime(); DateTime?nullable2 = (text6 + " " + this.txtStoreOpenTimeEndH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeEndM.Text.ToInt(0)).ToDateTime(); dateTime = nullable.Value; string str = dateTime.ToString("HH:mm"); dateTime = nullable2.Value; string text7 = dateTime.ToString("HH:mm"); if (text7 == "00:00") { nullable2 = (text6 + " 23:59").ToDateTime(); text7 = "23:59"; } empty = (storeById.StoreOpenTime = str + "-" + text7); storeById.OpenStartDate = nullable.Value; storeById.OpenEndDate = nullable2.Value; storeById.IsSupportExpress = (this.chkIsSupportExpress.Checked && true); storeById.IsAboveSelf = (this.chkIsAboveSelf.Checked && true); storeById.IsStoreDelive = (this.chkIsStoreDelive.Checked && true); storeById.Introduce = this.editDescription.Text; if (this.chkIsStoreDelive.Checked) { storeById.ServeRadius = num; storeById.MinOrderPrice = num3; storeById.StoreFreight = num2; } else { storeById.ServeRadius = 0.0; storeById.MinOrderPrice = null; storeById.StoreFreight = null; } storeById.CommissionRate = num4; List <string> list = RegionHelper.GetFullRegion(this.dropRegion.GetSelectedRegionId().Value, ",", true, 0).Split(',').Take(3) .ToList(); list.ForEach(delegate(string c) { Address = Address.Replace(c, string.Empty); }); IList <string> list2 = new List <string>(); string text9 = this.hidUploadImages.Value.Trim(); string[] array3 = text9.Split(','); for (int j = 0; j < array3.Length; j++) { if (!string.IsNullOrEmpty(array3[j])) { string text10 = Globals.SaveFile("depot", array3[j], "/Storage/master/", true, false, ""); string text11 = base.Request.MapPath(text10); string virtualPath = HiContext.Current.GetStoragePath() + "/depot/thum_" + text10.Substring(text10.LastIndexOf("/") + 1); if (!File.Exists(text11)) { this.ShowMsg("缩略图文件夹未创建,请联系管理员", false); return; } ResourcesHelper.CreateThumbnail(text11, base.Request.MapPath(virtualPath), 160, 160); list2.Add(text10); } } if (list2.Count == 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("logo已失效或未上传,请上传门店logo", false); } else if (ManagerHelper.Update(managerInfo)) { int value = this.dropRegion.GetSelectedRegionId().Value; storeById.StoreName = text3; storeById.RegionId = value; storeById.TopRegionId = RegionHelper.GetCityId(value); storeById.Tel = text; storeById.Address = Address; storeById.ContactMan = text2; storeById.StoreImages = ((list2.Count == 0) ? string.Empty : string.Join(",", list2.ToArray())); storeById.Longitude = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLongitude.Value) ? "0" : this.hfLongitude.Value), 6); storeById.Latitude = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLatitude.Value) ? "0" : this.hfLatitude.Value), 6); storeById.FullRegionPath = RegionHelper.GetFullPath(value, true); StoresHelper.UpdateStore(storeById); HiCache.Remove("DataCache-StoreInfoDataKey"); if (dictionary.Count > 0 && this.chkIsStoreDelive.Checked) { StoresHelper.AddDeliveryScope(this.storeId, dictionary); } else { StoresHelper.DeleteDevlieryScope(this.storeId); } if (!string.IsNullOrEmpty(this.txtStoreTag.Text.Trim())) { IList <int> list3 = new List <int>(); string text12 = this.txtStoreTag.Text.Trim(); string[] array4 = null; array4 = ((!text12.Contains(",")) ? new string[1] { text12 } : text12.Split(',')); string[] array5 = array4; foreach (string value2 in array5) { list3.Add(Convert.ToInt32(value2)); } StoresHelper.DeleteStoreTags(this.storeId); StoresHelper.BindStoreTags(this.storeId, list3); } else { StoresHelper.DeleteStoreTags(this.storeId); } HiCache.Remove($"DataCache-StoreStateCacheKey-{storeById.StoreId}"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.OpenDadaLogistics) { DataTable dataTable = DepotHelper.SynchroDadaStoreList(this.storeId); if (dataTable != null && dataTable.Rows.Count > 0) { for (int l = 0; l < dataTable.Rows.Count; l++) { string station_name = dataTable.Rows[l]["StoreName"].ToNullString(); int business = 5; string city_name = dataTable.Rows[l]["CityName"].ToNullString().Replace("市", ""); string area_name = dataTable.Rows[l]["RegionName"].ToNullString(); string station_address = dataTable.Rows[l]["Address"].ToNullString(); double lng = dataTable.Rows[l]["Longitude"].ToDouble(0); double lat = dataTable.Rows[l]["Latitude"].ToDouble(0); string contact_name = dataTable.Rows[l]["ContactMan"].ToNullString(); string phone = dataTable.Rows[l]["Tel"].ToNullString(); string text13 = dataTable.Rows[l]["StoreId"].ToNullString(); string text14 = DadaHelper.shopUpdate(masterSettings.DadaSourceID, this.storeId.ToString(), "", station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, -1); } } } } } } } } }
public static StoresInfo GetNearDeliveStores(string latLng, bool isApp = false) { StoresInfo storesInfo = new StoresInfo(); string text = ""; string province = ""; string text2 = ""; string country = ""; string text3 = ""; DepotHelper.GetAddressByLatLng(latLng, ref text, ref province, ref text2, ref country, ref text3); int regionIdByRegionName = RegionHelper.GetRegionIdByRegionName(text2, 2); int regionId = RegionHelper.GetRegionId(text3, country, text2, province); if (regionId == 0) { IList <RegionInfo> regionChildList = RegionHelper.GetRegionChildList(regionIdByRegionName, false); if (regionChildList != null && regionChildList.Count > 0) { regionId = regionChildList[0].RegionId; } } string fullPath = RegionHelper.GetFullPath(regionId, true); string fullPath2 = RegionHelper.GetFullPath(regionId, true); IList <StoresInfo> nearDeliveStores = new StoresDao().GetNearDeliveStores(regionIdByRegionName, fullPath); storesInfo = DepotHelper.GetBestNearStoreInfo(latLng, nearDeliveStores); if (storesInfo == null || storesInfo.StoreId <= 0) { nearDeliveStores = new StoresDao().GetNearOtherStores(regionIdByRegionName); storesInfo = DepotHelper.GetBestNearStoreInfo(latLng, nearDeliveStores); } if (!isApp) { string userCoordinateTimeCookieName = DepotHelper.UserCoordinateTimeCookieName; DateTime now = DateTime.Now; string value = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName, value, now.AddMinutes(1.0), null, true); string userCoordinateCookieName = DepotHelper.UserCoordinateCookieName; string value2 = HttpUtility.UrlEncode(string.IsNullOrWhiteSpace(text) ? text3 : text); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName, "Address", value2, now.AddMinutes(10.0)); string userCoordinateCookieName2 = DepotHelper.UserCoordinateCookieName; string value3 = HttpUtility.UrlEncode(text2); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName2, "CityName", value3, now.AddMinutes(10.0)); string userCoordinateCookieName3 = DepotHelper.UserCoordinateCookieName; string value4 = regionIdByRegionName.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName3, "CityRegionId", value4, now.AddMinutes(10.0)); string userCoordinateCookieName4 = DepotHelper.UserCoordinateCookieName; string value5 = regionId.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName4, "RegionId", value5, now.AddMinutes(10.0)); string userCoordinateCookieName5 = DepotHelper.UserCoordinateCookieName; string value6 = storesInfo.StoreId.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName5, "StoreId", value6, now.AddMinutes(10.0)); string userCoordinateCookieName6 = DepotHelper.UserCoordinateCookieName; now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName6, "Coordinate", latLng, now.AddMinutes(10.0)); string userCoordinateCookieName7 = DepotHelper.UserCoordinateCookieName; now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName7, "NewCoordinate", latLng, now.AddMinutes(10.0)); string userCoordinateCookieName8 = DepotHelper.UserCoordinateCookieName; now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName8, "StoreType", "1", now.AddMinutes(10.0)); string userCoordinateCookieName9 = DepotHelper.UserCoordinateCookieName; string value7 = fullPath2; now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName9, "FullRegionPath", value7, now.AddMinutes(10.0)); } return(storesInfo); }
public void BindData() { StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin); if (storeById == null) { base.Response.Redirect("StoresList.aspx"); } else { DbQueryResult storeDeliveryScop = StoresHelper.GetStoreDeliveryScop(new DeliveryScopeQuery { StoreId = storeById.StoreId, PageIndex = 1, PageSize = 2147483647 }); this.repStoreDeliveryScop.DataSource = storeDeliveryScop.Data; this.repStoreDeliveryScop.DataBind(); this.lblState.Text = (storeById.State.Equals(0) ? "关闭" : "开启"); this.lblUserName.Text = managerInfo.UserName; this.lblStoreName.Text = storeById.StoreName; this.lblRegions.Text = RegionHelper.GetFullRegion(storeById.RegionId, string.Empty, true, 0); this.lblAddress.Text = storeById.Address; this.lblContactMan.Text = storeById.ContactMan; this.lblTel.Text = storeById.Tel; this.lblCategoryName.Text = storeById.WXCategoryName; Literal literal = this.lblServeRadius; double? nullable = storeById.ServeRadius; literal.Text = nullable.ToString(); this.lblStoreOpenTime.Text = (string.IsNullOrEmpty(storeById.StoreOpenTime) ? "无" : storeById.StoreOpenTime); this.lblIsAboveSelf.Text = (storeById.IsAboveSelf ? "是" : "否"); this.lblWXBusinessName.Text = storeById.WXBusinessName; this.lblWXBranchName.Text = storeById.WXBranchName; this.lblWxAddress.Text = storeById.WxAddress; HiddenField hiddenField = this.hfLongitude; nullable = storeById.Longitude; hiddenField.Value = nullable.ToString(); HiddenField hiddenField2 = this.hfLatitude; nullable = storeById.Latitude; hiddenField2.Value = nullable.ToString(); this.lblWXTelephone.Text = storeById.WXTelephone; Literal literal2 = this.lblWXAvgPrice; int? nullable2 = storeById.WXAvgPrice; literal2.Text = nullable2.ToString(); this.lblWXOpenTime.Text = storeById.WXOpenTime; this.lblWXRecommend.Text = storeById.WXRecommend; this.lblWXSpecial.Text = storeById.WXSpecial; this.lblWXIntroduction.Text = storeById.WXIntroduction; HiddenField hiddenField3 = this.hidIsWX; nullable2 = storeById.WXState; hiddenField3.Value = nullable2.ToString(); if (!string.IsNullOrEmpty(storeById.StoreImages)) { string[] array = storeById.StoreImages.Split(','); foreach (string text in array) { if (!string.IsNullOrEmpty(text.Trim())) { Literal literal3 = this.lblImages; literal3.Text += $"<img src='{text}' width='98' height='98' style='padding:0 10px;'/>"; } } } } }
private void QueryDeliverFees(HttpContext context) { StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId); string text = context.Request["OrderIds"].ToNullString(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (string.IsNullOrEmpty(text)) { context.Response.Write(this.GetFailResultJson("订单号不能为空")); } else { string[] array = text.Split(','); IList <IDictionary <string, string> > list = new List <IDictionary <string, string> >(); ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); string[] array2 = array; foreach (string text2 in array2) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("OrderId", text2); string text3 = ""; OrderInfo orderInfo = TradeHelper.GetOrderInfo(text2); if (orderInfo == null) { text3 = "错误的订单号"; } if ((orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1)))) || orderInfo.RealShippingModeId == -2) { text3 = "错误的订单状态"; } string text4 = ""; try { string value = DadaHelper.cityCodeList(masterSettings.DadaSourceID); JObject jObject = JsonConvert.DeserializeObject(value) as JObject; JArray jArray = (JArray)jObject["result"]; foreach (JToken item in (IEnumerable <JToken>)jArray) { if (orderInfo.ShippingRegion.Contains(item["cityName"].ToString())) { text4 = item["cityCode"].ToString(); break; } } } catch { } if (text4 == "") { text3 = "配送范围超区,无法配送"; } if (text3 != "") { dictionary.Add("Message", text3); dictionary.Add("distance", ""); dictionary.Add("deliveryNo", ""); dictionary.Add("fee", ""); list.Add(dictionary); } else { string text5 = orderInfo.StoreId.ToNullString(); string orderId = orderInfo.OrderId; string city_code = text4; double cargo_price = orderInfo.GetTotal(false).F2ToString("f2").ToDouble(0); int is_prepay = 0; long expected_fetch_time = Globals.DateTimeToUnixTimestamp(DateTime.Now.AddMinutes(15.0)); string shipTo = orderInfo.ShipTo; string address = orderInfo.Address; string latLng = orderInfo.LatLng; if (string.IsNullOrWhiteSpace(latLng)) { ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId); latLng = shippingAddress.LatLng; } double receiver_lat = latLng.Split(',')[0].ToDouble(0); double receiver_lng = latLng.Split(',')[1].ToDouble(0); string callback = Globals.FullPath("/pay/dadaOrderNotify"); string cellPhone = orderInfo.CellPhone; string telPhone = orderInfo.TelPhone; bool isQueryDeliverFee = true; string value2 = DadaHelper.addOrder(masterSettings.DadaSourceID, "P_" + defaultOrFirstShipper.ShipperId, orderId, city_code, cargo_price, is_prepay, expected_fetch_time, shipTo, address, receiver_lat, receiver_lng, callback, cellPhone, telPhone, -1.0, -1.0, -1.0, -1.0, -1L, "", -1, -1.0, -1, -1L, "", "", "", false, isQueryDeliverFee); JObject jObject2 = JsonConvert.DeserializeObject(value2) as JObject; string a = jObject2["status"].ToString(); if (a == "success") { JObject jObject3 = JsonConvert.DeserializeObject(jObject2["result"].ToString()) as JObject; dictionary.Add("Message", ""); dictionary.Add("distance", jObject3["distance"].ToNullString()); dictionary.Add("deliveryNo", jObject3["deliveryNo"].ToNullString()); dictionary.Add("fee", "预计运费:¥" + jObject3["fee"].ToNullString()); } else { dictionary.Add("Message", jObject2["msg"].ToNullString()); dictionary.Add("distance", ""); dictionary.Add("deliveryNo", ""); dictionary.Add("fee", ""); } list.Add(dictionary); } } string s = JsonConvert.SerializeObject(new { Result = new { Status = "SUCCESS", List = from r in list select new { OrderId = r["OrderId"].ToNullString(), Message = r["Message"].ToNullString(), distance = r["distance"].ToNullString(), fee = r["fee"].ToNullString(), deliveryNo = r["deliveryNo"].ToNullString() } } }); context.Response.Write(s); context.Response.End(); } }
/// <summary> /// 更新一条数据 /// </summary> public static void UpdateStoresInfo(StoresInfo model) { DatabaseProvider.GetInstance().UpdateStoresInfo(model); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string text = context.Request["action"].ToNullString(); if (string.IsNullOrEmpty(text) || text == "") { string text2 = string.Empty; string text3 = context.Request["ckids"]; if (!string.IsNullOrEmpty(text3)) { text2 = text3; } string a2 = context.Request["client"].ToNullString(); ShoppingCartInfo shoppingCartInfo = (!(a2 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(text2, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(text2, false, false, -1); if (shoppingCartInfo != null) { string[] source = text2.Split(','); bool flag = false; bool flag2 = true; bool flag3 = true; foreach (ShoppingCartItemInfo lineItem in shoppingCartInfo.LineItems) { if (source.Contains(lineItem.SkuId) || source.Contains(lineItem.SkuId + "|" + lineItem.StoreId)) { int skuStock = ShoppingCartProcessor.GetSkuStock(lineItem.SkuId, lineItem.StoreId); if (skuStock < lineItem.Quantity) { flag = true; break; } if (HiContext.Current.SiteSettings.OpenMultStore && lineItem.StoreId > 0) { StoresInfo storeById = StoresHelper.GetStoreById(lineItem.StoreId); if (storeById != null) { if (!SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime) { DateTime dateTime = DateTime.Now; string str = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenStartDate; DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value; dateTime = DateTime.Now; string str2 = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenEndDate; DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value; if (dateTime2 <= value) { dateTime2 = dateTime2.AddDays(1.0); } if (DateTime.Now < value || DateTime.Now > dateTime2) { flag3 = false; } } if (!storeById.CloseStatus && storeById.CloseEndTime.HasValue && storeById.CloseBeginTime.HasValue && storeById.CloseEndTime.Value > DateTime.Now && storeById.CloseBeginTime.Value < DateTime.Now) { flag2 = false; } } } } } if (flag) { context.Response.ContentType = "text/json"; context.Response.Write("{\"status\":\"false\",\"msg\":\"有商品库存不足,不能结算\"}"); context.Response.End(); } if (!flag3) { context.Response.ContentType = "text/json"; context.Response.Write("{\"status\":\"StoreNotInTime\",\"msg\":\"非营业时间\"}"); context.Response.End(); } if (!flag2) { context.Response.ContentType = "text/json"; context.Response.Write("{\"status\":\"StoreNotOpen\",\"msg\":\"歇业中\"}"); context.Response.End(); } if (shoppingCartInfo != null) { ShoppingCartGiftInfo shoppingCartGiftInfo = (from a in shoppingCartInfo.LineGifts where a.PromoType == 5 select a).FirstOrDefault(); shoppingCartInfo.SendGiftPromotionId = (shoppingCartGiftInfo?.GiftId ?? 0); if (!shoppingCartInfo.IsSendGift && shoppingCartInfo.LineGifts.Count > 0) { foreach (ShoppingCartGiftInfo lineGift in shoppingCartInfo.LineGifts) { ShoppingCartProcessor.RemoveGiftItem(lineGift.GiftId, PromoteType.SentGift); } } } string s = JsonConvert.SerializeObject(shoppingCartInfo); context.Response.ContentType = "text/json"; context.Response.Write(s); } } else if (text == "ClearCart") { string text4 = context.Request.Form["ck_productId"].ToNullString(); if (string.IsNullOrEmpty(text4)) { context.Response.Write("{\"status\":\"false\",\"msg\":\"请选择要清除的商品\"}"); } else { string[] array = text4.Split(','); foreach (string text5 in array) { string[] array2 = text5.Split('|'); if (array2.Length == 2) { ShoppingCartProcessor.RemoveLineItem(array2[0], array2[1].ToInt(0)); } else { ShoppingCartProcessor.RemoveLineItem(text5, 0); } } context.Response.Write("{\"status\":\"true\",\"msg\":\"清除成功\"}"); } context.Response.End(); } else if (text == "HasStore") { string text6 = context.Request.Form["skuId"].ToNullString(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (string.IsNullOrEmpty(text6) || !masterSettings.OpenMultStore) { context.Response.Write("{\"status\":\"false\"}"); } else if (ShoppingCartProcessor.HasStoreSkuStocks(text6)) { context.Response.Write("{\"status\":\"true\"}"); } else { context.Response.Write("{\"status\":\"false\"}"); } } else if (text == "ProductsHasStore") { string text7 = context.Request.Form["productIds"]; SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(); if (string.IsNullOrEmpty(text7) || !masterSettings2.OpenMultStore) { context.Response.Write("{\"status\":\"false\"}"); } else { string str3 = ShoppingCartProcessor.HasStoreByProducts(text7); context.Response.Write("{\"status\":\"true\",\"productIds\":\"" + str3 + "\"}"); } } else if (text == "updateBuyNum") { string skuid = context.Request.Form["SkuId"].ToNullString().Trim(); int num = context.Request.Form["BuyNum"].ToNullString().Trim().ToInt(0); string a3 = context.Request.Form["client"].ToNullString().Trim(); ShoppingCartInfo shoppingCartInfo2 = (!(a3 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(null, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(null, false, false, -1); ShoppingCartItemInfo shoppingCartItemInfo = shoppingCartInfo2.LineItems.FirstOrDefault((ShoppingCartItemInfo a) => a.SkuId == skuid); int num2 = shoppingCartItemInfo?.Quantity ?? 1; if (num <= 0) { context.Response.Write("{\"status\":\"numError\",\"msg\":\"购买数量必须为大于0的整数\",\"oldNumb\":\"" + num2 + "\"}"); } else if (ShoppingCartProcessor.GetSkuStock(skuid, 0) < num) { context.Response.Write("{\"status\":\"StockError\",\"msg\":\"该商品库存不足\",\"oldNumb\":\"" + num2 + "\"}"); } else { ShoppingCartProcessor.UpdateLineItemQuantity(skuid, num, 0); PromotionInfo productQuantityDiscountPromotion = ShoppingCartProcessor.GetProductQuantityDiscountPromotion(skuid, HiContext.Current.User.GradeId); if (productQuantityDiscountPromotion != null && (decimal)num >= productQuantityDiscountPromotion.Condition) { shoppingCartItemInfo.AdjustedPrice = shoppingCartItemInfo.MemberPrice * productQuantityDiscountPromotion.DiscountValue; } else { shoppingCartItemInfo.AdjustedPrice = shoppingCartItemInfo.MemberPrice; } context.Response.Write("{\"status\":\"true\",\"adjustedPrice\":" + shoppingCartItemInfo.AdjustedPrice.F2ToString("f2") + "}"); } } else if (text == "updateGiftBuyNum") { string giftId = context.Request.Form["giftId"].ToNullString().Trim(); int num3 = context.Request.Form["BuyNum"].ToNullString().Trim().ToInt(0); string a4 = context.Request.Form["client"].ToNullString().Trim(); ShoppingCartInfo shoppingCartInfo3 = (!(a4 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(null, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(null, false, false, -1); ShoppingCartGiftInfo shoppingCartGiftInfo2 = shoppingCartInfo3.LineGifts.FirstOrDefault((ShoppingCartGiftInfo a) => a.GiftId == giftId.ToInt(0)); if (shoppingCartGiftInfo2 == null) { context.Response.Write("{\"status\":\"nullError\",\"msg\":\"该礼品不存在或已删除\",\"oldNumb\":\"" + 0 + "\"}"); } else if (num3 <= 0) { context.Response.Write("{\"status\":\"numError\",\"msg\":\"购买数量必须为大于0的整数\",\"oldNumb\":\"" + shoppingCartGiftInfo2.Quantity + "\"}"); } else { ShoppingCartProcessor.UpdateGiftItemQuantity(giftId.ToInt(0), num3, PromoteType.NotSet); context.Response.Write("{\"status\":\"true\"}"); } } else if (text == "deleteGift") { string text8 = context.Request.Form["giftId"].ToNullString().Trim(); text8 = text8.TrimStart(',').TrimEnd(','); string[] array3 = text8.Split(','); foreach (string text9 in array3) { ShoppingCartProcessor.RemoveGiftItem(text8.ToInt(0), PromoteType.NotSet); } context.Response.Write("{\"status\":\"true\"}"); } else if (text == "deletestore") { string skuId = context.Request.Form["SkuId"].ToNullString().Trim(); int storeId = context.Request.Form["StoreId"].ToInt(0); ShoppingCartProcessor.RemoveLineItem(skuId, storeId); context.Response.Write("{\"status\":\"true\"}"); } else if (text == "delete") { string skuId2 = context.Request.Form["SkuId"].ToNullString().Trim(); ShoppingCartProcessor.RemoveLineItem(skuId2, 0); context.Response.Write("{\"status\":\"true\"}"); } else if (text == "deleteall") { string text10 = context.Request.Form["SkuIdList"].ToNullString().Trim(); if (!string.IsNullOrEmpty(text10.ToNullString().Trim())) { text10 = text10.TrimStart(',').TrimEnd(','); string[] array4 = text10.Split(','); foreach (string skuId3 in array4) { ShoppingCartProcessor.RemoveLineItem(skuId3, 0); } } context.Response.Write("{\"status\":\"true\"}"); } else if (text == "reducedpromotion") { decimal amount = context.Request.Form["Amount"].ToDecimal(0); int quantity = context.Request.Form["Quantity"].ToInt(0); MemberInfo user = HiContext.Current.User; decimal num4 = default(decimal); PromotionInfo reducedPromotion = new PromotionDao().GetReducedPromotion(user.GradeId, amount, quantity, out num4, 0); if (reducedPromotion != null) { context.Response.Write("{\"ReducedPromotionAmount\":\"" + num4 + "\",\"ReducedPromotionCondition\":\"" + reducedPromotion.Condition + "\"}"); } else { context.Response.Write("{\"ReducedPromotionAmount\":\"0\",\"ReducedPromotionCondition\":\"0\"}"); } } }
private void SaveNewStock() { List <StoreSKUInfo> list = new List <StoreSKUInfo>(); List <StoreStockLogInfo> list2 = new List <StoreStockLogInfo>(); List <int> list3 = new List <int>(); int storeId = HiContext.Current.Manager.StoreId; StoresInfo storeById = StoresHelper.GetStoreById(storeId); if (this.grdSelectedProducts.Items.Count > 0) { foreach (RepeaterItem item in this.grdSelectedProducts.Items) { int num = 0; int num2 = 0; decimal num3 = default(decimal); TextBox textBox = item.FindControl("txtStock") as TextBox; TextBox textBox2 = item.FindControl("txtWarningStock") as TextBox; HiddenField hiddenField = item.FindControl("hidSKUContent") as HiddenField; int.TryParse(textBox.Text, out num); if (storeById.IsModifyPrice) { TextBox textBox3 = item.FindControl("txtStoreSalePrice") as TextBox; decimal.TryParse(textBox3.Text, out num3); if (num3 <= decimal.Zero) { this.ShowMsg("价格必须大于0!", false); return; } } if (num <= 0) { this.ShowMsg("库存必须设置大于0的数字!", false); return; } if (num2 < 0) { this.ShowMsg("警戒库存必须不能为负数!", false); return; } HiddenField hiddenField2 = item.FindControl("HidSkuId") as HiddenField; HiddenField hiddenField3 = item.FindControl("HidProductId") as HiddenField; string value = hiddenField2.Value; int num4 = hiddenField3.Value.ToInt(0); StoreSKUInfo storeSKUInfo = new StoreSKUInfo(); storeSKUInfo.ProductID = num4; storeSKUInfo.SkuId = value; storeSKUInfo.Stock = num; storeSKUInfo.StoreId = storeId; storeSKUInfo.WarningStock = textBox2.Text.ToInt(0); storeSKUInfo.FreezeStock = 0; if (storeById.IsModifyPrice) { storeSKUInfo.StoreSalePrice = num3; HiddenField hiddenField4 = item.FindControl("hidSalePrice") as HiddenField; decimal num5 = hiddenField4.Value.ToDecimal(0); decimal? minPriceRate = storeById.MinPriceRate; if (minPriceRate.GetValueOrDefault() > default(decimal) && minPriceRate.HasValue) { decimal d = num3; decimal value2 = num5; decimal?minPriceRate2 = storeById.MinPriceRate; minPriceRate = (decimal?)value2 * minPriceRate2; if (d < minPriceRate.GetValueOrDefault() && minPriceRate.HasValue) { this.ShowMsg(hiddenField.Value + "门店价格不能小于平台价格的" + storeById.MinPriceRate.Value.F2ToString("f2") + "倍!", false); return; } } minPriceRate = storeById.MaxPriceRate; if (minPriceRate.GetValueOrDefault() > default(decimal) && minPriceRate.HasValue) { decimal d2 = num3; decimal value2 = num5; decimal?minPriceRate2 = storeById.MaxPriceRate; minPriceRate = (decimal?)value2 * minPriceRate2; if (d2 > minPriceRate.GetValueOrDefault() && minPriceRate.HasValue) { this.ShowMsg(hiddenField.Value + "门店价格不能大于平台价格的" + storeById.MaxPriceRate.Value.F2ToString("f2") + "倍!", false); return; } } } else { storeSKUInfo.StoreSalePrice = decimal.Zero; } list.Add(storeSKUInfo); StoreStockLogInfo storeStockLogInfo = new StoreStockLogInfo(); storeStockLogInfo.ProductId = num4; storeStockLogInfo.Remark = "从平台商品移入"; storeStockLogInfo.SkuId = value; storeStockLogInfo.Operator = HiContext.Current.Manager.UserName; storeStockLogInfo.StoreId = storeId; storeStockLogInfo.ChangeTime = DateTime.Now; storeStockLogInfo.Content = hiddenField.Value + "库存由【0】变成【" + num + "】"; StoreStockLogInfo storeStockLogInfo2 = storeStockLogInfo; storeStockLogInfo2.Content = storeStockLogInfo2.Content + "警戒库存由【0】变成【" + storeSKUInfo.WarningStock + "】"; if (storeById.IsModifyPrice) { storeStockLogInfo2 = storeStockLogInfo; storeStockLogInfo2.Content = storeStockLogInfo2.Content + "门店售价由【0】变成【" + num3 + "】"; } list2.Add(storeStockLogInfo); if (!list3.Contains(num4)) { list3.Add(num4); } } if (list.Count > 0) { if (StoresHelper.AddStoreProduct(list, list2, list3)) { base.CloseWindow(null); } else { this.ShowMsg("保存失败!", false); } } this.BindProduct(); } }
public void bindReplaceInfo() { int replaceId = this.Page.Request["replaceId"].ToInt(0); ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId); OrderInfo orderInfo = TradeHelper.GetOrderInfo(replaceInfo.OrderId); if (replaceInfo == null) { this.ShowMsg("换货信息错误!", false); } else { HiddenField hiddenField = this.hidReplaceStatus; int num = (int)replaceInfo.HandleStatus; hiddenField.Value = num.ToString(); if (orderInfo == null) { this.ShowMsg("错误的订单信息!", false); } else if (orderInfo.StoreId != this.UserStoreId) { this.ShowMsg("不是门店的订单不能进行处理", false); } else { if (string.IsNullOrEmpty(replaceInfo.SkuId)) { this.listPrducts.DataSource = orderInfo.LineItems.Values; } else { Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>(); foreach (LineItemInfo value in orderInfo.LineItems.Values) { if (value.SkuId == replaceInfo.SkuId) { dictionary.Add(value.SkuId, value); } } this.listPrducts.DataSource = dictionary.Values; } this.listPrducts.DataBind(); this.litOrderId.Text = orderInfo.PayOrderId; this.litOrderTotal.Text = orderInfo.GetTotal(false).F2ToString("f2"); this.litRefundReason.Text = replaceInfo.ReplaceReason; this.litRemark.Text = replaceInfo.UserRemark; Literal literal = this.litReturnQuantity; num = replaceInfo.Quantity; literal.Text = num.ToString(); this.txtAdminRemark.Text = replaceInfo.AdminRemark; string userCredentials = replaceInfo.UserCredentials; if (!string.IsNullOrEmpty(userCredentials)) { string[] array = userCredentials.Split('|'); userCredentials = ""; string[] array2 = array; foreach (string str in array2) { userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str); } this.litImageList.Text = userCredentials; } else { this.divCredentials.Visible = false; } if (replaceInfo.HandleStatus == ReplaceStatus.Applied && this.UserStoreId == orderInfo.StoreId) { this.btnAcceptReplace.Visible = true; this.btnRefuseReplace.Visible = true; } else if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnGetAndSendGoods.Visible = true; } if (replaceInfo.HandleStatus != 0) { this.txtAdminCellPhone.Visible = false; this.txtAdminShipAddress.Visible = false; this.txtAdminShipTo.Visible = false; this.litAdminCellPhone.Visible = true; this.litAdminShipAddrss.Visible = true; this.litAdminShipTo.Visible = true; this.litAdminCellPhone.Text = replaceInfo.AdminCellPhone; this.litAdminShipTo.Text = replaceInfo.AdminShipTo; this.litAdminShipAddrss.Text = replaceInfo.AdminShipAddress; } else { StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId); if (storeById != null) { Literal literal2 = this.litAdminShipAddrss; TextBox textBox = this.txtAdminShipAddress; string text3 = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address); Literal literal3 = this.litAdminShipTo; TextBox textBox2 = this.txtAdminShipTo; text3 = (literal3.Text = (textBox2.Text = storeById.ContactMan)); Literal literal4 = this.litAdminCellPhone; TextBox textBox3 = this.txtAdminCellPhone; text3 = (literal4.Text = (textBox3.Text = storeById.Tel)); } } string str2 = string.IsNullOrEmpty(orderInfo.RealName) ? "" : (orderInfo.RealName.Replace("\n\r", "").Replace("\n", "").Replace("\r", "") + " (" + (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone) + ")"); str2 = str2 + orderInfo.ShippingRegion + " " + orderInfo.Address; this.litUserAddress.Text = str2; this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 0); Literal literal5 = this.txtAfterSaleId; num = replaceInfo.ReplaceId; literal5.Text = num.ToString(); if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnViewUserLogistic.Visible = true; AttributeCollection attributes = this.btnViewUserLogistic.Attributes; num = replaceInfo.ReplaceId; attributes.Add("replaceid", num.ToString()); this.btnViewUserLogistic.Attributes.Add("expresscompanyname", replaceInfo.UserExpressCompanyName.ToString()); this.btnViewUserLogistic.Attributes.Add("shipordernumber", replaceInfo.UserShipOrderNumber.ToString()); } if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced) { this.btnViewMallLogistic.Visible = true; AttributeCollection attributes2 = this.btnViewMallLogistic.Attributes; num = replaceInfo.ReplaceId; attributes2.Add("replaceid", num.ToString()); this.btnViewMallLogistic.Attributes.Add("expresscompanyname", replaceInfo.ExpressCompanyName.ToString()); this.btnViewMallLogistic.Attributes.Add("shipordernumber", replaceInfo.ShipOrderNumber.ToString()); } } } }
protected override void AttachChildControls() { base.CheckOpenMultStore(); this.storeLogo = (HtmlImage)this.FindControl("storeLogo"); this.litAddress = (Literal)this.FindControl("litAddress"); this.litStoreName = (Literal)this.FindControl("litStoreName"); this.litStoreName2 = (Literal)this.FindControl("litStoreName2"); this.litOpenDate = (Literal)this.FindControl("litOpenDate"); this.litStoreDelive = (Literal)this.FindControl("litStoreDelive"); this.litActivityList = (Literal)this.FindControl("litActivityList"); this.litActivityCount = (Literal)this.FindControl("litActivityCount"); this.hidLatitude = (HtmlInputHidden)this.FindControl("hidLatitude"); this.hidLongitude = (HtmlInputHidden)this.FindControl("hidLongitude"); this.hidStoreName = (HtmlInputHidden)this.FindControl("hidStoreName"); this.hidIsOpenData = (HtmlInputHidden)this.FindControl("hidIsOpenData"); this.hdQQMapKey = (HtmlInputHidden)this.FindControl("hdQQMapKey"); this.rp_markting = (Repeater)this.FindControl("rp_markting"); int.TryParse(this.Page.Request.QueryString["storeId"], out this.storeId); int num = this.Page.Request.QueryString["storeSource"].ToInt(0); string cookie = WebHelper.GetCookie("UserCoordinateCookie", "Coordinate"); this.hidIsReloadPosition = (HtmlInputHidden)this.FindControl("hidIsReloadPosition"); this.aTel = (HtmlAnchor)this.FindControl("aTel"); this.litStoreTel = (Literal)this.FindControl("litStoreTel"); this.hdAppId = (HtmlInputHidden)this.FindControl("hdAppId"); this.hdTitle = (HtmlInputHidden)this.FindControl("hdTitle"); this.hdDesc = (HtmlInputHidden)this.FindControl("hdDesc"); this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl"); this.hdLink = (HtmlInputHidden)this.FindControl("hdLink"); this.hdAppId.Value = HiContext.Current.SiteSettings.WeixinAppId; SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (!masterSettings.OpenMultStore) { this.Page.Response.Redirect("Default.aspx"); } else if (masterSettings.Store_PositionRouteTo == 2.ToString() && num != 3 && num != 2 && num != 1 && num != 4) { this.Page.Response.Redirect("StoreList?from"); } this.hdQQMapKey.Value = (string.IsNullOrEmpty(masterSettings.QQMapAPIKey) ? "SYJBZ-DSLR3-IWX3Q-3XNTM-ELURH-23FTP" : masterSettings.QQMapAPIKey); string cookie2 = WebHelper.GetCookie("UserCoordinateTimeCookie"); if (this.storeId > 0 && !string.IsNullOrWhiteSpace(cookie) && !string.IsNullOrEmpty(cookie2)) { StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); if (storeById != null && storeById.StoreId > 0) { this.hdTitle.Value = storeById.StoreName; this.hdDesc.Value = storeById.StoreName; string storeImages = storeById.StoreImages; string local = string.IsNullOrEmpty(storeImages) ? SettingsManager.GetMasterSettings().LogoUrl : storeImages; this.hdImgUrl.Value = Globals.FullPath(local); this.hdLink.Value = Globals.FullPath(this.Page.Request.Url.ToString()); MemberInfo user = HiContext.Current.User; if (user.UserId != 0 && user.IsReferral() && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"])) { string text = HttpContext.Current.Request.Url.ToString(); text = ((text.IndexOf("?") <= -1) ? (text + "?ReferralUserId=" + HiContext.Current.UserId) : (text + "&ReferralUserId=" + HiContext.Current.UserId)); this.Page.Response.Redirect(text); } else { string cookie3 = WebHelper.GetCookie("UserCoordinateCookie"); this.litAddress.Text = HttpUtility.UrlDecode(WebHelper.GetCookie("UserCoordinateCookie", "Address")); this.storeLogo.Src = storeById.StoreImages; this.litStoreName.SetWhenIsNotNull("<a href=\"StoreAbout?StoreId=" + storeById.StoreId + "\">" + storeById.StoreName + "</a>"); this.litStoreName2.SetWhenIsNotNull("<a href=\"StoreAbout?StoreId=" + storeById.StoreId + "\">" + storeById.StoreName + "</a>"); string text2 = (storeById.OpenEndDate < storeById.OpenStartDate) ? "次日" : ""; Literal literal = this.litOpenDate; DateTime dateTime = storeById.OpenStartDate; string arg = dateTime.ToString("HH:mm"); string arg2 = text2; dateTime = storeById.OpenEndDate; literal.Text = string.Format("{0} 至 {1}{2}", arg, arg2, dateTime.ToString("HH:mm")); HtmlInputHidden htmlInputHidden = this.hidLatitude; double? nullable = storeById.Latitude; htmlInputHidden.Value = nullable.ToString(); HtmlInputHidden htmlInputHidden2 = this.hidLongitude; nullable = storeById.Longitude; htmlInputHidden2.Value = nullable.ToString(); this.hidStoreName.Value = storeById.StoreName.ToString(); this.aTel.HRef = "tel://" + storeById.Tel; this.litStoreTel.Text = storeById.Tel; if (!base.site.Store_IsOrderInClosingTime) { dateTime = DateTime.Now; string str = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenStartDate; DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value; dateTime = DateTime.Now; string str2 = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenEndDate; DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value; if (dateTime2 <= value) { dateTime2 = dateTime2.AddDays(1.0); } this.hidIsOpenData.Value = "true"; if (DateTime.Now < value || DateTime.Now > dateTime2) { this.hidIsOpenData.Value = "false"; } } if (storeById.IsStoreDelive) { decimal?minOrderPrice = storeById.MinOrderPrice; int num2; if (minOrderPrice.GetValueOrDefault() > default(decimal) && minOrderPrice.HasValue) { Literal literal2 = this.litStoreDelive; num2 = storeById.MinOrderPrice.ToInt(0); literal2.Text = $"¥{num2.ToString()}起送,"; } minOrderPrice = storeById.StoreFreight; if (minOrderPrice.GetValueOrDefault() > default(decimal) && minOrderPrice.HasValue) { Literal literal3 = this.litStoreDelive; string text3 = literal3.Text; num2 = storeById.StoreFreight.ToInt(0); literal3.Text = text3 + $"配送费¥{num2.ToString()}"; } else { Literal literal4 = this.litStoreDelive; literal4.Text += "免配送费"; } } StoreActivityEntityList storeActivity = StoresHelper.GetStoreActivity(this.storeId); if (storeActivity != null) { StringBuilder stringBuilder = new StringBuilder(); if (storeActivity.FullAmountReduceList.Count > 0) { stringBuilder.AppendFormat("<div class=\"jian\"><i class=\"tag tag_green\">减</i><span>"); int num3 = 0; while (num3 < storeActivity.FullAmountReduceList.Count) { if (num3 < 2) { stringBuilder.AppendFormat("{0};", storeActivity.FullAmountReduceList[num3].ActivityName); num3++; continue; } stringBuilder.AppendFormat("{0}{1}", storeActivity.FullAmountReduceList[num3].ActivityName, (storeActivity.FullAmountReduceList.Count > 3) ? "等" : ""); break; } if (stringBuilder.ToString().EndsWith(";")) { stringBuilder.Remove(stringBuilder.ToString().LastIndexOf(';'), 1); } stringBuilder.AppendFormat("</span></div>"); } if (storeActivity.FullAmountSentFreightList.Count > 0) { stringBuilder.AppendFormat("<div class=\"mian\"><i class=\"tag tag_yellow\">免</i><span>"); int num4 = 0; while (num4 < storeActivity.FullAmountSentFreightList.Count) { if (num4 < 2) { stringBuilder.AppendFormat("{0};", storeActivity.FullAmountSentFreightList[num4].ActivityName); num4++; continue; } stringBuilder.AppendFormat("{0}{1}", storeActivity.FullAmountSentFreightList[num4].ActivityName, (storeActivity.FullAmountSentFreightList.Count > 3) ? "等" : ""); break; } if (stringBuilder.ToString().EndsWith(";")) { stringBuilder.Remove(stringBuilder.ToString().LastIndexOf(';'), 1); } stringBuilder.AppendFormat("</span></div>"); } if (storeActivity.FullAmountSentGiftList.Count > 0) { stringBuilder.AppendFormat("<div class=\"song\"><i class=\"tag tag_blue\">送</i><span>"); int num5 = 0; while (num5 < storeActivity.FullAmountSentGiftList.Count) { if (num5 < 2) { stringBuilder.AppendFormat("{0};", storeActivity.FullAmountSentGiftList[num5].ActivityName); num5++; continue; } stringBuilder.AppendFormat("{0}{1}", storeActivity.FullAmountSentGiftList[num5].ActivityName, (storeActivity.FullAmountSentGiftList.Count > 3) ? "等" : ""); break; } if (stringBuilder.ToString().EndsWith(";")) { stringBuilder.Remove(stringBuilder.ToString().LastIndexOf(';'), 1); } stringBuilder.AppendFormat("</span></div>"); } this.litActivityList.Text = stringBuilder.ToString(); if (storeActivity.ActivityCount > 1) { this.litActivityCount.Text = $"<div id=\"huod-b\"><a href=\"javascript:;\">{storeActivity.ActivityCount}个活动</a><i></i></div>"; } } if (this.rp_markting != null) { List <StoreMarktingInfo> storeMarktingInfoList = StoreMarktingHelper.GetStoreMarktingInfoList(); foreach (StoreMarktingInfo item in storeMarktingInfoList) { item.StoreId = this.storeId; item.RedirectTo = this.RedirectToFullPath(item.RedirectTo); } this.rp_markting.DataSource = storeMarktingInfoList; this.rp_markting.DataBind(); } PageTitle.AddSiteNameTitle(storeById.StoreName); } } } else { this.hidIsReloadPosition.Value = "1"; } }
private void UserPayOrder() { if (this.Order != null && this.Order.OrderStatus == OrderStatus.Closed) { OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款"); Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId); this.ResponseReturn(true, ""); } else if ((this.Order != null && this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) || (this.offlineOrder != null && this.offlineOrder.Status == 1)) { this.ResponseReturn(true, ""); } else { try { int maxCount = 0; int yetOrderNum = 0; int currentOrderNum = 0; if (this.Order != null) { if (this.Order.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { return; } yetOrderNum = TradeHelper.GetOrderCount(this.Order.GroupBuyId); currentOrderNum = this.Order.GetGroupBuyOerderNumber(); maxCount = groupBuy.MaxCount; if (maxCount < yetOrderNum + currentOrderNum) { return; } } if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order)) { Task.Factory.StartNew(delegate { TradeHelper.UserPayOrder(this.Order, false, true); try { if (this.offlineOrder != null) { OrderHelper.UpdateOrderPaymentTypeOfAPI(this.Order); OrderHelper.ConfirmTakeGoods(this.Order, true); } if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum) { TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId); } if (this.Order.UserId != 0 && this.Order.UserId != 1100) { string verificationPasswords = ""; if (this.Order.OrderType == OrderType.ServiceOrder) { verificationPasswords = OrderHelper.GetVerificationPasswordsOfOrderId(this.Order.OrderId); } Hidistro.Entities.Members.MemberInfo user = Users.GetUser(this.Order.UserId); if (user != null) { Messenger.OrderPayment(user, this.Order, this.Order.GetTotal(true), verificationPasswords); } } StoresInfo storesInfo2 = null; if (this.Order.StoreId > 0) { storesInfo2 = DepotHelper.GetStoreById(this.Order.StoreId); } if (storesInfo2 != null) { VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderPayed); if (this.offlineOrder == null) { if (this.Order.ShippingModeId == -2) { VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm); } else { VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods); } } } if (this.offlineOrder == null) { ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storesInfo2, null, this.Order, this.Order.GetTotal(true)); } this.Order.OnPayment(); } catch (Exception ex2) { IDictionary <string, string> dictionary2 = new Dictionary <string, string>(); dictionary2.Add("ErrorMessage", ex2.Message); dictionary2.Add("StackTrace", ex2.StackTrace); if (ex2.InnerException != null) { dictionary2.Add("InnerException", ex2.InnerException.ToString()); } if (ex2.GetBaseException() != null) { dictionary2.Add("BaseException", ex2.GetBaseException().Message); } if (ex2.TargetSite != (MethodBase)null) { dictionary2.Add("TargetSite", ex2.TargetSite.ToString()); } dictionary2.Add("ExSource", ex2.Source); Globals.AppendLog(dictionary2, "支付更新订单收款记录或者消息通知时出错:" + ex2.Message, "", "", "UserPay"); } this.Order.OnPayment(); this.ResponseReturn(true, ""); }); } if (this.Order.FightGroupId > 0) { VShopHelper.SetFightGroupSuccess(this.Order.FightGroupId); } } if (this.offlineOrder != null && this.offlineOrder.Status == 0) { this.offlineOrder.Status = 1; this.offlineOrder.PayTime = DateTime.Now; if (StoresHelper.UpdateStoreCollectionInfo(this.offlineOrder) && this.isOfflineOrder) { string text = ""; StoresInfo storeById = DepotHelper.GetStoreById(this.offlineOrder.StoreId); if (storeById != null) { text = storeById.StoreName; StoreBalanceDetailInfo storeBalanceDetailInfo = new StoreBalanceDetailInfo(); storeBalanceDetailInfo.StoreId = this.offlineOrder.StoreId; storeBalanceDetailInfo.TradeDate = DateTime.Now; storeBalanceDetailInfo.TradeType = StoreTradeTypes.OfflineCashier; storeBalanceDetailInfo.Expenses = default(decimal); storeBalanceDetailInfo.Income = this.offlineOrder.PayAmount; storeBalanceDetailInfo.Balance = storeById.Balance + this.offlineOrder.PayAmount; storeBalanceDetailInfo.Remark = "线下收银(" + this.offlineOrder.OrderId + ")"; storeBalanceDetailInfo.ManagerUserName = ""; storeBalanceDetailInfo.TradeNo = this.offlineOrder.OrderId; storeBalanceDetailInfo.CreateTime = DateTime.Now; storeBalanceDetailInfo.PlatCommission = decimal.Zero; if (StoreBalanceHelper.AddBalanceDetailInfo(storeBalanceDetailInfo)) { StoresInfo storesInfo = storeById; storesInfo.Balance += this.offlineOrder.PayAmount; StoresHelper.UpdateStore(storeById); } } if (storeById != null) { VShopHelper.AppPsuhRecordForStore(storeById.StoreId, this.offlineOrder.OrderId, "", EnumPushStoreAction.StoreOrderPayed); } } } } catch (Exception ex) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("ErrorMessage", ex.Message); dictionary.Add("StackTrace", ex.StackTrace); if (ex.InnerException != null) { dictionary.Add("InnerException", ex.InnerException.ToString()); } if (ex.GetBaseException() != null) { dictionary.Add("BaseException", ex.GetBaseException().Message); } if (ex.TargetSite != (MethodBase)null) { dictionary.Add("TargetSite", ex.TargetSite.ToString()); } dictionary.Add("ExSource", ex.Source); Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay1"); } this.ResponseReturn(true, ""); } }