Example #1
0
        protected void btnApprove_Click(Object Sender, EventArgs e)
        {
            int intVacation = Int32.Parse(lblVacation.Text);

            oVacation.Update(intVacation, 1);
            int intUser = Int32.Parse(oVacation.Get(intVacation, "userid"));

            oFunction.SendEmail("ClearView Out of Office Request", oUser.GetName(intUser), "", strEMailIdsBCC, "ClearView Out of Office Request", "<p><b>The following out of office request has been APPROVED by your MANAGER (" + oUser.GetFullName(intProfile) + ")</b><p><p>" + oVacation.GetBody(intVacation, intEnvironment) + "</p>", true, false);
            Response.Redirect(oPage.GetFullLink(intPage) + "?action=finish");
        }
Example #2
0
        protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            bool   boolApprove  = (oApplication.Get(intApplication, "approve_vacation") == "1");
            string strEmployees = oApplication.Get(intApplication, "employees_needed");
            int    intEmployees = 0;

            if (strEmployees != "")
            {
                intEmployees = Int32.Parse(strEmployees);
            }
            DataSet  dsEmployees = oUser.GetApplication(intApplication);
            DateTime _date       = DateTime.Today;
            string   strError    = "";
            DateTime _start      = DateTime.Parse(txtStart.Text);
            TimeSpan oSpan       = new TimeSpan();

            oSpan = _start.Subtract(_date);
            int intManager = oUser.GetManager(intProfile, true);

            if (oSpan.Days < intLeadDays)
            {
                boolApprove = true;
            }
            if (radDays.Checked == true)
            {
                DateTime _end = DateTime.Parse(txtEnd.Text);
                while (_start <= _end)
                {
                    DataSet dsOff   = oVacation.Get(_start, intApplication);
                    int     intDiff = dsEmployees.Tables[0].Rows.Count - dsOff.Tables[0].Rows.Count;
                    if (intDiff > intEmployees)
                    {
                        if (_start.DayOfWeek != System.DayOfWeek.Saturday && _start.DayOfWeek != System.DayOfWeek.Sunday)
                        {
                            int intVacation = oVacation.Add(intProfile, intApplication, _start, (radMorning.Checked ? 1 : 0), (radAfternoon.Checked ? 1 : 0), (radVacation.Checked ? 1 : 0), (radHoliday.Checked ? 1 : 0), (radPersonal.Checked ? 1 : 0), ddlReason.SelectedItem.Value, (boolApprove ? 0 : 1));
                            if (boolApprove == true)
                            {
                                string strDefault = oUser.GetApplicationUrl(intManager, intVacationPage);
                                if (strDefault == "")
                                {
                                    oFunction.SendEmail("ClearView Out of Office Request", oUser.GetName(intManager), "", strEMailIdsBCC, "ClearView Out of Office Request", "<p><b>The following out of office request requires your approval...</b><p><p>" + oVacation.GetBody(intVacation, intEnvironment) + "</p>", true, false);
                                }
                                else
                                {
                                    oFunction.SendEmail("ClearView Out of Office Request", oUser.GetName(intManager), "", strEMailIdsBCC, "ClearView Out of Office Request", "<p><b>The following out of office request requires your approval...</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intVacationPage) + "?id=" + intVacation.ToString() + "\" target=\"_blank\">Click here to view this out of office request.</a></p><p>" + oVacation.GetBody(intVacation, intEnvironment) + "</p>", true, false);
                                }
                            }
                        }
                    }
                    else
                    {
                        strError += "<tr><td>" + _start.ToShortDateString() + "</td></tr>";
                    }
                    _start = _start.AddDays(1);
                }
            }
            else
            {
                DataSet dsOff   = oVacation.Get(_start, intApplication);
                int     intDiff = dsEmployees.Tables[0].Rows.Count - dsOff.Tables[0].Rows.Count;
                if (intDiff > intEmployees)
                {
                    if (_start.DayOfWeek != System.DayOfWeek.Saturday && _start.DayOfWeek != System.DayOfWeek.Sunday)
                    {
                        int intVacation = oVacation.Add(intProfile, intApplication, _start, (radMorning.Checked ? 1 : 0), (radAfternoon.Checked ? 1 : 0), (radVacation.Checked ? 1 : 0), (radHoliday.Checked ? 1 : 0), (radPersonal.Checked ? 1 : 0), ddlReason.SelectedItem.Value, (boolApprove ? 0 : 1));
                        if (boolApprove == true)
                        {
                            string strDefault = oUser.GetApplicationUrl(intManager, intVacationPage);
                            if (strDefault == "")
                            {
                                oFunction.SendEmail("ClearView Out of Office Request", oUser.GetName(intManager), "", strEMailIdsBCC, "ClearView Out of Office Request", "<p><b>The following out of office request requires your approval...</b><p><p>" + oVacation.GetBody(intVacation, intEnvironment) + "</p>", true, false);
                            }
                            else
                            {
                                oFunction.SendEmail("ClearView Out of Office Request", oUser.GetName(intManager), "", strEMailIdsBCC, "ClearView Out of Office Request", "<p><b>The following out of office request requires your approval...</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intVacationPage) + "?id=" + intVacation.ToString() + "\" target=\"_blank\">Click here to view this out of office request.</a></p><p>" + oVacation.GetBody(intVacation, intEnvironment) + "</p>", true, false);
                            }
                        }
                    }
                }
                else
                {
                    strError += "<tr><td>" + _start.ToShortDateString() + "</td></tr>";
                }
            }
            try { _date = DateTime.Parse(ddlMonth.SelectedItem.Value + "/1/" + ddlYear.SelectedItem.Value); }
            catch { }
            if (strError == "")
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?d=" + Server.UrlPathEncode(_date.ToShortDateString()));
            }
            else
            {
                lblError.Text += "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\">" + strError + "</table>";
            }
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
     oVacation  = new Vacation(intProfile, dsn);
     oPage      = new Pages(intProfile, dsn);
     oUser      = new Users(intProfile, dsn);
     oFunction  = new Functions(intProfile, dsn, intEnvironment);
     oVariable  = new Variables(intEnvironment);
     if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
     {
         panFinish.Visible = true;
     }
     else
     {
         if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
         {
             intApplication = Int32.Parse(Request.QueryString["applicationid"]);
         }
         if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
         {
             intPage = Int32.Parse(Request.QueryString["pageid"]);
         }
         if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
         {
             intApplication = Int32.Parse(Request.Cookies["application"].Value);
         }
         int intVacation = 0;
         if (!IsPostBack)
         {
             if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
             {
                 intVacation      = Int32.Parse(Request.QueryString["id"]);
                 lblVacation.Text = Request.QueryString["id"];
                 int intRequester = Int32.Parse(oVacation.Get(intVacation, "userid"));
                 if (intVacation > 0)
                 {
                     if (oUser.IsManager(intRequester, intProfile, true))
                     {
                         panRequest.Visible = true;
                         strBody            = oVacation.GetBody(intVacation, intEnvironment);
                     }
                     else
                     {
                         panDenied.Visible = true;
                     }
                 }
                 else
                 {
                     panDenied.Visible = true;
                 }
             }
             else
             {
                 panDenied.Visible = true;
             }
         }
     }
     btnClose.Attributes.Add("onclick", "return CloseWindow();");
     btnFinish.Attributes.Add("onclick", "return CloseWindow();");
     btnApprove.Attributes.Add("onclick", "return confirm('Are you sure you want to APPROVE this request?');");
     btnDeny.Attributes.Add("onclick", "return confirm('Are you sure you want to DENY this request?');");
 }