Пример #1
0
        public ActionResult AddWFHComments(string userid, string status, string userwfhId, string managermail, string managerid, string managername, string startDate, string endDate)
        {
            Decript objdecrypt = new Decript();
            var newemail = accmail;
            var useriddd = objdecrypt.Decryption(userid);
            var leavid = objdecrypt.Decryption(userwfhId);
            var mngermail = objdecrypt.Decryption(managermail);
            var mngerid = objdecrypt.Decryption(managerid);
            var mngername = objdecrypt.Decryption(managername);
            int Usrid = uid;
            uid =Convert.ToInt32(useriddd);

            ManagerWFHforApproval obj = new ManagerWFHforApproval();
            obj = new ManagerWFHforApproval()
            {
                Usrl_UserId = Convert.ToInt32(useriddd),
                UserwfhID = Convert.ToInt32(leavid),
                ManagerID1 = Convert.ToInt32(mngerid),
                ManagerName1 = mngername,
                Leavestatus = status.ToString(),

            };
            obj = CheckMailWFHApproval(obj);

            if (obj.Message == "Already Approved")
            {
                ViewBag.msg = "Already Approved";
                return View();
            }

            else if (obj.Message == "Already Rejected")
            {
                ViewBag.msg = "Already Rejected";
                return View();
            }
            else if (obj.Message == "On Hold")
            {
                ViewBag.msg = "Already On Hold";
                return View();
            }
            else
            {
                managerwfhcomments wfhcmt = new managerwfhcomments();
                wfhcmt.WfhUserid = userid;
                wfhcmt.WfhStatuses = status;
                wfhcmt.userWFHId = userwfhId;
                wfhcmt.WfhManagerMail = managermail;
                wfhcmt.WfhManagerId = managerid;
                wfhcmt.WfhManagerName = managername;
                wfhcmt.WfhStartDate = startDate;
                wfhcmt.WfhEndDate = endDate;

                ViewBag.WfhUserid = wfhcmt.WfhUserid;
                ViewBag.WfhStatuses = wfhcmt.WfhStatuses;
                ViewBag.userWFHId = wfhcmt.userWFHId;
                ViewBag.WfhManagerMail = wfhcmt.WfhManagerMail;
                ViewBag.WfhManagerId = wfhcmt.WfhManagerId;
                ViewBag.WfhManagerName = wfhcmt.WfhManagerName;
                ViewBag.WfhStartDate = wfhcmt.WfhStartDate;
                ViewBag.WfhEndDate = wfhcmt.WfhEndDate;
                return View(wfhcmt);

            }
        }
