Example #1
0
    protected void lnkBtnReturn_Click(object sender, EventArgs e)
    {
        bool          lb_complete = true;
        woApprovalBLL apprvLogic  = new woApprovalBLL();

        WorkOrder.WOapprovalDataTable aprvDT = apprvLogic.GetWOApprovalDataByWOandProj(li_wonum, ls_proj);

        foreach (WorkOrder.WOapprovalRow aprvDR in aprvDT)
        {
            lb_complete = true;
            if (Convert.ToBoolean(aprvDR["wapr_required"]) && !Convert.ToBoolean(aprvDR["wapr_AprvCode"]))
            {
                lb_complete = false;
                break;
            }
        }

        if (lb_complete)
        {
            woPhaseBLL woPhaseLogic = new woPhaseBLL();

            int PhaseNum = woPhaseLogic.InsertPhaseRecord(li_wonum,
                                                          ls_proj, 0, DateTime.Now, "GONG", 1,
                                                          Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)));

            if (PhaseNum > 0)
            {
                PhaseNum = woPhaseLogic.InsertPhaseRecord(li_wonum,
                                                          ls_proj, 0, DateTime.Now, "IMPL", 0,
                                                          Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)));


                WorkOrderBLL woLogic = new WorkOrderBLL();
                WorkOrder.WorkOrderDataTable WrkOrds = woLogic.GetWorkOrdersByWOnumProj(li_wonum, ls_proj);
                WorkOrder.WorkOrderRow       WrkOrd  = WrkOrds[0];

                bool lb_rtn;

                WrkOrd.word_Status   = "IMPL";
                WrkOrd.word_statFlag = 0;
                WrkOrd.word_StatNum  = PhaseNum;

                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_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);
            }
        }

        string ls_response = "~/WorkOrder/EditWO.aspx?word_WOnum=" + li_wonum.ToString() + "&word_Proj=" + ls_proj;

        Response.Redirect(ls_response);
    }
Example #2
0
    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());
    }
