Ejemplo n.º 1
0
        private void SetExamPassedMessage(String InstallId, String TaskTitle, Int64 TaskId, Int64 ParentTaskId, String ParentTaskTitle, Boolean IsWithOutTask, string Sequence = null, int SequenceDesignationId = 0)
        {
            ltlUDesg.Text = this.DesignationName;

            // IF task is assigned to user.
            if (!IsWithOutTask)
            {
                ltlTaskInstallID.Text = InstallId;
                ltlTaskTitle.Text     = TaskTitle;
                ltlParentTask.Text    = ParentTaskTitle;

                //ltlAssignTo.Text = String.Concat(txtfirstname.Text, " ", txtlastname.Text, " - ");

                //ltlAssignToInstallID.Text = hlnkUserID.Text;

                hypTaskLink.HRef  = String.Concat(JGApplicationInfo.GetSiteURL(), "/Sr_App/ITDashboard.aspx?TaskId=", ParentTaskId.ToString(), "&hstid=", TaskId.ToString());
                hypTaskLink1.HRef = String.Concat(JGApplicationInfo.GetSiteURL(), "/Sr_App/ITDashboard.aspx?TaskId=", ParentTaskId.ToString(), "&hstid=", TaskId.ToString());

                divTaskAssigned.Visible = true;
            }

            #region "-- User Details in Popup --"


            //ddlEmployeeType.SelectedIndex = ddlEmployeeType.SelectedIndex;

            //  divCountryCode.Attributes.Add("class", ddlCountry.SelectedValue);

            //lblCity.Text = txtCity.Text;
            //lblZip.Text = txtZip.Text;

            ////lbtnEmail.Text = hidExtEmail.Value;

            //lblPrimaryPhone.Text = txtPhone.Text;
            lblExt.Text          = txtExt.Text;
            lblSeqtask.InnerText = JGCommon.GetSequenceDisplayText(string.IsNullOrEmpty(Sequence) ? "N.A." : Sequence, SequenceDesignationId, "TT");

            #endregion

            hypExam.HRef = String.Concat(hypExam.HRef, this.UserID);

            hypTaskLink.HRef  = String.Concat(JGApplicationInfo.GetSiteURL(), "/Sr_App/ITDashboard.aspx?TaskId=", ParentTaskId.ToString(), "&hstid=", TaskId.ToString(), "&did=", this.DesignationID, "&uid=", this.UserID);
            hypTaskLink1.HRef = String.Concat(JGApplicationInfo.GetSiteURL(), "/Sr_App/ITDashboard.aspx?TaskId=", ParentTaskId.ToString(), "&hstid=", TaskId.ToString(), "&did=", this.DesignationID, "&uid=", this.UserID);

            ////Only for programming designations
            //if (ShowGithubField)
            //{
            //    txtGithubUsername.Text = InstallUserBLL.Instance.GetUserGithubUserName(this.UserID);
            //}

            //trConfirmInterview.Visible = true;
        }
Ejemplo n.º 2
0
        private bool UserGivenAllTests(int userID)
        {
            bool   isAllExamGiven          = false;
            double overAllPercentageScored = 0;

            //Check if user has given exam and is above acceptable percentage.
            overAllPercentageScored = AptitudeTestBLL.Instance.GetExamsResultByUserID(this.UserID, ref isAllExamGiven);

            if (isAllExamGiven && overAllPercentageScored > JGApplicationInfo.GetAcceptiblePrecentage()) // if user has finished attempting all available designation exams then check pass or fail result.
            {
                isAllExamGiven = true;
            }
            else
            {
                isAllExamGiven = false;
            }

            return(isAllExamGiven);
        }
