/// <summary>
        /// 提交事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DTO.Business.Address address = new DTO.Business.Address();

            if (Request.Params["AID"] != null)
            {
                address.AddressID = Convert.ToInt32(Request.Params["AID"]);
                address = Business.Business.AddressBLL.Get(address);
            }
            if (string.IsNullOrEmpty(this.DDLSecAddr.SelectedValue) || string.IsNullOrEmpty(this.DDLFirAddr.SelectedValue) || string.IsNullOrEmpty(this.txtAddr.Text))
            {
                Common.MessageBox.ShowAndRedirect(this, "信息填写不完整", "");
                return;
            }
               address.Addr= this.txtAddr.Text;
               address.FaAreaID =int.Parse( this.DDLFirAddr.SelectedValue);
               address.AreaID =int.Parse(this.DDLSecAddr.SelectedValue);

            //修改
               if (Request.Params["AID"] != null)
                Business.Business.AddressBLL.Save(address);
            else {
                address.UserID = Convert.ToInt32(Request.Params["UID"]);
                Business.Business.AddressBLL.Add(address);
            }
            Common.MessageBox.ShowAndRedirect(this, "编辑成功", "CustomEdit.aspx?ID=" + Request.Params["UID"]);
        }
예제 #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbtnRemoveCommand(object sender, CommandEventArgs e)
        {
            DTO.Business.Address address = new DTO.Business.Address();
            address.AddressID = Convert.ToInt32(e.CommandName);
            Business.Business.AddressBLL.Remove(address);
            Common.MessageBox.Show(this, "删除成功");

            GetList();
        }
        /// <summary>
        /// 获取父对象
        /// </summary>
        protected void GetDTO()
        {
            DTO.Business.Address address = new DTO.Business.Address();
            address.AddressID = Convert.ToInt32(Request.Params["AID"]);
            address = Business.Business.AddressBLL.Get(address);
            this.txtAddr.Text = address.Addr;

            this.DDLFirAddr.DataSource = Business.Business.AreaBLL.GetAreaList("0");//一级
            this.DDLFirAddr.DataValueField = "AreaID";
            this.DDLFirAddr.DataTextField = "AreaName";
            this.DDLFirAddr.DataBind();
            this.DDLFirAddr.SelectedValue = address.FaAreaID.ToString();
            this.DDLSecAddr.DataSource = Business.Business.AreaBLL.GetAreaList(address.FaAreaID.ToString());//二级
            this.DDLSecAddr.DataValueField = "AreaID";
            this.DDLSecAddr.DataTextField = "AreaName";
            this.DDLSecAddr.DataBind();
            this.DDLSecAddr.SelectedValue = address.AreaID.ToString();
        }