protected void SendForInterviewButton_Click(object sender, EventArgs e)
    {
        List<String> idList = new List<String>();

        CheckBox cb = new CheckBox();

        foreach (GridViewRow row in ApplicantsListGridView.Rows)
        {
            cb = (CheckBox)row.Cells[selectRow].Controls[0];
            if (cb.Checked)
            {
                idList.Add(((GridViewRow)cb.NamingContainer).Cells[0].Text);
            }
        }

        EmailModule myEmailModule = new EmailModule();
        Employer emailSender = new Employer();
        emailSender.sheduleAndCallForInterviews(idList, Request["pid"], StartingTimeTextBox.Text, DateTextBox.Text, VenueTextBox.Text);
        /*
        foreach (String applicantId in idList)
        {
            myEmailModule.sendEmailForInterview(applicantId, Request["pid"], "10.30AM", "06/06/2015", "Company Conference Hall");
        }
        */
    }
예제 #2
0
        public void OnPostUpdate()
        {
            string name        = Request.Form["name"];
            string description = Request.Form["description"];
            string beginDate   = Request.Form["beginDate"];
            string endDate     = Request.Form["endDate"];
            string status      = Request.Form["status"];
            string email       = Request.Form["email"];
            string phone       = Request.Form["phone"];
            string comment     = Request.Form["comment"];

            string body = "<table><tr><td>Name:&nbsp;&nbsp;</td><td>" + name + "</td></tr>" +
                          "<tr><td>Position Description:&nbsp;&nbsp;</td><td>" + HttpUtility.HtmlEncode(description) + "</td></tr>" +
                          "<tr><td>Position Begin Date:&nbsp;&nbsp;</td><td>" + beginDate + "</td></tr>" +
                          "<tr><td>Position End Date:&nbsp;&nbsp;</td><td>" + endDate + "</td></tr>" +
                          "<tr><td>Voting Status:&nbsp;&nbsp;</td><td>" + status + "</td></tr>" +
                          "<tr><td>Primary Email Address:&nbsp;&nbsp;</td><td>" + email + "</td></tr>" +
                          "<tr><td>Primary Phone:&nbsp;&nbsp;</td><td>" + Phone + "</td></tr>" +
                          "<tr><td>Comment:&nbsp;&nbsp;</td><td>" + HttpUtility.HtmlEncode(comment) + "</td></tr></table>";

            // handle the request
            try
            {
                string smtpServer   = Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("SMTPServer").Value;
                string smtpDomain   = Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("SmtpDomain").Value;
                string smtpLogin    = Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("SMTPLogin").Value;
                string smtpPassword = string.Empty; // Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("SMTPPassword").Value;
                string fromEmail    = Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("FromEmail").Value;
                string toEmail      = Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("MyEmail").Value;
                if (string.IsNullOrEmpty(toEmail))
                {
                    toEmail = Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("AdminEmail").Value;
                }
                else
                {
                    fromEmail = toEmail;
                }
                string emailSender = "Chapter Officer"; //Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("FromDisplayNameEmail").Value;
                string subject     = Configuration.GetSection("MyConfiguration").GetSection("Smtpconfig").GetSection("EmailSubject").Value;
                string emailBody   = string.Format("<iframe>{0}</iframe>", body);

                EmailModule em = new EmailModule();
                em.SendRegistrationEmail(smtpServer, smtpDomain, smtpLogin, smtpPassword, fromEmail, toEmail, emailSender, subject, emailBody);

                //// successful
                //Name = name;
                //Description = description;
                //BeginDate = beginDate;
                //EndDate = endDate;
                //Status = status;
                //EmailAddress = email;
                //Phone = phone;
                //Comment = comment;
            }
            catch
            {
                throw;
            }
        }
 protected void Button2_Click(object sender, EventArgs e)
 {
     LoginModule myLoginModule = new LoginModule();
     EmailModule myEmailModule = new EmailModule();
     myEmailModule.deleteAccountConfirmation((String)Session["userID"]);
     myLoginModule.deleteAccount((String)Session["userID"]);
     Response.Redirect("WhereIsMyJob.aspx");
 }
예제 #4
0
        public async Task <IActionResult> GetEmailsView(long emailId)
        {
            EmailModule invMod = new EmailModule();

            EmailEntityView view = await invMod.Email.Query().GetViewById(emailId);

            return(Ok(view));
        }