Ejemplo n.º 3
0
        private static bool SendEmailAsync(string strEmailTemplate, string strToAddress, string strSubject,
                                           string strBody, List <Attachment> lstAttachments, List <AlternateView> lstAlternateView = null,
                                           string[] CC = null, string[] BCC = null)
        {
            bool retValue = false;

            //if (!InstallUserBLL.Instance.CheckUnsubscribedEmail(strToAddress))
            //{
            try
            {
                /* Sample HTML Template
                 * *****************************************************************************
                 * Hi #lblFName#,
                 * <br/>
                 * <br/>
                 * You are requested to appear for an interview on #lblDate# - #lblTime#.
                 * <br/>
                 * <br/>
                 * Regards,
                 * <br/>
                 */

                string defaultEmailFrom = ConfigurationManager.AppSettings["defaultEmailFrom"].ToString();
                string userName         = ConfigurationManager.AppSettings["smtpUName"].ToString();
                string password         = ConfigurationManager.AppSettings["smtpPwd"].ToString();

                //if (JGApplicationInfo.GetApplicationEnvironment() == "1" || JGApplicationInfo.GetApplicationEnvironment() == "2")
                //{
                //    strBody = String.Concat(strBody, "<br/><br/><h1>Email is intended for Email Address: " + strToAddress + "</h1><br/><br/>");
                //    strToAddress = "*****@*****.**";

                //}

                MailMessage Msg = new MailMessage();
                Msg.From = new MailAddress(defaultEmailFrom, "JGrove Construction");
                if (JGApplicationInfo.GetApplicationEnvironment() == "1" || JGApplicationInfo.GetApplicationEnvironment() == "2")
                {
                    strBody = String.Concat(strBody, "<br/><br/><h1>Email is intended for Email Address: " + string.Join(", ", strToAddress) + "</h1><br/><br/>");
                    Msg.To.Add("*****@*****.**");
                    Msg.To.Add("*****@*****.**");
                }
                else
                {
                    if (!InstallUserBLL.Instance.CheckUnsubscribedEmail(strToAddress))
                    {
                        Msg.To.Add(strToAddress);
                    }
                }
                #region Check for autologin url
                if (strBody.Contains("{AutoLoginCode}"))
                {
                    // Generate auto login code
                    string loginCode = InstallUserDAL.Instance.GenerateLoginCode(strToAddress).Object;
                    strBody = strBody.Replace("{AutoLoginCode}", loginCode);
                }
                #endregion
                // Msg.To.Add(strToAddress);
                // Msg.Bcc.Add(JGApplicationInfo.GetDefaultBCCEmail());
                Msg.Subject    = strSubject;// "JG Prospect Notification";
                Msg.Body       = strBody;
                Msg.IsBodyHtml = true;
                if (CC != null)
                {
                    foreach (string email in CC)
                    {
                        Msg.CC.Add(email);
                    }
                }
                if (BCC != null)
                {
                    foreach (string email in BCC)
                    {
                        Msg.Bcc.Add(email);
                    }
                }
                //ds = AdminBLL.Instance.GetEmailTemplate('');
                //// your remote SMTP server IP.
                if (lstAttachments != null)
                {
                    foreach (Attachment objAttachment in lstAttachments)
                    {
                        Msg.Attachments.Add(objAttachment);
                    }
                }

                if (lstAlternateView != null)
                {
                    foreach (AlternateView objAlternateView in lstAlternateView)
                    {
                        Msg.AlternateViews.Add(objAlternateView);
                    }
                }

                SmtpClient sc = new SmtpClient(
                    ConfigurationManager.AppSettings["smtpHost"].ToString(),
                    Convert.ToInt32(ConfigurationManager.AppSettings["smtpPort"].ToString())
                    );
                NetworkCredential ntw = new NetworkCredential(userName, password);
                sc.UseDefaultCredentials = false;
                sc.Credentials           = ntw;
                sc.DeliveryMethod        = SmtpDeliveryMethod.Network;
                sc.EnableSsl             = Convert.ToBoolean(ConfigurationManager.AppSettings["enableSSL"].ToString()); // runtime encrypt the SMTP communications using SSL
                sc.Send(Msg);
                retValue = true;

                Msg = null;
                sc.Dispose();
                sc = null;
            }
            catch (Exception ex)
            {
                UpdateEmailStatistics(String.Concat(strToAddress, "-", ex.Message));

                //if (JGApplicationInfo.IsSendEmailExceptionOn())
                //{
                //    CommonFunction.SendExceptionEmail(ex);
                //}
            }
            //}
            return(retValue);
        }
