// Sending Reminder to Supervisor
    protected void btnSendReminder_Click(object sender, EventArgs e)
    {
        int    i             = 0;
        int    inCount       = 0;
        string strSupervisor = "";

        foreach (GridViewRow gRow in grLeaveApp.Rows)
        {
            string strEmpID = gRow.Cells[1].Text.Trim();

            CheckBox chk = (CheckBox)gRow.Cells[12].FindControl("chkBox");
            if (chk.Checked == true)
            {
                if (strSupervisor == "")
                {
                    strSupervisor = grLeaveApp.DataKeys[gRow.DataItemIndex].Values[13].ToString().Trim();
                }
                else
                {
                    strSupervisor = strSupervisor + "," + grLeaveApp.DataKeys[gRow.DataItemIndex].Values[13].ToString().Trim();
                }
                inCount++;
            }
        }
        strSupervisor = Common.ShowDistinctValueFromString(inCount, strSupervisor);
        string[] strSupervisors             = strSupervisor.Split(',');
        MailManagerSmtpClient objMailClient = new MailManagerSmtpClient();

        objMailClient.SendLeavePendingReminder(strSupervisors, grLeaveApp, Session["EMAILID"].ToString().Trim(), lblMsg, Session["USERNAME"].ToString(),
                                               Session["DESIGNATION"].ToString(), Session["LOCATION"].ToString());
    }
    private void SendEmail()
    {
        MasterTablesManager   MasMgr  = new MasterTablesManager();
        MailManagerSmtpClient objMail = new MailManagerSmtpClient();

        DataTable dt = MasMgr.GetEmailNotification();

        string strRetText  = "";
        string strToAddr   = dt.Rows[0]["Disburse"].ToString().Trim();
        string strCC       = dt.Rows[0]["Notify"].ToString().Trim() + ";" + dt.Rows[0]["Verify"].ToString().Trim() + ";" + dt.Rows[0]["Review"].ToString().Trim();
        string strSubject  = "Salary of " + ddlMonth.SelectedItem.ToString().Trim() + " has been Approved";
        string strBody     = "Salary is approved, please proceed for payment.";
        string strFromAddr = Session["EMAILID"].ToString().Trim();

        strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, strCC);

        if (strRetText == "Y")
        {
            lblMsg.Text = lblMsg.Text + ", and Email has been sent to Disburse by Finance.";
        }
        else
        {
            lblMsg.Text = lblMsg.Text + ", Email sending failed.";
        }
    }
