private void BindPostageModel() { this.ddlPostageModel.DataSource = PostageModel.GetList(1000, "", "AutoID desc"); this.ddlPostageModel.DataTextField = "ModelName"; this.ddlPostageModel.DataValueField = "AutoID"; this.ddlPostageModel.DataBind(); }
// GET: Postage public ActionResult Index(string price = "", string weight = "", string size = "") { if (string.IsNullOrEmpty(price) || string.IsNullOrEmpty(weight) || string.IsNullOrEmpty(size)) { return(View()); } var postages = PostageCalculator.GetPostages(weight, price, size).OrderBy(x => x.Price); var model = new PostageModel { Economy = postages.FirstOrDefault(x => x.Type == PostageCalculator.ServiceType.Economy), Standard = postages.FirstOrDefault(x => x.Type == PostageCalculator.ServiceType.Standard), Express = postages.FirstOrDefault(x => x.Type == PostageCalculator.ServiceType.Express), Price = price, Weight = weight, Size = size == "LL" ? "Large Letter" : size == "SP" ? "Small Parcel" : "Parcel" }; model.Alternatives = postages.Where(x => x.Name != model.Economy.Name && x.Name != model.Standard.Name && x.Name != model.Express.Name); return(View(model)); }
protected void lnk_Delete_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { int @int = WebUtils.GetInt((sender as LinkButton).CommandArgument); PostageModelInfo dataById = PostageModel.GetDataById(@int); if (dataById == null) { base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa"); } else if (PostageModel.Delete(@int)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除邮费模板[" + dataById.ModelName + "] thành công"); base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại"); } } }
private void InitForModify() { PostageModelInfo dataById = PostageModel.GetDataById(base.OpID); this.TextBox1.Text = dataById.ModelName; this.TextBox2.Text = dataById.ShortDesc; this.hfOldIDs.Value = dataById.RuleSet; }
private void BindData() { int recordCount = 0; int num = 0; string strSort = " AutoID DESC "; this.SinGooPager1.PageSize = WebUtils.GetInt(this.drpPageSize.SelectedValue); this.Repeater1.DataSource = PostageModel.GetPagerList(this.GetCondition(), strSort, this.SinGooPager1.PageIndex, this.SinGooPager1.PageSize, ref recordCount, ref num); this.Repeater1.DataBind(); this.SinGooPager1.RecordCount = recordCount; }
private void GetShippingFee() { ShippingParam shippingParam = JsonUtils.JsonToObject <ShippingParam>(WebUtils.GetQueryString("querystr")); ShippingAddressInfo addr = ShippingAddress.GetDataById((shippingParam == null) ? 0 : shippingParam.addrid); if (addr != null && shippingParam != null && shippingParam.pros.Count > 0) { foreach (ProAndNum current in shippingParam.pros) { ProductInfo dataById = Product.GetDataById(current.pid); AreaModelInfo dataById2 = AreaModel.GetDataById((dataById == null) ? 0 : dataById.AreaModelID); PostageModelInfo dataById3 = PostageModel.GetDataById((dataById == null) ? 0 : dataById.PostageModelID); bool arg_DD_0; if (dataById2 != null) { arg_DD_0 = ((from p in dataById2.CityList where p.ZoneName.Equals(addr.City) select p).FirstOrDefault <ZoneInfo>() == null); } else { arg_DD_0 = true; } if (!arg_DD_0) { current.isshipping = true; } if (dataById3 != null && dataById3.PostageItems.Count > 0) { PostageItem postageItem = (from p in dataById3.PostageItems where p.AreaNames.Contains(addr.Province) select p).FirstOrDefault <PostageItem>(); if (postageItem != null && current.isshipping) { current.shippingfee = postageItem.ExpFee + (current.num - 1) * postageItem.ExpAddoneFee; } } } shippingParam.totalfee = shippingParam.pros.Sum((ProAndNum p) => p.shippingfee); } base.Response.Write(JsonUtils.ObjectToJson <ShippingParam>(shippingParam)); }
protected void btn_DelBat_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { string repeaterCheckIDs = base.GetRepeaterCheckIDs(this.Repeater1, "chk", "autoid"); if (!string.IsNullOrEmpty(repeaterCheckIDs)) { if (PostageModel.Delete(repeaterCheckIDs)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "批量删除邮费模板成功"); base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại"); } } } }
protected void btnok_Click(object sender, System.EventArgs e) { if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else { PostageModelInfo postageModelInfo = new PostageModelInfo(); if (base.IsEdit) { postageModelInfo = PostageModel.GetDataById(base.OpID); } postageModelInfo.ModelName = this.TextBox1.Text.Trim(); postageModelInfo.ShortDesc = this.TextBox2.Text.Trim(); postageModelInfo.RuleSet = this.hfNewIDs.Value; postageModelInfo.Creator = base.LoginAccount.AccountName; postageModelInfo.AutoTimeStamp = System.DateTime.Now; if (string.IsNullOrEmpty(postageModelInfo.ModelName)) { base.ShowMsg("模板名称不能为空"); } else { if (base.Action.Equals(ActionType.Add.ToString())) { if (PostageModel.Add(postageModelInfo) > 0) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加邮费模板[" + postageModelInfo.ModelName + "] thành công"); base.Response.Redirect(string.Concat(new object[] { "PostageModelList.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&action=View" })); } else { base.ShowMsg("Thao tác thất bại"); } } if (base.Action.Equals(ActionType.Modify.ToString())) { if (PostageModel.Update(postageModelInfo)) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改邮费模板[" + postageModelInfo.ModelName + "] thành công"); base.Response.Redirect(string.Concat(new object[] { "PostageModelList.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&action=View" })); } else { base.ShowMsg("Thao tác thất bại"); } } } } }