Ejemplo n.º 4
0
        private static long SendEmailAsync(string EmailType, string strEmailTemplate, string strToAddress, string strSubject,
                                           string strBody, List <Attachment> lstAttachments, List <AlternateView> lstAlternateView = null,
                                           string[] CC = null, string[] BCC = null)
        {
            bool retValue = false;

            //if (!InstallUserBLL.Instance.CheckUnsubscribedEmail(strToAddress))
            //{
            try
            {
                /* Sample HTML Template
                 * *****************************************************************************
                 * Hi #lblFName#,
                 * <br/>
                 * <br/>
                 * You are requested to appear for an interview on #lblDate# - #lblTime#.
                 * <br/>
                 * <br/>
                 * Regards,
                 * <br/>
                 */

                string defaultEmailFrom = ConfigurationManager.AppSettings["defaultEmailFrom"].ToString();
                string userName         = ConfigurationManager.AppSettings["smtpUName"].ToString();
                string password         = ConfigurationManager.AppSettings["smtpPwd"].ToString();

                //if (JGApplicationInfo.GetApplicationEnvironment() == "1" || JGApplicationInfo.GetApplicationEnvironment() == "2")
                //{
                //    strBody = String.Concat(strBody, "<br/><br/><h1>Email is intended for Email Address: " + strToAddress + "</h1><br/><br/>");
                //    strToAddress = "*****@*****.**";

                //}

                MailMessage Msg = new MailMessage();
                Msg.From = new MailAddress(defaultEmailFrom, "JGrove Construction");
                if (JGApplicationInfo.GetApplicationEnvironment() == "1" || JGApplicationInfo.GetApplicationEnvironment() == "2")
                {
                    strBody = String.Concat(strBody, "<br/><br/><h1>Email is intended for Email Address: " + string.Join(", ", strToAddress) + "</h1><br/><br/>");
                    Msg.To.Add("*****@*****.**");
                    Msg.To.Add("*****@*****.**");
                }
                else
                {
                    if (!InstallUserBLL.Instance.CheckUnsubscribedEmail(strToAddress))
                    {
                        Msg.To.Add(strToAddress);
                    }
                }
                #region Check for autologin url
                if (strBody.Contains("{AutoLoginCode}"))
                {
                    // Generate auto login code
                    string loginCode = InstallUserDAL.Instance.GenerateLoginCode(strToAddress).Object;
                    strBody = strBody.Replace("{AutoLoginCode}", loginCode);
                }
                #endregion
                // Msg.To.Add(strToAddress);
                // Msg.Bcc.Add(JGApplicationInfo.GetDefaultBCCEmail());
                Msg.Subject    = strSubject;// "JG Prospect Notification";
                Msg.Body       = strBody;
                Msg.IsBodyHtml = true;
                if (CC != null)
                {
                    foreach (string email in CC)
                    {
                        Msg.CC.Add(email);
                    }
                }
                if (BCC != null)
                {
                    foreach (string email in BCC)
                    {
                        Msg.Bcc.Add(email);
                    }
                }
                //ds = AdminBLL.Instance.GetEmailTemplate('');
                //// your remote SMTP server IP.
                if (lstAttachments != null)
                {
                    foreach (Attachment objAttachment in lstAttachments)
                    {
                        Msg.Attachments.Add(objAttachment);
                    }
                }

                if (lstAlternateView != null)
                {
                    foreach (AlternateView objAlternateView in lstAlternateView)
                    {
                        Msg.AlternateViews.Add(objAlternateView);
                    }
                }

                SmtpClient sc = new SmtpClient(
                    ConfigurationManager.AppSettings["smtpHost"].ToString(),
                    Convert.ToInt32(ConfigurationManager.AppSettings["smtpPort"].ToString())
                    );
                NetworkCredential ntw = new NetworkCredential(userName, password);
                sc.UseDefaultCredentials = false;
                sc.Credentials           = ntw;
                sc.DeliveryMethod        = SmtpDeliveryMethod.Network;
                sc.EnableSsl             = Convert.ToBoolean(ConfigurationManager.AppSettings["enableSSL"].ToString()); // runtime encrypt the SMTP communications using SSL

                //sc.Send(Msg);
                Common.ElasticEmailClient.ApiTypes.EmailSend data = Common.ElasticEmailClient.Api.Email.Send(subject: strSubject,
                                                                                                             from: ConfigurationManager.AppSettings["defaultEmailFrom"].ToString(),
                                                                                                             to: new List <string> {
                    strToAddress
                }, bodyHtml: strBody, isTransactional: true, trackOpens: true, trackClicks: true);

                /*
                 * JG_Prospect.Common.ElasticEmailClient.ApiTypes.EmailStatus data =
                 *  JG_Prospect.Common.ElasticEmailClient.Api.Email.Status("0zkOx0X3qGqbp74sVO-nYg2");
                 *
                 * JG_Prospect.Common.ElasticEmailClient.ApiTypes.EmailJobStatus ss =
                 *  JG_Prospect.Common.ElasticEmailClient.Api.Email.GetStatus("310e4832-13a6-81c5-c032-307a2ff9dc58", showFailed: true, showSent: true,
                 *              showDelivered: true, showPending: true, showOpened: true, showClicked: true, showAbuse: true, showUnsubscribed: true,
                 *              showErrors: true, showMessageIDs: true);
                 */
                // Get Status using MessageId And TransactionId & save into database
                //Common.ElasticEmailClient.ApiTypes.EmailStatus EmailStatus =
                //    Common.ElasticEmailClient.Api.Email.Status(data.MessageID);
                //if (EmailStatus != null)
                //{
                Common.ElasticEmailClient.ApiTypes.EmailStatus EmailStatus = new Common.ElasticEmailClient.ApiTypes.EmailStatus();
                EmailStatus.Status           = Common.ElasticEmailClient.ApiTypes.LogJobStatus.Sent;
                EmailStatus.From             = ConfigurationManager.AppSettings["defaultEmailFrom"].ToString();
                EmailStatus.To               = strToAddress;
                EmailStatus.TransactionID    = new Guid(data.TransactionID);
                EmailStatus.ErrorMessage     = data.MessageID;
                EmailStatus.DateOpened       = null;
                EmailStatus.DateClicked      = null;
                EmailStatus.StatusName       = Common.ElasticEmailClient.ApiTypes.LogJobStatus.Sent.ToString();
                EmailStatus.StatusChangeDate = DateTime.UtcNow;
                EmailStatus.ErrorMessage     = null;

                long EmailStatusId = SaveEmailStatus(EmailStatus, data.MessageID, EmailType, strBody);
                //}

                retValue = true;

                Msg = null;
                sc.Dispose();
                sc = null;
                return(EmailStatusId);
            }
            catch (Exception ex)
            {
                UpdateEmailStatistics(String.Concat(strToAddress, "-", ex.Message));

                //if (JGApplicationInfo.IsSendEmailExceptionOn())
                //{
                //    CommonFunction.SendExceptionEmail(ex);
                //}
            }
            //}
            return(0);
        }