Example #3
0
    protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {
        int        statflag;
        int        rws          = e.AffectedRows;
        woPhaseBLL woPhaseLogic = new woPhaseBLL();

        // If Phase changed (or PhaseStat is 'Completed') then a new row is needed in Phase table and WO updated with new Phase/PhaseNumber
        if (!e.NewValues["word_Status"].ToString().Equals(e.OldValues["word_Status"].ToString()) ||
            (!e.NewValues["word_statFlag"].ToString().Equals(e.OldValues["word_statFlag"].ToString()) &&
             e.NewValues["word_statFlag"].ToString().Equals("1")))
        {
            int PhaseNum = woPhaseLogic.InsertPhaseRecord(li_wonum,
                                                          ls_proj, 0, DateTime.Now, e.NewValues["word_Status"].ToString(),
                                                          Convert.ToInt32(e.NewValues["word_statFlag"].ToString()),
                                                          Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)));
        }

        WorkOrderBLL woLogic = new WorkOrderBLL();

        WorkOrder.WorkOrderDataTable WrkOrds = woLogic.GetWorkOrdersByWOnumProj(li_wonum, ls_proj);
        WorkOrder.WorkOrderRow       WrkOrd  = WrkOrds[0];

        //If Phase Status is 'Completed' insert a new row in Phase and update WO with new Phase/Status/PhaseNumber

        if (Convert.ToUInt32(e.NewValues["word_statFlag"]) == 1)
        {
            statflag = 0;
            string NewPhase = "";
            switch (e.NewValues["word_Status"].ToString())
            {
            case "IWOR":
                NewPhase = "WORA";
                break;

            case "WORA":
                NewPhase = "WORD";
                break;

            case "WORM":
                NewPhase = "WORA";
                break;

            case "WORD":
                NewPhase = "WOTS";
                break;

            case "WOTS":
                NewPhase = "WDEV";
                break;

            case "WDEV":
                NewPhase = "WTST";
                break;

            case "WTST":
                NewPhase = "GONG";
                break;

            case "GONG":
                NewPhase = "IMPL";
                break;

            case "IMPL":
                NewPhase = "IMPL";
                statflag = 1;
                break;

            default:

                break;
            }


            int PhaseNum = woPhaseLogic.InsertPhaseRecord(li_wonum,
                                                          ls_proj, 0, DateTime.Now, NewPhase, statflag,
                                                          Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)));


            WrkOrd.word_Status   = NewPhase;
            WrkOrd.word_statFlag = statflag;
            WrkOrd.word_StatNum  = PhaseNum;

            bool lb_rtn;

            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_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);

            string ls_to;
            if (Convert.ToString(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)) == WrkOrd.word_PMorSME.ToString())
            {
                ls_to = WrkOrd.word_BusnOwner.ToString();
            }
            else
            {
                ls_to = WrkOrd.word_PMorSME.ToString();
            }

            string    host        = Request.ServerVariables["SERVER_NAME"]; //HttpContext.Current.Request.Url.Host;
            SmtpEmail mailMessage = new SmtpEmail();

            switch (NewPhase) // This logic makes sure that the authorizers get emails during GO/NoGO phase.
            {
            case "GONG":

                RolesBLL WOroleLogic = new RolesBLL();
                WorkOrder.WOroleTextDisplayDataTable woRoleDT;
                woRoleDT = WOroleLogic.GetWOrolesByWOnumProj(li_wonum, ls_proj);
                //woApprovalBLL apprvLogic = new woApprovalBLL();
                //WorkOrder.WOapprovalDataTable apprvlDT;
                //apprvlDT = apprvLogic.GetWOApprovalDataByWOandProj(li_wonum, ls_proj);

                // this code ensures that every approval record is created
                foreach (WorkOrder.WOroleTextDisplayRow roleRow in woRoleDT)
                {
                    if (Convert.ToBoolean(roleRow["worl_aprvl"]) == true)
                    {
                        ls_to = ls_to + "," + roleRow["worl_uid"].ToString();
                    }
                }



                lb_rtn = mailMessage.Send(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1), ls_to, "Work Order Approval - " + WrkOrd.word_Proj.ToString()
                                          + " WO# " + li_wonum + " - " + WrkOrd.word_Title.ToString(),
                                          "WO# " + li_wonum + " - " + WrkOrd.word_Title.ToString() + " requires your Go/NoGo action." +
                                          " Log into the EBS Work Order Module for details. Please do not respond to this email." +
                                          Environment.NewLine + Environment.NewLine + "http://" + host + "/WorkOrder/Approvals.aspx?word_WOnum=" +
                                          li_wonum.ToString() + "&word_Proj=" + WrkOrd.word_Proj.ToString() + Environment.NewLine + Environment.NewLine +
                                          "The most recent comment on this work order is as follows:" +
                                          Environment.NewLine + Environment.NewLine + WrkOrd.word_Cmnts.ToString(), li_wonum, 0, WrkOrd.word_Proj.ToString());

                break;

            default:

                lb_rtn = mailMessage.Send(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1), ls_to, "Work Order Modification - " + WrkOrd.word_Proj.ToString()
                                          + " WO# " + li_wonum + " - " + WrkOrd.word_Title.ToString(),
                                          "WO# " + li_wonum + " - " + WrkOrd.word_Title.ToString() + " requires your attention." +
                                          " Log into the EBS Work Order Module for details. Please do not respond to this email." +
                                          Environment.NewLine + Environment.NewLine + "http://" + host + "/WorkOrder/EditWO.aspx?word_WOnum=" +
                                          li_wonum.ToString() + "&word_Proj=" + WrkOrd.word_Proj.ToString() + Environment.NewLine + Environment.NewLine +
                                          "The most recent comment on this work order is as follows:" +
                                          Environment.NewLine + Environment.NewLine + WrkOrd.word_Cmnts.ToString(), li_wonum, 0, WrkOrd.word_Proj.ToString());

                break;
            }
        }

        if (!e.NewValues["word_PMorSME"].ToString().Equals(e.OldValues["word_PMorSME"].ToString()) ||
            !e.NewValues["word_BusnOwner"].ToString().Equals(e.OldValues["word_BusnOwner"].ToString()))
        {
            string ls_to, ls_msg;
            if (Convert.ToString(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)) == WrkOrd.word_PMorSME.ToString())
            {
                ls_to = WrkOrd.word_BusnOwner.ToString();
            }
            else
            {
                ls_to = WrkOrd.word_PMorSME.ToString();
            }

            if (!e.NewValues["word_PMorSME"].ToString().Equals(e.OldValues["word_PMorSME"].ToString()))
            {
                ls_msg = " The Business Owner of this work order has changed.";
            }
            else
            {
                ls_msg = " The Project manager for this work order has changed. ";
            }

            string    host        = Request.ServerVariables["SERVER_NAME"]; //HttpContext.Current.Request.Url.Host;
            SmtpEmail mailMessage = new SmtpEmail();
            bool      lb_rtn      = mailMessage.Send(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1), ls_to, "Work Order Modification - " + WrkOrd.word_Proj.ToString()
                                                     + " WO# " + li_wonum + " - " + WrkOrd.word_Title.ToString(),
                                                     "WO# " + li_wonum + " - " + WrkOrd.word_Title.ToString() + " requires your attention." + ls_msg +
                                                     " Log into the EBS Work Order Module for details. Please do not respond to this email."
                                                     + Environment.NewLine + Environment.NewLine + "http://" + host + "/WorkOrder/EditWO.aspx?word_WOnum=" +
                                                     li_wonum.ToString() + "&word_Proj=" + WrkOrd.word_Proj.ToString() + Environment.NewLine + Environment.NewLine + //"http://www.google.com"
                                                     "The most recent comment on this work order is as follows:" +
                                                     Environment.NewLine + Environment.NewLine + WrkOrd.word_Cmnts.ToString(), li_wonum, 0, WrkOrd.word_Proj.ToString());
        }

        Response.Redirect("~/WorkOrder/Default.aspx?word_Proj=" + ls_proj);
    }