private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; BLL.car_repair_recordbll bll = new BLL.car_repair_recordbll(); 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_record_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 ddlCar_Number_SelectedIndexChanged(object sender, EventArgs e) { string selectitem = ddlCar_Number.SelectedValue; if (selectitem == null) { selectitem = ""; } BLL.car_repair_recordbll bll1 = new BLL.car_repair_recordbll(); DataTable tb1 = bll1.GetList(1000, " 1=1 and Car_Number='" + selectitem + "'", " id").Tables[0]; string code = ""; if (tb1 != null && tb1.Rows.Count > 0) { code = tb1.Rows[0]["Code"] + ""; ddlCar_Number.SelectedValue = code; txtid.Text = tb1.Rows[0]["ID"] + ""; } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { action = "Edit"; if (action == DTEnums.ActionEnum.Edit.ToString()) //修改 { string strid = txtid.Text; if (strid == "") { string s = ddlCode.Text; BLL.car_repair_recordbll bll = new BLL.car_repair_recordbll(); DataTable tb = bll.GetList(1000, " code='" + s + "'", "code").Tables[0]; if (tb != null && tb.Rows.Count > 0) { strid = tb.Rows[0]["ID"] + ""; } } this.id = Convert.ToInt32(strid); ChkAdminLevel("users", DTEnums.ActionEnum.Edit.ToString()); //检查权限 if (!DoEdit(this.id)) { JscriptMsg("保存过程中发生错误啦!", "", "Error"); return; } JscriptMsg("修改维修信息成功啦!", "car_repair_record_list.aspx", "Success"); } else //添加 { ChkAdminLevel("users", DTEnums.ActionEnum.Add.ToString()); //检查权限 if (new BLL.car_repair_recordbll().Exists(ddlCode.Text)) { JscriptMsg("编码已存在啦!", "", "Error"); return; } if (!DoAdd()) { JscriptMsg("保存过程中发生错误啦!", "", "Error"); return; } JscriptMsg("添加维修信息成功啦!", "car_repair_record_list.aspx", "Success"); } }
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) { BLL.car_repair_recordbll bll1 = new BLL.car_repair_recordbll(); DataTable tb1 = bll1.GetList(1000, " 1=1 and Status=0", " id").Tables[0]; this.ddlCar_Number.Items.Clear(); foreach (DataRow dr in tb1.Rows) { this.ddlCar_Number.Items.Add(new ListItem(dr["Car_Number"].ToString(), dr["Car_Number"].ToString())); } this.ddlCode.Items.Clear(); foreach (DataRow dr in tb1.Rows) { this.ddlCode.Items.Add(new ListItem(dr["Code"].ToString(), dr["Code"].ToString())); } if (action == DTEnums.ActionEnum.Edit.ToString()) //修改 { ShowInfo(this.id); } } }