示例#3
0
    private void SendEmail()
    {
        MasterTablesManager   MasMgr  = new MasterTablesManager();
        MailManagerSmtpClient objMail = new MailManagerSmtpClient();

        DataTable dt = MasMgr.GetEmailNotification();

        string strRetText  = "";
        string strToAddr   = dt.Rows[0]["Review"].ToString().Trim();
        string strCC       = dt.Rows[0]["Notify"].ToString().Trim();
        string strSubject  = "Salary of " + ddlMonth.SelectedItem.ToString().Trim() + " has been waiting for ur Recommendation";
        string strBody     = "Hi,<br />The salary has been verified by Finance and found ok, you may recommend for approval.";
        string strFromAddr = Session["EMAILID"].ToString().Trim();

        strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, strCC);

        if (strRetText == "Y")
        {
            lblMsg.Text = lblMsg.Text + ", and Email has been sent to Review by Director Finance.";
        }
        else
        {
            lblMsg.Text = lblMsg.Text + ", Email sending failed.";
        }
    }
    private void SendEmail()
    {
        MasterTablesManager   MasMgr  = new MasterTablesManager();
        MailManagerSmtpClient objMail = new MailManagerSmtpClient();

        DataTable dt = MasMgr.GetEmailNotification();

        string strRetText  = "";
        string strToAddr   = dt.Rows[0]["Approval"].ToString().Trim();
        string strCC       = dt.Rows[0]["Notify"].ToString().Trim() + ";" + dt.Rows[0]["Verify"].ToString().Trim();
        string strSubject  = "Salary of " + ddlMonth.SelectedItem.ToString().Trim() + " has been waiting for your Approval";
        string strBody     = "Hi,<br />The salary has been reviwed and found ok, you may now approve.";
        string strFromAddr = Session["EMAILID"].ToString().Trim();

        strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, strCC);

        if (strRetText == "Y")
        {
            lblMsg.Text = lblMsg.Text + ", and Email has been sent to Approve by CR.";
        }
        else
        {
            lblMsg.Text = lblMsg.Text + ", Email sending failed.";
        }
    }
    private void SendEmail()
    {
        MasterTablesManager   MasMgr  = new MasterTablesManager();
        MailManagerSmtpClient objMail = new MailManagerSmtpClient();

        DataTable dt = MasMgr.GetEmailNotification();

        string strRetText  = "";
        string strToAddr   = dt.Rows[0]["Notify"].ToString().Trim();
        string strCC       = dt.Rows[0]["Verify"].ToString().Trim() + ";" + dt.Rows[0]["Review"].ToString().Trim() + ";" + dt.Rows[0]["Approval"].ToString().Trim();
        string strSubject  = "Payroll has been Disbursed";
        string strBody     = "";
        string strFromAddr = Session["EMAILID"].ToString().Trim();

        strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, strCC);

        if (strRetText == "Y")
        {
            lblMsg.Text = lblMsg.Text + ", and Email has been sent to Notify previous Actors.";
        }
        else
        {
            lblMsg.Text = lblMsg.Text + ", Email sending failed.";
        }
    }
        protected void grTravelApp_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            MailManagerSmtpClient objMail = new MailManagerSmtpClient();
            string   mailMessage          = "";
            GridView _gridView            = (GridView)sender;
            // Get the selected index and the command name
            int    _selectedIndex = int.Parse(e.CommandArgument.ToString());
            string _commandName   = e.CommandName;

            _gridView.SelectedIndex = _selectedIndex;
            char[]   splitter   = { ',' };
            string[] arinfo2    = new string[10];
            string   leaveStart = "";
            string   leaveEnd   = "";

            switch (_commandName)
            {
            case ("ViewClick"):
                GenerateReport(grTravelList.DataKeys[_gridView.SelectedIndex].Values[0].ToString().Trim(), grTravelList.DataKeys[_gridView.SelectedIndex].Values[10].ToString().Trim(), grTravelList.DataKeys[_gridView.SelectedIndex].Values[13].ToString().Trim());
                break;

            case ("ApproveClick"):
                this.GetTravelDates(grTravelList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(), "A", grTravelList.DataKeys[_gridView.SelectedIndex].Values[4].ToString(), grTravelList.DataKeys[_gridView.SelectedIndex].Values[5].ToString());
                UpdateTravel(grTravelList.DataKeys[_gridView.SelectedIndex].Values[0].ToString().Trim(), grTravelList.DataKeys[_gridView.SelectedIndex].Values[10].ToString().Trim(), "A", hfLDates.Value);

                //Email Notification
                SiteMaster.ShowClientMessage(Page, "Leave has been approved successfully", "success");
                break;

            case ("DenyClick"):
                //objLeaveMgr.UpdateLeaveAppMstForDeny(grTravelList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                //    grTravelList.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), "Y", "N", "D",
                //    Session["USERID"].ToString(), Common.ReturnDateTimeInString(Common.DisplayDateTime(DateTime.Now.ToString(), false, Constant.strDateFormat), false,Constant.strDateFormat));

                mailMessage = objMail.LeaveMail(grTravelList.DataKeys[_gridView.SelectedIndex].Values[11].ToString(), grTravelList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                                                Session["EMPID"].ToString(), leaveStart, leaveEnd, "D");
                SiteMaster.ShowClientMessage(Page, "Leave has been Regreted Successfully.", "success");
                break;

            case ("CancelClick"):
                //objLeaveMgr.CancelLeaveApp(grTravelList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                //    grTravelList.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), "Y", "N", "C",
                //    Session["USERID"].ToString(), Common.ReturnDateTimeInString(Common.DisplayDateTime( DateTime.Now.ToString(), false, Constant.strDateFormat), false,Constant.strDateFormat));

                mailMessage = objMail.LeaveMail(grTravelList.DataKeys[_gridView.SelectedIndex].Values[11].ToString(), grTravelList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                                                Session["EMPID"].ToString(), leaveStart, leaveEnd, "C");

                SiteMaster.ShowClientMessage(Page, "Leave has been Cancelled Successfully.", "success");
                break;
            }

            this.OpenRecord();
        }
        private void SendMail(string totalDays)
        {
            MailManagerSmtpClient mailManager = new MailManagerSmtpClient();
            EmpInfoManager        empManager  = new EmpInfoManager();

            mailManager.strFromAddr = "";
            mailManager.strToAddr   = "";
            //mailManager.MailServer = ConfigurationManager.AppSettings["MyMailServer"].ToString();
            //mailManager.MailPort = Convert.ToInt32(ConfigurationManager.AppSettings["MyMailServerPort"]);
            //mailManager.SystemEmailUserName = ConfigurationManager.AppSettings["MyEmailUserName"].ToString();
            //mailManager.SystemEmailPwd = ConfigurationManager.AppSettings["MyEmailPwd"].ToString();
            //mailManager.Enablessl = ConfigurationManager.AppSettings["Enssl"].ToString().Trim();

            mailManager.strSubject = "Request to Verify Travel Recommendation";

            //+ " Total Days : " + totalDays + ","
            mailManager.strBody = "Please verify the Application "
                                  + " \n "
                                  + " \n\n "
                                  + "With thanks "
                                  + " \n\n ";

            DataTable empUserFrom = new DataTable();
            DataTable empUserTo   = new DataTable();

            empUserFrom = empManager.SelectEmpInfo(Session["EMPID"].ToString());
            if (empUserFrom.Rows.Count > 0)
            {
                mailManager.strFromAddr = empUserFrom.Rows[0]["OfficeEmail"].ToString();
                //mailManager.strFromAddr = "*****@*****.**";
                mailManager.strBody += empUserFrom.Rows[0]["FullName"].ToString() + " \n ";
            }
            empUserTo = empManager.SelectEmpInfo(empUserFrom.Rows[0]["SupervisorId"].ToString());
            if (empUserTo.Rows.Count > 0)
            {
                mailManager.strToAddr = empUserTo.Rows[0]["OfficeEmail"].ToString();
                //mailManager.strToAddr = "*****@*****.**";
            }
            string strVPath = "http://10.0.1.70:82/LogIn";

            mailManager.strBody += " \n ======================================\n"
                                   + " Click here to login for recommendation: " + strVPath;
            mailManager.SendMSBMail();
        }
        private void SendMail(string applicant)
        {
            MailManagerSmtpClient mailManager = new MailManagerSmtpClient();
            EmpInfoManager        empManager  = new EmpInfoManager();

            mailManager.strFromAddr = "";
            mailManager.strToAddr   = "";
            //mailManager.MailServer = ConfigurationManager.AppSettings["MyMailServer"].ToString();
            //mailManager.MailPort = Convert.ToInt32(ConfigurationManager.AppSettings["MyMailServerPort"]);
            //mailManager.SystemEmailUserName = ConfigurationManager.AppSettings["MyEmailUserName"].ToString();
            //mailManager.SystemEmailPwd = ConfigurationManager.AppSettings["MyEmailPwd"].ToString();
            //mailManager.Enablessl = ConfigurationManager.AppSettings["Enssl"].ToString().Trim();

            mailManager.strSubject = "Travel Approval";

            mailManager.strBody = "Your travel Application has been Approved. "
                                  + " \n "
                                  + " \n\n "
                                  + "With thanks "
                                  + " \n\n ";

            DataTable empUserFrom = new DataTable();
            DataTable empUserTo   = new DataTable();

            empUserFrom = empManager.SelectEmpInfo(Session["EMPID"].ToString());
            if (empUserFrom.Rows.Count > 0)
            {
                mailManager.strFromAddr = empUserFrom.Rows[0]["OfficeEmail"].ToString();
                //mailManager.strFromAddr = "*****@*****.**";
                mailManager.strBody += empUserFrom.Rows[0]["FullName"].ToString() + " \n ";
            }
            empUserTo = empManager.SelectEmpInfo(applicant);
            if (empUserTo.Rows.Count > 0)
            {
                mailManager.strToAddr = empUserTo.Rows[0]["OfficeEmail"].ToString();
                //mailManager.strToAddr = "*****@*****.**";
            }
            string strVPath = "http://10.0.1.70:82/LogIn";

            mailManager.strBody += " \n ======================================\n"
                                   + " Click here to login: " + strVPath;
            mailManager.SendMSBMail();
        }