예제 #5
0
        public async Task <IActionResult> DeleteEmails([FromBody] EmailEntityView view)
        {
            EmailModule invMod = new EmailModule();
            EmailEntity email  = await invMod.Email.Query().MapToEntity(view);

            invMod.Email.DeleteEmail(email).Apply();

            return(Ok(view));
        }
 protected void SendEmailButton_Click(object sender, EventArgs e)
 {
     try
     {
         EmailModule myEmailModule = new EmailModule();
         myEmailModule.sendEmailToReportAProblem2((String)Session["userID"], problem.Text, description.Text);
         Response.Redirect("ManagerHomePage.aspx");
     }
     catch (NullReferenceException en) { }
 }
    public String sheduleAndCallForInterviews(List<String> applicantsList, String positionId, String startingTime, String date, String venue)
    {
        EmailModule emailSender = new EmailModule();
        foreach (String applicantId in applicantsList)
        {
            emailSender.sendEmailForInterview(applicantId, positionId, startingTime, date, venue);
        }

        return "Emails Sent";
    }
 protected void CreatePostButton_Click(object sender, EventArgs e)
 {
     try
     {
         EmailModule myEmailModule = new EmailModule();
         //myEmailModule.recoverPassword(TextBox1.Text);
         myEmailModule.recoverPassword2(TextBox1.Text);
         Response.Redirect("EmailConfirmation.aspx");
     }
     catch (NullReferenceException en) { }
 }
예제 #9
0
        public async Task <IActionResult> UpdateEmails([FromBody] EmailEntityView view)
        {
            EmailModule invMod = new EmailModule();

            EmailEntity email = await invMod.Email.Query().MapToEntity(view);


            invMod.Email.UpdateEmail(email).Apply();

            EmailEntityView retView = await invMod.Email.Query().GetViewById(email.EmailId);


            return(Ok(retView));
        }
예제 #10
0
 private void SendEmails(EPUser user, IEnumerable <Email> emailList)
 {
     if (emailList.Count() > 0)
     {
         EmailModule emailModule = new EmailModule(user.EmailUsername, user.EmailPassword);
         foreach (var email in emailList)
         {
             bool emailSuccess = emailModule.SendEmail(user.Name, email.ToAddress, "", "", email.Subject, email.Body);
             email.StatusId   = emailSuccess ? (int)MessageStatus.Send : (int)MessageStatus.Failed;
             email.StatusDate = DateTime.Now;
             emailCount      += 1;
         }
         campaignService.UpdateCampaignEmails(emailList);
     }
 }
예제 #11
0
        public bool ProcessMemberShip(Customer customer)
        {
            if (customer.MembershipType == MembershipTypeEnum.Activate)
            {
                ActivateMembership();
            }
            else
            {
                UpgradeMembership();
            }
            EmailModule.SendEmail(customer);

            //do some process
            return(true);
        }
예제 #12
0
        public async Task <IActionResult> AddEmails([FromBody] EmailEntityView view)
        {
            EmailModule invMod = new EmailModule();

            NextNumber nnEmails = await invMod.Email.Query().GetNextNumber();

            view.EmailEntityNumber = nnEmails.NextNumberValue;

            EmailEntity emailEntity = await invMod.Email.Query().MapToEntity(view);

            invMod.Email.AddEmail(emailEntity).Apply();

            EmailEntityView newView = await invMod.Email.Query().GetViewByNumber(view.EmailEntityNumber);


            return(Ok(newView));
        }
예제 #13
0
        public bool SendTestCampaign(int campaignId, string recepient)
        {
            CampaignService campaignService = new CampaignService();
            var             campaign        = campaignService.GetCampaign(campaignId);
            var             user            = new UserService().GetUser(campaign.CreatedBy);
            bool            response        = false;

            if (campaign.TypeId == (int)CampaignType.SMS)
            {
                SmsModule smsModule = new SmsModule(user.SmsUsername, user.SmsPassword);
                response = smsModule.SendSMS(recepient, campaign.ContentTemplate);
            }
            else
            {
                EmailModule emailModule = new EmailModule(user.EmailUsername, user.EmailPassword);
                response = emailModule.SendEmail(user.Name, recepient, "", "", campaign.SubjectTemplate, campaign.ContentTemplate);
            }
            return(response);
        }