Ejemplo n.º 5
0
 // update user status to interview date.
 private DataSet UpdateUserStatusAsInterviewDateWithReason(DateTime InterviewDateNTime, String StatusReason = "Default automated interview date assigned")
 {
     return(InstallUserBLL.Instance.ChangeUserSatatus(UserID, Convert.ToInt32(JGConstant.InstallUserStatus.InterviewDate), InterviewDateNTime.Date, InterviewDateNTime.ToShortTimeString(), JGApplicationInfo.GetJMGCAutoUserID(), JGSession.IsInstallUser.Value, StatusReason, UserID.ToString()));
 }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
 protected void btnRejectTask_Click(object sender, EventArgs e)
 {
     TaskGeneratorBLL.Instance.RejectUserAssignedWithSequence(this.AssignedSequenceID, this.UserID, JGApplicationInfo.GetJMGCAutoUserID());
 }
Ejemplo n.º 8
0
 private void UpdateUserStatusAsRejectedWithReason(int userID, String ReasonMessage)
 {
     // Changed By Yogesh Keraliya
     // Reference : JG-YK skype chat 03/23/2018
     //InstallUserBLL.Instance.ChangeUserStatusToReject(Convert.ToInt32(JGConstant.InstallUserStatus.Rejected), DateTime.Now.Date, DateTime.Now.ToShortTimeString(), JGApplicationInfo.GetJMGCAutoUserID(), Convert.ToInt32(Session["ID"]), ReasonMessage);
     InstallUserBLL.Instance.ChangeUserStatusToReject(Convert.ToInt32(JGConstant.InstallUserStatus.Applicant), DateTime.Now.Date, DateTime.Now.ToShortTimeString(), JGApplicationInfo.GetJMGCAutoUserID(), Convert.ToInt32(Session["ID"]), ReasonMessage);
 }
