public static int SendTemplateEmail(Jury jury, Guid tempalteId) { int rtnValue = 0; //string emailformat = ReadEmailTemplate(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EmailTemplate\\InvitationEmailRound1.htm"); EmailTemplate emailtempalte = EmailTemplate.GetEmailTemplate(tempalteId); if (emailtempalte != null) { string emailformat = emailtempalte.Body; string emailCC = string.Empty; if (jury != null) { emailformat = emailformat.Replace("#NAME#", jury.FirstName); emailformat = emailformat.Replace("#LINKAPPROVE#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|2") + "&request=" + GeneralFunction.StringEncryption("yes") + ""); emailformat = emailformat.Replace("#LINKAPPROVER1#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|") + "&request=" + GeneralFunction.StringEncryption("yes") + ""); emailformat = emailformat.Replace("#LINKAPPROVER2#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("2|") + "&request=" + GeneralFunction.StringEncryption("yes") + ""); emailformat = emailformat.Replace("#LINKREJECT#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|2") + "&request=" + GeneralFunction.StringEncryption("no") + ""); emailformat = emailformat.Replace("#JURYLOGINURL#", System.Configuration.ConfigurationSettings.AppSettings["WebURLEffie"] + "Jury/Login.aspx"); emailformat = emailformat.Replace("#LOGINID#", jury.SerialNo); emailformat = emailformat.Replace("#PASSWORD#", jury.Password); if (emailformat.IndexOf("#PROFILELINK#") != -1) { jury.IsProfileUpdated = false; } jury.Save(); string updateProfileLink = ConfigurationSettings.AppSettings["WebURL"] + "Jury/Profile.aspx?juryId=" + IptechLib.Crypto.StringEncryption(jury.Id.ToString()); emailformat = emailformat.Replace("#PROFILELINK#", "<a href='" + updateProfileLink + "'>this link</a>"); if (!String.IsNullOrEmpty(jury.PAEmail.Trim())) { string pattern = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z][a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$"; Match match = Regex.Match(jury.PAEmail.Trim(), pattern, RegexOptions.IgnoreCase); if (match.Success && tempalteId != new Guid("714b1944-3fab-41c7-b353-cedeec28924f") && tempalteId != new Guid("e0cc09ee-30e1-44b7-83b1-48834a6fbbb9")) { emailCC = jury.PAEmail; } } //Disable PAEmail emailCC = ""; rtnValue = SendMail(jury.Email, System.Configuration.ConfigurationSettings.AppSettings["AdminEmail"], emailCC, "", emailtempalte.Subject, emailformat, true, null, null); } } return(rtnValue); }
public static int SendInvitationTemplateEmail(Invitation inv, Guid tempalteId) { int rtnValue = 0; //string emailformat = ReadEmailTemplate(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EmailTemplate\\InvitationEmailRound1.htm"); EmailTemplate emailtempalte = EmailTemplate.GetEmailTemplate(tempalteId); if (emailtempalte != null) { string emailformat = emailtempalte.Body; string emailCC = string.Empty; Jury jury = Jury.GetJury(inv.JuryId); if (jury != null) { emailformat = emailformat.Replace("#NAME#", jury.FirstName); emailformat = emailformat.Replace("#LINKAPPROVE#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|2") + "&request=" + GeneralFunction.StringEncryption("yes") + ""); emailformat = emailformat.Replace("#LINKAPPROVER1#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|") + "&request=" + GeneralFunction.StringEncryption("yes") + ""); emailformat = emailformat.Replace("#LINKAPPROVER2#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("2|") + "&request=" + GeneralFunction.StringEncryption("yes") + ""); emailformat = emailformat.Replace("#LINKREJECT#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|2") + "&request=" + GeneralFunction.StringEncryption("no") + ""); if (emailformat.IndexOf("#PROFILELINK#") != -1) { jury.IsProfileUpdated = false; } jury.Save(); emailformat = emailformat.Replace("#PROFILELINK#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Jury/Profile.aspx?juryId=" + IptechLib.Crypto.StringEncryption(jury.Id.ToString())); emailformat = emailformat.Replace("#EMAILTRACKER#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "EmailTracking.aspx?invId=" + IptechLib.Crypto.StringEncryption(inv.Id.ToString())); if (!String.IsNullOrEmpty(jury.PAEmail.Trim())) { string pattern = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z][a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$"; Match match = Regex.Match(jury.PAEmail.Trim(), pattern, RegexOptions.IgnoreCase); if (match.Success) { emailCC = jury.PAEmail; } } rtnValue = SendMail(jury.Email, System.Configuration.ConfigurationSettings.AppSettings["AdminEmail"], emailCC, "", emailtempalte.Subject, emailformat, true, null, null); } } return(rtnValue); }
protected void btnSubmit_Click(object sender, EventArgs e) { Invitation inv = SaveForm(); if (inv != null) { Jury jury = Jury.GetJury(inv.JuryId); if (jury != null) { jury.EffieExpYear = Jury.GetEffieExperienceYears(jury, inv); jury.DateModifiedString = DateTime.Now.ToString(); jury.Save(); } Response.Redirect(GeneralFunction.GetRedirect("../Main/InvitationList.aspx")); } }
public void ReadExcelData(XLWorkbook workBook) { if (workBook.Worksheets.Count > 0) { int sheetNo = 1; foreach (IXLWorksheet sh in workBook.Worksheets) { var dataRange = sh.RangeUsed(); int skiprows = 1; if (dataRange != null) { foreach (var row in dataRange.Rows()) { if (skiprows >= 2 && sheetNo == 1) { if (ValidateRow(row)) { Jury jury = Jury.NewJury(); jury.Type = RemoveControlChars(row.Cell(3).GetString()); jury.Salutation = RemoveControlChars(row.Cell(4).GetString()); jury.FirstName = RemoveControlChars(row.Cell(5).GetString()); jury.LastName = RemoveControlChars(row.Cell(6).GetString()); jury.Designation = RemoveControlChars(row.Cell(8).GetString()); jury.Company = RemoveControlChars(row.Cell(9).GetString()); //jury.CompanyType = RemoveControlChars(row.Cell(9).GetString()); jury.Network = RemoveControlChars(row.Cell(10).GetString()); jury.HoldingCompany = RemoveControlChars(row.Cell(11).GetString()); jury.Email = RemoveControlChars(row.Cell(12).GetString()); jury.Contact = RemoveControlChars(row.Cell(13).GetString()); jury.Mobile = RemoveControlChars(row.Cell(14).GetString()); jury.PAName = RemoveControlChars(row.Cell(15).GetString()); jury.PAEmail = RemoveControlChars(row.Cell(16).GetString()); jury.PATel = RemoveControlChars(row.Cell(17).GetString()); jury.Address1 = RemoveControlChars(row.Cell(18).GetString()); jury.Address2 = RemoveControlChars(row.Cell(19).GetString()); jury.City = RemoveControlChars(row.Cell(20).GetString()); jury.Postal = RemoveControlChars(row.Cell(21).GetString()); jury.Country = RemoveControlChars(row.Cell(22).GetString()); string effieExpereinceYears = string.Empty; effieExpereinceYears += "#" + RemoveControlChars(row.Cell(25).GetString()) + "|"; effieExpereinceYears += "#" + RemoveControlChars(row.Cell(24).GetString()) + "|"; effieExpereinceYears += "#" + RemoveControlChars(row.Cell(23).GetString()) + "|"; jury.EffieExpYear = effieExpereinceYears; jury.EffieExp = RemoveControlChars(row.Cell(26).GetString()); jury.Remarks = RemoveControlChars(row.Cell(27).GetString()); jury.Reference = RemoveControlChars(row.Cell(28).GetString()); jury.Source = RemoveControlChars(row.Cell(29).GetString()); jury.LastUpdate = RemoveControlChars(row.Cell(30).GetString()); if (jury.IsNew) { jury.SerialNo = GeneralFunction.GetNewJuryId(); jury.DateCreatedString = DateTime.Now.ToString(); jury.Password = Guid.NewGuid().ToString().Substring(0, 6); } if (jury.IsValid) { jury = jury.Save(); } } //else // return; } skiprows++; } } sheetNo++; } } else { lbError.Text += "The Sheet has invalid/not enough data.<br/>Please check your file"; } }
public void ReadExcelData(XLWorkbook workBook) { JuryList jurylsit = JuryList.GetJuryList(); if (workBook.Worksheets.Count > 0) { int sheetNo = 1; foreach (IXLWorksheet sh in workBook.Worksheets) { var dataRange = sh.RangeUsed(); int skiprows = 1; if (dataRange != null) { foreach (var row in dataRange.Rows()) { if (skiprows >= 2 && sheetNo == 1) { if (ValidateRow(row)) { Jury jury = null; string serialNo = RemoveControlChars(row.Cell(3).GetString()); try { jury = jurylsit.Where(m => m.SerialNo.Equals(serialNo)).Single(); } catch { } if (jury == null) { jury = Jury.NewJury(); } if (jury.IsNew) { jury.Type = RemoveControlChars(row.Cell(2).GetString()); jury.Salutation = RemoveControlChars(row.Cell(4).GetString()); jury.FirstName = RemoveControlChars(row.Cell(5).GetString()); jury.LastName = RemoveControlChars(row.Cell(6).GetString()); jury.Designation = RemoveControlChars(row.Cell(7).GetString()); jury.Company = RemoveControlChars(row.Cell(8).GetString()); jury.Network = RemoveControlChars(row.Cell(9).GetString()); jury.HoldingCompany = RemoveControlChars(row.Cell(10).GetString()); jury.Email = RemoveControlChars(row.Cell(11).GetString()); jury.Contact = RemoveControlChars(row.Cell(12).GetString()); jury.Mobile = RemoveControlChars(row.Cell(13).GetString()); jury.PAName = RemoveControlChars(row.Cell(14).GetString()); jury.PAEmail = RemoveControlChars(row.Cell(16).GetString()); jury.PATel = RemoveControlChars(row.Cell(15).GetString()); jury.Country = RemoveControlChars(row.Cell(17).GetString()); jury.EffieExpProgram = RemoveControlChars(row.Cell(18).GetString()); jury.Source = RemoveControlChars(row.Cell(19).GetString()); string effieExpereinceYears = string.Empty; effieExpereinceYears += ((RemoveControlChars(row.Cell(25).GetString()).Equals("1") || RemoveControlChars(row.Cell(26).GetString()).Equals("1")) ? "2014" : "") + "#" + RemoveControlChars(row.Cell(27).GetString()) + "|"; effieExpereinceYears += "|"; effieExpereinceYears += "|"; jury.EffieExpYear = effieExpereinceYears; jury.Remarks = RemoveControlChars(row.Cell(28).GetString()); jury.SerialNo = GeneralFunction.GetNewJuryId(); jury.DateCreatedString = DateTime.Now.ToString(); jury.Password = Guid.NewGuid().ToString().Substring(0, 6); } else { bool is2014 = jury.EffieExpYear.IndexOf("2014") != -1; bool is2015 = jury.EffieExpYear.IndexOf("2015") != -1; bool is2016 = jury.EffieExpYear.IndexOf("2016") != -1; string remarks2014 = string.Empty; string remarks2015 = string.Empty; string remarks2016 = string.Empty; try { remarks2014 = jury.EffieExpYear.Split('|')[0].Split('#')[1]; } catch { } try { remarks2015 = jury.EffieExpYear.Split('|')[1].Split('#')[1]; } catch { } try { remarks2016 = jury.EffieExpYear.Split('|')[2].Split('#')[1]; } catch { } string effieExpereinceYears = string.Empty; effieExpereinceYears += ((RemoveControlChars(row.Cell(25).GetString()).Equals("1") || RemoveControlChars(row.Cell(26).GetString()).Equals("1")) ? "2014" : "") + "#" + RemoveControlChars(row.Cell(27).GetString()) + "|"; effieExpereinceYears += (is2015 ? "2015" : "") + "#" + remarks2015 + "|"; effieExpereinceYears += (is2016 ? "2016" : "") + "#" + remarks2016 + "|"; jury.EffieExpYear = effieExpereinceYears; } if (jury.IsValid) { jury = jury.Save(); } Invitation juryInv = Invitation.NewInvitation(); juryInv.JuryId = jury.Id; juryInv.IsRound1Invited = RemoveControlChars(row.Cell(20).GetString()).Equals("1"); juryInv.IsRound2Invited = RemoveControlChars(row.Cell(21).GetString()).Equals("1"); juryInv.IsDeclined = RemoveControlChars(row.Cell(22).GetString()).Equals("1"); juryInv.IsRound1Accepted = RemoveControlChars(row.Cell(23).GetString()).Equals("1"); juryInv.IsRound2Accepted = RemoveControlChars(row.Cell(24).GetString()).Equals("1"); juryInv.IsRound1Assigned = RemoveControlChars(row.Cell(25).GetString()).Equals("1"); juryInv.IsRound2Assigned = RemoveControlChars(row.Cell(26).GetString()).Equals("1"); juryInv.EventCode = "2014"; if (juryInv.IsValid) { juryInv.Save(); } if (!IsSameCompanyDetails(jury, row)) { SaveCompanyHistory(jury, row); } } } skiprows++; } } sheetNo++; } } else { lbError.Text += "The Sheet has invalid/not enough data.<br/>Please check your file"; } }
protected void radGridJury_ItemCommand(object sender, GridCommandEventArgs e) { lblError.Text = ""; if (e.CommandName == "Edit") { GeneralFunction.SetFilter("JuryList", txtSearch.Text, ddlSearch.SelectedValue, ddlNetwork.SelectedValue, ddlHoldingCompany.SelectedValue, ddlCountry.SelectedValue, ddlType.SelectedValue, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, radGridJury.CurrentPageIndex.ToString()); //Security.SetLoginSessionUser(GeneralFunction.GetDummyRegistrationForAdminSpoof()); GeneralFunction.SetRedirect("../Main/JuryList.aspx"); // to return from whereever Response.Redirect("../Main/Jury.aspx?juryId=" + e.CommandArgument.ToString()); } else if (e.CommandName == "ViewJury") { GeneralFunction.SetFilter("JuryList", txtSearch.Text, ddlSearch.SelectedValue, ddlNetwork.SelectedValue, ddlHoldingCompany.SelectedValue, ddlCountry.SelectedValue, ddlType.SelectedValue, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, radGridJury.CurrentPageIndex.ToString()); //Security.SetLoginSessionUser(GeneralFunction.GetDummyRegistrationForAdminSpoof()); GeneralFunction.SetRedirect("../Main/JuryList.aspx"); // to return from whereever Response.Redirect("../Main/Jury.aspx?v=1&juryId=" + e.CommandArgument.ToString()); } else if (e.CommandName == "delete") { Jury jury = Jury.GetJury(new Guid(e.CommandArgument.ToString())); if (jury != null) { if (jury.IsActive) { Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", "<script>function f(){AlertJuryActive('" + jury.SerialNo + "','" + jury.Id.ToString() + "');Sys.Application.remove_load(f) ;}; Sys.Application.add_load(f) ;</script>"); } else { jury.IsToDelete = true; jury.IsActive = false; jury.DateModifiedString = DateTime.Now.ToString(); jury.Save(); Response.Redirect("../Main/JuryList.aspx?tab=0"); } } } else if (e.CommandName == "restore") { Jury jury = Jury.GetJury(new Guid(e.CommandArgument.ToString())); if (jury != null) { jury.IsToDelete = false; jury.DateModifiedString = DateTime.Now.ToString(); jury.Save(); } Response.Redirect("../Main/JuryList.aspx?tab=1"); } else if (e.CommandName == "DelateConfirm") { Jury jury = Jury.GetJury(new Guid(e.CommandArgument.ToString())); if (jury != null) { jury.IsToDelete = true; jury.IsActive = false; jury.DateModifiedString = DateTime.Now.ToString(); jury.Save(); } Response.Redirect("../Main/JuryList.aspx?tab=0"); } }