Example #1
0
        public bool SaveDesignationHTMLTemplate(DesignationHTMLTemplate objDesignationHTMLTemplate, byte?intMasterCategory)
        {
            try
            {
                SqlDatabase database = MSSQLDataBase.Instance.GetDefaultDatabase();
                {
                    DbCommand command = database.GetStoredProcCommand("SaveDesignationHTMLTemplate");
                    command.CommandType = CommandType.StoredProcedure;
                    database.AddInParameter(command, "@HTMLTemplatesMasterId", DbType.Int16, objDesignationHTMLTemplate.HTMLTemplatesMasterId);
                    if (intMasterCategory.HasValue)
                    {
                        database.AddInParameter(command, "@MasterCategory", DbType.Byte, intMasterCategory);
                    }
                    else
                    {
                        database.AddInParameter(command, "@MasterCategory", DbType.Byte, DBNull.Value);
                    }
                    database.AddInParameter(command, "@Designation", DbType.String, objDesignationHTMLTemplate.Designation);
                    database.AddInParameter(command, "@Subject", DbType.String, objDesignationHTMLTemplate.Subject);
                    database.AddInParameter(command, "@Header", DbType.String, objDesignationHTMLTemplate.Header);
                    database.AddInParameter(command, "@Body", DbType.String, objDesignationHTMLTemplate.Body);
                    database.AddInParameter(command, "@Footer", DbType.String, objDesignationHTMLTemplate.Footer);

                    database.ExecuteNonQuery(command);

                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #2
0
        protected void btnSaveTemplate_Click(object sender, EventArgs e)
        {
            DesignationHTMLTemplate objDesignationHTMLTemplate = new DesignationHTMLTemplate();

            objDesignationHTMLTemplate.HTMLTemplatesMasterId = (byte)this.HTMLTemplate.Value;
            objDesignationHTMLTemplate.Designation           = ddlDesignation.SelectedValue;

            byte?intMasterCategory = null;

            // category field is visible and used only for auto email template type.
            // so, we are setting it to 0 for rest of the types.
            if (ddlCategory.SelectedIndex > 0)
            {
                intMasterCategory = Convert.ToByte(ddlCategory.SelectedValue);
            }

            objDesignationHTMLTemplate.Subject = txtSubject.Text;
            objDesignationHTMLTemplate.Header  = txtHeader.Content;
            objDesignationHTMLTemplate.Body    = txtBody.Content;
            objDesignationHTMLTemplate.Footer  = txtFooter.Content;
            if (HTMLTemplateBLL.Instance.SaveDesignationHTMLTemplate(objDesignationHTMLTemplate, intMasterCategory))
            {
                CommonFunction.ShowAlertFromUpdatePanel(this, "Designation template updated.");
                Response.Redirect(Request.Url.ToString());
            }
            else
            {
                CommonFunction.ShowAlertFromUpdatePanel(this, "Designation template can not be updated! Please try again later.");
            }
        }
Example #3
0
        public void SendOfflineChatEmail(int LoginUserID, int UserID, string LoginUserInstallID,
                                         string Message, int ChatSource, string BaseUrl, string chatGroupId, int userChatGroupId)
        {
            // Get Html Template
            string messageUrl = string.Empty, toEmail = string.Empty, body = string.Empty;
            //string BaseUrl = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority + System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/";
            DesignationHTMLTemplate html = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(HTMLTemplates.HR_EditSales_TouchpointLog_Email, "");
            // sender details
            var    sender = InstallUserBLL.Instance.getuserdetails(LoginUserID).Tables[0].Rows[0];
            string pic    = string.IsNullOrEmpty(sender["Picture"].ToString()) ? "default.jpg"
                                : sender["Picture"].ToString().Replace("~/UploadeProfile/", "");

            pic       = BaseUrl + "Employee/ProfilePictures/" + pic;
            html.Body = html.Body.Replace("{ImageUrl}", pic);
            html.Body = html.Body.Replace("{Name}", sender["FristName"].ToString() + " " + sender["LastName"].ToString());
            html.Body = html.Body.Replace("{Designation}", sender["Designation"].ToString());
            html.Body = html.Body.Replace("{UserInstallID}", sender["UserInstallID"].ToString());
            html.Body = html.Body.Replace("{ProfileUrl}", BaseUrl + "Sr_App/ViewSalesUser.aspx?id=" + sender["Id"].ToString());
            html.Body = html.Body.Replace("{MessageContent}", Message.Replace("Note :", "").Trim());

            // Generate auto login code
            string loginCode = InstallUserDAL.Instance.GenerateLoginCode(UserID).Object;
            var    receiver  = InstallUserBLL.Instance.getuserdetails(UserID).Tables[0].Rows[0];

            toEmail    = receiver["Email"].ToString();
            messageUrl = BaseUrl + "Sr_App/TouchPointLog.aspx?TUID=" + UserID + "&CGID=" + chatGroupId +
                         "&auth=" + loginCode + "&RcvrID=" + LoginUserID + "&Src=" + ChatSource +
                         "&ugid=" + userChatGroupId;

            body = (html.Header + html.Body + html.Footer).Replace("{MessageUrl}", messageUrl);
            EmailManager.SendEmail(JGConstant.EmailTypes.ChatMessage.ToString(), "New Message", toEmail, html.Subject, body, null);
        }
        private void SendEmail(string emailId, string FName, string LName, string status, string Reason, string Designition, int DesignitionId, string HireDate, string EmpType, string PayRates, HTMLTemplates objHTMLTemplateType, DateTime InterviewDateTime, List <Attachment> Attachments = null, string strManager = "")
        {
            DesignationHTMLTemplate objHTMLTemplate = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(objHTMLTemplateType, DesignitionId.ToString());

            string fullname = FName + " " + LName;

            string strHeader  = objHTMLTemplate.Header;
            string strBody    = objHTMLTemplate.Body;
            string strFooter  = objHTMLTemplate.Footer;
            string strsubject = objHTMLTemplate.Subject;

            strBody = strBody.Replace("#Email#", emailId).Replace("#email#", emailId);
            strBody = strBody.Replace("#FirstName#", FName);
            strBody = strBody.Replace("#LastName#", LName);
            strBody = strBody.Replace("#Name#", FName).Replace("#name#", FName);
            strBody = strBody.Replace("#Date#", CommonFunction.GetStandardDateString(InterviewDateTime)).Replace("#date#", CommonFunction.GetStandardDateString(InterviewDateTime));
            strBody = strBody.Replace("#Time#", CommonFunction.GetStandardTimeString(InterviewDateTime)).Replace("#time#", CommonFunction.GetStandardDateString(InterviewDateTime));
            strBody = strBody.Replace("#Designation#", Designition).Replace("#designation#", Designition);

            strFooter = strFooter.Replace("#Name#", FName).Replace("#name#", FName);
            strFooter = strFooter.Replace("#Date#", CommonFunction.GetStandardDateString(InterviewDateTime)).Replace("#date#", CommonFunction.GetStandardDateString(InterviewDateTime));
            strFooter = strFooter.Replace("#Time#", CommonFunction.GetStandardTimeString(InterviewDateTime)).Replace("#time#", CommonFunction.GetStandardTimeString(InterviewDateTime));
            strFooter = strFooter.Replace("#Designation#", Designition).Replace("#designation#", Designition);

            strBody = strBody.Replace("Lbl Full name", fullname);
            strBody = strBody.Replace("LBL position", Designition);
            //strBody = strBody.Replace("lbl: start date", txtHireDate.Text);
            //strBody = strBody.Replace("($ rate","$"+ txtHireDate.Text);
            strBody = strBody.Replace("Reason", Reason);

            strBody = strBody.Replace("#manager#", strManager);

            strBody = strHeader + strBody + strFooter;



            List <Attachment> lstAttachments = objHTMLTemplate.Attachments;


            if (Attachments != null)
            {
                lstAttachments.AddRange(Attachments);
            }

            try
            {
                JG_Prospect.App_Code.CommonFunction.SendEmail(Designition, emailId, strsubject, strBody, lstAttachments);

                ScriptManager.RegisterStartupScript(this, this.GetType(), "UserMsg", "alert('An email notification has sent on " + emailId + ".');", true);
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "UserMsg", "alert('Error while sending email notification on " + emailId + ".');", true);
            }
        }
Example #5
0
        public DesignationHTMLTemplate GetDesignationHTMLTemplate(HTMLTemplates objHTMLTemplates, string strDesignation)
        {
            try
            {
                SqlDatabase database = MSSQLDataBase.Instance.GetDefaultDatabase();
                {
                    DbCommand command = database.GetStoredProcCommand("GetDesignationHTMLTemplate");
                    command.CommandType = CommandType.StoredProcedure;
                    database.AddInParameter(command, "@Id", DbType.Int16, (byte)objHTMLTemplates);
                    if (!string.IsNullOrEmpty(strDesignation))
                    {
                        database.AddInParameter(command, "@Designation", DbType.String, strDesignation);
                    }

                    DataSet dsHTMLTemplate = database.ExecuteDataSet(command);
                    DesignationHTMLTemplate objHTMLTemplate = null;
                    if (
                        dsHTMLTemplate != null &&
                        dsHTMLTemplate.Tables.Count > 0 &&
                        dsHTMLTemplate.Tables[0].Rows.Count > 0
                        )
                    {
                        DataRow dr = dsHTMLTemplate.Tables[0].Rows[0];

                        objHTMLTemplate = new DesignationHTMLTemplate();

                        objHTMLTemplate.Id = Convert.ToInt32(dr["Id"]);
                        objHTMLTemplate.HTMLTemplatesMasterId = Convert.ToInt32(dr["HTMLTemplatesMasterId"]);
                        objHTMLTemplate.Subject = Convert.ToString(dr["Subject"]);
                        objHTMLTemplate.Header  = Convert.ToString(dr["Header"]);

                        String BodyText = Convert.ToString(dr["Body"]);

                        if (BodyText.IndexOf("#UNSEMAIL#") > 0)
                        {
                            objHTMLTemplate.Body = BodyText;
                        }
                        else
                        {
                            objHTMLTemplate.Body = String.Concat(BodyText, JGCommon.GetEmailUnSubscribeSection());
                        }

                        objHTMLTemplate.Footer      = Convert.ToString(dr["Footer"]);
                        objHTMLTemplate.DateUpdated = Convert.ToDateTime(dr["DateUpdated"]);
                    }

                    return(objHTMLTemplate);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        private void SendEmail(string emailId, string FName, string LName, string status, string Reason, string Designition, int DesignitionId, string HireDate, string EmpType, string PayRates, HTMLTemplates objHTMLTemplateType, DateTime InterviewDateTime, List <Attachment> Attachments = null, string strManager = "")
        {
            DesignationHTMLTemplate objHTMLTemplate = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(objHTMLTemplateType, DesignitionId.ToString());

            string fullname = FName + " " + LName;

            string strHeader  = objHTMLTemplate.Header;
            string strBody    = objHTMLTemplate.Body;
            string strFooter  = objHTMLTemplate.Footer;
            string strsubject = objHTMLTemplate.Subject;

            strBody = strBody.Replace("#Email#", emailId).Replace("#email#", emailId);
            strBody = strBody.Replace("#FirstName#", FName);
            strBody = strBody.Replace("#LastName#", LName);
            strBody = strBody.Replace("#Name#", FName).Replace("#name#", FName);
            strBody = strBody.Replace("#Date#", CommonFunction.GetStandardDateString(InterviewDateTime)).Replace("#date#", CommonFunction.GetStandardDateString(InterviewDateTime));
            strBody = strBody.Replace("#Time#", CommonFunction.GetStandardTimeString(InterviewDateTime)).Replace("#time#", CommonFunction.GetStandardDateString(InterviewDateTime));
            strBody = strBody.Replace("#Designation#", Designition).Replace("#designation#", Designition);

            strFooter = strFooter.Replace("#Name#", FName).Replace("#name#", FName);
            strFooter = strFooter.Replace("#Date#", CommonFunction.GetStandardDateString(InterviewDateTime)).Replace("#date#", CommonFunction.GetStandardDateString(InterviewDateTime));
            strFooter = strFooter.Replace("#Time#", CommonFunction.GetStandardTimeString(InterviewDateTime)).Replace("#time#", CommonFunction.GetStandardTimeString(InterviewDateTime));
            strFooter = strFooter.Replace("#Designation#", Designition).Replace("#designation#", Designition);

            strBody = strBody.Replace("Lbl Full name", fullname);
            strBody = strBody.Replace("LBL position", Designition);
            //strBody = strBody.Replace("lbl: start date", txtHireDate.Text);
            //strBody = strBody.Replace("($ rate","$"+ txtHireDate.Text);
            strBody = strBody.Replace("Reason", Reason);

            strBody = strBody.Replace("#manager#", strManager);

            strBody = strHeader + strBody + strFooter;

            List <Attachment> lstAttachments = objHTMLTemplate.Attachments;


            if (Attachments != null)
            {
                lstAttachments.AddRange(Attachments);
            }
            JG_Prospect.App_Code.CommonFunction.SendEmail(JGConstant.EmailTypes.InterviewEmail.ToString(), Designition, emailId, strsubject, strBody, lstAttachments);
        }
Example #7
0
        protected void btnSaveTemplate_Click(object sender, EventArgs e)
        {
            DesignationHTMLTemplate objDesignationHTMLTemplate = new DesignationHTMLTemplate();

            objDesignationHTMLTemplate.HTMLTemplatesMasterId = (byte)this.HTMLTemplate.Value;
            objDesignationHTMLTemplate.Designation           = ddlDesignation.SelectedValue;
            objDesignationHTMLTemplate.Subject = txtSubject.Text;
            objDesignationHTMLTemplate.Header  = txtHeader.Text;
            objDesignationHTMLTemplate.Body    = txtBody.Text;
            objDesignationHTMLTemplate.Footer  = txtFooter.Text;
            if (HTMLTemplateBLL.Instance.SaveDesignationHTMLTemplate(objDesignationHTMLTemplate))
            {
                CommonFunction.ShowAlertFromUpdatePanel(this, "Designation template updated.");
                Response.Redirect(Request.Url.ToString());
            }
            else
            {
                CommonFunction.ShowAlertFromUpdatePanel(this, "Designation template can not be updated! Please try again later.");
            }
        }
Example #8
0
        public bool SaveMasterSMSTemplate(DesignationHTMLTemplate objDesignationHTMLTemplate)
        {
            try
            {
                SqlDatabase database = MSSQLDataBase.Instance.GetDefaultDatabase();
                {
                    DbCommand command = database.GetStoredProcCommand("usp_updateMasterSMSTemplate");
                    command.CommandType = CommandType.StoredProcedure;
                    database.AddInParameter(command, "@MasterTemplateID", DbType.Int16, objDesignationHTMLTemplate.HTMLTemplatesMasterId);
                    database.AddInParameter(command, "@Body", DbType.String, objDesignationHTMLTemplate.Body);

                    database.ExecuteNonQuery(command);

                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #9
0
        protected void ddlDesignation_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlDesignation.SelectedIndex > 0)
            {
                DesignationHTMLTemplate objDesignationHTMLTemplate = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(this.HTMLTemplate.Value, ddlDesignation.SelectedValue);

                txtSubject.Text      = objDesignationHTMLTemplate.Subject;
                txtHeader.Text       = objDesignationHTMLTemplate.Header;
                txtBody.Text         = objDesignationHTMLTemplate.Body;
                txtFooter.Text       = objDesignationHTMLTemplate.Footer;
                trMasterCopy.Visible = (objDesignationHTMLTemplate.Id == 0);
            }
            else
            {
                txtHeader.Text              =
                    txtBody.Text            =
                        txtFooter.Text      =
                            txtSubject.Text = string.Empty;
                trMasterCopy.Visible        = false;
            }
        }
Example #10
0
 public bool SaveDesignationHTMLTemplate(DesignationHTMLTemplate objDesignationHTMLTemplate, byte?intMasterCategory)
 {
     return(HTMLTemplateDAL.Instance.SaveDesignationHTMLTemplate(objDesignationHTMLTemplate, intMasterCategory));
 }
        private void SendEmailToAssignedUsers(string strInstallUserIDs, string strTaskId, string strSubTaskId, string strTaskTitle, String InstallId)
        {
            try
            {
                //string strHTMLTemplateName = "Task Generator Auto Email";
                //DataSet dsEmailTemplate = AdminBLL.Instance.GetEmailTemplate(strHTMLTemplateName, 108);

                DesignationHTMLTemplate objHTMLTemplate = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(HTMLTemplates.Task_Generator_Auto_Email, JGSession.DesignationId.ToString());

                foreach (string userID in strInstallUserIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    DataSet dsUser = TaskGeneratorBLL.Instance.GetInstallUserDetails(Convert.ToInt32(userID));

                    string emailId  = dsUser.Tables[0].Rows[0]["Email"].ToString();
                    string FName    = dsUser.Tables[0].Rows[0]["FristName"].ToString();
                    string LName    = dsUser.Tables[0].Rows[0]["LastName"].ToString();
                    string fullname = FName + " " + LName;

                    //string strHeader = dsEmailTemplate.Tables[0].Rows[0]["HTMLHeader"].ToString();
                    //string strBody = dsEmailTemplate.Tables[0].Rows[0]["HTMLBody"].ToString();
                    //string strFooter = dsEmailTemplate.Tables[0].Rows[0]["HTMLFooter"].ToString();
                    //string strsubject = dsEmailTemplate.Tables[0].Rows[0]["HTMLSubject"].ToString();
                    string strHeader  = objHTMLTemplate.Header;
                    string strBody    = objHTMLTemplate.Body;
                    string strFooter  = objHTMLTemplate.Footer;
                    string strsubject = objHTMLTemplate.Subject;

                    strsubject = strsubject.Replace("#ID#", strTaskId);
                    strsubject = strsubject.Replace("#TaskTitleID#", strTaskTitle);
                    strsubject = strsubject.Replace("#TaskTitle#", strTaskTitle);

                    strBody = strBody.Replace("#ID#", strTaskId);
                    strBody = strBody.Replace("#TaskTitleID#", strTaskTitle);
                    strBody = strBody.Replace("#TaskTitle#", strTaskTitle);
                    strBody = strBody.Replace("#Fname#", fullname);
                    strBody = strBody.Replace("#email#", emailId);

                    strBody = strBody.Replace("#Designation(s)#", this.DesignationName);
                    strBody = strBody.Replace("#TaskLink#", string.Format(
                                                  "{0}?TaskId={1}&hstid={2}",
                                                  string.Concat(
                                                      JGApplicationInfo.GetSiteURL(),
                                                      "/Sr_App/TaskGenerator.aspx"
                                                      ),
                                                  strTaskId,
                                                  strSubTaskId
                                                  )
                                              );

                    // Added by Zubair Ahmed Khan for displaying proper text for task link
                    string strTaskLinkTitle = CommonFunction.GetTaskLinkTitleForAutoEmail(int.Parse(strTaskId));
                    strBody = strBody.Replace("#TaskLinkTitle#", strTaskLinkTitle);

                    strBody = strHeader + strBody + strFooter;

                    string            strHTMLTemplateName = "Task Generator Auto Email";
                    DataSet           dsEmailTemplate     = AdminBLL.Instance.GetEmailTemplate(strHTMLTemplateName, 108);
                    List <Attachment> lstAttachments      = new List <Attachment>();
                    // your remote SMTP server IP.
                    for (int i = 0; i < dsEmailTemplate.Tables[1].Rows.Count; i++)
                    {
                        string sourceDir = Server.MapPath(dsEmailTemplate.Tables[1].Rows[i]["DocumentPath"].ToString());
                        if (File.Exists(sourceDir))
                        {
                            Attachment attachment = new Attachment(sourceDir);
                            attachment.Name = Path.GetFileName(sourceDir);
                            lstAttachments.Add(attachment);
                        }
                    }

                    CommonFunction.SendEmail(HTMLTemplates.Task_Generator_Auto_Email.ToString(), emailId, strsubject, strBody, lstAttachments);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0} Exception caught.", ex);
            }
        }
        private void SetCarrerPathDetails()
        {
            DesignationHTMLTemplate objHTMLTemplate = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(HTMLTemplates.Carrer_Path, this.DesignationID.ToString());

            ltlCPath.Text = objHTMLTemplate.Header + objHTMLTemplate.Body + objHTMLTemplate.Footer;
        }
        private void SetLegalDisclaimer()
        {
            DesignationHTMLTemplate objHTMLTemplate = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(HTMLTemplates.Legal_Desclaimer, this.DesignationID.ToString());

            ltlLegal.Text = objHTMLTemplate.Header + objHTMLTemplate.Body + objHTMLTemplate.Footer;
        }
Example #14
0
        internal static void BulkEmail(HTMLTemplates objHTMLTemplateType, Int32 DesignationId)
        {
            DesignationHTMLTemplate objHTMLTemplate = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(objHTMLTemplateType, DesignationId.ToString());

            // Get all install users with statuses, Applicant, Refferal Applcant, InterviewDate
            DataSet dsUser = InstallUserBLL.Instance.GetInstallUsersForBulkEmail(DesignationId);

            if (dsUser != null && dsUser.Tables.Count > 0)
            {
                foreach (DataRow installUser in dsUser.Tables[0].Rows)
                {
                    // Send email to each user.
                    string emailId = String.Empty;
                    string strBody = String.Empty;

                    if (JGApplicationInfo.GetApplicationEnvironment() == "1")
                    {
                        emailId = "*****@*****.**";
                        strBody = "<h1>Email is intended for Email Address: " + installUser["Email"].ToString() + "</h1><br/><br/>";
                    }
                    else
                    {
                        emailId = installUser["Email"].ToString();
                    }

                    string FName       = installUser["FristName"].ToString();
                    string LName       = installUser["LastName"].ToString();
                    string Designation = installUser["Designation"].ToString();
                    string fullname    = FName + " " + LName;

                    string userName = ConfigurationManager.AppSettings["VendorCategoryUserName"].ToString();
                    string password = ConfigurationManager.AppSettings["VendorCategoryPassword"].ToString();


                    string strHeader = objHTMLTemplate.Header;
                    strBody = String.Concat(strBody, objHTMLTemplate.Body);
                    string strFooter  = objHTMLTemplate.Footer;
                    string strsubject = objHTMLTemplate.Subject;

                    strBody = strBody.Replace("#name#", fullname).Replace("#Email#", installUser["Email"].ToString()).Replace("#Phone number#", installUser["Phone"].ToString());

                    strFooter = strFooter.Replace("#Designation#", Designation);

                    strBody = strHeader + strBody + strFooter;

                    List <Attachment> lstAttachments = objHTMLTemplate.Attachments;

                    try
                    {
                        string message = "";
                        int    userId  = Convert.ToInt32(installUser["Id"]);
                        // log this activity into HR group chats
                        switch (objHTMLTemplateType)
                        {
                        case HTMLTemplates.Applicant_Recontact_Auto_Email:
                            message = "Auto Email sent by JMGC PC-AREC-A0011 - Application Incomplete Reminder - " + string.Format("{0:MMM d, yyyy, h:mm tt}", DateTime.Now.ToEST()) + "(EST)";
                            break;

                        case HTMLTemplates.InterviewDateAutoEmail:
                            message = "Auto Email sent by JMGC PC-AREC-A0011 - Interview Date Reminder - " + string.Format("{0:MMM d, yyyy, h:mm tt}", DateTime.Now.ToEST()) + "(EST)";
                            break;
                        }
                        message = "<span class='auto-entry'>" + message + "</span>";


                        // send email
                        long EmailStatusId = EmailManager.SendEmail(
                            objHTMLTemplateType == HTMLTemplates.Applicant_Recontact_Auto_Email? "Application Incomplete Reminder"
                            : "Interview Date Reminder", Designation, emailId, strsubject, strBody, lstAttachments);
                        ChatBLL.Instance.AddHRChatMessage(userId, message, EmailStatusId);
                        // based on email sending result update statistics.
                        //String strLogText = mailSendingResult == true ? String.Concat(emailId, ",true,", strsubject) : String.Concat(emailId, ",false,", strsubject);

                        //UpdateEmailStatistics(strLogText);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
Example #15
0
        public int AddTouchPointLogRecord(int LoginUserID, int UserID, string LoginUserInstallID, DateTime now,
                                          string ChangeLog, string strGUID, int touchPointSource, int?taskId, int?multiLevelTaskId)
        {
            ChatParameter para = InstallUserDAL.Instance.GetChatParametersByUser(UserID, LoginUserID, taskId, multiLevelTaskId);

            var LastUserTouchPoint = InstallUserDAL.Instance.GetUserTouchPointLogs(0, 1, UserID).Data;

            ChatDAL.Instance.SaveChatMessage(new ChatMessage
            {
                ChatGroupId          = para.ChatGroupId,
                ChatSourceId         = touchPointSource,
                FileId               = null,
                IsRead               = false,
                Message              = ChangeLog,
                MessageAt            = DateTime.Now.ToEST(),
                ReceiverIds          = para.ReceiverIds,
                TaskId               = taskId,
                TaskMultilevelListId = multiLevelTaskId,
                UserChatGroupId      = para.UserChatGroupId,
                UserId               = UserID
            }, para.ChatGroupId, para.ReceiverIds, LoginUserID);

            int UserTouchPointLogID = 0;
            //int UserTouchPointLogID = InstallUserDAL.Instance.AddTouchPointLogRecord(LoginUserID, UserID, LoginUserInstallID, now, ChangeLog, strGUID, touchPointSource);
            // Send email to User / Recruiter
            // Get Html Template
            string messageUrl = string.Empty, toEmail = string.Empty, body = string.Empty;
            string baseUrl               = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority + System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/";
            DesignationHTMLTemplate html = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(HTMLTemplates.HR_EditSales_TouchpointLog_Email, "");
            // sender details
            var    sender = getuserdetails(LoginUserID).Tables[0].Rows[0];
            string pic    = string.IsNullOrEmpty(sender["Picture"].ToString()) ? "default.jpg"
                                : sender["Picture"].ToString().Replace("~/UploadeProfile/", "");

            pic       = baseUrl + "Employee/ProfilePictures/" + pic;
            html.Body = html.Body.Replace("{ImageUrl}", pic);
            html.Body = html.Body.Replace("{Name}", sender["FristName"].ToString() + " " + sender["LastName"].ToString());
            html.Body = html.Body.Replace("{Designation}", sender["Designation"].ToString());
            html.Body = html.Body.Replace("{UserInstallID}", sender["UserInstallID"].ToString());
            html.Body = html.Body.Replace("{ProfileUrl}", baseUrl + "Sr_App/ViewSalesUser.aspx?id=" + sender["Id"].ToString());
            html.Body = html.Body.Replace("{MessageContent}", ChangeLog.Replace("Note :", "").Trim());
            //

            // Generate auto login code
            string loginCode = InstallUserDAL.Instance.GenerateLoginCode(UserID).Object;


            if (LastUserTouchPoint == null && LoginUserID == UserID) // first entry
            {
                // send email to recruiter
                toEmail    = "*****@*****.**";
                messageUrl = baseUrl + "Sr_App/edituser.aspx?TUID=" + UserID + "&NID=" + UserTouchPointLogID + "&auth=" + loginCode;
            }
            else if (LastUserTouchPoint != null && LastUserTouchPoint.Count() > 0 && LoginUserID == UserID) // send email to receiver
            {
                // send email to user
                var lastSender = getuserdetails(LastUserTouchPoint.First().UpdatedByUserID).Tables[0].Rows[0];
                if (Convert.ToInt32(lastSender["Id"]) == UserID)
                {
                    toEmail    = lastSender["Email"].ToString();
                    messageUrl = baseUrl + "Sr_App/TouchPointLog.aspx?TUID=" + UserID + "&NID=" + UserTouchPointLogID + "&auth=" + loginCode +
                                 "&ugid=" + para.UserChatGroupId;
                }
                else
                {
                    toEmail    = lastSender["Email"].ToString();
                    messageUrl = baseUrl + "Sr_App/edituser.aspx?TUID=" + UserID + "&NID=" + UserTouchPointLogID +
                                 "&auth=" + loginCode + "&ugid=" + para.UserChatGroupId;
                }
            }
            else
            {
                var receiver = getuserdetails(UserID).Tables[0].Rows[0];
                // send email to user
                toEmail    = receiver["Email"].ToString();
                messageUrl = baseUrl + "Sr_App/TouchPointLog.aspx?TUID=" + UserID + "&NID=" + UserTouchPointLogID +
                             "&auth=" + loginCode + "&ugid=" + para.UserChatGroupId;
            }
            body = (html.Header + html.Body + html.Footer).Replace("{MessageUrl}", messageUrl);

            EmailManager.SendEmail(JGConstant.EmailTypes.ChatMessage.ToString(), "Touch Point Log", toEmail, html.Subject, body, null);

            // find all emails
            List <string> emails = new List <string>();

            // emails.Add(toEmail);
            string[] allWords = ChangeLog.Split(new char[] { '@' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (var item in allWords)
            {
                switch (item.Trim().ToLower().Substring(0, item.IndexOf(' ')))
                {
                case "justin":
                    if (toEmail != "*****@*****.**")
                    {
                        emails.Add("*****@*****.**");    //321
                    }
                    // add touch point note entry
                    break;

                case "yogesh":
                    if (toEmail != "*****@*****.**")
                    {
                        emails.Add("*****@*****.**");    //901
                    }
                    break;

                default:
                    break;
                }
            }
            if (emails.Count > 1)
            {
                foreach (var item in emails.Distinct())
                {
                    switch (item)
                    {
                    case "*****@*****.**":
                        UserTouchPointLogID = InstallUserDAL.Instance.AddTouchPointLogRecord(LoginUserID, 321, LoginUserInstallID, now, ChangeLog, strGUID, touchPointSource);
                        messageUrl          = baseUrl + "Sr_App/TouchPointLog.aspx?TUID=" + UserID + "&NID=" + UserTouchPointLogID + "&auth=" + loginCode + "&ugid=" + para.UserChatGroupId;
                        body = (html.Header + html.Body + html.Footer).Replace("{MessageUrl}", messageUrl);
                        EmailManager.SendEmail(JGConstant.EmailTypes.None.ToString(), "Touch Point Log", item, html.Subject, body, null);
                        break;

                    case "*****@*****.**":
                        UserTouchPointLogID = InstallUserDAL.Instance.AddTouchPointLogRecord(LoginUserID, 901, LoginUserInstallID, now, ChangeLog, strGUID, touchPointSource);
                        messageUrl          = baseUrl + "Sr_App/TouchPointLog.aspx?TUID=" + UserID + "&NID=" + UserTouchPointLogID + "&auth=" + loginCode + "&ugid=" + para.UserChatGroupId;
                        body = (html.Header + html.Body + html.Footer).Replace("{MessageUrl}", messageUrl);
                        EmailManager.SendEmail(JGConstant.EmailTypes.None.ToString(), "Touch Point Log", item, html.Subject, body, null);
                        break;

                    default:
                        break;
                    }
                }
            }
            return(UserTouchPointLogID);
        }
        internal static void BulkEmail(HTMLTemplates objHTMLTemplateType, Int32 DesignationId)
        {
            DesignationHTMLTemplate objHTMLTemplate = HTMLTemplateBLL.Instance.GetDesignationHTMLTemplate(objHTMLTemplateType, DesignationId.ToString());

            // Get all install users with statuses, Applicant, Refferal Applcant, InterviewDate
            DataSet dsUser = InstallUserBLL.Instance.GetInstallUsersForBulkEmail(DesignationId);

            if (dsUser != null && dsUser.Tables.Count > 0)
            {
                foreach (DataRow installUser in dsUser.Tables[0].Rows)
                {
                    // Send email to each user.
                    string emailId = String.Empty;
                    string strBody = String.Empty;

                    if (JGApplicationInfo.GetApplicationEnvironment() == "1")
                    {
                        emailId = "*****@*****.**";
                        strBody = "<h1>Email is intended for Email Address: " + installUser["Email"].ToString() + "</h1><br/><br/>";
                    }
                    else
                    {
                        emailId = installUser["Email"].ToString();
                    }

                    string FName       = installUser["FristName"].ToString();
                    string LName       = installUser["LastName"].ToString();
                    string Designation = installUser["Designation"].ToString();
                    string fullname    = FName + " " + LName;

                    string userName = ConfigurationManager.AppSettings["VendorCategoryUserName"].ToString();
                    string password = ConfigurationManager.AppSettings["VendorCategoryPassword"].ToString();


                    string strHeader = objHTMLTemplate.Header;
                    strBody = String.Concat(strBody, objHTMLTemplate.Body);
                    string strFooter  = objHTMLTemplate.Footer;
                    string strsubject = objHTMLTemplate.Subject;

                    strBody = strBody.Replace("#name#", fullname).Replace("#Email#", installUser["Email"].ToString()).Replace("#Phone number#", installUser["Phone"].ToString());

                    strFooter = strFooter.Replace("#Designation#", Designation);

                    strBody = strHeader + strBody + strFooter;

                    List <Attachment> lstAttachments = objHTMLTemplate.Attachments;

                    try
                    {
                        Boolean mailSendingResult = EmailManager.SendEmail(Designation, emailId, strsubject, strBody, lstAttachments);

                        // based on email sending result update statistics.
                        String strLogText = mailSendingResult == true?String.Concat(emailId, ",true,", strsubject) : String.Concat(emailId, ",false,", strsubject);

                        UpdateEmailStatistics(strLogText);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
Example #17
0
 public bool SaveMasterSMSTemplate(DesignationHTMLTemplate objDesignationHTMLTemplate)
 {
     return(HTMLTemplateDAL.Instance.SaveMasterSMSTemplate(objDesignationHTMLTemplate));
 }