Ejemplo n.º 9
0
 private void UpdateUserStatusAsApplicantWithReason(int userID, String ReasonMessage)
 {
     InstallUserBLL.Instance.ChangeUserStatusToReject(Convert.ToInt32(JGConstant.InstallUserStatus.Applicant), DateTime.Now.Date, DateTime.Now.ToShortTimeString(), JGApplicationInfo.GetJMGCAutoUserID(), Convert.ToInt32(Session["ID"]), ReasonMessage);
 }
Ejemplo n.º 10
0
        private void ResetExamParameter()
        {
            this.ExamsGiven = String.Concat(this.ExamsGiven, this.CurrentExamID.ToString(), ",");

            this.CurrentQuestion       = 0;
            this.ExamAttempted         = null;
            this.NextQuestion          = 0;
            this.CurrentExamID         = 0;
            JGSession.ExamTimerSetTime = null;
            JGSession.CurrentExamTime  = 0;
            divEndExam.Visible         = false;
            hdnTimeLeft.Value          = "0";

            // String userExamsGiven = this.ExamsGiven;

            // string[] exams = userExamsGiven.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            bool isAllExamGiven = false;

            double overAllPercentageScored = 0;

            overAllPercentageScored = AptitudeTestBLL.Instance.GetExamsResultByUserID(UserID, ref isAllExamGiven);


            if (isAllExamGiven)// if user has finished attempting all available designation exams then check pass or fail result.
            {
                // set flag to exam over so auto exam time up doesn't happens.
                hdnExamsOver.Value = "1";

                //All exams finished.

                #region "-- Aptitude test result based status change - OLD --"
                // Changed By - Yogesh Keraliya
                //  Reference:  Skype Chat JG-KY 03/23/2018
                //// If obtained aggregated percentage is less than acceptable level, user is unfit to join JG.
                //if (overAllPercentageScored < JGApplicationInfo.GetAcceptiblePrecentage())
                //{
                //    //Set User status as rejected.
                //    UpdateUserStatusAsRejectedWithReason(UserID, "Didn't Passed apptitude test.");
                //    LogoutUser(true);

                //}
                //else // User is pass into our application.
                //{
                //    //After successfully completed test , Status will be applicant again.
                //    UpdateUserStatusAsApplicantWithReason(UserID, "Completed apptitude test successfully.");

                //    //Response.Redirect("~/ViewApplicantUser.aspx?Id="+UserID+"&IE=1");

                //    #region "-- old cold commented --"
                //    /// Modified By: Yogesh Keraliya
                //    /// Modified Date: 11/16/2017
                //    /// Description: Flow changed after discussion with JG, http://web.jmgrovebuildingsupply.com/Sr_App/TaskGenerator.aspx?TaskId=686&hstid=722
                //    /// Point X. 2,3
                //    /// If user successfully completed test, but haven't accepted task their status is still in "Applicant"
                //    //UpdateUserStatusAsInterviewDateWithReason(DateTime.Now.AddDays(2), "Exam successfully cleared!s");
                //    #endregion

                //    ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "ExamPassed", "SuccessRedirect(" + UserID + ");", true);

                //    //Get latest task to be assigned for user's designation.
                //    //DataSet dsTaskToBeAssigned = TaskGeneratorBLL.Instance.GetDesignationTaskToAssignWithSequence(this.DesignationID, true);

                //    //if (dsTaskToBeAssigned != null && dsTaskToBeAssigned.Tables.Count > 0 && dsTaskToBeAssigned.Tables[0].Rows.Count > 0)
                //    //{
                //    //    // Assign automatic task to user.
                //    //    AssignedTaskToUser(UserID, Convert.ToUInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), Convert.ToUInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["ParentTaskId"]), Convert.ToString(dsTaskToBeAssigned.Tables[0].Rows[0]["Title"]), Convert.ToString(dsTaskToBeAssigned.Tables[0].Rows[0]["InstallId"]));

                //    //    //Update automatic task sequence  assignment
                //    //    InsertAssignedTaskSequenceInfo(Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), this.DesignationID, Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["AvailableSequence"]), true);

                //    //    //SetInterviewDateNTime();

                //    //    SetExamPassedMessage(dsTaskToBeAssigned.Tables[0].Rows[0]["InstallId"].ToString(), dsTaskToBeAssigned.Tables[0].Rows[0]["Title"].ToString(), Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["ParentTaskId"]));

                //    //    ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "ExamPassed", "showExamPassPopup();", true);
                //    //}
                //}
                #endregion

                #region "-- Aptitude test result based status change - NEW --"
                // If obtained aggregated percentage is less than acceptable level, user is unfit to join JG.
                if (overAllPercentageScored < JGApplicationInfo.GetAcceptiblePrecentage())
                {
                    // Changed By - Yogesh Keraliya
                    // Reference:  Skype Chat JG-KY 03/23/2018
                    //Set User status as rejected.
                    //UpdateUserStatusAsRejectedWithReason(UserID, "Didn't Passed apptitude test.");
                    //LogoutUser(true);

                    //keep user status as applicant but set message of fail.
                    UpdateUserStatusAsApplicantWithReason(UserID, "Didn't Passed apptitude test.");
                }
                else // User is pass into our application.
                {
                    //After successfully completed test , Status will be applicant again.
                    UpdateUserStatusAsApplicantWithReason(UserID, "Completed apptitude test successfully.");

                    //Response.Redirect("~/ViewApplicantUser.aspx?Id="+UserID+"&IE=1");

                    #region "-- old cold commented --"
                    /// Modified By: Yogesh Keraliya
                    /// Modified Date: 11/16/2017
                    /// Description: Flow changed after discussion with JG, http://web.jmgrovebuildingsupply.com/Sr_App/TaskGenerator.aspx?TaskId=686&hstid=722
                    /// Point X. 2,3
                    /// If user successfully completed test, but haven't accepted task their status is still in "Applicant"
                    //UpdateUserStatusAsInterviewDateWithReason(DateTime.Now.AddDays(2), "Exam successfully cleared!s");
                    #endregion



                    //Get latest task to be assigned for user's designation.
                    //DataSet dsTaskToBeAssigned = TaskGeneratorBLL.Instance.GetDesignationTaskToAssignWithSequence(this.DesignationID, true);

                    //if (dsTaskToBeAssigned != null && dsTaskToBeAssigned.Tables.Count > 0 && dsTaskToBeAssigned.Tables[0].Rows.Count > 0)
                    //{
                    //    // Assign automatic task to user.
                    //    AssignedTaskToUser(UserID, Convert.ToUInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), Convert.ToUInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["ParentTaskId"]), Convert.ToString(dsTaskToBeAssigned.Tables[0].Rows[0]["Title"]), Convert.ToString(dsTaskToBeAssigned.Tables[0].Rows[0]["InstallId"]));

                    //    //Update automatic task sequence  assignment
                    //    InsertAssignedTaskSequenceInfo(Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), this.DesignationID, Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["AvailableSequence"]), true);

                    //    //SetInterviewDateNTime();

                    //    SetExamPassedMessage(dsTaskToBeAssigned.Tables[0].Rows[0]["InstallId"].ToString(), dsTaskToBeAssigned.Tables[0].Rows[0]["Title"].ToString(), Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["ParentTaskId"]));

                    //    ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "ExamPassed", "showExamPassPopup();", true);
                    //}
                }

                ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "ExamPassed", "SuccessRedirect(" + UserID + ");", true);

                #endregion
            }
            else
            {
                //Load exam with result again.
                populateExams();

                //Start next pending exam.
                StartExam();
            }
        }
        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)
                    {
                    }
                }
            }
        }
