Exemplo n.º 1
0
        public async Task Validate(string email)
        {
            ResultEmail = email.ToLower().Trim();
            var eml = FixCommon(ResultEmail.Replace(",", ".").TrimEnd('.', ',', ';'));

            if (RegExValidate(eml))
            {
                Probable = true;
            }
            else
            {
                eml = CleanSpelling(eml);
            }
            if (await MxCheckDomain(eml))
            {
                DomainExists = true;
                Valid        = true;
            }
            PopulateData(eml);
            if (!ResultEmail.Equals(eml))
            {
                ResultEmail = eml;
                Corrected   = true;
            }
        }
Exemplo n.º 2
0
        public static ResultEmail EmailRegex(string email)
        {
            var          results = new ResultEmail();
            const string pattern = @"^[A-Z0-9._%+-]+@[A-Z0-9.-]+.(com|org|net|edu|gov|mil|biz|info|mobi)(.[A-Z]{2})?$";

            Regex regex  = new Regex(pattern, RegexOptions.IgnoreCase);
            var   result = regex.IsMatch(email);

            if (result)
            {
                results.ResultEmailList.Add(email);
            }
            else
            {
                results.ResultErrorList.Add(email);
            }
            return(results);
        }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string aid=Request.QueryString["aid"].ToString();

            ResultEmail resultEmail = new ResultEmail();
            resultEmail = resultEmail.GetResultEmailByAOID(Convert.ToInt32(aid));

            if (resultEmail == null)
            {
                lblULR.Text = "Please Fill up Contents for Result Email First.";
                lblULR.ForeColor = System.Drawing.Color.Red;

            }
            else
            {
                string asseeementURL = System.Web.Configuration.WebConfigurationManager.AppSettings["asseeementURL"].ToString();
                //lblULR.Text = "http://localhost/CVTC/Exam.aspx?aid=" + aid;
                //lblULR.Text = "http://iss.cvtc.edu/CVTC/Exam.aspx?aid=" + aid;
                lblULR.Text = asseeementURL+"CVTC/Exam.aspx?aid=" + aid;
                lblULR.ForeColor = System.Drawing.Color.Green;
            }

            //LabelAssessmentName.Text
            Session["aid"] = aid;
            HiddenFieldAOID.Value = aid;
            Initialize(Convert.ToInt32(aid));

            if (Session["CurrentUser"] != null)
            {
                User u = (User)Session["CurrentUser"];
                HiddenFieldCurrentUser.Value = u.UserOID.ToString();
            }

        }
    }
