Пример #1
0
    public static bool isAttendedEvent(Jury jury, string eventCode)
    {
        bool isAttended = false;

        Invitation inv = null;

        try
        {
            inv = InvitationList.GetInvitationList(jury.Id, eventCode).Single();
        }
        catch { }

        if (inv != null)
        {
            isAttended = inv.IsRound1Assigned || inv.IsRound2Assigned;
        }

        return(isAttended);
    }
Пример #2
0
 public bool UpdateGui(ProfileInformationDTO user)
 {
     return(InvitationList.UpdateGui(user));
 }
Пример #3
0
    private void PopulateForm(Jury jury)
    {
        if (jury != null)
        {
            InvitationList inv = InvitationList.GetInvitationList(jury.Id, Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value);

            if (inv.Count > 0)
            {
                if (!inv[0].IsLocked)
                {
                    string[] roundsArray = null;
                    try
                    {
                        roundsArray = GeneralFunction.StringDecryption(rounds).ToString().Trim().Split('|').ToArray();
                    }
                    catch
                    {
                    }

                    string evetnYear = string.Empty;
                    try
                    {
                        evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;
                    }
                    catch { }

                    if (roundsArray != null)
                    {
                        if (GeneralFunction.StringDecryption(requestString).Trim().ToLower().Equals("yes"))
                        {
                            foreach (string round in roundsArray)
                            {
                                if (!String.IsNullOrEmpty(round))
                                {
                                    if (Convert.ToInt32(round) == 1)
                                    {
                                        inv[0].IsRound1Accepted = true;
                                    }
                                    if (Convert.ToInt32(round) == 2)
                                    {
                                        inv[0].IsRound2Accepted = true;
                                    }
                                }
                            }

                            EmailTemplate updateProfileTemplate = EmailTemplate.GetEmailTemplate(new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultUpdateProfileTemplateId")[0].Value));
                            if (updateProfileTemplate != null)
                            {
                                Email.SendTemplateEmail(jury, updateProfileTemplate.Id);
                                GeneralFunction.SaveEmailSentLog(jury, updateProfileTemplate.Id, evetnYear);
                            }

                            pnlSuccess.Visible = true;
                        }
                        else
                        {
                            foreach (string round in roundsArray)
                            {
                                if (!String.IsNullOrEmpty(round))
                                {
                                    if (Convert.ToInt32(round) == 1)
                                    {
                                        inv[0].IsRound1Accepted = false;
                                    }
                                    if (Convert.ToInt32(round) == 2)
                                    {
                                        inv[0].IsRound2Accepted = false;
                                    }
                                }
                            }

                            pnlReject.Visible = true;
                        }

                        inv[0].IsLocked   = true; //Only one time Jury can give his response
                        inv[0].IsDeclined = GeneralFunction.StringDecryption(requestString).Trim().ToLower().Equals("no");

                        inv[0].Save();
                    }
                }
                else
                {
                    pnlLock.Visible = true;
                }
            }
        }
    }
Пример #4
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 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/>";
            }
        }
    }
Пример #5
0
    protected void radGridJury_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Jury jury = (Jury)e.Item.DataItem;

            LinkButton lnkBtn = null;
            Label      lbl    = null;
            HyperLink  lnk    = null;

            // Jury Id
            lnkBtn                 = (LinkButton)e.Item.FindControl("lnkBtnJuryId");
            lnkBtn.Text            = jury.SerialNo;
            lnkBtn.CommandArgument = jury.Id.ToString();

            ((GridDataItem)e.Item)["Status"].Text = jury.IsToDelete ? "Del" : "Cur";

            // Jury Name
            lnk             = (HyperLink)e.Item.FindControl("lnkJuryName");
            lnk.Text        = jury.FirstName + " " + jury.LastName;
            lnk.NavigateUrl = "mailto:" + jury.Email;

            lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnEdit");
            lnkBtn.CommandArgument = jury.Id.ToString();

            HiddenField hdfId = (HiddenField)e.Item.FindControl("hdfId");
            hdfId.Value = jury.Id.ToString();

            lnk             = (HyperLink)e.Item.FindControl("hlkEmailHistory");
            lnk.CssClass    = "fancybox fancybox.iframe tblLinkRed";
            lnk.NavigateUrl = "./EmailSentHistory.aspx?juryId=" + jury.Id.ToString();

            CheckBox chkbox = (CheckBox)e.Item.FindControl("chkbox");

            try {
                InvitationList invList = InvitationList.GetInvitationList(jury.Id, Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value);
                if (invList.Count > 0)
                {
                    chkbox.Enabled = false;
                }
            }
            catch { }


            lnk             = (HyperLink)e.Item.FindControl("hlkEmailHistory");
            lnk.CssClass    = "fancybox fancybox.iframe tblLinkRed";
            lnk.NavigateUrl = "./EmailSentHistory.aspx?juryId=" + jury.Id.ToString();

            LinkButton lnkDelete = (LinkButton)e.Item.FindControl("lnkDelete");
            lnkDelete.CommandArgument = jury.Id.ToString();
            LinkButton lnkRestore = (LinkButton)e.Item.FindControl("lnkRestore");
            lnkRestore.CommandArgument = jury.Id.ToString();

            CheckBox chkBox = (CheckBox)e.Item.FindControl("chkbox");

            switch ((string)ViewState["TabFilterValue"])
            {
            case "All":
                lnkRestore.Visible = false;
                lnkDelete.Visible  = true;
                chkBox.Visible     = true;
                break;

            case "Deleted":
                lnkDelete.Visible  = false;
                lnkRestore.Visible = true;
                chkBox.Visible     = false;
                break;

            default:
                lnkDelete.Visible = true;
                chkBox.Visible    = true;
                break;
            }

            if (Security.IsRoleReadOnlyAdmin())
            {
                lnkDelete.Visible = false;
            }
        }
        else if (e.Item.ItemType == GridItemType.Pager)
        {
            RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");

            PageSizeCombo.Items.Clear();
            PageSizeCombo.Items.Add(new RadComboBoxItem("50", "50"));
            PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", radGridJury.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("100", "100"));
            PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", radGridJury.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("200", "200"));
            PageSizeCombo.FindItemByText("200").Attributes.Add("ownerTableViewId", radGridJury.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("All", "99999"));
            PageSizeCombo.FindItemByText("All").Attributes.Add("ownerTableViewId", radGridJury.MasterTableView.ClientID);
            PageSizeCombo.FindItemByValue(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
        }
    }
