protected void bt_Disable_Click(object sender, EventArgs e) { EWF_ApproveAgencyBLL bll = new EWF_ApproveAgencyBLL((int)ViewState["ID"]); bll.Model.EnableFlag = "N"; bll.Model.UpdateStaff = (int)Session["UserID"]; bll.Update(); MessageBox.ShowAndRedirect(this, "失效成功", "ApproveAgencyList.aspx"); }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int id = (int)gv_List.DataKeys[e.Row.RowIndex][0]; EWF_ApproveAgency agency = new EWF_ApproveAgencyBLL(id).Model; if (agency != null) { if (agency.EnableFlag == "N" || agency.PrincipalStaff != (int)Session["UserID"] || (agency.EndDate < DateTime.Today && agency.EndDate.Year != 1900)) { CheckBox cbx_Check = (CheckBox)e.Row.FindControl("cbx_Check"); if (cbx_Check != null) cbx_Check.Visible = false; } } } }
protected void bt_Disable_Click(object sender, EventArgs e) { foreach (GridViewRow row in gv_List.Rows) { CheckBox cbx_Check = (CheckBox)row.FindControl("cbx_Check"); if (cbx_Check != null && cbx_Check.Visible && cbx_Check.Checked) { int id = (int)gv_List.DataKeys[row.RowIndex][0]; EWF_ApproveAgencyBLL agencybll = new EWF_ApproveAgencyBLL(id); agencybll.Model.EnableFlag = "N"; agencybll.Model.UpdateStaff = (int)Session["UserID"]; agencybll.Update(); } } BindGrid(); }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int id = (int)gv_List.DataKeys[e.Row.RowIndex][0]; EWF_ApproveAgency agency = new EWF_ApproveAgencyBLL(id).Model; if (agency != null) { if (agency.EnableFlag == "N" || agency.PrincipalStaff != (int)Session["UserID"] || (agency.EndDate < DateTime.Today && agency.EndDate.Year != 1900)) { CheckBox cbx_Check = (CheckBox)e.Row.FindControl("cbx_Check"); if (cbx_Check != null) { cbx_Check.Visible = false; } } } } }
private void BindData() { EWF_ApproveAgency m = new EWF_ApproveAgencyBLL((int)ViewState["ID"]).Model; pl_detail.BindData(m); if (m.BeginDate < DateTime.Today) { TextBox tbx_BeginDate = (TextBox)pl_detail.FindControl("EWF_ApproveAgency_BeginDate"); if (tbx_BeginDate != null) { tbx_BeginDate.Enabled = false; } } if (m.EnableFlag == "N" || m.PrincipalStaff != (int)Session["UserID"]) { pl_detail.SetControlsEnable(false); bt_Save.Visible = false; bt_Disable.Visible = false; } }
protected void bt_Save_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] == 0) { EWF_ApproveAgencyBLL bll = new EWF_ApproveAgencyBLL(); pl_detail.GetData(bll.Model); if (bll.Model.AgentStaff == 0) { MessageBox.Show(this, "请选择代理人!"); return; } if (bll.Model.BeginDate < DateTime.Today) { MessageBox.Show(this, "起始日期不能小于今天!"); return; } if (bll.Model.EndDate.Year != 1900 && bll.Model.BeginDate > bll.Model.EndDate) { MessageBox.Show(this, "截止日期不能小于起始日期!"); return; } if (cbx_AppList.SelectedIndex == -1) { MessageBox.Show(this, "请选择待授权的工作流!"); return; } bll.Model.EnableFlag = "Y"; bll.Model.ApproveFlag = 2; bll.Model.InsertStaff = (int)Session["UserID"]; foreach (ListItem item in cbx_AppList.Items) { if (item.Selected) { bll.Model.App = new Guid(item.Value); bll.Add(); } } } else { EWF_ApproveAgencyBLL bll = new EWF_ApproveAgencyBLL((int)ViewState["ID"]); DateTime orgBeginDate = bll.Model.BeginDate; DateTime orgEndDate = bll.Model.EndDate; pl_detail.GetData(bll.Model); if (bll.Model.BeginDate < DateTime.Today && bll.Model.BeginDate != orgBeginDate) { MessageBox.Show(this, "起始日期不能小于今天!"); return; } if (bll.Model.EndDate < DateTime.Today && bll.Model.EndDate != orgEndDate) { MessageBox.Show(this, "截止日期不能小于今天!"); return; } if (bll.Model.AgentStaff == 0) { MessageBox.Show(this, "请选择代理人!"); return; } bll.Model.UpdateStaff = (int)Session["UserID"]; bll.Update(); } Response.Redirect("ApproveAgencyList.aspx"); }
private void BindData() { EWF_ApproveAgency m = new EWF_ApproveAgencyBLL((int)ViewState["ID"]).Model; pl_detail.BindData(m); if (m.BeginDate < DateTime.Today) { TextBox tbx_BeginDate = (TextBox)pl_detail.FindControl("EWF_ApproveAgency_BeginDate"); if (tbx_BeginDate != null) tbx_BeginDate.Enabled = false; } if (m.EnableFlag == "N" || m.PrincipalStaff != (int)Session["UserID"]) { pl_detail.SetControlsEnable(false); bt_Save.Visible = false; bt_Disable.Visible = false; } }