Ejemplo n.º 1
0
 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);
         AreaModelInfo dataById = AreaModel.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 (AreaModel.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");
         }
     }
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        private void BindData()
        {
            AreaModelInfo dataById = AreaModel.GetDataById(base.OpID);

            if (dataById != null)
            {
                this.TextBox1.Text = dataById.ModelName;
                this.OriginalCitys = dataById.Citys.Split(new char[]
                {
                    ','
                });
            }
            System.Collections.Generic.IList <ZoneInfo> source = (from p in Zone.GetZoneList()
                                                                  orderby p.AutoID
                                                                  select p).ToList <ZoneInfo>();
            System.Text.StringBuilder stringBuilder         = new System.Text.StringBuilder();
            System.Collections.Generic.List <ZoneInfo> list = (from p in source
                                                               where p.Depth.Equals(1)
                                                               select p).ToList <ZoneInfo>();
            if (list != null && list.Count > 0)
            {
                foreach (ZoneInfo itemProvince in list)
                {
                    stringBuilder.Append("{\"Province\":\"" + itemProvince.ZoneName + "\",\"Citys\":[");
                    System.Collections.Generic.List <ZoneInfo> list2 = (from p in source
                                                                        where p.Depth.Equals(2) && p.ParentID.Equals(itemProvince.AutoID)
                                                                        select p).ToList <ZoneInfo>();
                    if (list2 != null && list2.Count > 0)
                    {
                        for (int i = 0; i < list2.Count; i++)
                        {
                            if (i == list2.Count - 1)
                            {
                                stringBuilder.Append(string.Concat(new object[]
                                {
                                    "{\"AutoID\":",
                                    list2[i].AutoID,
                                    ",\"City\":\"",
                                    list2[i].ZoneName,
                                    "\",\"IsChecked\":",
                                    (dataById != null && this.OriginalCitys.Contains(list2[i].AutoID.ToString())) ? 1 : 0,
                                    "}"
                                }));
                            }
                            else
                            {
                                stringBuilder.Append(string.Concat(new object[]
                                {
                                    "{\"AutoID\":",
                                    list2[i].AutoID,
                                    ",\"City\":\"",
                                    list2[i].ZoneName,
                                    "\",\"IsChecked\":",
                                    (dataById != null && this.OriginalCitys.Contains(list2[i].AutoID.ToString())) ? 1 : 0,
                                    "},"
                                }));
                            }
                        }
                    }
                    stringBuilder.Append("]},");
                }
            }
            this.JsonForProvinceAndCity = "[" + stringBuilder.ToString().TrimEnd(new char[]
            {
                ','
            }) + "]";
        }
Ejemplo n.º 4
0
 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
     {
         AreaModelInfo areaModelInfo = new AreaModelInfo();
         if (base.IsEdit)
         {
             areaModelInfo = AreaModel.GetDataById(base.OpID);
         }
         areaModelInfo.ModelName = this.TextBox1.Text.Trim();
         areaModelInfo.Citys     = this.hfIDs.Value.TrimEnd(new char[]
         {
             ','
         });
         if (base.Action.Equals(ActionType.Add.ToString()))
         {
             areaModelInfo.Creator       = base.LoginAccount.AccountName;
             areaModelInfo.AutoTimeStamp = System.DateTime.Now;
             if (AreaModel.Add(areaModelInfo) > 0)
             {
                 PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加区域模板[" + areaModelInfo.ModelName + "] thành công");
                 base.Response.Redirect(string.Concat(new object[]
                 {
                     "AreaModelList.aspx?CatalogID=",
                     base.CurrentCatalogID,
                     "&Module=",
                     base.CurrentModuleCode,
                     "&action=View"
                 }));
             }
             else
             {
                 base.ShowMsg("添加区域模板失败");
             }
         }
         if (base.Action.Equals(ActionType.Modify.ToString()))
         {
             if (AreaModel.Update(areaModelInfo))
             {
                 PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改区域模板[" + areaModelInfo.ModelName + "] thành công");
                 base.Response.Redirect(string.Concat(new object[]
                 {
                     "AreaModelList.aspx?CatalogID=",
                     base.CurrentCatalogID,
                     "&Module=",
                     base.CurrentModuleCode,
                     "&action=View"
                 }));
             }
             else
             {
                 base.ShowMsg("修改区域模板失败");
             }
         }
     }
 }