private void BindGrid() { PmsRequirementBiz pmsRequirementBiz = new PmsRequirementBiz(); PmsRequirement pmsRequirement = new PmsRequirement(); pmsRequirement.RequirementPeriod = DropDownListWeekPeriod.SelectedValue; GridViewRequirement.EmptyDataText = "No Data."; IList <PmsRequirement> pmsRequirementList = pmsRequirementBiz.GetPmsRequirementByWeekPeriod(pmsRequirement); GridViewRequirement.DataSource = pmsRequirementList; GridViewRequirement.DataBind(); }
private void SaveExcelDataSet(DataSet dsExcel) { IList <PmsRequirement> listPmsRequirement = GetPmsRequirementList(dsExcel); IList <PmsHeadCount> listPmsHeadCount = GetPmsHeadCountList(dsExcel); //取得HeadCount数据,Department IList <PmsHeadCountByContent> listPmsHeadCountByContent = GetPmsHeadCountByContentList(dsExcel); //取得HeadCount数据,Content if (listPmsRequirement != null && listPmsHeadCount != null && listPmsHeadCountByContent != null) { PmsRequirementBiz pmsRequirementBiz = new PmsRequirementBiz(); pmsRequirementBiz.InsertPmsRequirement(listPmsRequirement, listPmsHeadCount, listPmsHeadCountByContent); } }
protected void GridViewRequirement_RowCommand(object sender, GridViewCommandEventArgs e) { int currentRowIndex = int.Parse(e.CommandArgument.ToString()); string commandName = e.CommandName; switch (commandName) { case "Edit": GridViewRequirement.EditIndex = currentRowIndex; BindGrid(); break; case "Update": TextBox textBoxCRId = (TextBox)GridViewRequirement.Rows[currentRowIndex].FindControl("textBoxCRId"); string crId = Server.HtmlDecode(textBoxCRId.Text).Trim(); if (!CheckUpdate(crId)) { return; } DropDownList dropDownListStatus = (DropDownList)GridViewRequirement.Rows[currentRowIndex].FindControl("DropDownListStatus"); string status = Server.HtmlDecode(dropDownListStatus.SelectedValue).Trim(); int serial = int.Parse(GridViewRequirement.DataKeys[currentRowIndex]["Serial"].ToString()); PmsRequirementBiz pmsRequirementBiz = new PmsRequirementBiz(); PmsRequirement pmsRequirement = new PmsRequirement(); pmsRequirement.Serial = serial; pmsRequirement.CrId = crId; pmsRequirement.Status = status; pmsRequirement.Maintaindate = System.DateTime.Now; pmsRequirement.Maintainuser = WSC.GlobalDefinition.Cookie_LoginUser.Replace(" ", "."); if (!pmsRequirementBiz.UpdatePmsRequirement(pmsRequirement)) { Msgbox("Update failed!"); return; } GridViewRequirement.EditIndex = -1; BindGrid(); break; case "Cancel": GridViewRequirement.EditIndex = -1; BindGrid(); break; default: break; } }
protected void GridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int rowIndex = e.RowIndex; int serial = int.Parse(GridViewRequirement.DataKeys[rowIndex]["Serial"].ToString()); PmsRequirementBiz pmsRequirementBiz = new PmsRequirementBiz(); PmsRequirement pmsRequirement = new PmsRequirement(); pmsRequirement.Vid = "PZ"; pmsRequirement.Serial = serial; pmsRequirement.Maintaindate = System.DateTime.Now; pmsRequirement.Maintainuser = WSC.GlobalDefinition.Cookie_LoginUser.Replace(" ", "."); pmsRequirementBiz.DeletePmsRequirement(pmsRequirement); BindGrid(); } catch { Msgbox("Delete failure!"); } }
private void BindGrid() { PmsRequirementBiz pmsRequirementBiz = new PmsRequirementBiz(); PmsRequirement pmsRequirement = new PmsRequirement(); pmsRequirement.YearAndMonth = Month; pmsRequirement.RequirementPeriod = Week; pmsRequirement.UserDept = UserDept; pmsRequirement.Status = Status; GridViewRequirement.EmptyDataText = "No Data."; IList <PmsRequirement> pmsRequirementList = pmsRequirementBiz.GetPmsRequirement(pmsRequirement); if (pmsRequirementList != null) { foreach (var requirement in pmsRequirementList) { requirement.Status = Status; } } GridViewRequirement.DataSource = pmsRequirementList; GridViewRequirement.DataBind(); }