Пример #6
0
    private void BindGrid(bool needRebind)
    {
        string invitationYear = !String.IsNullOrEmpty(GetHighLightedYearTab()) ? GetHighLightedYearTab() : GeneralFunction.GetEffieExperienceYears().Last().ToString();  // By Default, get latest year invitation list when page loads

        HighLightYearTab(invitationYear);

        InvitationList invList = InvitationList.GetInvitationList(Guid.Empty, invitationYear);

        JuryList juryList = JuryList.GetJuryList();

        var filteredJuryList = (from jury in juryList
                                join inv in invList on jury.Id equals inv.JuryId
                                where inv.IsDeclined == false
                                select jury).ToList();


        List <Jury> list = new List <Jury>();

        //foreach (Jury jury in filteredJuryList)
        //{
        //    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) || File.Exists(profile) || File.Exists(profile1))
        //        list.Add(jury);
        //}

        string advanceSearch = (string)ViewState["AdvanceSearch"];

        List <Jury> flist = new List <Jury>();

        if (advanceSearch == "1")
        {
            foreach (Jury item in filteredJuryList)
            {
                if ((ddlType.SelectedValue == "" || (ddlType.SelectedValue != "" && item.Type == ddlType.SelectedValue)) && (
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "judgeId") && item.SerialNo.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "name") && (item.FirstName.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1 || item.LastName.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1))) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "title") && item.Designation.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "company") && item.Company.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)))
                    )
                {
                    bool isFilterPhoto = ddlUploadPhoto.SelectedValue.Equals("1");
                    bool isFilterBio   = ddlUploadBio.SelectedValue.Equals("1");

                    bool isFilterPhotoNo = ddlUploadPhoto.SelectedValue.Equals("0");
                    bool isFilterBioNo   = ddlUploadBio.SelectedValue.Equals("0");

                    string photo    = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryPhoto\\" + item.Id.ToString() + ".jpg";
                    string profile  = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryProfile\\" + item.SerialNo.ToString() + ".doc";
                    string profile1 = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryProfile\\" + item.SerialNo.ToString() + ".docx";

                    bool isToAdd = false;

                    if (isFilterPhoto || isFilterBio)
                    {
                        if (isFilterPhoto)
                        {
                            if (File.Exists(photo))
                            {
                                isToAdd = true;
                            }
                        }

                        if (isFilterBio)
                        {
                            if (File.Exists(profile) || File.Exists(profile1))
                            {
                                isToAdd = true;
                            }
                        }
                    }
                    else if (isFilterPhotoNo || isFilterBioNo)
                    {
                        if (isFilterPhotoNo)
                        {
                            if (!File.Exists(photo))
                            {
                                isToAdd = true;
                            }
                        }

                        if (isFilterBioNo)
                        {
                            if (!File.Exists(profile) && !File.Exists(profile1))
                            {
                                isToAdd = true;
                            }
                        }
                    }
                    else
                    {
                        isToAdd = false;
                        flist.Add(item);
                    }

                    if (isToAdd)
                    {
                        flist.Add(item);
                    }
                }
            }
        }
        else
        {
            foreach (Jury jury in filteredJuryList)
            {
                flist.Add(jury);
            }
        }

        // Sort
        flist = flist.OrderBy(p => p.SerialNo).ToList();

        radGridJury.DataSource = flist;
        if (needRebind)
        {
            radGridJury.Rebind();
        }

        GeneralFunction.SetReportDataCache(flist);
    }