예제 #14
0
        public async Task TestAddUpdatDelete()
        {
            EmailModule EmailMod    = new EmailModule();
            AddressBook addressBook = await EmailMod.AddressBook.Query().GetEntityById(1);

            EmailEntityView view = new EmailEntityView()
            {
                AddressId  = addressBook.AddressId,
                Name       = addressBook.Name,
                Email      = "*****@*****.**",
                Password   = "******",
                LoginEmail = false
            };
            NextNumber nnNextNumber = await EmailMod.Email.Query().GetNextNumber();

            view.EmailEntityNumber = nnNextNumber.NextNumberValue;

            EmailEntity email = await EmailMod.Email.Query().MapToEntity(view);

            EmailMod.Email.AddEmail(email).Apply();

            EmailEntity newEmails = await EmailMod.Email.Query().GetEntityByNumber(view.EmailEntityNumber);

            Assert.NotNull(newEmails);

            newEmails.Email = "[email protected] Update";

            EmailMod.Email.UpdateEmail(newEmails).Apply();

            EmailEntityView updateView = await EmailMod.Email.Query().GetViewById(newEmails.EmailId);

            Assert.Same(updateView.Email, "[email protected] Update");
            EmailMod.Email.DeleteEmail(newEmails).Apply();
            EmailEntity lookupEmails = await EmailMod.Email.Query().GetEntityById(view.EmailId);

            Assert.Null(lookupEmails);
        }
예제 #15
0
    /**
     * Approve a particular project with a project object
     *
     * - change the status to APPROVED
     * - validate project atributes
     * - update the project object
     * - send out email to project owner
     *
     */
    public Project approveProject(Project project, long UCId)
    {
        if (session == null || !session.IsOpen)
        {
            session = hibernate.getSession();
        }
        if (project.PROJECT_ID == null || project.PROJECT_ID == 0)
            throw new ApproveProjectException("Project " + project.PROJECT_TITLE + " is not submitted yet. Please submit project first.");

        //Set to APPROVED
        project.PROJECT_STATUS = APPLICATION_STATUS.APPROVED;

        //Set approver ID
        project.UC_APPROVER = UCId;

        //Update project
        Project approvedProject = this.updateProject(project);

        //send out email
        string subject = "Congratulations! Your project has been approved!";
        string message = "<h2>Your project " + project.PROJECT_TITLE + " has been approved!</h2>";
        EmailModule emailModule = new EmailModule();
        emailModule.sendEmail(subject, message, project.PROJECT_OWNER.EMAIL);

        return approvedProject;
    }
예제 #16
0
    /**
     * Rejects a project
     *
     */
    public Project rejectProject(Project project)
    {
        if (session == null || !session.IsOpen)
        {
            session = hibernate.getSession();
        }
        if (project.PROJECT_ID == null || project.PROJECT_ID == 0)
            throw new ApproveProjectException("Project " + project.PROJECT_TITLE + " is not submitted yet. Please submit project first.");

        //Set to APPROVED
        project.PROJECT_STATUS = APPLICATION_STATUS.REJECTED;

        //Update project
        Project approvedProject = this.updateProject(project);

        //send out email
        string subject = "Sorry your project has been rejected.";
        string message = "Your project " + project.PROJECT_TITLE + " has been rejected.<br/>";
        message += "Reason: " + project.UC_REMARKS;
        EmailModule emailModule = new EmailModule();
        emailModule.sendEmail(subject, message, project.PROJECT_OWNER.EMAIL);

        return approvedProject;
    }