Пример #2
0
        public string WorkFromHomeStatus(string cmt, string userid, string status, string leaveid, string managermail, string managerid, string managername, string startDate, string endDate)
        {

            string LeavId = String.Empty, mangrmail = String.Empty, mangrname = String.Empty, mangrid = String.Empty;
            string UrlEmailImage = string.Empty;

            Decript objdecrypt = new Decript();
            var newemail = accmail;
            var useriddd = objdecrypt.Decryption(userid);
            var leavid = objdecrypt.Decryption(leaveid);
            var mngermail = objdecrypt.Decryption(managermail);
            var mngerid = objdecrypt.Decryption(managerid);
            var mngername = objdecrypt.Decryption(managername);
            int Usrid = uid;

            //LeavId = newuwfhid;
            //mangrmail = email;
            //mangrid = id;
            //mangrname = name;

            EvolutyzCornerDataEntities db = new EvolutyzCornerDataEntities();
            var getusermailid = (from u in db.UsersProfiles where u.UsrP_UserID == uid select u.UsrP_EmailID).FirstOrDefault();
            var getaccntid = (from u in db.Users where u.Usr_UserID == uid select u.Usr_AccountID).FirstOrDefault();
            var getaccntlogo = (from a in db.Accounts where a.Acc_AccountID == getaccntid select a.Acc_CompanyLogo).FirstOrDefault();
            // UrlEmailImage = "<img alt='Company Logo' style='height:100px;display:block;margin:auto;max-width:100%;' src='" + "https://" + UrlEmailAddress + "/uploadimages/Images/" + getaccntlogo + "'";
            UrlEmailImage = "<img alt='Company Logo'   src='" + "https://" + UrlEmailAddress + "/uploadimages/images/thumb/" + getaccntlogo + "'";
            var emailcontent = "";

            ManagerWFHforApproval obj = new ManagerWFHforApproval();
            obj = new ManagerWFHforApproval()
            {
                Usrl_UserId = Convert.ToInt32(useriddd),
                UserwfhID = Convert.ToInt32(leavid),
                ManagerID1 = Convert.ToInt32(mngerid),
                ManagerName1 = mngername,
                Leavestatus = status.ToString(),

            };
            obj = CheckMailWFHApproval(obj);

            if (obj.Message == "Already approved")
            {
                return obj.Message;
            }

            else if (obj.Message == "Already Rejected")
            {
                return obj.Message;
            }
            else if (obj.Message == "On Hold")
            {
                return obj.Message;
            }
            //else if(obj.Message == "Leave Already Approved")
            //{
            //    return obj.Message;
            //}
            //else if(obj.Message == "Leave Already Rejected")
            //{
            //    return obj.Message;
            //}
            else
            {

                if (status == "1")
                {
                    emailcontent = "<html>" +
                    "<body bgcolor='#f6f6f6' style='-webkit-font-smoothing: antialiased; background:#f6f6f6; margin:0 auto; padding:0;'>" +
                    "<div style='background:#f4f4f4; border: 0px solid #f4f4f4; margin:0; padding:0'>" +
                    "<center>" +
                    "<table bgcolor='#ffffff' border='0' cellpadding='0' cellspacing='0' style='background: #ffffff; border-collapse:collapse !important; table-layout:fixed; mso-table-lspace:0pt; mso-table-rspace:0pt; width:100%'>" +
                    "<tbody>" +
                    "<tr>" +
                    "<td align='center' bgcolor='#ffffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size:18px; line-height:28px; padding-bottom:0px; padding-top:0px valign='top'>" +
                    "<a href='javascript:;' style='color: #7DA33A;text-decoration: none;display: block;' target='_blank'>" +
                    //"<img alt='Company Logo' src='http://evolutyz.in/img/evolutyz-logo.png'/>" +
                    UrlEmailImage +
                    "</a>" +
                    "</td>" +
                    " </tr>" +
                    " <tr>" +
                    "<td align='center' bgcolor='#ffffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 20px; padding-top: 0px' valign='top'>" +
                    " </td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td align='center' bgcolor='#fffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 20px; padding-top: 20px' valign=top>" +
                    " <h2 align='center' style='color: #707070; font-weight: 400; margin:0; text-align: center'>Work From Home</h2>" +
                    "</td>" +
                    " </tr>" +
                    "</tbody>" +
                    "</table>" +
                    "<table bgcolor='#ffffff' border='0' cellpadding='0' cellspacing='0' class='mobile' style='background: #ffffff; border-collapse:collapse !important; table-layout:fixed; mso-table-lspace:0pt; mso-table-rspace:0pt; width:100%'>" +
                    "<tbody>" +
                    "<tr>" +
                    "<td align='center'>" +
                    "<table bgcolor='#ffffff' cellpadding='0' cellspacing='0' class='mobile' style='background: #ffffff; border-collapse:collapse !important; border: 1px solid #d1d2d1; max-width:600px; mso-table-lspace:0pt; mso-table-rspace:0pt; width:96%'>" +
                    " <tbody>" +
                    " <tr>" +
                    "<td align=center bgcolor='#ffffff' style='background: #ffffff; padding-bottom:0px'; padding-top:0' valign='top'>" +
                    "<table align='center' border='0' cellpadding = '0' cellspacing = '0' style = 'border-collapse: collapse !important; max-width:600px; mso-table-lspace:0pt; mso-table-rspace:0pt; width:80%'>" +
                    " <tbody>" +
                    "<tr>" +
                    "<td align='left' bgcolor='#ffffff' style='background: #ffffff; font-family:Lato, Helevetica, Arial, sans-serif; font-size:18px; line-height:28px; padding:10px 0px 20px' valign='top'>" +
                    "<table align='center' border='0' cellpadding='0' cellspacing='0' style='border-collapse:collapse !important; max-width:600px; width:100%'>" +
                    "<tbody>" +
                    "<tr>" +
                    "<td align='left' bgcolor='#ffffff' style=background:'#ffffff; font-family:Lato, Helevetica, Arial, sans-serif; font-size:18px; max-width:80%; padding:0px; width:40%' valign='top'>" +
                    "<p align='left' style='color: #707070; font-size:14px; font-weight:400; line-height:22px; padding-bottom:0px; text-align:left'>" +
                    "<strong>" +
                    "Work From Home Approved By" +
                    " </strong>" +
                    "<br>" +
                    "</p>" +
                    "</td>" +
                    "<td align = 'right' bgcolor = '#ffffff' style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 0px; width: 40%' valign='top'>" +
                    "<p align = 'right' style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: 'right'>" +
                     name +
                    "</p>" +
                    "</td>" +
                    "</tr>" +
                    "</tbody>" +
                    "</table>" +
                    "<hr>" +
                    "<table align ='center' border = '0' cellpadding = '0' cellspacing = '0' style = 'border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%'>" +
                    " <tbody>" +
                    "<tr>" +
                    "<td align = 'left' bgcolor = '#ffffff' style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                    "<p align = 'left' style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                    "<strong>" +
                    " FromDate " +
                    " </strong>" +
                    "<br> " +
                    "</p>" +
                    " </td>" +
                    "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                    "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                    "<strong>" +
                    startDate +
                    "</strong>" +
                    "</p>" +
                    "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td align = left bgcolor = #ffffff style = background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                    "<p align = left style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                    "<strong> " +
                    " ToDate " +
                    " </strong>" +
                    "<br>" +
                    "</p>" +
                    "</td>" +
                    "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                    "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                    "<strong> " +
                    endDate +
                    "</strong>" +
                    "</p>" +
                    "</td>" +
                    "</tr>" +
                    "</tbody>" +
                    "</table>" +
                    "</td>" +
                    "</tr>" +
                    "</tbody>" +
                    "</table>" +
                    "<table align = center bgcolor = #ffffff border =0 cellpadding =0 cellspacing = 0 style = 'background: #ffffff; border-collapse: collapse !important; border-top-color: #D1D2D1; border-top-style: solid; border-top-width: 1px; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%'>" +
                    "<tbody>" +
                    " <tr>" +
                    "<td align = center bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding: 10x 0px 20px' valign='middle'>" +
                    "<table align = center border = 0 cellpadding = 0 cellspacing = 0 style = 'border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 80%'>" +
                    "<tbody>" +
                    "<tr>" +
                    " <td align = center bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                    "<p align = left style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                    "<strong> " +
                    "Comments " +
                    "</strong>" +
                    "</p>" +
                    "</td>" +
                    "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                    "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                    "<strong>" +
                     cmt +
                    "</strong>" +
                    "</p>" +
                    "</td>" +
                    "</tr>" +
                    "</tbody>" +
                    "</table>" +
                    "</td>" +
                    "</tr>" +
                    "</tbody>" +
                    "</table>" +
                    " </td>" +
                    "</tr>" +
                    "</tbody>" +
                    " </table>" +
                    "<table bgcolor = #ffffff cellpadding =0 cellspacing =0 class=mobile style='background: #ffffff; border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 96%'>" +
                    "<tbody>" +
                    "<tr>" +
                    "<td align = center style='padding-bottom: 20px' valign=top>" +
                    "<table align = center border=0 cellpadding=0 cellspacing=0 style='border-collapse: collapse !important; mso-table-lspace: 0pt; mso-table-rspace: 0pt'>" +
                    "<tbody>" +
                    "<tr>" +
                    "<td align = center style='padding-bottom: 0px; padding-top: 30px' valign=top>" +
                    "</td>" +
                    "</tr>" +
                    "</tbody>" +
                    "</table>" +
                    "</td>" +
                    "</tr>" +
                    "</tbody>" +
                    "</table>" +
                    "</td>" +
                    "</tr>" +
                    "</tbody>" +
                    "</table>" +
                    "</center>" +
                    "</div>" +
                    "</body>" +
                    "</html>";
                    //RestClient client = new RestClient();
                    //client.BaseUrl = new Uri("https://api.mailgun.net/v3");
                    //client.Authenticator = new HttpBasicAuthenticator("api", "key-25b8e8c23e4a09ef67b7957d77eb7413");
                    //RestRequest request = new RestRequest();
                    //request.AddParameter("domain", "evolutyzstaging.com", ParameterType.UrlSegment);
                    //request.Resource = "{domain}/messages";
                    //request.AddParameter("from", "Evolutyz ITServices <*****@*****.**>");
                    //request.AddParameter("to", getusermailid);
                    //request.AddParameter("to", newemail);
                    //request.AddParameter("subject", "Work From Home Approved");
                    //request.AddParameter("html", emailcontent);
                    //request.Method = Method.POST;
                    //client.Execute(request);

                    var client = new SendGridClient("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");

                    var msgs = new SendGridMessage()
                    {
                        // From = new EmailAddress(mngermail),
                        From = new EmailAddress(FromMailAddress),
                        Subject = "Work From Home Approved",
                        //TemplateId = "d-0741723a4269461e99a89e57a58dc0d3",
                        HtmlContent = emailcontent

                    };
                    msgs.AddTo(new EmailAddress(getusermailid));

                    var responses = client.SendEmailAsync(msgs);
                }
                else
                {
                    if (status == "2")
                    {
                        emailcontent = "<html>" +
                   "<body bgcolor='#f6f6f6' style='-webkit-font-smoothing: antialiased; background:#f6f6f6; margin:0 auto; padding:0;'>" +
                   "<div style='background:#f4f4f4; border: 0px solid #f4f4f4; margin:0; padding:0'>" +
                   "<center>" +
                   "<table bgcolor='#ffffff' border='0' cellpadding='0' cellspacing='0' style='background: #ffffff; border-collapse:collapse !important; table-layout:fixed; mso-table-lspace:0pt; mso-table-rspace:0pt; width:100%'>" +
                   "<tbody>" +
                   "<tr>" +
                   "<td align='center' bgcolor='#ffffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size:18px; line-height:28px; padding-bottom:0px; padding-top:0px valign='top'>" +
                   "<a href='javascript:;' style='color: #7DA33A;text-decoration: none;display: block;' target='_blank'>" +
                    //"<img alt='Company Logo' src='http://evolutyz.in/img/evolutyz-logo.png'/>" +
                    UrlEmailImage +
                   "</a>" +
                   "</td>" +
                   " </tr>" +
                   " <tr>" +
                   "<td align='center' bgcolor='#ffffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 20px; padding-top: 0px' valign='top'>" +
                   " </td>" +
                   "</tr>" +
                   "<tr>" +
                   "<td align='center' bgcolor='#fffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 20px; padding-top: 20px' valign=top>" +
                   " <h2 align='center' style='color: #707070; font-weight: 400; margin:0; text-align: center'>Work From Home</h2>" +
                   "</td>" +
                   " </tr>" +
                   "</tbody>" +
                   "</table>" +
                   "<table bgcolor='#ffffff' border='0' cellpadding='0' cellspacing='0' class='mobile' style='background: #ffffff; border-collapse:collapse !important; table-layout:fixed; mso-table-lspace:0pt; mso-table-rspace:0pt; width:100%'>" +
                   "<tbody>" +
                   "<tr>" +
                   "<td align='center'>" +
                   "<table bgcolor='#ffffff' cellpadding='0' cellspacing='0' class='mobile' style='background: #ffffff; border-collapse:collapse !important; border: 1px solid #d1d2d1; max-width:600px; mso-table-lspace:0pt; mso-table-rspace:0pt; width:96%'>" +
                   " <tbody>" +
                   " <tr>" +
                   "<td align=center bgcolor='#ffffff' style='background: #ffffff; padding-bottom:0px'; padding-top:0' valign='top'>" +
                   "<table align='center' border='0' cellpadding = '0' cellspacing = '0' style = 'border-collapse: collapse !important; max-width:600px; mso-table-lspace:0pt; mso-table-rspace:0pt; width:80%'>" +
                   " <tbody>" +
                   "<tr>" +
                   "<td align='left' bgcolor='#ffffff' style='background: #ffffff; font-family:Lato, Helevetica, Arial, sans-serif; font-size:18px; line-height:28px; padding:10px 0px 20px' valign='top'>" +
                   "<table align='center' border='0' cellpadding='0' cellspacing='0' style='border-collapse:collapse !important; max-width:600px; width:100%'>" +
                   "<tbody>" +
                   "<tr>" +
                   "<td align='left' bgcolor='#ffffff' style=background:'#ffffff; font-family:Lato, Helevetica, Arial, sans-serif; font-size:18px; max-width:80%; padding:0px; width:40%' valign='top'>" +
                   "<p align='left' style='color: #707070; font-size:14px; font-weight:400; line-height:22px; padding-bottom:0px; text-align:left'>" +
                   "<strong>" +
                   "Work From Home Rejected By" +
                   " </strong>" +
                   "<br>" +
                   "</p>" +
                   "</td>" +
                   "<td align = 'right' bgcolor = '#ffffff' style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width:80%; padding:0px; width:40%' valign='top'>" +
                   "<p align = 'right' style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: 'right'>" +
                    name +
                   "</p>" +
                   "</td>" +
                   "</tr>" +
                   "</tbody>" +
                   "</table>" +
                   "<hr>" +
                   "<table align ='center' border = '0' cellpadding = '0' cellspacing = '0' style = 'border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%'>" +
                   " <tbody>" +
                   "<tr>" +
                   "<td align = 'left' bgcolor = '#ffffff' style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                   "<p align = 'left' style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                   "<strong>" +
                   " FromDate " +
                   " </strong>" +
                   "<br> " +
                   "</p>" +
                   " </td>" +
                   "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                   "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                   "<strong>" +
                   startDate +
                   "</strong>" +
                   "</p>" +
                   "</td>" +
                   "</tr>" +
                   "<tr>" +
                   "<td align = left bgcolor = #ffffff style = background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                   "<p align = left style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                   "<strong> " +
                   " ToDate " +
                   " </strong>" +
                   "<br>" +
                   "</p>" +
                   "</td>" +
                   "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                   "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                   "<strong> " +
                   endDate +
                   "</strong>" +
                   "</p>" +
                   "</td>" +
                   "</tr>" +
                   "</tbody>" +
                   "</table>" +
                   "</td>" +
                   "</tr>" +
                   "</tbody>" +
                   "</table>" +
                   "<table align = center bgcolor = #ffffff border =0 cellpadding =0 cellspacing = 0 style = 'background: #ffffff; border-collapse: collapse !important; border-top-color: #D1D2D1; border-top-style: solid; border-top-width: 1px; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%'>" +
                   "<tbody>" +
                   " <tr>" +
                   "<td align = center bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding: 10x 0px 20px' valign='middle'>" +
                   "<table align = center border = 0 cellpadding = 0 cellspacing = 0 style = 'border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 80%'>" +
                   "<tbody>" +
                   "<tr>" +
                   " <td align = center bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                   "<p align = left style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                   "<strong> " +
                   "Comments " +
                   "</strong>" +
                   "</p>" +
                   "</td>" +
                   "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                   "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                   "<strong>" +
                    cmt +
                   "</strong>" +
                   "</p>" +
                   "</td>" +
                   "</tr>" +
                   "</tbody>" +
                   "</table>" +
                   "</td>" +
                   "</tr>" +
                   "</tbody>" +
                   "</table>" +
                   " </td>" +
                   "</tr>" +
                   "</tbody>" +
                   " </table>" +
                   "<table bgcolor = #ffffff cellpadding =0 cellspacing =0 class=mobile style='background: #ffffff; border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 96%'>" +
                   "<tbody>" +
                   "<tr>" +
                   "<td align = center style='padding-bottom: 20px' valign=top>" +
                   "<table align = center border=0 cellpadding=0 cellspacing=0 style='border-collapse: collapse !important; mso-table-lspace: 0pt; mso-table-rspace: 0pt'>" +
                   "<tbody>" +
                   "<tr>" +
                   "<td align = center style='padding-bottom: 0px; padding-top: 30px' valign=top>" +
                   "</td>" +
                   "</tr>" +
                   "</tbody>" +
                   "</table>" +
                   "</td>" +
                   "</tr>" +
                   "</tbody>" +
                   "</table>" +
                   "</td>" +
                   "</tr>" +
                   "</tbody>" +
                   "</table>" +
                   "</center>" +
                   "</div>" +
                   "</body>" +
                   "</html>";
                        //RestClient client = new RestClient();
                        //client.BaseUrl = new Uri("https://api.mailgun.net/v3");
                        //client.Authenticator = new HttpBasicAuthenticator("api", "key-25b8e8c23e4a09ef67b7957d77eb7413");
                        //RestRequest request = new RestRequest();
                        //request.AddParameter("domain", "evolutyzstaging.com", ParameterType.UrlSegment);
                        //request.Resource = "{domain}/messages";
                        //request.AddParameter("from", "Evolutyz ITServices <*****@*****.**>");
                        //request.AddParameter("to", getusermailid);
                        //request.AddParameter("to", newemail);
                        //request.AddParameter("subject", "Work From Home Rejected");
                        //request.AddParameter("html", emailcontent);
                        //request.Method = Method.POST;
                        //client.Execute(request);
                        var client = new SendGridClient("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");

                        var msgs = new SendGridMessage()
                        {
                            //From = new EmailAddress(mngermail),
                            From = new EmailAddress(FromMailAddress),
                            Subject = "Work From Home Rejected",
                            //TemplateId = "d-0741723a4269461e99a89e57a58dc0d3",
                            HtmlContent = emailcontent

                        };
                        msgs.AddTo(new EmailAddress(getusermailid));
                        var responses = client.SendEmailAsync(msgs);

                    }
                    else
                    {
                        emailcontent = "<html>" +
                "<body bgcolor='#f6f6f6' style='-webkit-font-smoothing: antialiased; background:#f6f6f6; margin:0 auto; padding:0;'>" +
                "<div style='background:#f4f4f4; border: 0px solid #f4f4f4; margin:0; padding:0'>" +
                "<center>" +
                "<table bgcolor='#ffffff' border='0' cellpadding='0' cellspacing='0' style='background: #ffffff; border-collapse:collapse !important; table-layout:fixed; mso-table-lspace:0pt; mso-table-rspace:0pt; width:100%'>" +
                "<tbody>" +
                "<tr>" +
                "<td align='center' bgcolor='#ffffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size:18px; line-height:28px; padding-bottom:0px; padding-top:0px valign='top'>" +
                "<a href='javascript:;' style='color: #7DA33A;text-decoration: none;display: block;' target='_blank'>" +
                //"<img alt='Company Logo' src='http://evolutyz.in/img/evolutyz-logo.png'/>" +
                UrlEmailImage +
                "</a>" +
                "</td>" +
                " </tr>" +
                " <tr>" +
                "<td align='center' bgcolor='#ffffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 20px; padding-top: 0px' valign='top'>" +
                " </td>" +
                "</tr>" +
                "<tr>" +
                "<td align='center' bgcolor='#fffff' style='background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 20px; padding-top: 20px' valign=top>" +
                " <h2 align='center' style='color: #707070; font-weight: 400; margin:0; text-align: center'>Work From Home</h2>" +
                "</td>" +
                " </tr>" +
                "</tbody>" +
                "</table>" +
                "<table bgcolor='#ffffff' border='0' cellpadding='0' cellspacing='0' class='mobile' style='background: #ffffff; border-collapse:collapse !important; table-layout:fixed; mso-table-lspace:0pt; mso-table-rspace:0pt; width:100%'>" +
                "<tbody>" +
                "<tr>" +
                "<td align='center'>" +
                "<table bgcolor='#ffffff' cellpadding='0' cellspacing='0' class='mobile' style='background: #ffffff; border-collapse:collapse !important; border: 1px solid #d1d2d1; max-width:600px; mso-table-lspace:0pt; mso-table-rspace:0pt; width:96%'>" +
                " <tbody>" +
                " <tr>" +
                "<td align=center bgcolor='#ffffff' style='background: #ffffff; padding-bottom:0px'; padding-top:0' valign='top'>" +
                "<table align='center' border='0' cellpadding = '0' cellspacing = '0' style = 'border-collapse: collapse !important; max-width:600px; mso-table-lspace:0pt; mso-table-rspace:0pt; width:80%'>" +
                " <tbody>" +
                "<tr>" +
                "<td align='left' bgcolor='#ffffff' style='background: #ffffff; font-family:Lato, Helevetica, Arial, sans-serif; font-size:18px; line-height:28px; padding:10px 0px 20px' valign='top'>" +
                "<table align='center' border='0' cellpadding='0' cellspacing='0' style='border-collapse:collapse !important; max-width:600px; width:100%'>" +
                "<tbody>" +
                "<tr>" +
                "<td align='left' bgcolor='#ffffff' style=background:'#ffffff; font-family:Lato, Helevetica, Arial, sans-serif; font-size:18px; max-width:80%; padding:0px; width:40%' valign='top'>" +
                "<p align='left' style='color: #707070; font-size:14px; font-weight:400; line-height:22px; padding-bottom:0px; text-align:left'>" +
                "<strong>" +
                "Work From Home kept on hold by" +
                " </strong>" +
                "<br>" +
                "</p>" +
                "</td>" +
                "<td align = 'right' bgcolor = '#ffffff' style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width:80%; padding:0px; width:40%' valign='top'>" +
                "<p align = 'right' style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: 'right'>" +
                 name +
                 "</p>" +
                "</td>" +
                "</tr>" +
                "</tbody>" +
                "</table>" +
                "<hr>" +
                "<table align ='center' border = '0' cellpadding = '0' cellspacing = '0' style = 'border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%'>" +
                " <tbody>" +
                "<tr>" +
                "<td align = 'left' bgcolor = '#ffffff' style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                "<p align = 'left' style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                "<strong>" +
                " FromDate " +
                " </strong>" +
                "<br> " +
                "</p>" +
                " </td>" +
                "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                "<strong>" +
                startDate +
                "</strong>" +
                "</p>" +
                "</td>" +
                "</tr>" +
                "<tr>" +
                "<td align = left bgcolor = #ffffff style = background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                "<p align = left style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                "<strong> " +
                " ToDate " +
                " </strong>" +
                "<br>" +
                "</p>" +
                "</td>" +
                "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                "<strong> " +
                endDate +
                "</strong>" +
                "</p>" +
                "</td>" +
                "</tr>" +
                "</tbody>" +
                "</table>" +
                "</td>" +
                "</tr>" +
                "</tbody>" +
                "</table>" +
                "<table align = center bgcolor = #ffffff border =0 cellpadding =0 cellspacing = 0 style = 'background: #ffffff; border-collapse: collapse !important; border-top-color: #D1D2D1; border-top-style: solid; border-top-width: 1px; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%'>" +
                "<tbody>" +
                " <tr>" +
                "<td align = center bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; line-height: 28px; padding: 10x 0px 20px' valign='middle'>" +
                "<table align = center border = 0 cellpadding = 0 cellspacing = 0 style = 'border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 80%'>" +
                "<tbody>" +
                "<tr>" +
                " <td align = center bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; max-width: 80%; padding: 10px 0px 0px; width: 40%' valign='middle'>" +
                "<p align = left style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: left'>" +
                "<strong> " +
                "Comments " +
                "</strong>" +
                "</p>" +
                "</td>" +
                "<td align = right bgcolor = #ffffff style = 'background: #ffffff; font-family: Lato, Helevetica, Arial, sans-serif; font-size: 18px; padding: 10x 0px 0px' valign='middle'>" +
                "<p align = right style = 'color: #707070; font-size: 14px; font-weight: 400; line-height: 22px; padding-bottom: 0px; text-align: right'>" +
                "<strong>" +
                cmt +
                "</strong>" +
                "</p>" +
                "</td>" +
                "</tr>" +
                "</tbody>" +
                "</table>" +
                "</td>" +
                "</tr>" +
                "</tbody>" +
                "</table>" +
                " </td>" +
                "</tr>" +
                "</tbody>" +
                " </table>" +
                "<table bgcolor = #ffffff cellpadding =0 cellspacing =0 class=mobile style='background: #ffffff; border-collapse: collapse !important; max-width: 600px; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 96%'>" +
                "<tbody>" +
                "<tr>" +
                "<td align = center style='padding-bottom: 20px' valign=top>" +
                "<table align = center border=0 cellpadding=0 cellspacing=0 style='border-collapse: collapse !important; mso-table-lspace: 0pt; mso-table-rspace: 0pt'>" +
                "<tbody>" +
                "<tr>" +
                "<td align = center style='padding-bottom: 0px; padding-top: 30px' valign=top>" +
                "</td>" +
                "</tr>" +
                "</tbody>" +
                "</table>" +
                "</td>" +
                "</tr>" +
                "</tbody>" +
                "</table>" +
                "</td>" +
                "</tr>" +
                "</tbody>" +
                "</table>" +
                "</center>" +
                "</div>" +
                "</body>" +
                "</html>";

                        //RestClient client = new RestClient();
                        //client.BaseUrl = new Uri("https://api.mailgun.net/v3");
                        //client.Authenticator = new HttpBasicAuthenticator("api", "key-25b8e8c23e4a09ef67b7957d77eb7413");
                        //RestRequest request = new RestRequest();
                        //request.AddParameter("domain", "evolutyzstaging.com", ParameterType.UrlSegment);
                        //request.Resource = "{domain}/messages";
                        //request.AddParameter("from", "Evolutyz ITServices <*****@*****.**>");
                        //request.AddParameter("to", getusermailid);
                        //request.AddParameter("to", newemail);
                        //request.AddParameter("subject", "Work from Home OnHold");
                        //request.AddParameter("html", emailcontent);
                        //request.Method = Method.POST;
                        //client.Execute(request);

                        var client = new SendGridClient("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");

                        var msgs = new SendGridMessage()
                        {
                            //From = new EmailAddress(mngermail),
                            From = new EmailAddress(FromMailAddress),
                            Subject = "Work from Home OnHold",
                            //TemplateId = "d-0741723a4269461e99a89e57a58dc0d3",
                            HtmlContent = emailcontent

                        };
                        msgs.AddTo(new EmailAddress(getusermailid));
                        var responses = client.SendEmailAsync(msgs);
                    }
                }

                AdminComponent admc = new AdminComponent();

                //var res = admc.SaveWorkFromHomeStatus(newuwfhid, status, id);leavid, status, mngerid, useriddd
                var res = admc.SaveWorkFromHomeStatus(cmt, leavid, status, mngerid, useriddd);
                obj.Message = res;
            }

            // return null;
            return obj.Message;

        }