/// <summary> /// 获取父对象 /// </summary> protected void GetDTO() { DTO.Business.ServType servType = new DTO.Business.ServType(); servType.ServTypeID = Convert.ToInt32(Request.Params["AID"]); servType = Business.Business.ServTypeBLL.Get(servType); this.DDLFirType.DataSource = Business.Business.RepairTypeBLL.GetRepairTypeList("0");//一级 this.DDLFirType.DataValueField = "RepairTypeID"; this.DDLFirType.DataTextField = "RepairName"; this.DDLFirType.DataBind(); this.DDLFirType.SelectedValue = servType.FaRepairID.ToString(); this.DDLSecType.DataSource = Business.Business.RepairTypeBLL.GetRepairTypeList(servType.FaRepairID.ToString());//二级 this.DDLSecType.DataValueField = "RepairTypeID"; this.DDLSecType.DataTextField = "RepairName"; this.DDLSecType.DataBind(); this.DDLSecType.SelectedValue = servType.RepairID.ToString(); }
/// <summary> /// 提交事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { DTO.Business.ServType ServType = new DTO.Business.ServType(); if (Request.Params["AID"] != null) { ServType.ServTypeID = Convert.ToInt32(Request.Params["AID"]); ServType = Business.Business.ServTypeBLL.Get(ServType); } ServType.FaRepairID =int.Parse( this.DDLFirType.SelectedValue); ServType.RepairID =int.Parse(this.DDLSecType.SelectedValue); //修改 if (Request.Params["AID"] != null) Business.Business.ServTypeBLL.Save(ServType); else { ServType.ServiceID = Convert.ToInt32(Request.Params["UID"]); Business.Business.ServTypeBLL.Add(ServType); } Common.MessageBox.ShowAndRedirect(this, "编辑成功", "ServiceEdit.aspx?ID=" + Request.Params["UID"]); }