예제 #17
0
    /**
     * Assign project to a team of Students
     *
     * - If rejectOthers is TRUE, set all other Application statuses to REJECTED
     * - Change the application status of all studentIds to APPROVED
     * - Create a Team object with TeamAssignment to the studentIds
     * - For each student who is assigned to this project, close off
     */
    public Team assignProject(long projectId, IList<long> applicationIds, bool rejectOthers)
    {
        Project project = this.getProjectById(projectId);
        if (project == null)
            throw new ProjectAssignmentException("Project Id " + projectId + " not found.");

        if(project.PROJECT_STATUS != APPLICATION_STATUS.APPROVED)
            throw new ProjectAssignmentException("Project Id " + projectId + " is not in the APPROVED status.");

        if(applicationIds.Count <= 0 )
            throw new ProjectAssignmentException("Please select at least 1 application.");

        IList<ProjectApplication> allApplications = project.APPLICATIONS;
        IList<ProjectApplication> successfulApplications = new List<ProjectApplication>();
        IList<ProjectApplication> failedApplications = new List<ProjectApplication>();

        if (session == null || !session.IsOpen)
        {
            session = hibernate.getSession();
        }

        //Update successful applications
        session.BeginTransaction();
        foreach (ProjectApplication application in allApplications)
        {
            if (applicationIds.Contains(application.APPLICATION_ID))
            {
                application.APPLICATION_STATUS = APPLICATION_STATUS.APPROVED;
                successfulApplications.Add(application);
                session.Update(application);
            }

            if (successfulApplications.Count % MAX_FLUSH_SIZE == 0)
                session.Flush();
        }
        session.Flush();

        //If rejectOthers flag is set as true, reject the rest of the applications
        if (rejectOthers)
        {
            foreach (ProjectApplication application in allApplications)
            {
                if (!applicationIds.Contains(application.APPLICATION_ID))
                {
                    application.APPLICATION_STATUS = APPLICATION_STATUS.REJECTED;
                    failedApplications.Add(application);
                    session.Update(application);
                }

                if (failedApplications.Count % MAX_FLUSH_SIZE == 0)
                    session.Flush();
            }
            session.Flush();
        }

        //Set Project status to ASSIGNED
        project.PROJECT_STATUS = APPLICATION_STATUS.ASSIGNED;

        //Create Team first
        Team newTeam = new Team();
        session.Save(newTeam);

        //Create ProjectAssignment - relationship between Team and Project
        ProjectAssignment pAssignment = new ProjectAssignment();
        pAssignment.PROJECT = project;
        pAssignment.TEAM = newTeam;
        project.ASSIGNED_TEAMS.Add(pAssignment);
        newTeam.ASSIGNED_TO_PROJECT.Add(pAssignment);

        foreach (ProjectApplication application in successfulApplications)
        {
            //set team relationships
            TeamAssignment tAssignment = new TeamAssignment();
            Student student = application.APPLICANT;

            tAssignment.STUDENT = student;
            tAssignment.TEAM = newTeam;

            //Close off all this student's applications
            IList<ProjectApplication> existingApplications = student.PROJECTS_APPLIED;
            foreach(ProjectApplication existingApplication in existingApplications)
            {
                if (existingApplication.APPLICATION_ID == application.APPLICATION_ID)
                    continue;
                existingApplication.APPLICATION_STATUS = APPLICATION_STATUS.REJECTED;
                session.Save(existingApplication);
            }

            //set opposite direction relationships
            newTeam.TEAM_ASSIGNMENT.Add(tAssignment);
            student.TEAM_ASSIGNMENT.Add(tAssignment);

            //set assignment attributes
            tAssignment.ROLE = TEAM_ASSIGNMENT_ROLE.MEMBER;

            session.Save(tAssignment);
            session.Save(student);
        }

        session.Save(pAssignment);
        session.Save(project);
        session.Save(newTeam);
        //session.Flush();

        session.Transaction.Commit();

        //send emails to:
        //1. Project Owner
        //2. Project members
        EmailModule emailModule = new EmailModule();
        string ownerSubject = "Congratulations! Your project has been assigned!";
        string ownerMessage = "<h2>Your project " + project.PROJECT_TITLE + " has been assigned to the following students:<h2> <br />";
        foreach(TeamAssignment ta in newTeam.TEAM_ASSIGNMENT)
        {
            Student member = ta.STUDENT;
            ownerMessage += "- " + member.FIRSTNAME + " " + member.LASTNAME + " (Student ID: " + member.USER_ID + ", Email: " + member.EMAIL + ") <br />";
        }
        emailModule.sendEmail(ownerSubject, ownerMessage, project.PROJECT_OWNER.EMAIL);

        string studentSubject = "Congratulations! You have been assigned to a project!";
        string studentMessage = "<h2>You have been assigned to the following project:</h2> <br />";
        studentMessage += "'" + project.PROJECT_TITLE + "' (Project ID: " + project.PROJECT_ID + ") <br />";
        studentMessage += "By company: " + project.PROJECT_OWNER.USERNAME + " (Company reg num: " + project.PROJECT_OWNER.COMPANY_REG_NUM + ") <br />";
        studentMessage += "Contact person: " + project.CONTACT_NAME + " <br />";
        studentMessage += "Contact email: " + project.CONTACT_EMAIL + " <br />";
        studentMessage += "Contact phone: " + project.CONTACT_NUMBER + " <br />";

        IList<string> addresses = new List<string>();
        foreach (TeamAssignment ta in newTeam.TEAM_ASSIGNMENT)
        {
            Student member = ta.STUDENT;
            addresses.Add(member.EMAIL);
        }
        emailModule.sendEmailToMany(studentSubject, studentMessage,addresses);

        return newTeam;
    }