/// <summary> /// 详细 /// </summary> /// <param name="id"></param> public void Bind(int id) { Car_Davnote dav = CarDavnoteManager.SelectDavnoteById(Id); txtDept.Text = dav.DavDept.Departmentname.ToString(); txtDirection.Text = dav.DavTtion.ToString(); txtLiCheng.Text = dav.DavCourse.ToString(); txtMan.Text = dav.DavMan.Trim().ToString(); txtDriver.Text = dav.DavDriver.Trim().ToString(); txtMark.Text = dav.DavMark.ToString(); txtOutDate.Text = dav.DavData.ToString(); txtReMark.Text = dav.DavRemark.ToString(); txtReturnDate.Text = dav.DavReturnData.ToString(); txtStartAddr.Text = dav.DavPlace.ToString(); if (dav.DavTypeId.TypeId == 1) { rdo1.Checked = true; } else if (dav.DavTypeId.TypeId == 2) { rdo2.Checked = true; } else if (dav.DavTypeId.TypeId == 3) { rdo3.Checked = true; } else { rdo4.Checked = true; } }
void ucpage_onPageIndexChanging(int pageIndex) { string mark = txtMark.Text.ToString(); string typeid = ddlType.SelectedValue.ToString(); string dept = ddlDept.SelectedValue.ToString(); gvDavnote.DataSourceID = null; IList <Car_Davnote> list = CarDavnoteManager.SelectDavnoteDark(txtMark.Text, ddlType.SelectedValue, ddlDept.SelectedValue); if (list.Count == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('无记录!');", true); return; } PagedDataSource page = new PagedDataSource(); page.AllowPaging = true; page.DataSource = list;// CarDavnoteManager.SelectDavnoteDark(txtMark.Text, ddlDept.SelectedValue, ddlType.SelectedValue); page.PageSize = 5; ucpage.PageCount = page.PageCount; page.CurrentPageIndex = pageIndex; gvDavnote.DataSource = page; gvDavnote.DataBind(); ucpage.SetButtonEnable(); }
void ucpage_onPageIndexChanging(int pageIndex) { PagedDataSource page = new PagedDataSource(); page.AllowPaging = true; page.DataSource = CarDavnoteManager.SelectDavnoteDark(txtMark.Text, ddlDept.SelectedValue, ddlType.SelectedValue); page.PageSize = 5; ucpage.PageCount = page.PageCount; page.CurrentPageIndex = pageIndex; gvDavnote.DataSource = page; ucpage.SetButtonEnable(); gvDavnote.DataBind(); }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { Car_Davnote davnote = new Car_Davnote(); davnote = getdavs(ref davnote); int num = CarDavnoteManager.AddDavte(davnote); if (num > 0) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存成功!');window.location.href=Davnotelist.aspx';</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('添加失败!');", true); } }
/// <summary> /// 查询 /// </summary> private void Bind() { string mark = txtMark.Text.ToString(); string typeid = ddlType.SelectedValue.ToString(); string dept = ddlDept.SelectedValue.ToString(); gvDavnote.DataSourceID = null; IList <Car_Davnote> list = CarDavnoteManager.SelectDavnoteDark(txtMark.Text, ddlType.SelectedValue, ddlDept.SelectedValue); if (list.Count == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('无记录!');", true); return; } gvDavnote.DataSource = list; gvDavnote.DataBind(); }
/// <summary> /// 删除方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { CheckBox chckbx = null; LinkButton lkbtnDelete = null; string Id = ""; for (int i = 0; i < this.gvDavnote.Rows.Count; i++) { chckbx = this.gvDavnote.Rows[i].FindControl("chSelect") as CheckBox; lkbtnDelete = this.gvDavnote.Rows[i].FindControl("lnkdel") as LinkButton; if (chckbx.Checked) { string Id1 = lkbtnDelete.CommandArgument.ToString(); Id += Id1 + ","; } } if (Id != "") { try { Id = Id.Substring(0, Id.Length - 1); CarDavnoteManager.DeleteDavnote(Id); Bind(); } catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除失败!');", true); return; } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请选择要删除的项!');", true); } }
public void Bind(int id) { Car_Davnote dav = CarDavnoteManager.SelectDavnoteById(Id); ddlDepartment.DataSourceID = null; ddlDepartment.DataSource = DepartmentManager.GetAllDepartment(); ddlDepartment.DataTextField = "departmentName"; ddlDepartment.DataValueField = "Id"; ddlDepartment.DataBind(); ddlDepartment.SelectedValue = dav.DavDept.Id.ToString(); txtDirection.Text = dav.DavTtion.ToString(); txtLiCheng.Text = dav.DavCourse.ToString(); txtMan.Text = dav.DavMan.Trim().ToString(); txtDriver.Text = dav.DavDriver.Trim().ToString(); txtMark.Text = dav.DavMark.ToString(); txtOutDate.Value = dav.DavData.ToString(); txtReMark.Text = dav.DavRemark.ToString(); txtReturnDate.Value = dav.DavReturnData.ToString(); txtStartAddr.Text = dav.DavPlace.ToString(); if (dav.DavTypeId.TypeId == 1) { rdo1.Checked = true; } else if (dav.DavTypeId.TypeId == 2) { rdo2.Checked = true; } else if (dav.DavTypeId.TypeId == 3) { rdo3.Checked = true; } else { rdo4.Checked = true; } }
protected void gvDavnote_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "del") { string Id = e.CommandArgument.ToString(); try { int num = CarDavnoteManager.DeleteDavnote(Id); if (num > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除成功!');", true); } Bind(); } catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除失败!');", true); return; } } }