Ejemplo n.º 12
0
        private void ResetExamParameter()
        {
            this.ExamsGiven = String.Concat(this.ExamsGiven, this.CurrentExamID.ToString(), ",");

            this.CurrentQuestion       = 0;
            this.ExamAttempted         = null;
            this.NextQuestion          = 0;
            this.CurrentExamID         = 0;
            JGSession.ExamTimerSetTime = null;
            JGSession.CurrentExamTime  = 0;
            divEndExam.Visible         = false;
            hdnTimeLeft.Value          = "0";

            // String userExamsGiven = this.ExamsGiven;

            // string[] exams = userExamsGiven.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            bool isAllExamGiven = false;

            double overAllPercentageScored = 0;

            overAllPercentageScored = AptitudeTestBLL.Instance.GetExamsResultByUserID(UserID, ref isAllExamGiven);


            if (isAllExamGiven)// if user has finished attempting all available designation exams then check pass or fail result.
            {
                // set flag to exam over so auto exam time up doesn't happens.
                hdnExamsOver.Value = "1";

                //All exams finished.

                // If obtained aggregated percentage is less than acceptable level, user is unfit to join JG.
                if (overAllPercentageScored < JGApplicationInfo.GetAcceptiblePrecentage())
                {
                    //Set User status as rejected.
                    UpdateUserStatusAsRejectedWithReason(UserID, "Didn't Passed apptitude test.");
                    LogoutUser(true);
                }
                else // User is pass into our application.
                {
                    //Response.Redirect("~/ViewApplicantUser.aspx?Id="+UserID+"&IE=1");
                    UpdateUserStatusAsInterviewDateWithReason(DateTime.Now.AddDays(2), "Exam successfully cleared!s");
                    ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "ExamPassed", "SuccessRedirect(" + UserID + ");", true);
                    ////Get latest task to be assigned for user's designation.
                    //DataSet dsTaskToBeAssigned = TaskGeneratorBLL.Instance.GetDesignationTaskToAssignWithSequence(this.DesignationID, true);

                    //if (dsTaskToBeAssigned != null && dsTaskToBeAssigned.Tables.Count > 0 && dsTaskToBeAssigned.Tables[0].Rows.Count > 0)
                    //{
                    //    // Assign automatic task to user.
                    //    AssignedTaskToUser(UserID, Convert.ToUInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), Convert.ToUInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["ParentTaskId"]), Convert.ToString(dsTaskToBeAssigned.Tables[0].Rows[0]["Title"]), Convert.ToString(dsTaskToBeAssigned.Tables[0].Rows[0]["InstallId"]));

                    //    //Update automatic task sequence  assignment
                    //    InsertAssignedTaskSequenceInfo(Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), this.DesignationID, Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["AvailableSequence"]), true);

                    //    //SetInterviewDateNTime();

                    //    SetExamPassedMessage(dsTaskToBeAssigned.Tables[0].Rows[0]["InstallId"].ToString(), dsTaskToBeAssigned.Tables[0].Rows[0]["Title"].ToString(), Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["TaskId"]), Convert.ToInt64(dsTaskToBeAssigned.Tables[0].Rows[0]["ParentTaskId"]));

                    //    ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "ExamPassed", "showExamPassPopup();", true);
                    //}
                }
            }
            else
            {
                //Load exam with result again.
                populateExams();

                //Start next pending exam.
                StartExam();
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Update user status to Rejected with reason "Opt out"
 /// </summary>
 /// <param name="strKey"></param>
 /// <param name="isEmail"></param>
 private void updateUserStatus(string strKey, bool isEmail)
 {
     if (isEmail)
     {
         InstallUserBLL.Instance.ChangeUserStatusToRejectByEmail(Convert.ToInt32(JGConstant.InstallUserStatus.Rejected), DateTime.Now.Date, DateTime.Now.ToShortTimeString(), JGApplicationInfo.GetJMGCAutoUserID(), strKey, "Email Opt Out");
     }
     else
     {
         InstallUserBLL.Instance.ChangeUserStatusToRejectByMobile(Convert.ToInt32(JGConstant.InstallUserStatus.Rejected), DateTime.Now.Date, DateTime.Now.ToShortTimeString(), JGApplicationInfo.GetJMGCAutoUserID(), strKey, "Mobile Opt Out");
     }
 }
Ejemplo n.º 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)
                    {
                    }
                }
            }
        }