protected void Page_Load(object sender, System.EventArgs e) { if (!base.IsPostBack) { System.Data.DataTable expressTable = ExpressHelper.GetExpressTable(); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); foreach (System.Data.DataRow dataRow in expressTable.Rows) { stringBuilder.AppendFormat("<option value='{0}'>{0}</option>", dataRow["Name"]); } this.ems = stringBuilder.ToString(); } }
protected void btnSave_Click(object sender, System.EventArgs e) { string key = this.txtKey.Text.Trim(); string text = this.txtUrl.Text.Trim(); if (string.IsNullOrEmpty(text)) { this.ShowMsg("物理查询地址不允许为空!", false); return; } ExpressHelper.UpdateExpressUrlAndKey(key, text); this.ShowMsg("修改物流查询地址和快递100 key成功!", true); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { DataTable expressTable = ExpressHelper.GetExpressTable(); StringBuilder builder = new StringBuilder(); foreach (DataRow row in expressTable.Rows) { builder.AppendFormat("<option value='{0}'>{0}</option>", row["Name"]); } this.ems = builder.ToString(); } }
private void UpdateCloseStaute(HttpContext context) { string name = context.Request["LogisticsName"]; bool staut = !string.IsNullOrEmpty(context.Request["CloseStaute"]) && context.Request["CloseStaute"] == "true"; bool flag = ExpressHelper.UpdateStaut(name, staut); context.Response.Clear(); context.Response.ContentType = "application/json"; context.Response.Write("{ "); context.Response.Write(string.Format("\"IsSuccess\":\"{0}\"", flag ? "1" : "0")); context.Response.Write("}"); context.Response.End(); }
private void BindData() { DropdownColumn column = (DropdownColumn)this.grdOrderGoods.Columns[4]; column.DataSource = SalesHelper.GetShippingModes(); DropdownColumn column2 = (DropdownColumn)this.grdOrderGoods.Columns[5]; column2.DataSource = ExpressHelper.GetAllExpress(); string orderIds = "'" + this.strIds.Replace(",", "','") + "'"; this.grdOrderGoods.DataSource = OrderHelper.GetSendGoodsOrders(orderIds); this.grdOrderGoods.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { string key = this.txtKey.Text.Trim(); string str2 = this.txtUrl.Text.Trim(); if (string.IsNullOrEmpty(str2)) { this.ShowMsg("物理查询地址不允许为空!", false); } else { ExpressHelper.UpdateExpressUrlAndKey(key, str2); this.ShowMsg("修改物流查询地址和快递100 key成功!", true); } }
public async Task RetrieveIdsLong <TEntity>(IContextAdapter context, TEntity[] entities) { var tableName = context.GetTableName <TEntity>(); var entitiesLength = entities.Length; var minId = Minus(await context.RunScalar <TValue>(RetrieveIdsSql(tableName, entitiesLength)), entitiesLength); var pkSetter = ExpressHelper.GetPropSetter <TEntity, TValue>(context.GetPk <TEntity>().PropertyName).Compile(); var id = minId; foreach (var entity in entities) { id = AddOne(id); pkSetter(entity, id); } }
protected override void AttachChildControls() { this.txtRefundRemark = (System.Web.UI.WebControls.TextBox) this.FindControl("txtRefundRemark"); this.txtReturnRemark = (System.Web.UI.WebControls.TextBox) this.FindControl("txtReturnRemark"); this.txtReplaceRemark = (System.Web.UI.WebControls.TextBox) this.FindControl("txtReplaceRemark"); this.rptOrderProducts = (WapTemplatedRepeater)this.FindControl("rptOrderProducts"); this.dropLogisticsCompany = (System.Web.UI.WebControls.DropDownList) this.FindControl("dropLogisticsCompany"); this.dropRefundReason = (System.Web.UI.WebControls.DropDownList) this.FindControl("dropRefundReason"); this.dropReturnReason = (System.Web.UI.WebControls.DropDownList) this.FindControl("dropReturnReason"); string action = this.Page.Request.QueryString["Action"]; string orderId = this.Page.Request.QueryString["OrderId"]; if (action == "Refund") { PageTitle.AddSiteNameTitle("退款申请"); WAPHeadName.AddHeadName("退款申请"); } else if (action == "Return") { PageTitle.AddSiteNameTitle("退货申请"); WAPHeadName.AddHeadName("退货申请"); } else if (action == "Replace") { PageTitle.AddSiteNameTitle("换货申请"); WAPHeadName.AddHeadName("换货申请"); } //OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId); IList <string> list = ExpressHelper.GetAllExpressName(); List <ListItem> item = new List <ListItem>(); foreach (string s in list) { item.Add(new ListItem(s, s)); } dropLogisticsCompany.Items.AddRange(item.ToArray()); //绑定物流公司选择 //IList<ShippingModeInfo> shippingModes = ControlProvider.Instance().GetShippingModes(); //dropLogisticsCompany.DataSource = shippingModes; //dropLogisticsCompany.DataValueField = "Name"; //dropLogisticsCompany.DataMember = "Name"; //dropLogisticsCompany.DataBind(); this.rptOrderProducts.DataSource = ShoppingProcessor.GetOrderItems(orderId); this.rptOrderProducts.DataBind(); BindRefundReason(); BindReturnReason(); }
protected void Page_Load(object sender, EventArgs e) { this.strIds = base.Request.QueryString["OrderIds"]; this.btnSetShipOrderNumber.Click += this.btnSetShipOrderNumber_Click; this.grdOrderGoods.ItemDataBound += this.grdOrderGoods_RowDataBound; this.btnBatchSendGoods.Click += this.btnSendGoods_Click; if (!this.Page.IsPostBack) { this.dropExpressComputerpe.DataSource = ExpressHelper.GetAllExpress(false); this.dropExpressComputerpe.DataTextField = "Name"; this.dropExpressComputerpe.DataValueField = "Name"; this.dropExpressComputerpe.DataBind(); this.dropExpressComputerpe.Items.Insert(0, new ListItem("", "")); this.BindData(); } }
private void grdOrderGoods_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow) { string orderId = (string)this.grdOrderGoods.DataKeys[e.Row.RowIndex].Value; System.Web.UI.WebControls.DropDownList dropDownList = e.Row.FindControl("dropExpress") as System.Web.UI.WebControls.DropDownList; OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId); if (orderInfo != null && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid) { ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(orderInfo.ExpressCompanyName); if (expressCompanyInfo != null) { dropDownList.SelectedValue = expressCompanyInfo.Kuaidi100Code; } } } }
private void grdOrderGoods_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string orderId = (string)this.grdOrderGoods.DataKeys[e.Row.RowIndex].Value; DropDownList list = e.Row.FindControl("dropExpress") as DropDownList; OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId); if ((orderInfo != null) && (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)) { ExpressCompanyInfo info2 = ExpressHelper.FindNode(orderInfo.ExpressCompanyName); if (info2 != null) { list.SelectedValue = info2.Kuaidi100Code; } } } }
protected void Page_Load(object sender, System.EventArgs e) { this.strIds = base.Request.QueryString["OrderIds"]; this.btnSetShippingMode.Click += new System.EventHandler(this.btnSetShippingMode_Click); this.btnSetShipOrderNumber.Click += new System.EventHandler(this.btnSetShipOrderNumber_Click); this.grdOrderGoods.RowDataBound += new System.Web.UI.WebControls.GridViewRowEventHandler(this.grdOrderGoods_RowDataBound); this.btnBatchSendGoods.Click += new System.EventHandler(this.btnSendGoods_Click); if (!this.Page.IsPostBack) { this.dropShippingMode.DataBind(); this.dropExpressComputerpe.DataSource = ExpressHelper.GetAllExpress(); this.dropExpressComputerpe.DataTextField = "Name"; this.dropExpressComputerpe.DataValueField = "Name"; this.dropExpressComputerpe.DataBind(); this.dropExpressComputerpe.Items.Insert(0, new System.Web.UI.WebControls.ListItem("", "")); this.BindData(); } }
private Queryable <T1, T> GetJoin <Tj>(JoinType joinType, Expression expression, int index) { LambdaExpression lambda = expression as LambdaExpression; ReadOnlyCollection <ParameterExpression> parameters = lambda.Parameters; this.CheckShortName(parameters[0].ToString()); if (joinBuilder == null) { joinBuilder = new StringBuilder(); } var tjShortName = parameters[index].ToString(); this.SetType <Tj>(tjShortName); string join = ExpressHelper.SqlWhere(lambda.Body); joinBuilder.AppendFormat(" {0} join [{1}] {2} on ({3})", joinType.ToString(), ObjectUtil.GetTableName <Tj>(!mapColumns), tjShortName, join); return(this); }
private void LoadDataSource() { System.Data.DataTable expressTable = ExpressHelper.GetExpressTable(); if (!string.IsNullOrEmpty(this.companyname)) { expressTable.DefaultView.RowFilter = "Name like '%" + this.companyname + "%'"; } if (!string.IsNullOrEmpty(this.kuaidi100Code)) { expressTable.DefaultView.RowFilter = "Kuaidi100Code like '%" + this.kuaidi100Code + "%'"; } if (!string.IsNullOrEmpty(this.taobaoCode)) { expressTable.DefaultView.RowFilter = "TaobaoCode like '%" + this.taobaoCode + "%'"; } this.grdExpresscomputors.DataSource = expressTable.DefaultView; this.grdExpresscomputors.DataBind(); }
private void btnCreateValue_Click(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(this.txtAddCmpName.Text.Trim())) { this.ShowMsg("物流名称不允许为空!", false); } else { if (string.IsNullOrEmpty(this.txtAddKuaidi100Code.Text.Trim())) { this.ShowMsg("快递100Code不允许为空!", false); } else { if (string.IsNullOrEmpty(this.txtAddTaobaoCode.Text.Trim())) { this.ShowMsg("淘宝Code不允许为空!", false); } else { if (!string.IsNullOrEmpty(this.hdcomputers.Value.Trim())) { ExpressHelper.UpdateExpress(Globals.HtmlEncode(this.hdcomputers.Value.Trim()), Globals.HtmlEncode(this.txtAddCmpName.Text.Trim()), Globals.HtmlEncode(this.txtAddKuaidi100Code.Text.Trim()), Globals.HtmlEncode(this.txtAddTaobaoCode.Text.Trim())); this.ShowMsg("修改物流公司信息成功!", true); } else { if (ExpressHelper.IsExitExpress(this.txtAddCmpName.Text.Trim())) { this.ShowMsg("此物流公司已存在,请重新输入!", false); return; } ExpressHelper.AddExpress(Globals.HtmlEncode(this.txtAddCmpName.Text.Trim()), Globals.HtmlEncode(this.txtAddKuaidi100Code.Text.Trim()), Globals.HtmlEncode(this.txtAddTaobaoCode.Text.Trim())); this.ShowMsg("添加物流公司信息成功!", true); } this.LoadDataSource(); this.txtAddCmpName.Text = ""; this.txtAddKuaidi100Code.Text = ""; this.txtAddTaobaoCode.Text = ""; this.hdcomputers.Value = ""; } } } }
public void BindExpressCheckBoxList() { base.Items.Clear(); foreach (ExpressCompanyInfo info in ExpressHelper.GetAllExpress()) { ListItem item = new ListItem(info.Name, info.Name); if (this.ExpressCompany != null) { foreach (string str in this.ExpressCompany) { if (string.Compare(item.Value, str, false) == 0) { item.Selected = true; } } } base.Items.Add(item); } }
public override void DataBind() { IList <string> list = this.ExpressCompanies; if (list == null || list.Count == 0) { list = ExpressHelper.GetAllExpressName(); } base.Items.Clear(); foreach (string current in list) { ListItem listItem = new ListItem(current, current); if (string.Compare(listItem.Value, this.Name, false) == 0) { listItem.Selected = true; } base.Items.Add(listItem); } }
protected void Page_Load(object sender, System.EventArgs e) { int result = 0; string str = this.Page.Request.QueryString["ExpressName"]; string str2 = this.Page.Request.QueryString["XmlFile"]; if (!int.TryParse(this.Page.Request.QueryString["ExpressId"], out result)) { base.GotoResourceNotFound(); } else { if (string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str2) || !str2.EndsWith(".xml")) { base.GotoResourceNotFound(); } else { if (!base.IsPostBack) { System.Data.DataTable expressTable = ExpressHelper.GetExpressTable(); XmlDocument document = new XmlDocument(); document.Load(System.Web.HttpContext.Current.Request.MapPath(Globals.ApplicationPath + string.Format("/Storage/master/flex/{0}", str2))); string innerText = document.SelectSingleNode("/printer/size").InnerText; this.width = innerText.Split(new char[] { ':' })[0]; this.height = innerText.Split(new char[] { ':' })[1]; System.Text.StringBuilder builder = new System.Text.StringBuilder(); foreach (System.Data.DataRow row in expressTable.Rows) { builder.AppendFormat("<option value='{0}' {1}>{0}</option>", row["Name"], row["Name"].Equals(str) ? "selected" : ""); } this.ems = builder.ToString(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { DataTable expressTable = ExpressHelper.GetExpressTable(); StringBuilder builder = new StringBuilder(); foreach (DataRow row in expressTable.Rows) { builder.AppendFormat("<option value='{0}'>{0}</option>", row["Name"]); } this.ems = builder.ToString(); } string str = this.Page.Request.QueryString["ExpressName"]; string str2 = this.Page.Request.QueryString["XmlFile"]; if ((string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str2)) || !str2.EndsWith(".xml")) { base.GotoResourceNotFound(); } }
private List <ExpressListItem> GetExpressCompany() { List <ExpressListItem> items = new List <ExpressListItem>(); IList <ExpressCompanyInfo> expressList = ExpressHelper.GetAllExpress(); if (expressList != null) { int i = 1; foreach (var current in expressList) { items.Add(new ExpressListItem(current.Kuaidi100Code, current.Name, "", i)); i++; } } return(items); }
private void AddAndUpdate(HttpContext context) { string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; text = base.GetParameter(context, "companyname", false); text2 = base.GetParameter(context, "kuaidi100Code", false); text3 = base.GetParameter(context, "taobaoCode", false); text4 = base.GetParameter(context, "jdCode", false); if (string.IsNullOrEmpty(text.Trim())) { throw new HidistroAshxException("物流名称不允许为空!"); } if (string.IsNullOrEmpty(text2.Trim())) { throw new HidistroAshxException("快递鸟Code不允许为空!"); } if (string.IsNullOrEmpty(text3.Trim())) { throw new HidistroAshxException("淘宝Code不允许为空!"); } if (string.IsNullOrEmpty(text4.Trim())) { throw new HidistroAshxException("京东Code不允许为空!"); } string parameter = base.GetParameter(context, "hdcomputers", false); if (!string.IsNullOrEmpty(parameter.Trim())) { ExpressHelper.UpdateExpress(Globals.HtmlEncode(parameter), Globals.HtmlEncode(text.Trim()), Globals.HtmlEncode(text2.Trim()), Globals.HtmlEncode(text3.Trim()), Globals.HtmlEncode(text4.Trim())); base.ReturnSuccessResult(context, "修改物流公司信息成功!", 0, true); } else if (ExpressHelper.IsExitExpress(text.Trim())) { throw new HidistroAshxException("此物流公司已存在,请重新输入!"); } ExpressHelper.AddExpress(Globals.HtmlEncode(text.Trim()), Globals.HtmlEncode(text2.Trim()), Globals.HtmlEncode(text3.Trim()), Globals.HtmlEncode(text4.Trim())); base.ReturnSuccessResult(context, "添加物流公司信息成功!", 0, true); }
private void BindExpressCompany(int modeId) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (!masterSettings.OpenMultStore) { this.expressRadioButtonList.ExpressCompanies = ExpressHelper.GetAllExpressName(false); this.expressRadioButtonList.DataBind(); } else if (modeId != -1 && modeId != -2) { this.expressRadioButtonList.ExpressCompanies = ExpressHelper.GetAllExpressName(false); this.expressRadioButtonList.DataBind(); } else { IList <string> allExpressName = ExpressHelper.GetAllExpressName(false); this.expressRadioButtonList.ExpressCompanies = allExpressName; this.expressRadioButtonList.DataBind(); } }
public void BindExpressCheckBoxList() { base.Items.Clear(); IList <ExpressCompanyInfo> allExpress = ExpressHelper.GetAllExpress(); foreach (ExpressCompanyInfo current in allExpress) { ListItem listItem = new ListItem(current.Name, current.Name); if (this.ExpressCompany != null) { foreach (string current2 in this.ExpressCompany) { if (string.Compare(listItem.Value, current2, false) == 0) { listItem.Selected = true; } } } base.Items.Add(listItem); } }
public static DataTable GetDataReader <T>(this DbContext context, IEnumerable <T> entities) { var propertyMaps = context.Db <T>().Properties; var table = propertyMaps.CreateTable(); var columns = propertyMaps.Select(o => new { o.ColumnName, GetValue = o.IsDiscriminator ? x => typeof(T).Name : ExpressHelper.GetPropGetter <T>(o.PropertyName).Compile() }).ToArray(); foreach (var entity in entities) { var dataRow = table.Rows.Add(); foreach (var column in columns) { dataRow[column.ColumnName] = column.GetValue(entity) ?? DBNull.Value; } } return(table); }
//订单完成页面 protected override void AttachChildControls() { string str = this.Page.Request.QueryString["orderId"]; if (string.IsNullOrEmpty(str)) { base.GotoResourceNotFound(""); } OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(str); ExpressSet expressSet = ExpressHelper.GetExpressSet(); Literal literal = this.FindControl("litHasNewKey") as Literal; Literal literal2 = this.FindControl("litExpressUrl") as Literal; Literal control = this.FindControl("litCompanyCode") as Literal; literal.Text = "0"; literal2.Text = ""; if (expressSet != null) { if (!string.IsNullOrEmpty(expressSet.NewKey)) { literal.Text = "1"; } if (!string.IsNullOrEmpty(expressSet.Url.Trim())) { literal2.Text = expressSet.Url.Trim(); } } Literal literal4 = this.FindControl("litOrderID") as Literal; Literal literal5 = this.FindControl("litNumberID") as Literal; Literal literal6 = this.FindControl("litCompanyName") as Literal; Literal literal7 = this.FindControl("litLogisticsNumber") as Literal; literal4.Text = str; literal5.Text = orderInfo.ShipOrderNumber; literal6.SetWhenIsNotNull(orderInfo.ExpressCompanyName); literal7.SetWhenIsNotNull(orderInfo.ShipOrderNumber); control.SetWhenIsNotNull(orderInfo.ExpressCompanyAbb); PageTitle.AddSiteNameTitle("我的物流"); }
protected void Page_Load(object sender, System.EventArgs e) { int num = 0; string text = this.Page.Request.QueryString["ExpressName"]; string text2 = this.Page.Request.QueryString["XmlFile"]; if (!int.TryParse(this.Page.Request.QueryString["ExpressId"], out num)) { base.GotoResourceNotFound(); return; } if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2) && text2.EndsWith(".xml")) { if (!base.IsPostBack) { System.Data.DataTable expressTable = ExpressHelper.GetExpressTable(); System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument(); xmlDocument.Load(System.Web.HttpContext.Current.Request.MapPath(Globals.ApplicationPath + string.Format("/Storage/master/flex/{0}", text2))); System.Xml.XmlNode xmlNode = xmlDocument.SelectSingleNode("/printer/size"); string innerText = xmlNode.InnerText; this.width = innerText.Split(new char[] { ':' })[0]; this.height = innerText.Split(new char[] { ':' })[1]; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); foreach (System.Data.DataRow dataRow in expressTable.Rows) { stringBuilder.AppendFormat("<option value='{0}' {1}>{0}</option>", dataRow["Name"], dataRow["Name"].Equals(text) ? "selected" : ""); } this.ems = stringBuilder.ToString(); } return; } base.GotoResourceNotFound(); }
protected void Page_Load(object sender, EventArgs e) { wid = GetCurWebId(); if (string.IsNullOrEmpty(wid)) { return; } this.strIds = base.Request.QueryString["OrderIds"]; this.btnSetShippingMode.Click += new EventHandler(this.btnSetShippingMode_Click); this.btnSetShipOrderNumber.Click += new EventHandler(this.btnSetShipOrderNumber_Click); this.grdOrderGoods.RowDataBound += new GridViewRowEventHandler(this.grdOrderGoods_RowDataBound); this.btnBatchSendGoods.Click += new EventHandler(this.btnSendGoods_Click); if (!this.Page.IsPostBack) { this.dropShippingMode.DataBind(); this.dropExpressComputerpe.DataSource = ExpressHelper.GetAllExpress(); this.dropExpressComputerpe.DataTextField = "name"; this.dropExpressComputerpe.DataValueField = "Kuaidi100Code"; this.dropExpressComputerpe.DataBind(); this.dropExpressComputerpe.Items.Insert(0, new ListItem("", "")); this.BindData(); } }
private static DataTable GetDataTable <T>(this IContextAdapter contextAdapter, IEnumerable <T> entities) { var propertyMaps = contextAdapter.GetProperties <T>().ToArray(); var table = propertyMaps.CreateTable(); var columns = propertyMaps.Select(o => new { o.ColumnName, GetValue = o.IsDiscriminator ? x => contextAdapter.GetDiscriminatorValue(x.GetType()) : ExpressHelper.GetPropGetter <T>(o.PropertyName).Compile(), o.ValueTransform }).ToArray(); foreach (var entity in entities) { var dataRow = table.Rows.Add(); foreach (var column in columns) { dataRow[column.ColumnName] = column.ValueTransform(column.GetValue(entity)) ?? DBNull.Value; } } return(table); }
public string SendLogistic(string tid, string company_name, string out_sid) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(tid); if (orderInfo == null || string.IsNullOrEmpty(orderInfo.OrderId)) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_not_Exists, "tid")); } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_Send, "group order")); } if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_Send, "orderstatue")); } if (string.IsNullOrEmpty(out_sid)) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Required_Arguments, "out_sid")); } ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(company_name); if (expressCompanyInfo == null) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Company_not_Exists, "company_name")); } orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ShipOrderNumber = out_sid; if (!OrderHelper.SendGoods(orderInfo)) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_Send, "send good")); } Express.SubscribeExpress100(orderInfo.ExpressCompanyAbb, out_sid); OrderHelper.SaveSendNote(new SendNoteInfo { NoteId = Globals.GetGenerateId(), OrderId = orderInfo.OrderId, Operator = orderInfo.UserId.ToString(), Remark = "接口发货成功" }); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayClient payClient; if (masterSettings.EnableSP) { payClient = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID); } else { payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", ""); } payClient.DeliverNotify(new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }); } } orderInfo.OnDeliver(); string format = "{{\"logistics_send_response\":{{\"shipping\":{{\"is_success\":{0}}}}}}}"; return(string.Format(format, "true")); }
private void btnSendGoods_Click(object sender, EventArgs e) { if (this.grdOrderGoods.Items.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); } else { StringBuilder stringBuilder = new StringBuilder(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); int num = 0; for (int i = 0; i < this.grdOrderGoods.Items.Count; i++) { HiddenField hiddenField = (HiddenField)this.grdOrderGoods.Items[i].FindControl("hidorderId"); string value = hiddenField.Value; TextBox textBox = (TextBox)this.grdOrderGoods.Items[i].FindControl("txtShippOrderNumber"); ExpressDropDownList expressDropDownList = this.grdOrderGoods.Items[i].FindControl("expressList1") as ExpressDropDownList; OrderInfo orderInfo = OrderHelper.GetOrderInfo(value); if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)) { ExpressCompanyInfo expressCompanyInfo = null; if (!string.IsNullOrEmpty(expressDropDownList.SelectedValue)) { expressCompanyInfo = ExpressHelper.FindNode(expressDropDownList.SelectedValue); } if (expressCompanyInfo != null) { if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && orderInfo.OuterOrderId.StartsWith("jd_") && string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode)) { continue; } orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ShipOrderNumber = textBox.Text; } if (OrderHelper.SendGoods(orderInfo) && expressCompanyInfo != null && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); } if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null) { string hIGW = paymentMode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.PayOrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.PayOrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new { HIGW = hIGW })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new { HIGW = hIGW })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && expressCompanyInfo != null) { if (orderInfo.OuterOrderId.StartsWith("tb_")) { string text = orderInfo.OuterOrderId.Replace("tb_", ""); try { string requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}"; WebRequest webRequest = WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch { } } else if (orderInfo.OuterOrderId.StartsWith("jd_") && expressCompanyInfo != null) { string text = orderInfo.OuterOrderId.Replace("jd_", ""); try { JDHelper.JDOrderOutStorage(masterSettings.JDAppKey, masterSettings.JDAppSecret, masterSettings.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text); } catch (Exception ex) { stringBuilder.Append($"订单:{orderInfo.OrderId}同步京东发货失败,京东订单号:{text},{ex.Message}\r\n"); } } } int num2 = orderInfo.UserId; if (num2 == 1100) { num2 = 0; } MemberInfo user = Users.GetUser(num2); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); num++; } } if (num == 0) { this.ShowMsg("批量发货失败,您填写的信息不完整!", false); } else if (num > 0) { this.ShowMsgCloseWindow(string.Format("批量发货成功!发货数量{0}个!{1}", num, (stringBuilder.Length > 0) ? stringBuilder.ToString() : ""), true); } } }