Exemplo n.º 1
0
    protected List <JuryAPACEffieExperience> GetJuryAPACEffieExperienceList(EffieJuryManagementApp.Jury jury)
    {
        List <JuryAPACEffieExperience> JAPY = new List <JuryAPACEffieExperience>();
        var EffieExpYears = jury.EffieExpYear.Split('|');

        foreach (var item in EffieExpYears)
        {
            try { JAPY.Add(new JuryAPACEffieExperience {
                    Year = item.Split('#')[0], Remarks = item.Split('#')[1]
                }); }
            catch { }
        }

        List <JuryAPACEffieExperience> JuryAPACEffieExperiences = new List <JuryAPACEffieExperience>();
        List <string> effieExpYears = GeneralFunction.GetEffieExperienceYears();

        foreach (var year in effieExpYears)
        {
            EffieJuryManagementApp.InvitationList invitations = EffieJuryManagementApp.InvitationList.GetInvitationList(jury.Id, year);
            EffieJuryManagementApp.Invitation     invitation  = invitations.FirstOrDefault();
            if (invitation != null)
            {
                string Remaks = "";
                try { Remaks = JAPY.FirstOrDefault(x => x.Year == year).Remarks; }
                catch { }
                JuryAPACEffieExperience juryAPACEffieExperience = new JuryAPACEffieExperience();
                juryAPACEffieExperience.Year     = year;
                juryAPACEffieExperience.InviteR1 = invitation.IsRound1Invited;
                juryAPACEffieExperience.InviteR2 = invitation.IsRound2Invited;
                juryAPACEffieExperience.Decline  = invitation.IsDeclined;
                juryAPACEffieExperience.AcceptR1 = invitation.IsRound1Accepted;
                juryAPACEffieExperience.AcceptR2 = invitation.IsRound2Accepted;
                juryAPACEffieExperience.AssignR1 = invitation.IsRound1Assigned;
                juryAPACEffieExperience.AssignR2 = invitation.IsRound2Assigned;
                juryAPACEffieExperience.Remarks  = Remaks;
                JuryAPACEffieExperiences.Add(juryAPACEffieExperience);
            }
        }

        return(JuryAPACEffieExperiences);
    }
Exemplo n.º 2
0
    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 radGridEntry.Items)
        {
            CheckBox    chkbox = (CheckBox)item.FindControl("chkbox");
            HiddenField hdfId  = (HiddenField)item.FindControl("hdfId");

            if (chkbox.Checked)
            {
                EffieJuryManagementApp.Jury jury = EffieJuryManagementApp.Jury.GetJury(new Guid(hdfId.Value.ToString()));

                EffieJuryManagementApp.InvitationList invList = EffieJuryManagementApp.InvitationList.GetInvitationList(jury.Id, Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value);

                EffieJuryManagementApp.Invitation inv = null;

                if (invList.Count > 0)
                {
                    inv = invList[0];
                }
                else
                {
                    inv = EffieJuryManagementApp.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.SaveEmailSentLogJury(jury, templateId, evetnYear);
                }
                else
                {
                    inv.IsLocked = true;
                }

                if (inv.IsValid)
                {
                    inv.Save();
                }

                chkbox.Checked = false;
                counter++;
            }
        }

        if (counter == 0)
        {
            lblError.Text = "Please select at least 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/>";
            }
        }
    }