/// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbtnRemoveCommand(object sender, CommandEventArgs e)
        {
            DTO.Business.RepairType repair = new DTO.Business.RepairType();
            repair.RepairTypeID = Convert.ToInt32(e.CommandName);
            Business.Business.RepairTypeBLL.Remove(repair);
            Common.MessageBox.Show(this, "删除成功");

            GetList();
        }
Exemple #2
0
 /// <summary>
 /// 获取父对象
 /// </summary>
 protected void GetDTO()
 {
     DTO.Business.RepairType repair = new DTO.Business.RepairType();
     repair.RepairTypeID = Convert.ToInt32(Request.Params["ID"]);
     repair = Business.Business.RepairTypeBLL.Get(repair);
     this.txtRepairName.Text = repair.RepairName;
     this.txtSort.Text = repair.Sort.ToString();
     this.txtPrice.Text = repair.Price.ToString();
     this.txtUnit.Text = repair.Unit;
 }
        /// <summary>
        /// 获取父对象
        /// </summary>
        protected void GetDTO()
        {
            DTO.Business.RepairType repair = new DTO.Business.RepairType();
            repair.RepairTypeID = Convert.ToInt32(Request.Params["ID"]);
            repair = Business.Business.RepairTypeBLL.Get(repair);
            this.txtRepairName.Text = repair.RepairName;
            this.txtSort.Text = repair.Sort.ToString();
            this.txtPrice.Text = repair.Price.ToString();
            this.txtUnit.Text = repair.Unit;

            //this.DDLFirType.DataSource = Business.Business.RepairTypeBLL.GetRepairTypeList("0");//一级
            //this.DDLFirType.DataValueField = "RepairTypeID";
            //this.DDLFirType.DataTextField = "RepairName";
            //this.DDLFirType.DataBind();

            ////判断读取的id是1级类别还是二级类别
            //if (repair.FaTypeID == 0)
            //{ //1级
            //    this.DDLSecType.DataSource = Business.Business.RepairTypeBLL.GetRepairTypeList(repair.RepairTypeID.ToString());//二级
            //    this.DDLSecType.DataValueField = "RepairTypeID";
            //    this.DDLSecType.DataTextField = "RepairName";
            //    this.DDLSecType.DataBind();
            //    this.DDLFirType.SelectedValue=repair.RepairTypeID.ToString();
            //    this.DDLSecType.Items.Insert(0, new ListItem() { Value = "-1", Text = "无" });
            //}
            //else
            //{
            //    this.DDLSecType.DataSource = Business.Business.RepairTypeBLL.GetRepairTypeList(repair.FaTypeID.ToString());//二级
            //    this.DDLSecType.DataValueField = "RepairTypeID";
            //    this.DDLSecType.DataTextField = "RepairName";
            //    this.DDLSecType.DataBind();
            //    this.DDLFirType.SelectedValue = repair.FaTypeID.ToString();
            //    this.DDLSecType.Items.Insert(0, new ListItem() { Value = "-1", Text = "无" });
            //    this.DDLSecType.SelectedValue = repair.RepairTypeID.ToString();

            //}

            //if (repair.FaTypeID == 0)
            //{
            //    this.DDLSecType.Visible = false;
            //    this.RBLGrade.SelectedValue = "1";
            //}
            //else
            //{
            //    this.DDLSecType.Visible = true;
            //    this.RBLGrade.SelectedValue = "2";
            //}
        }
Exemple #4
0
        /// <summary>
        /// 提交事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DTO.Business.RepairType repair = new DTO.Business.RepairType();
            if (Request.Params["ID"] != null)
            {
                repair.RepairTypeID = Convert.ToInt32(Request.Params["ID"]);
                repair = Business.Business.RepairTypeBLL.Get(repair);

            }
            repair.RepairName = this.txtRepairName.Text;
            repair.Sort = int.Parse(this.txtSort.Text);
            repair.Price = (this.txtPrice.Text=="")?0:int.Parse(this.txtPrice.Text);
            repair.Unit = this.txtUnit.Text;
            //修改
            if (Request.Params["ID"] != null)
                Business.Business.RepairTypeBLL.Save(repair);
            else
            {
                repair.FaTypeID = int.Parse(Request.Params["FID"]);
                Business.Business.RepairTypeBLL.Add(repair);
            }
            Common.MessageBox.ShowAndRedirect(this, "编辑成功", "List.aspx");
        }
        /// <summary>
        /// 提交事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DTO.Business.RepairType repair = new DTO.Business.RepairType();

            if (string.IsNullOrEmpty(this.txtRepairName.Text) || string.IsNullOrEmpty(this.txtSort.Text) || string.IsNullOrEmpty(this.txtPrice.Text) || string.IsNullOrEmpty(this.txtUnit.Text)) { Common.MessageBox.ShowAndRedirect(this, "信息填写不完整", ""); return; }
            if (!System.Text.RegularExpressions.Regex.IsMatch(this.txtPrice.Text, "^[0-9]*$")) { Common.MessageBox.ShowAndRedirect(this, "请输入正确的价格", ""); return; }
            if (Request.Params["ID"] != null)
            {
                repair.RepairTypeID = Convert.ToInt32(Request.Params["ID"]);
                repair = Business.Business.RepairTypeBLL.Get(repair);

            }
            repair.RepairName = this.txtRepairName.Text;
                repair.Sort = int.Parse(this.txtSort.Text);
                repair.Price = int.Parse(this.txtPrice.Text);
                repair.Unit = this.txtUnit.Text;
            //修改
            if (Request.Params["ID"] != null)
                Business.Business.RepairTypeBLL.Save(repair);
            else {
                //按不同级别提交
                int count = int.Parse(this.RBLGrade.SelectedValue);
                if (count == 1) {
                    repair.FaTypeID=0;
                }else if(count == 2){
                repair.FaTypeID=int.Parse(this.DDLFirType.SelectedValue);
                }
                else if (count == 3)
                {
                    repair.FaTypeID = int.Parse(this.DDLSecType.SelectedValue);
                }

                Business.Business.RepairTypeBLL.Add(repair);
            }
            Common.MessageBox.ShowAndRedirect(this, "编辑成功", "List.aspx");
        }