protected void Page_Load(object sender, EventArgs e) { ScriptManager SM = ((ScriptManager)(Master.FindControl("ScriptManager1"))); SM.RegisterAsyncPostBackControl(btnAddParticipant); SM.RegisterAsyncPostBackControl(FormView2); WorkOrderBLL woLogic = new WorkOrderBLL(); WorkOrder.WorkOrderDataTable WrkOrds = woLogic.GetWorkOrdersByWOnumProj(Convert.ToInt32(Request.QueryString["word_WOnum"]), Request.QueryString["word_Proj"].ToString()); WorkOrder.WorkOrderRow WrkOrd = WrkOrds[0]; ls_proj = Request.QueryString["word_Proj"]; li_wonum = Convert.ToInt32(Request.QueryString["word_WOnum"]); RolesBLL roleLogic = new RolesBLL(); if (!IsPostBack) { if ((WrkOrd.word_Status == "IMPL" && WrkOrd.word_statFlag == 1) || (WrkOrd.word_Status == "GONG")) // && { if (!(WrkOrd.word_Status == "GONG" && roleLogic.IsUserApprover(Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)), li_wonum, ls_proj))) // AND IsUserPMorUp?RoleBLL { FormView1.DefaultMode = FormViewMode.ReadOnly; FormView1.DataSourceID = ObjectDataSource2.ID; FormView1.DataBind(); ddlParticipant.Enabled = false; ddlParticipant.Visible = false; ddlRole.Enabled = false; ddlRole.Visible = false; btnAddParticipant.Visible = false; lblParticipant.Visible = false; lblRole.Visible = false; GridView2.Enabled = false; GridView2.Visible = false; ((LinkButton)(FormView1.FindControl("RespondButton"))).Visible = false; } else { ((LinkButton)(FormView1.FindControl("Approvals"))).Visible = true; } } bool lb_rtn = false; WorkOrderTableAdapters.WOroleTableAdapter roleAdapter = new WorkOrderTableAdapters.WOroleTableAdapter(); WorkOrder.WOroleDataTable roleDT = roleAdapter.GetWOroleByWOproj(li_wonum, ls_proj); foreach (DataRow roleRow in roleDT) { if (roleRow["worl_uid"].ToString() == WrkOrd.word_Author.ToString()) { lb_rtn = true; break; } } if (!lb_rtn) { lb_rtn = roleLogic.InsertWOroles(li_wonum, Convert.ToInt32(WrkOrd.word_Author), ls_proj, "AUTH", false, true); } lb_rtn = false; foreach (DataRow roleRow in roleDT) { if (roleRow["worl_uid"].ToString() == WrkOrd.word_BusnOwner.ToString()) { lb_rtn = true; break; } } if (!lb_rtn) { lb_rtn = roleLogic.InsertWOroles(li_wonum, Convert.ToInt32(WrkOrd.word_BusnOwner), ls_proj, "BOWN", false, true); } lb_rtn = false; foreach (DataRow roleRow in roleDT) { if (roleRow["worl_uid"].ToString() == WrkOrd.word_PMorSME.ToString()) { lb_rtn = true; break; } } if (!lb_rtn) { lb_rtn = roleLogic.InsertWOroles(li_wonum, Convert.ToInt32(WrkOrd.word_PMorSME), ls_proj, "PM", false, true); } lb_rtn = false; //GridView2.DataBind(); } woResponseBLL responseLogic = new woResponseBLL(); if (responseLogic.GetWOresponseCountByWOandProj(li_wonum, ls_proj) > 0) { FormView2.Visible = true; } else { FormView2.Visible = false; } }