示例#9
0
        private void SendMail(string empId, string leaveAppId, string leaveStrt, string leaveEnd, string approvedBy, string supervisorId)
        {
            //lblMsg.Text = "Lel3";
            string message = "";
            MailManagerSmtpClient objMail = new MailManagerSmtpClient();

            #region mail sending

            DateTime LvStDate = Convert.ToDateTime(leaveStrt);
            DateTime LvEnDate = new DateTime();
            if (leaveEnd != "")
            {
                LvEnDate = Convert.ToDateTime(leaveEnd);
            }
            string emp  = Session["EMPID"].ToString();
            string user = Session["USERNAME"].ToString();
            string des  = Session["DESIGNATION"].ToString();
            string loc  = Session["LOCATION"].ToString();//now static
            if (string.IsNullOrEmpty(hdfSpervisorEmail.Value))
            {
                message = "Leave applied but mail did not send";
            }
            else
            {
                //Open this part for mail
                //lblMsg.Text = "Level4";
                //hdfSpervisorEmail.Value = "*****@*****.**";
                message = objMail.RequestFromRecommendar(empId, leaveAppId,
                                                         Common.SetDate(LvStDate.ToShortDateString()), Common.SetDate(LvEnDate.ToShortDateString()),
                                                         Session["EMPID"].ToString(), Session["USERNAME"].ToString(),
                                                         Session["DESIGNATION"].ToString(), Session["LOCATION"].ToString(),
                                                         Session["USERID"].ToString().Trim().ToUpper() == "SYSTEM" ? "Y" : "N", supervisorId,
                                                         hdfSpervisorEmail.Value.ToString());
            }
            SiteMaster.ShowClientMessage(Page, message, "info");
            #endregion
        }
    private void SendEmail()
    {
        MasterTablesManager   MasMgr  = new MasterTablesManager();
        MailManagerSmtpClient objMail = new MailManagerSmtpClient();

        DataTable dt = MasMgr.GetEmailNotification();

        string strRetText  = "";
        string strToAddr   = dt.Rows[0]["Verify"].ToString().Trim();
        string strSubject  = "Salary of " + ddlMonth.SelectedItem.ToString().Trim() + " has been waiting for your verification";
        string strBody     = "Hi,<br />The salary has been prepared by HR. Please verify and forword to Dir finance & Admin.";
        string strFromAddr = Session["EMAILID"].ToString().Trim();

        strRetText = objMail.PayslipEmail(strFromAddr, strToAddr, strSubject, strBody, "");

        if (strRetText == "Y")
        {
            lblMsg.Text = lblMsg.Text + "Email has been sent to Verify by Finance.";
        }
        else
        {
            lblMsg.Text = lblMsg.Text + "Email sending failed.";
        }
    }
        protected void grLeaveApp_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            MailManagerSmtpClient objMail = new MailManagerSmtpClient();
            string   mailMessage          = "";
            GridView _gridView            = (GridView)sender;
            // Get the selected index and the command name
            int    _selectedIndex = int.Parse(e.CommandArgument.ToString());
            string _commandName   = e.CommandName;

            _gridView.SelectedIndex = _selectedIndex;
            string strPreYrLv = "";

            char[]   splitter   = { ',' };
            string[] arinfo2    = new string[10];
            string   leaveStart = "";
            string   leaveEnd   = "";

            switch (_commandName)
            {
            case ("ViewClick"):
                StringBuilder sb     = new StringBuilder();
                string        strURL = "LeaveApplicationView.aspx?params=" + grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString() + "," + grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString().Trim() + ", R" + ", L";
                // string strURL = "LeaveApplicationView.aspx";
                sb.Append("<script>");

                sb.Append("window.open('" + strURL + "', '', '');");
                sb.Append("</script>");
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ConfirmSubmit",
                                                    sb.ToString(), false);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ConfirmSubmit", sb.ToString());
                break;

            case ("ApproveClick"):
                this.AvailableLeave("A", grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[2].ToString(), _gridView.SelectedIndex);
                this.GetLeaveDates(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(), "A", grLeaveList.DataKeys[_gridView.SelectedIndex].Values[4].ToString(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[5].ToString());
                objLeaveMgr.UpdateLeaveAppMstForApprove(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                                                        grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), "Y", "N", "A", hfLEnjoyed.Value.ToString(), hfLDates.Value.ToString(),
                                                        grLeaveList.DataKeys[_gridView.SelectedIndex].Values[10].ToString(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[2].ToString(),
                                                        grLeaveList.DataKeys[_gridView.SelectedIndex].Values[9].ToString(),
                                                        Session["USERID"].ToString(), Common.ReturnDateTimeInString(Common.DisplayDateTime(DateTime.Now.ToString(), false, Constant.strDateFormat), false, Constant.strDateFormat), strPreYrLv, grLeaveList.DataKeys[_gridView.SelectedIndex].Values[7].ToString());

                arinfo2 = Common.str_split(hfLDates.Value.ToString(), splitter);
                if (arinfo2.Length > 1)
                {
                    leaveStart = arinfo2[0];
                    leaveEnd   = arinfo2[1];
                }
                else if (arinfo2.Length == 1)
                {
                    leaveStart = arinfo2[0];
                    leaveEnd   = arinfo2[0];
                }
                else
                {
                    leaveStart = "";
                    leaveEnd   = "";
                }

                //Email Notification
                mailMessage = objMail.LeaveMail(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                                                Session["EMPID"].ToString(), leaveStart, leaveEnd, "A");
                if (mailMessage == "")
                {
                    mailMessage = "Leave has been approved successfully";
                }
                //lblMsg.Text = "Leave has been approved and mailed successfully";
                SiteMaster.ShowClientMessage(Page, "Leave has been approved successfully", "success");
                break;

            case ("DenyClick"):
                AvailableLeave("A", grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[2].ToString(), _gridView.SelectedIndex);
                this.GetLeaveDates(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(), "A", grLeaveList.DataKeys[_gridView.SelectedIndex].Values[4].ToString(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[5].ToString());
                //CalculateLeaveDates("A");
                //this.GetWeekend(grLeaveApp.SelectedRow.Cells[1].Text.Trim(), grLeaveApp.SelectedRow.Cells[4].Text.Trim(), grLeaveApp.SelectedRow.Cells[5].Text.Trim(),"A");
                objLeaveMgr.UpdateLeaveAppMstForDeny(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                                                     grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), "Y", "N", "D",
                                                     Session["USERID"].ToString(), Common.ReturnDateTimeInString(Common.DisplayDateTime(DateTime.Now.ToString(), false, Constant.strDateFormat), false, Constant.strDateFormat));

                arinfo2 = Common.str_split(hfLDates.Value.ToString(), splitter);
                if (arinfo2.Length > 1)
                {
                    leaveStart = arinfo2[0];
                    leaveEnd   = arinfo2[1];
                }
                else if (arinfo2.Length == 1)
                {
                    leaveStart = arinfo2[0];
                    leaveEnd   = arinfo2[0];
                }
                else
                {
                    leaveStart = "";
                    leaveEnd   = "";
                }
                mailMessage = objMail.LeaveMail(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                                                Session["EMPID"].ToString(), leaveStart, leaveEnd, "D");
                SiteMaster.ShowClientMessage(Page, "Leave has been Regreted Successfully.", "success");
                break;

            case ("CancelClick"):
                AvailableLeave("A", grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[2].ToString(), _gridView.SelectedIndex);
                this.GetLeaveDates(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(), "A", grLeaveList.DataKeys[_gridView.SelectedIndex].Values[4].ToString(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[5].ToString());
                //CalculateLeaveDates("A");
                //this.GetWeekend(grLeaveApp.SelectedRow.Cells[1].Text.Trim(), grLeaveApp.SelectedRow.Cells[4].Text.Trim(), grLeaveApp.SelectedRow.Cells[5].Text.Trim(),"A");
                objLeaveMgr.CancelLeaveApp(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                                           grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), "Y", "N", "C",
                                           Session["USERID"].ToString(), Common.ReturnDateTimeInString(Common.DisplayDateTime(DateTime.Now.ToString(), false, Constant.strDateFormat), false, Constant.strDateFormat));

                arinfo2 = Common.str_split(hfLDates.Value.ToString(), splitter);
                if (arinfo2.Length > 1)
                {
                    leaveStart = arinfo2[0];
                    leaveEnd   = arinfo2[1];
                }
                else if (arinfo2.Length == 1)
                {
                    leaveStart = arinfo2[0];
                    leaveEnd   = arinfo2[0];
                }
                else
                {
                    leaveStart = "";
                    leaveEnd   = "";
                }
                mailMessage = objMail.LeaveMail(grLeaveList.DataKeys[_gridView.SelectedIndex].Values[11].ToString(), grLeaveList.DataKeys[_gridView.SelectedIndex].Values[0].ToString(),
                                                Session["EMPID"].ToString(), leaveStart, leaveEnd, "C");

                SiteMaster.ShowClientMessage(Page, "Leave has been Cancelled Successfully.", "success");
                break;
            }

            this.OpenRecord();
            strPreYrLv = "";
        }