protected void radGridTemplateHistory_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { EmailSent emailsent = (EmailSent)e.Item.DataItem; if (emailsent != null) { Jury jury = Jury.GetJury(emailsent.JuryId); if (jury != null) { Label lblType = (Label)e.Item.FindControl("lblType"); lblType.Text = jury.Type; LinkButton lnkBtnJuryId = (LinkButton)e.Item.FindControl("lnkBtnJuryId"); lnkBtnJuryId.Text = jury.SerialNo; lnkBtnJuryId.CommandArgument = jury.Id.ToString(); HyperLink lnk = (HyperLink)e.Item.FindControl("lnkJuryName"); lnk.Text = jury.FirstName + " " + jury.LastName; lnk.NavigateUrl = "mailto:" + jury.Email; } Label lblEmailTemplate = (Label)e.Item.FindControl("lblEmailTemplate"); lblEmailTemplate.Text = emailsent.TemplateName; } } }
public void PopulateForm() { if (inv != null) { lblEventYear.Text = inv.EventCode; Jury jury = Jury.GetJury(inv.JuryId); lblJuryId.Text = jury.SerialNo; lblName.Text = jury.FirstName + " " + jury.LastName; lblCompany.Text = jury.Company; lblEmail.Text = jury.Email; lblCountry.Text = jury.Country; chkInvRound1.Checked = inv.IsRound1Invited; chkInvRound2.Checked = inv.IsRound2Invited; //if (inv.IsLocked) { chkAccptRound1.Checked = inv.IsRound1Accepted; chkAccptRound2.Checked = inv.IsRound2Accepted; chkDecline.Checked = inv.IsDeclined; } chkShortListedRound1.Checked = inv.IsRound1Shortlisted; chkShortListedRound2.Checked = inv.IsRound2Shortlisted; chkAssignRound1.Checked = inv.IsRound1Assigned; chkAssignRound2.Checked = inv.IsRound2Assigned; } }
protected void Page_Load(object sender, EventArgs e) { try { //jury = Jury.GetJury(new Guid(Request.QueryString["juryId"])); if (Request.QueryString["juryId"] != null && Request.QueryString["juryId"] != "") { jury = Jury.GetJury(IptechLib.Validation.GetValueGuid(Request.QueryString["juryId"], true)); } } catch { } if (jury == null) { Security.RedirectToAccessDeniedPage(); } itemsToShow = Convert.ToInt32(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultListToShow")[0].Value); if (!IsPostBack) { LoadForm(); PopulateForm(); } if (GeneralFunction.IsProfileUpdateDateCutOff()) { Response.Redirect("../Jury/Thankyou.aspx"); } }
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 Page_Load(object sender, EventArgs e) { if (Request.QueryString["juryId"] != null && Request.QueryString["juryId"] != "") { jury = Jury.GetJury(new Guid(Request.QueryString["juryId"])); } else { jury = Jury.NewJury(); } itemsToShow = Convert.ToInt32(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultListToShow")[0].Value); if (!IsPostBack) { LoadForm(); PopulateForm(); } // view mode if (Request.QueryString["v"] != null && Request.QueryString["v"] == "1") { IptechLib.Forms.ChangeStateControls(this, false); filePhoto.Enabled = false; btnSubmit.Visible = false; btnEdit.Visible = true; btnEdit.Enabled = true; btnBack.Enabled = true; } else { btnEdit.Enabled = true; lnkChangePassword.Visible = Security.IsRoleSuperAdmin() && !jury.IsNew; } if (Security.IsRoleReadOnlyAdmin()) { GeneralFunction.DisableAllAction(this, false); btnSubmit.Visible = false; btnJurySubmitRemarks.Visible = false; filePhoto.Enabled = false; } }
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 GenerateEmails(Guid templateId) { string evetnYear = string.Empty; try { evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value; } catch { } lblError.Text = string.Empty; int counter = 0; foreach (GridDataItem item in radGridJury.Items) { CheckBox chkbox = (CheckBox)item.FindControl("chkbox"); HiddenField hdfId = (HiddenField)item.FindControl("hdfId"); if (chkbox.Checked) { Jury jury = Jury.GetJury(new Guid(hdfId.Value.ToString())); Email.SendTemplateEmail(jury, templateId); GeneralFunction.SaveEmailSentLog(jury, templateId, evetnYear); chkbox.Checked = false; counter++; } } if (counter == 0) { lblError.Text = "Please select atleat one jury to send email.<br/>"; } else { lblError.Text = "Email sent to " + (counter).ToString() + " Jury(s).<br/>"; } }
protected void Page_Load(object sender, EventArgs e) { juryIdString = Request.QueryString["jId"]; rounds = Request.QueryString["rounds"]; requestString = Request.QueryString["request"]; if (GeneralFunction.IsInvitationDateCutOff()) { pnlDeadline.Visible = true; } else { if (juryIdString != null && rounds != null && requestString != null) { if (GeneralFunction.ValidateGuid(GeneralFunction.GetValueGuid(juryIdString, true).ToString())) { juryId = GeneralFunction.GetValueGuid(juryIdString, true); jury = Jury.GetJury(juryId); if (!IsPostBack) { LoadForm(); PopulateForm(jury); } } else { return; } } else { return; } } }
public void GenerateInvitation(SendInvitationCriteria invCriteria, Guid templateId) { string evetnYear = string.Empty; try { evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value; } catch { } lblError.Text = string.Empty; int counter = 0; foreach (GridDataItem item in radGridJury.Items) { CheckBox chkbox = (CheckBox)item.FindControl("chkbox"); HiddenField hdfId = (HiddenField)item.FindControl("hdfId"); if (chkbox.Checked) { Jury jury = Jury.GetJury(new Guid(hdfId.Value.ToString())); InvitationList invList = InvitationList.GetInvitationList(jury.Id, Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value); Invitation inv = null; if (invList.Count > 0) { inv = invList[0]; } else { inv = Invitation.NewInvitation(); } inv.EventCode = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value.ToString(); inv.JuryId = jury.Id; if (invCriteria.isRound1) { inv.IsRound1Invited = true; inv.DateRound1EmailSentString = DateTime.Now.ToString(); } if (invCriteria.isRound2) { inv.IsRound2Invited = true; inv.DateRound2EmailSentString = DateTime.Now.ToString(); } if (inv.IsNew) { inv.DateCreatedString = DateTime.Now.ToString(); } inv.DateModifiedString = DateTime.Now.ToString(); if (invCriteria.isSend) { Email.SendInvitationTemplateEmail(inv, templateId); GeneralFunction.SaveEmailSentLog(jury, templateId, evetnYear); } else { inv.IsLocked = true; } if (inv.IsValid) { inv.Save(); } chkbox.Checked = false; counter++; } } if (counter == 0) { lblError.Text = "Please select atleat one jury to send Invitation.<br/>"; } else { if (invCriteria.isSend) { lblError.Text = "Email sent to " + (counter).ToString() + " Jury(s).<br/>"; } else { lblError.Text = "Invitation added for " + (counter).ToString() + " Jury(s).<br/>"; } } }
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"); } }
protected void btnDownload_Click(object sender, EventArgs e) { int counter = 0; bool isSelected = false; lblError.Text = string.Empty; List <MediaFileInfo> filesToInclude = new List <MediaFileInfo>(); foreach (GridDataItem item in radGridJury.Items) { CheckBox chkbox = (CheckBox)item.FindControl("chkbox"); if (chkbox.Checked) { Jury jury = Jury.GetJury(new Guid(item["Id"].Text)); string storageFileName = jury.FirstName + " " + jury.LastName + " - " + jury.SerialNo; string photo = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryPhoto\\" + jury.Id.ToString() + ".jpg"; string profile = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryProfile\\" + jury.SerialNo.ToString() + ".doc"; string profile1 = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryProfile\\" + jury.SerialNo.ToString() + ".docx"; if (File.Exists(photo)) { AddNewMediaFile(filesToInclude, storageFileName, photo, "Photo", ".jpeg"); } if (File.Exists(profile)) { AddNewMediaFile(filesToInclude, storageFileName, profile, "Bio", ".doc"); } if (File.Exists(profile1)) { AddNewMediaFile(filesToInclude, storageFileName, profile1, "Bio", ".docx"); } isSelected = true; counter++; } chkbox.Checked = false; // unchecked it } if (!isSelected) { lblError.Text = "Select at least 1 jury to downlaod jury updates."; } else { string archiveName = String.Format("JuryUpdates-{0}.zip", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")); Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=\"" + archiveName + "\""); Response.ContentType = "application/zip"; Response.BufferOutput = false; using (ZipFile zip = new ZipFile()) { foreach (MediaFileInfo info in filesToInclude) { zip.AddEntry(info.fileDirectory + "\\" + info.storageFileName + info.fileExtension, File.ReadAllBytes(info.fielPath)); } zip.Save(Response.OutputStream); } Response.End(); } }