Exemplo n.º 4
0
    private void PrintIntervention(int aid, string studentID,string StuEmail)
    {
        try
        {
            Assessment ass = new Assessment();
            ass = ass.GetAssessmentByOID(aid);
            ResultEmail resultEmail = new ResultEmail();
            resultEmail = resultEmail.GetResultEmailByAOID(aid);

            if (resultEmail == null)
                return;

            Student student = new Student().GetStudentByStudentOID(studentID);

            StringBuilder sb = new StringBuilder();
            sb.Append("<table cellpadding='0px' cellspacing='0px' style='width:100%; margin:0px 30px 0px 30px'>");

            sb.Append("<tr>");
            sb.Append("<td align='center'  style='font-size:24px; font-weight:bold;'> " + ass.AssessmentName + " Feedback Report</td>");
            sb.Append("</tr>");
            sb.Append("<tr>");
            sb.Append("<td>CVTC applicant: <b>" + student.FullName + "</b> Program Interest: <b>" + student.MajorProgramEnrollment + "</b></td>");
            sb.Append("</tr>");
            sb.Append("<tr>");
            sb.Append("<td > <br />" + resultEmail.Header + "</td>");
            sb.Append("</tr>");
            sb.Append("<tr>");
            sb.Append("<td ><br /><b>*Your individual Inventory of Student Success assessment results suggest . . .</b><br /></td>");
            sb.Append("</tr>");

            StudentRank studentRank = new StudentRank();
            Collection<StudentRank> studentRankList = studentRank.GetStudentRankBySOIDandAOID(student.StudentOID, ass.AssessmentOID);

            int i = 0;
            string txtSign = "", txtComments = "";
            sb.Append("<td>");
            sb.Append("<table cellpadding='0px' cellspacing='0px' style='width:80%;'>");
            foreach (StudentRank SR in studentRankList)
            {
                txtComments = SR.Comment;
                foreach (Section s in ass.SectionList)
                {
                    if (SR.SectionOID == s.SectionOID)
                    {
                        if (SR.Rank >= s.Medium)
                        {
                            txtSign = "+";
                        }
                        else if ((SR.Rank < s.Medium) && (SR.Rank >= s.Low))
                        {
                            txtSign = "~";
                        }
                        else if ((SR.Rank < s.Low))
                        {
                            txtSign = "-";
                        }
                        //else
                        //{
                        //    txtSign = "-";
                        //    //txtComments = "";
                        //}
                        break;
                    }
                }

                if (i % 2 == 0)
                {
                    sb.Append("<tr>");
                    sb.Append("<td align='right' valign='middle' style='width:2%'><b>" + txtSign + "</b></td>");
                    sb.Append("<td style='width:48%; border: thin solid #000000; padding:10px;'> " + txtComments + " </td>");
                    //sb.Append("<td style='width:48%; border: thin solid #000000; padding:10px;'> " + SR.Rank + " </td>");
                }
                else
                {
                    sb.Append("<td align='right'  valign='middle' style='width:2%'><b>" + txtSign + "</b></td>");
                    sb.Append("<td style='width:48%; border: thin solid #000000; padding:10px;'> " + txtComments + " </td>");
                    //sb.Append("<td style='width:48%; border: thin solid #000000; padding:10px;'> " + SR.Rank + " </td>");
                    sb.Append("</tr>");
                }
                i++;
                txtSign = "";
                txtComments = "";
            }

            if (studentRankList.Count % 2 == 0)
            {
                sb.Append("<tr>");
                sb.Append("<td colspan='4'><br />*( +above average ~average -below average )</td>");
                sb.Append("</tr>");
            }
            else
            {
                sb.Append("<td colspan='2'><br /> *( +above average ~average -below average )</td>");
                sb.Append("</tr>");
            }
            sb.Append("</table>");
            sb.Append("</td>");
            sb.Append("<tr>");
            sb.Append("<td > <br />" + resultEmail.ShowAboveResult + "</td>");
            sb.Append("</tr>");
            sb.Append("</table>");

            string StudentEmail=null;
            if (ConfigurationManager.AppSettings["productionMode"].ToString() == "OFF")
            {
                StudentEmail = System.Web.Configuration.WebConfigurationManager.AppSettings["asseeementEmail"].ToString();
            }
            else if (ConfigurationManager.AppSettings["productionMode"].ToString() == "ON")
            {
                StudentEmail = StuEmail;
                if (StudentEmail == null || StudentEmail == "")
                {
                    StudentEmail = System.Web.Configuration.WebConfigurationManager.AppSettings["asseeementEmail"].ToString();
                }
            }

            this.SendMail(StudentEmail, "Assesment feedback report ", sb.ToString());
            //this.SendMail("*****@*****.**", "Assesment feedback report ", sb.ToString());

        }
        catch (Exception ex)
        { }
    }
