Example #1
0
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        ViewState["JournalCode"] = Request.QueryString["JournalCode"];
        if (lblReviewer.ForeColor == Color.Black)
        {
            string confirmValue = Request.Form["confirm_value"];
            if (confirmValue == "Yes")
            {
                using (EmployeeJournal objEmployeeJournal = new EmployeeJournal())
                {
                    objEmployeeJournal.EmployeeJournalCode = Convert.ToInt16(Request.QueryString["JournalCode"]);
                    objEmployeeJournal.JournalStatus       = "F";
                    objEmployeeJournal.LockStatus          = "1";
                    objEmployeeJournal.Enabled             = "1";
                    objEmployeeJournal.Contents            = ckeContents.Text.Replace("style=\"display: none\"", "");
                    objEmployeeJournal.ModifiedBy          = Request.Cookies["Speedo"]["UserName"].ToString();
                    if (objEmployeeJournal.UpdateStatus() > 0)
                    {
                        using (EmployeeJournalApproval objEmployeeJournalApproval = new EmployeeJournalApproval())
                        {
                            objEmployeeJournalApproval.EmployeeJournalCode = objEmployeeJournal.EmployeeJournalCode;
                            objEmployeeJournalApproval.JournalApprover     = EmployeeReviewer.GetReviewer(Request.Cookies["Speedo"]["UserName"].ToString());
                            objEmployeeJournalApproval.JournalAStatus      = "F";
                            objEmployeeJournalApproval.JournalAOrder       = 1;
                            objEmployeeJournalApproval.JournalADate        = DateTime.Now;
                            objEmployeeJournalApproval.Insert();

                            objEmployeeJournal.SendNotification(EmployeeJournal.EJSMailType.FiledAcknowledgementRequestor, Request.Cookies["Speedo"]["UserName"].ToString(), EmployeeReviewer.GetReviewer(Request.Cookies["Speedo"]["UserName"].ToString()));
                            objEmployeeJournal.SendNotification(EmployeeJournal.EJSMailType.FiledNotificationApprover, Request.Cookies["Speedo"]["UserName"].ToString(), EmployeeReviewer.GetReviewer(Request.Cookies["Speedo"]["UserName"].ToString()));
                        }
                        Response.Redirect("EmployeeJournalList.aspx");
                    }
                }
            }
            else
            {
                using (EmployeeJournal objEmployeeJournal = new EmployeeJournal())
                {
                    objEmployeeJournal.EmployeeJournalCode = Convert.ToInt16(Request.QueryString["JournalCode"]);
                    objEmployeeJournal.Contents            = ckeContents.Text;
                    objEmployeeJournal.ModifiedBy          = Request.Cookies["Speedo"]["UserName"].ToString();
                    objEmployeeJournal.ModifiedOn          = DateTime.Now;

                    if (objEmployeeJournal.Update() > 0)
                    {
                        Response.Redirect("JournalEncoding.aspx?JournalCode=" + Request.QueryString["JournalCode"]);
                    }
                }
            }
        }
    }
Example #2
0
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        using (EmployeeJournal objEmployeeJournal = new EmployeeJournal())
        {
            //objEmployeeJournal.EmployeeJournalCode = EmployeeJournal.GetLastJournalCode(Convert.ToInt16(WeekYear.GetActiveWeekCode()), Request.Cookies["Speedo"]["UserName"].ToString());
            objEmployeeJournal.EmployeeJournalCode = Convert.ToInt16(Request.QueryString["JournalCode"]);
            objEmployeeJournal.LockStatus          = "1";
            objEmployeeJournal.Enabled             = "1";
            objEmployeeJournal.JournalStatus       = "A";
            objEmployeeJournal.ModifiedBy          = Request.Cookies["Speedo"]["UserName"].ToString();
            if (objEmployeeJournal.UpdateStatus2() > 0)
            {
                using (EmployeeJournalApproval objEmployeeJournalApproval = new EmployeeJournalApproval())
                {
                    objEmployeeJournalApproval.EmployeeJournalACode = EmployeeJournalApproval.GetForApprovalJournalACode(objEmployeeJournal.EmployeeJournalCode);
                    objEmployeeJournalApproval.JournalAStatus       = "A";
                    if (EmployeeJournalApproval.GetForApprovalJournalAOrder(objEmployeeJournal.EmployeeJournalCode) == 1)
                    {
                        objEmployeeJournalApproval.Remarks = txtDepartmentHeadsRemarks.Text;
                    }
                    //else if (EmployeeJournalApproval.GetForApprovalJournalAOrder(objEmployeeJournal.EmployeeJournalCode) == 2)
                    //{
                    //    objEmployeeJournal.JournalStatus = "A";
                    //    objEmployeeJournal.UpdateStatus();
                    //    objEmployeeJournalApproval.Remarks = txtDivisionHeadsRemarks.Text;
                    //}

                    if (objEmployeeJournalApproval.UpdateStatus() > 0)
                    {
                        objEmployeeJournal.SendNotification(EmployeeJournal.EJSMailType.ApprovedNotificationRequestor, EmployeeJournal.GetRequestor(objEmployeeJournal.EmployeeJournalCode), EmployeeJournalApproval.GetApprover(objEmployeeJournal.EmployeeJournalCode, "1"));
                        objEmployeeJournal.SendNotification(EmployeeJournal.EJSMailType.ApprovedAcknowledgementApprover, EmployeeJournal.GetRequestor(objEmployeeJournal.EmployeeJournalCode), EmployeeJournalApproval.GetApprover(objEmployeeJournal.EmployeeJournalCode, "1"));

                        Response.Redirect("EmployeeJournalListFApproval.aspx");
                    }
                }
            }
        }
    }