Beispiel #1
0
        /// <summary>
        /// 编辑权限
        /// </summary>
        public void EditJurisdiction(XMExpressManagement Info)
        {
            if (!string.IsNullOrEmpty(Info.CourierNumber))
            {
                this.ddlExpress.Enabled           = false;
                this.txtReceivingName.ReadOnly    = true;
                this.txtReceivingCompany.ReadOnly = true;
                this.txtReceivingTel.ReadOnly     = true;
                this.ddlProvince.Enabled          = false;
                this.ddlCity.Enabled     = false;
                this.ddlCounty.Enabled   = false;
                this.txtAddress.ReadOnly = true;
                this.txtGoods.ReadOnly   = true;
            }

            if (Jurisdiction != 1)
            {
                if (Info.CreateID != HozestERPContext.Current.User.CustomerID)
                {
                    this.btnSave.Visible = false;
                }
            }
            else
            {
                this.txtPrice.ReadOnly = false;
            }
        }
Beispiel #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            decimal a                = 0;
            string  ExpressID        = this.ddlExpress.SelectedValue;
            int     DepartmentID     = int.Parse(this.ddlDepartment.SelectedValue);
            string  ReceivingName    = this.txtReceivingName.Text.Trim();
            string  ReceivingCompany = this.txtReceivingCompany.Text.Trim();
            string  ReceivingTel     = this.txtReceivingTel.Text.Trim();
            string  Address          = this.txtAddress.Text.Trim();
            string  Price            = this.txtPrice.Text.Trim();
            string  Goods            = this.txtGoods.Text.Trim();
            string  Remarks          = this.txtRemarks.Text.Trim();
            string  Province         = this.ddlProvince.SelectedValue.Trim();
            string  City             = this.ddlCity.SelectedValue.Trim();
            string  County           = this.ddlCounty.SelectedValue.Trim();

            //if (ExpressID == -1)
            //{
            //    base.ShowMessage("请选择快递公司!");
            //    return;
            //}
            if (DepartmentID == -1)
            {
                base.ShowMessage("该账号没有所属的部门!");
                return;
            }
            if (ReceivingName == "")
            {
                base.ShowMessage("请填写收件人姓名!");
                return;
            }
            if (ReceivingTel == "")
            {
                base.ShowMessage("请填写收件人电话!");
                return;
            }
            if (ReceivingTel.Length > 15)
            {
                base.ShowMessage("收件人电话位数太长,请修改!");
                return;
            }
            if (this.ddlCity.SelectedItem == null || this.ddlCounty.SelectedItem == null || this.ddlProvince.SelectedItem.Text == "" ||
                this.ddlCity.SelectedItem.Text == "" || this.ddlCounty.SelectedItem.Text == "")
            {
                base.ShowMessage("请填写收件人省市区!");
                return;
            }
            if (Address == "")
            {
                base.ShowMessage("请填写收件人地址!");
                return;
            }
            if (Price != "")
            {
                if (!decimal.TryParse(Price, out a))
                {
                    base.ShowMessage("价格必须为数字!");
                    return;
                }
            }

            if (Id != 0 && Copy != 1)
            {
                var Info = base.XMExpressManagementService.GetXMExpressManagementByID(Id);
                if (Info != null)
                {
                    if (ExpressID != "")
                    {
                        Info.ExpressID = int.Parse(ExpressID);
                    }

                    Info.ReceivingName    = ReceivingName;
                    Info.ReceivingCompany = ReceivingCompany;
                    Info.ReceivingTel     = ReceivingTel;
                    if (Price != "")
                    {
                        Info.Price = decimal.Parse(Price);
                    }
                    Info.Remarks = Remarks;
                    Info.Goods   = Goods;
                }
                if (Province != "-1")
                {
                    var info = base.AreaCodeService.GetAreaByNumberID(Province);
                    Info.Province = this.ddlProvince.SelectedItem.Text.Trim();

                    if (City != "-2" && City != "-3" && City != "-4")
                    {
                        Info.Province += info.CityType;
                    }
                }
                if (City == "-2" || City == "-3" || City == "-4")
                {
                    Info.City = Info.Province;
                    if (City == "-3" || City == "-4")
                    {
                        Info.City += "市";
                    }
                }
                else if (City != "-1" && City != "-2" && City != "-3" && City != "-4" && City != "")
                {
                    var info = base.AreaCodeService.GetAreaByNumberID(City);
                    Info.City = this.ddlCity.SelectedItem.Text.Trim() + info.CityType;
                }

                if (County != "-1" && County != "")
                {
                    var info = base.AreaCodeService.GetAreaByNumberID(County);
                    Info.County = this.ddlCounty.SelectedItem.Text.Trim() + info.CityType;
                }
                Info.Address    = Address;
                Info.UpdateID   = HozestERPContext.Current.User.CustomerID;
                Info.UpdateDate = DateTime.Now;
                base.XMExpressManagementService.UpdateXMExpressManagement(Info);
            }
            else
            {
                XMExpressManagement Info = new XMExpressManagement();
                if (ExpressID != "")
                {
                    Info.ExpressID = int.Parse(ExpressID);
                }

                Info.CourierNumber    = "";
                Info.DepartmentID     = DepartmentID;
                Info.SendDate         = DateTime.Now;
                Info.ReceivingName    = ReceivingName;
                Info.ReceivingCompany = ReceivingCompany;
                Info.ReceivingTel     = ReceivingTel;
                Info.Province         = this.ddlProvince.SelectedItem.Text;
                Info.City             = this.ddlCity.SelectedItem.Text;
                Info.County           = this.ddlCounty.SelectedItem.Text;
                Info.Address          = Address;
                Info.Remarks          = Remarks;
                Info.PrintCount       = 0;
                Info.Goods            = Goods;
                Info.IsEnable         = false;
                Info.SenderID         = Info.CreateID = Info.UpdateID = HozestERPContext.Current.User.CustomerID;
                Info.CreateDate       = Info.UpdateDate = DateTime.Now;
                base.XMExpressManagementService.InsertXMExpressManagement(Info);
            }
            base.ShowMessage("保存成功!");
        }
        public StringBuilder GetJsonStr(StringBuilder t, string print_data, string Template, XMExpressManagement Info, string emsCustomerCode)
        {
            string no = DateTime.Now.ToString("yyMMddHHmmddfff") + Info.CourierNumber;

            if (t.ToString().IndexOf("documentID") != -1)
            {
                t.Append(",");//多个电子面单
                this.documentIDs.Value += "," + no;
            }
            else
            {
                this.documentIDs.Value = no;
            }

            t.Append("{\"documentID\": \"" + no + "\",\"contents\": ["
                     + print_data);
            t.Append(",{\"templateURL\": \"" + Template + "\",  \"data\": { \"premiumsInfo\": \"内  件:" + Info.Goods + "\"");
            t.Append(",\"orderCode\": \"" + "" + "\"");
            t.Append(",\"emsCustomerCode\": \"" + emsCustomerCode + "\"");
            t.Append(",\"isInvoiced\": \"" + "" + "\"");
            t.Append("}}]}");

            return(t);
        }