protected void Button1_Click(object sender, EventArgs e) { if (ddlRole.SelectedIndex > 0 && ddlParticipant.SelectedIndex > 0) { string roleVal = ddlRole.SelectedValue; int uid = Convert.ToInt32(ddlParticipant.SelectedValue); RolesBLL roleLogic = new RolesBLL(); if (roleLogic.GetUIDcount(uid, li_wonum, ls_proj) == 0) { int ndx = roleLogic.GetMaxRolesIndex(); if (roleLogic.InsertWOroles(li_wonum, uid, ls_proj, roleVal, false, true)) { ddlParticipant.Items.RemoveAt(ddlParticipant.SelectedIndex); ddlParticipant.SelectedIndex = -1; ddlRole.SelectedIndex = -1; UpdatePanel1.Update(); GridView2.DataBind(); } } } }
protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e) { int rws = e.AffectedRows; woPhaseBLL woPhaseLogic = new woPhaseBLL(); WorkOrderBLL woLogic = new WorkOrderBLL(); int wonum = (woLogic.GetMaxWOnum(e.Values[3].ToString()) - 1); bool lb_rtn; //SmtpEmail mailMessage = new SmtpEmail(); //bool lb_rtn = mailMessage.Send(e.Values["word_Author"].ToString(), e.Values["word_PMorSME"].ToString(), "Work Order Creation - " + e.Values[3].ToString() // + " WO# " + wonum + " - " + e.Values["word_Title"].ToString(), // "WO# " + wonum + " - " + e.Values["word_Title"].ToString() + " requires your attention." + // " Log into the EBS Work Order Module for details. Please do not respond to this email.", wonum, 0, e.Values["word_Proj"].ToString()); // Insert a WOphase record, update the WOrole table and update the WorkOrder table record as well. WorkOrder.WorkOrderDataTable WrkOrds = woLogic.GetWorkOrdersByWOnumProj(wonum, e.Values["word_Proj"].ToString()); WorkOrder.WorkOrderRow WrkOrd = WrkOrds[0]; int PhaseNum = woPhaseLogic.InsertPhaseRecord(wonum, WrkOrd.word_Proj, 0, DateTime.Now, "IWOR", 0, Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1))); RolesBLL roleLogic = new RolesBLL(); lb_rtn = roleLogic.InsertWOroles(wonum, Convert.ToInt32(WrkOrd.word_Author), WrkOrd.word_Proj, "AUTH", false, true); lb_rtn = roleLogic.InsertWOroles(wonum, Convert.ToInt32(WrkOrd.word_BusnOwner), WrkOrd.word_Proj, "BOWN", false, true); lb_rtn = roleLogic.InsertWOroles(wonum, Convert.ToInt32(WrkOrd.word_PMorSME), WrkOrd.word_Proj, "PM", false, true); DataView dv = (DataView)ObjectDataSource1.Select(); DataRow dr = (DataRow)dv.Table.Rows[0]; FormView fv = sender as FormView; if (fv.CurrentMode == FormViewMode.Insert) { DropDownList DropDownListPhaseStat = (DropDownList)fv.Row.FindControl("DropDownListPhaseStat"); int PhaseStat = Convert.ToInt32(DropDownListPhaseStat.SelectedValue); if (PhaseStat == 1) { int PhaseNumb = woPhaseLogic.InsertPhaseRecord(wonum, WrkOrd.word_Proj, 0, DateTime.Now, "WORA", 0, Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1))); WrkOrd.word_Status = "WORA"; WrkOrd.word_statFlag = 0; WrkOrd.word_StatNum = PhaseNumb; //DateTimePicker DTimePicker = (DateTimePicker)fv.Row.FindControl("CalendarExtender1"); //string ls_val = DTimePicker.Value.ToString(); //TextBox TxtBxReqDate = (TextBox)fv.Row.FindControl("word_reqDueDateTextBox"); //TxtBxReqDate.Text = ls_val; //WrkOrd.word_reqDueDate = Convert.ToDateTime(DTimePicker.Value.ToString()); lb_rtn = woLogic.UpdateWorkOrder(WrkOrd.word_WOnum, WrkOrd.word_Proj, WrkOrd.word_StatNum, WrkOrd.word_Status, WrkOrd.word_statFlag, WrkOrd.word_Date, WrkOrd.word_Author, WrkOrd.word_Title, WrkOrd.word_Doc.ToString(), WrkOrd.word_DocVer.ToString(), WrkOrd.word_Priority, WrkOrd.word_Descr, WrkOrd.word_Justify, WrkOrd.word_Cmnts, WrkOrd.word_PMorSME, WrkOrd.word_BusnOwner, WrkOrd.word_reqDueDate, WrkOrd.word_WOnum, WrkOrd.word_Proj); } } Response.Redirect("~/WorkOrder/Default.aspx?word_Proj=" + WrkOrd.word_Proj.ToString()); }
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; } }