Exemplo n.º 5
0
        public ActionResult Index(Send Savemail)
        {
            List <SelectListItem> ulkekodu = (from i in db.TelKodu.ToList()
                                              select new SelectListItem
            {
                Text = i.UlkeKodu,
                Value = i.Id.ToString()
            }).ToList();

            ViewBag.bag = ulkekodu;

            try
            {
                try
                {
                    string[] email = Savemail.Kime.Split(';');

                    for (int i = 0; i < email.Count(); i++)
                    {
                        results = EmailExtension.EmailRegex(email[i]);
                    }
                    if (results.ResultErrorList.Count > 0)
                    {
                        ModelState.AddModelError("Kime", "Email girişlerinde hatalı bir email mevcut");
                        return(View(Savemail));
                    }
                    else
                    {
                        foreach (var item in email)
                        {
                            var senderEmail = new MailAddress("*****@*****.**", "Edanur");

                            var receiverEmail = new MailAddress(item, "Receiver");

                            var password = "******";
                            var sub      = Savemail.Konu;
                            var body     = Savemail.Mesaj + "  " + Savemail.Kim + " " + Savemail.Telefon;
                            var smtp     = new SmtpClient()
                            {
                                Host                  = "smtp.gmail.com",
                                Port                  = 587,
                                EnableSsl             = true,
                                DeliveryMethod        = SmtpDeliveryMethod.Network,
                                UseDefaultCredentials = false,
                                Credentials           = new NetworkCredential(senderEmail.Address, password)
                            };
                            using (var mess = new MailMessage(senderEmail, receiverEmail)
                            {
                                Subject = Savemail.Konu,
                                Body = body
                            })
                                smtp.Send(mess);
                            db.Send.Add(Savemail);
                            db.SaveChanges();
                        }
                    }
                    return(View());
                }
                catch (NullReferenceException exception)
                {
                    ModelState.AddModelError("Kime", "Email alanı boş olamaz");
                    return(View());
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 6
0
    public ResultEmail GetResultEmailByOID(int OID)
    {
        ResultEmail resultEmail = null;
        using (OdbcConnection connection = new OdbcConnection(connectionString))
        {
            using (OdbcCommand command = new OdbcCommand())
            {

                command.Connection = connection;
                command.CommandText = "{CALL ResultEmail_ByOID(?)}";
                command.CommandType = CommandType.StoredProcedure;

                //Set Parameter Value
                command.Parameters.AddWithValue("@AssessmentResultOID", OID);

                //Open connection
                connection.Open();
                //Read using reader
                using (OdbcDataReader dataReader = command.ExecuteReader())
                {

                    ResultEmailDetail eDetail = new ResultEmailDetail();
                    if (dataReader.Read())
                    {
                        resultEmail = new ResultEmail();

                        resultEmail.AssessmentOID = Convert.ToInt32(dataReader["AssessmentOID"]);
                        resultEmail.AssessmentResultOID = Convert.ToInt32(dataReader["AssessmentResultOID"]);
                        resultEmail.CreatedBy = Convert.ToInt32(dataReader["CreatedBy"]);
                        resultEmail.CreatedDate = Convert.ToDateTime(dataReader["CreatedDate"]);
                        resultEmail.Header = Convert.ToString(dataReader["Header"]);
                        resultEmail.LastModifiedBy = Convert.ToInt32(dataReader["LastModifiedBy"]);
                        resultEmail.LastModifiedDate = Convert.ToDateTime(dataReader["LastModifiedDate"]);
                        resultEmail.ShowAboveResult = Convert.ToString(dataReader["ShowAboveResult"]);

                        resultEmail.ResultDetail = eDetail.GetEmailDetailByEmailOID(resultEmail.AssessmentResultOID);
                    }
                }

            }
        }
        return resultEmail;
    }
Exemplo n.º 7
0
    protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        int aid = 0;
        try
        {
            User user=(User)Session["CurrentUser"];
            if (user == null) return;
            System.Collections.ObjectModel.Collection<ResultEmailDetail> _list = new System.Collections.ObjectModel.Collection<ResultEmailDetail>();
            ResultEmailDetail emailDetail=null;
            aid = (Session["aid"] != null) ? (Convert.ToInt32(Session["aid"])) : 0;
            Assessment ass = new Assessment();
            ass = ass.GetAssessmentByOID(aid);

            ResultEmail resultEmail = new ResultEmail();
            //resultEmail.Header = TextBoxHeader.Text;
            //resultEmail.ShowAboveResult = TextBoxShowAboveResult.Text;
            resultEmail.Header = TextBoxHeaderHtml;
            resultEmail.ShowAboveResult = TextBoxShowAboveResultHtml;

            resultEmail.AssessmentOID = aid;
            resultEmail.CreatedBy = user.UserOID;
            resultEmail.LastModifiedBy = user.UserOID;

            //Result Detail
            ResultEmail rEmail = resultEmail.GetResultEmailByAOID(aid);
            //TextBox txt;
            string val = "";
            foreach (Section s in ass.SectionList)
            {
                emailDetail = new ResultEmailDetail();
                ////Positive Result
                //val = Request.Form["txtPositive" + s.SectionOID.ToString()];
                //emailDetail.PositiveResult = val;

                ////Negative Result
                //val = Request.Form["txtNegative" + s.SectionOID.ToString()];
                //emailDetail.NegativeResult = val;

                //Low Result
                val = Request.Form["txtLow" + s.SectionOID.ToString()];
                emailDetail.LowResult = val;

                //Medium Result
                val = Request.Form["txtMedium" + s.SectionOID.ToString()];
                emailDetail.MediumResult = val;

                //High Result
                val = Request.Form["txtHigh" + s.SectionOID.ToString()];
                emailDetail.HighResult = val;

                emailDetail.SectionOID = s.SectionOID;
                emailDetail.LastModifiedBy = user.UserOID;
                emailDetail.CreatedBy = user.UserOID;

                _list.Add(emailDetail);

            }
            resultEmail.ResultDetail = _list;

            //check whether It is exist or not

            if (rEmail == null)
            {
                if (resultEmail.AddResultEmail())
                {
                    LabelMessage.Text = "Saved Successfully.";
                }
                else
                {
                    LabelMessage.Text = "Not Saved.";
                }
            }
            else
            {
                resultEmail.AssessmentResultOID = rEmail.AssessmentResultOID;
                for (int i = 0; i < rEmail.ResultDetail.Count; i++)
                {
                    resultEmail.ResultDetail[i].ResultSectionOID = rEmail.ResultDetail[i].ResultSectionOID;

                }

                if (resultEmail.UpdateResultEmail())
                {
                    LabelMessage.Text = "Update Successfully.";
                }
                else
                {
                    LabelMessage.Text = "Update Failed.";
                }
            }

            TextBoxShowAboveResultHtml = "";
            TextBoxHeaderHtml = "";
            this.Initialize(aid);
        }
        catch (Exception ex)
        {

           this.Initialize(aid);
        }
    }
Exemplo n.º 8
0
    //private void PrintIntervention(int aid, string studentID)
    //{
    //    try
    //    {
    //        Assessment ass = new Assessment();
    //        ass = ass.GetAssessmentByOID(aid);
    //        ResultEmail resultEmail = new ResultEmail();
    //        resultEmail = resultEmail.GetResultEmailByAOID(aid);
    //        Student student = new Student().GetStudentByStudentOID(studentID);
    //        StringBuilder sb = new StringBuilder();
    //        sb.Append("<table cellpadding='0px' cellspacing='0px' style='width:100%; margin:0px 30px 0px 30px'>");
    //        sb.Append("<tr>");
    //        sb.Append("<td align='center'  style='font-size:24px; font-weight:bold;'> " + ass.AssessmentName + " Feedback Report</td>");
    //        sb.Append("</tr>");
    //        sb.Append("<tr>");
    //        sb.Append("<td>CVTC applicant: <b>" + student.FullName + "</b> Program Interest: <b>" + student.MajorProgramEnrollment + "</b></td>");
    //        sb.Append("</tr>");
    //        sb.Append("<tr>");
    //        sb.Append("<td >" + resultEmail.Header + "</td>");
    //        sb.Append("</tr>");
    //        sb.Append("<tr>");
    //        sb.Append("<td ><b>*Your individual Inventory of Student Success assessment results suggest . . .</b></br></td>");
    //        sb.Append("</tr>");
    //        StudentRank studentRank = new StudentRank();
    //        Collection<StudentRank> studentRankList = studentRank.GetStudentRankBySOIDandAOID(student.StudentOID, ass.AssessmentOID);
    //        int i = 0;
    //        string txtSign="", txtComments="";
    //        sb.Append("<td>");
    //        sb.Append("<table cellpadding='0px' cellspacing='0px' style='width:80%;'>");
    //        foreach (StudentRank SR in studentRankList)
    //        {
    //            txtComments = SR.Comment;
    //            foreach (Section s in ass.SectionList)
    //            {
    //                if (SR.SectionOID == s.SectionOID)
    //                {
    //                    if (SR.Rank >= s.High)
    //                    {
    //                        txtSign = "+";
    //                    }
    //                    else if ((SR.Rank < s.High) && (SR.Rank >= s.Medium))
    //                    {
    //                        txtSign = "~";
    //                    }
    //                    else if ((SR.Rank < s.Medium) && (SR.Rank >= s.Low))
    //                    {
    //                        txtSign = "-";
    //                    }
    //                    else
    //                    {
    //                        txtSign = "";
    //                        txtComments = "";
    //                    }
    //                    break;
    //                }
    //            }
    //            if (i % 2 == 0)
    //            {
    //                sb.Append("<tr>");
    //                sb.Append("<td align='right' valign='middle' style='width:2%'><b>" + txtSign + "</b></td>");
    //                sb.Append("<td style='width:48%; border: thin solid #000000'> " + txtComments + " </td>");
    //            }
    //            else
    //            {
    //                sb.Append("<td align='right'  valign='middle' style='width:2%'><b>" + txtSign + "</b></td>");
    //                sb.Append("<td style='width:48%; border: thin solid #000000'> " + txtComments + " </td>");
    //                sb.Append("</tr>");
    //            }
    //            i++;
    //            txtSign = "";
    //            txtComments = "";
    //        }
    //        if (studentRankList.Count % 2 == 0)
    //        {
    //            sb.Append("<tr>");
    //            sb.Append("<td colspan='4'></br>*( +above average ~average -below average )</br></td>");
    //            sb.Append("</tr>");
    //        }
    //        else
    //        {
    //            sb.Append("<td></br>*( +above average ~average -below average )</br></td>");
    //            sb.Append("</tr>");
    //        }
    //        sb.Append("</table>");
    //        sb.Append("</td>");
    //        sb.Append("<tr>");
    //        sb.Append("<td > </br>" + resultEmail.ShowAboveResult + "</td>");
    //        sb.Append("</tr>");
    //        sb.Append("</table>");
    //        print_div1.InnerHtml = sb.ToString();
    //    }
    //    catch (Exception ex)
    //    { }
    //}
    private void Initialize(int aid)
    {
        try
        {
            string html = "";
            Assessment ass = new Assessment();
            ass = ass.GetAssessmentByOID(aid);
            ResultEmail resultEmail = new ResultEmail();
            resultEmail = resultEmail.GetResultEmailByAOID(aid);
            string txtLow, txtMedium, txtHigh;

            if (resultEmail != null)
            {
                //TextBoxHeader.Text = resultEmail.Header;
                //TextBoxShowAboveResult.Text = resultEmail.ShowAboveResult;

                TextBoxHeaderHtml = resultEmail.Header;
                TextBoxShowAboveResultHtml = resultEmail.ShowAboveResult;
            }

            ResultEmailDetail rEmailDetail=null;
            html = "<table>";
            foreach (Section s in ass.SectionList)
            {
                //PlaceHolderResult.Controls.Add(InsertLineBreaks(1));
                if (s.SectionName != "NoScore")
                {
                    if (resultEmail != null)
                    {
                        if (resultEmail.ResultDetail != null)
                        {
                            var tmp = from detail in resultEmail.ResultDetail
                                      where detail.SectionOID == s.SectionOID
                                      select detail;

                            if (tmp.Count<ResultEmailDetail>() > 0)
                            {
                                rEmailDetail = tmp != null ? tmp.First() : null;
                            }
                            else
                            {
                                rEmailDetail = null;
                            }

                        }
                    }
                    txtLow = (rEmailDetail != null) ? rEmailDetail.LowResult : "";
                    txtMedium = (rEmailDetail != null) ? rEmailDetail.MediumResult : "";
                    txtHigh = (rEmailDetail != null) ? rEmailDetail.HighResult : "";

                    html += "<tr>";
                    html += "<td colspan='3' style='font-size:6;font-weight:bold;'>" + s.SectionName + "<td>";
                    html += "</tr>";
                    html += "<tr>";
                    html += "<td>" + "Low Ranking <br/>" + "<input  id='txtLow" + s.SectionOID.ToString() + "' name='txtLow" + s.SectionOID.ToString() + "' type='text' style='height:20px;width:250px;' value='" + txtLow + "'/>" + "<td>";
                    html += "<td>" + "Medium Ranking <br/>" + "<input id='txtMedium" + s.SectionOID.ToString() + "'  name='txtMedium" + s.SectionOID.ToString() + "' type='text' style='height:20px;width:250px;' value='" + txtMedium + " '/>" + "<td>";
                    html += "<td>" + "High Ranking <br/>" + "<input id='txtHigh" + s.SectionOID.ToString() + "' name='txtHigh" + s.SectionOID.ToString() + "' type='text' style='height:20px;width:250px;' value='" + txtHigh + " '/>" + "<td>";
                    html += "</tr>";

                    #region Old Code
                    ////Positive Result
                    //txtBox = new TextBox();
                    //lbl = new Label();
                    //txtBox.ID = "txtPositive" + s.SectionOID.ToString();
                    //txtBox.Text = (rEmailDetail != null) ? rEmailDetail.PositiveResult : "";
                    //lbl.ID = "lblPositive" + s.SectionOID.ToString();
                    //lbl.Text = "Positive Result for " + s.SectionName;
                    //PlaceHolderResult.Controls.Add(lbl);
                    //PlaceHolderResult.Controls.Add(InsertSpace(2));
                    //PlaceHolderResult.Controls.Add(txtBox);
                    //PlaceHolderResult.Controls.Add(InsertSpace(10));

                    ////Negative Result
                    //txtBox = new TextBox();
                    //lbl = new Label();
                    //txtBox.ID = "txtNegative" + s.SectionOID.ToString();
                    //txtBox.Text = (rEmailDetail != null) ? rEmailDetail.NegativeResult : "";
                    //lbl.ID = "lblNegative" + s.SectionOID.ToString();
                    //lbl.Text = "Negative Result for "+s.SectionName;
                    //PlaceHolderResult.Controls.Add(lbl);
                    //PlaceHolderResult.Controls.Add(InsertSpace(2));
                    //PlaceHolderResult.Controls.Add(txtBox);

                    //PlaceHolderResult.Controls.Add(InsertLineBreaks(1));
                    #endregion

                }
            }
            html += " </table>";
            ResultHolder.InnerHtml = html;
            //PlaceHolderResult.Controls.Add(html);
        }
        catch (Exception ex)
        { }
    }