protected void Page_Load(object sender, EventArgs e) { string _action = DTRequest.GetQueryString("action"); if (!string.IsNullOrEmpty(_action) && _action == DTEnums.ActionEnum.Edit.ToString()) { this.action = DTEnums.ActionEnum.Edit.ToString();//修改类型 this.id = DTRequest.GetQueryInt("id"); if (this.id == 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } if (!new BLL.car_repair_recordbll().Exists(this.id)) { JscriptMsg("信息不存在或已被删除!", "back", "Error"); return; } } if (!Page.IsPostBack) { txtCode.Text = DateTime.Now.ToString("yyyyMMddHHmmsss"); BLL.carbll bll = new BLL.carbll(); DataTable tb = bll.GetList(1000, " 1=1 and Status in(0,1)", " id").Tables[0]; this.ddlCar_Number.Items.Clear(); foreach (DataRow dr in tb.Rows) { this.ddlCar_Number.Items.Add(new ListItem(dr["Car_Number"].ToString(), dr["Car_Number"].ToString())); } BLL.car_maintenance_itembll bll1 = new BLL.car_maintenance_itembll(); DataTable tb1 = bll1.GetList(1000, " 1=1 ", " id").Tables[0]; this.ddlMaintenance_Item.Items.Clear(); foreach (DataRow dr in tb1.Rows) { this.ddlMaintenance_Item.Items.Add(new ListItem(dr["Maintenance_Item_Name"].ToString(), dr["Code"].ToString())); } BLL.car_repair_plantbll bll2 = new BLL.car_repair_plantbll(); DataTable tb2 = bll2.GetList(1000, " 1=1 ", " id").Tables[0]; this.ddlRepair_Plant.Items.Clear(); foreach (DataRow dr in tb2.Rows) { this.ddlRepair_Plant.Items.Add(new ListItem(dr["Repair_Plant_Name"].ToString(), dr["Code"].ToString())); } BLL.car_driverbll bll3 = new BLL.car_driverbll(); DataTable tb3 = bll3.GetList(1000, " 1=1 ", " id").Tables[0]; this.ddlDriver_Code.Items.Clear(); foreach (DataRow dr in tb3.Rows) { this.ddlDriver_Code.Items.Add(new ListItem(dr["Driver_Name"].ToString(), dr["Driver_Code"].ToString())); } if (action == DTEnums.ActionEnum.Edit.ToString()) //修改 { ShowInfo(this.id); } } }
private void ShowInfo(int _id) { BLL.car_repair_plantbll bll = new BLL.car_repair_plantbll(); Model.car_repair_plantinfo model = bll.GetModel(_id); txtCode.Text = model.Code; txtCode.ReadOnly = true; txtRepair_Plant_Name.Text = model.Repair_Plant_Name; txtAddress.Text = model.Address; txtContactor.Text = model.Contactor; txtTel.Text = model.Tel; }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; BLL.car_repair_plantbll bll = new BLL.car_repair_plantbll(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("car_repair_plant_list.aspx", "group_id={0}&keywords={1}&page={2}", this.group_id.ToString(), this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.car_repair_plantbll bll = new BLL.car_repair_plantbll(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("car_repair_plant_list.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords), "Success"); }
private bool DoAdd() { bool result = true; Model.car_repair_plantinfo model = new Model.car_repair_plantinfo(); BLL.car_repair_plantbll bll = new BLL.car_repair_plantbll(); model.Code = txtCode.Text.Trim(); model.Repair_Plant_Name = txtRepair_Plant_Name.Text; model.Address = txtAddress.Text; model.Contactor = txtContactor.Text; model.Tel = txtTel.Text; if (bll.Add(model) < 1) { result = false; } return(result); }
private bool DoEdit(int _id) { bool result = true; BLL.car_repair_plantbll bll = new BLL.car_repair_plantbll(); Model.car_repair_plantinfo model = bll.GetModel(_id); model.Code = txtCode.Text.Trim(); model.Repair_Plant_Name = txtRepair_Plant_Name.Text; model.Address = txtAddress.Text; model.Contactor = txtContactor.Text; model.Tel = txtTel.Text; if (!bll.Update(model)) { result = false; } return(result); }