Ejemplo n.º 1
0
    protected void BindEntry()
    {
        Effie2017.App.Registration registration = Security.GetLoginSessionUser();

        Effie2017.App.EntryList entryList = Effie2017.App.EntryList.GetEntryList(Guid.Empty, registration.Id, "", StatusEntry.PaymentPending + "|" + StatusEntry.UploadPending + "|" + StatusEntry.UploadCompleted + "|" + StatusEntry.Completed + "|");

        bool neeReminder = false;

        foreach (Effie2017.App.Entry entry in entryList)
        {
            if (entry.Status == StatusEntry.UploadCompleted && entry.IsReminded == 0)
            {
                Effie2017.App.Entry entryUpdate = Effie2017.App.Entry.GetEntry(entry.Id);

                entryUpdate.IsReminded = 1;
                entryUpdate.Save();

                neeReminder = true;
            }
        }

        if (neeReminder)
        {
            ltrJs.Text = "<script type=\"text/javascript\"> $( document ).ready(function() { alert('You have successfully uploaded all the files. Please click confirm to complete your submission.'); }); </script>";
        }
        //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "none", "<script type=\"text/javascript\"> alert('You have successfully uploaded all the files. Please click confirm to complete your submission.'); </script>", false);

        radGridEntry.DataSource = entryList;
        radGridEntry.DataBind();

        #region radGridEntryPending
        entryList = Effie2017.App.EntryList.GetEntryList(Guid.Empty, registration.Id, "", StatusEntry.Draft + "|" + StatusEntry.Ready + "|");
        var          GroupIds   = entryList.GroupBy(x => x.Id);
        List <Entry> entryTeamp = new List <Entry>();
        foreach (var id in GroupIds)
        {
            try
            {
                entryTeamp.Add(entryList.FirstOrDefault(x => x.Id == id.Key));
            }
            catch { }
        }
        radGridEntryPending.DataSource = entryTeamp.OrderByDescending(x => x.DateModified);
        #endregion

        if (Security.IsUserLogin())
        {
            Registration reg          = Security.GetLoginSessionUser();
            var          LogHostories = LoginHistoryList.GetLoginHistoryList().Where(x => x.UserId == reg.Id);
            radLoginHistories.DataSource = LogHostories.OrderByDescending(x => x.DateModified);
        }
    }
Ejemplo n.º 2
0
    protected void BindEntry()
    {
        Effie2017.App.Registration registration = Security.GetLoginSessionUser();
        List <Effie2017.App.Entry> entryList    = new List <Effie2017.App.Entry>();
        string guidList = "";

        Effie2017.App.EntryList entryList2 = Effie2017.App.EntryList.GetEntryList(Guid.Empty, registration.Id, "", StatusEntry.PaymentPending + "|" + StatusEntry.UploadPending + "|" + StatusEntry.UploadCompleted + "|" + StatusEntry.Completed + "|");

        foreach (Effie2017.App.Entry entry in entryList2)
        {
            //Try 3
            bool isFound = false;
            foreach (Effie2017.App.Entry entryCheck in entryList)
            {
                if (entryCheck.Invoice == entry.Invoice)
                {
                    isFound                    = true;
                    entryCheck.Amount         += entry.Amount;
                    entryCheck.Fee            += entry.Fee;
                    entryCheck.AmountReceived += entry.AmountReceived;
                    entryCheck.GrandAmount    += entry.GrandAmount;
                }
            }

            if (!isFound)
            {
                entryList.Add(entry);
            }
            //END Try 3
        }

        radGridEntry.DataSource = entryList;
        List <Effie2017.App.AdhocInvoiceItem> adhocInvoiceList = new List <Effie2017.App.AdhocInvoiceItem>();

        foreach (var entryItem in entryList)
        {
            AdhocInvoiceItemList AdhocInvoiceLists = Effie2017.App.AdhocInvoiceItemList.GetAdhocInvoiceItemList(entryItem.Id);
            foreach (var AdhocInvoiceItem in AdhocInvoiceLists)
            {
                int count = adhocInvoiceList.Where(x => x.Invoice == AdhocInvoiceItem.Invoice).ToList().Count();
                if (count == 0)
                {
                    adhocInvoiceList.Add(AdhocInvoiceItem);
                }
            }
        }

        radGridEntryAdhoc.DataSource = adhocInvoiceList.Where(x => !string.IsNullOrEmpty(x.Invoice));
    }
Ejemplo n.º 3
0
    private void BindGrid(bool isCustomSort, string sortExpression, GridSortOrder order, bool needRebind)
    {
        Effie2017.App.EntryList entryList = Effie2017.App.EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.UploadPending + "|" + StatusEntry.UploadCompleted + "|" + StatusEntry.Completed + "|");

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

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

        if (advanceSearch == "1")
        {
            // Advanced search
            // basic fields
            // user's country
            List <Guid> entryIdList  = GeneralFunction.GetFilteredEntryListFromRegCountry(ddlCountry.SelectedValue, true);
            List <Guid> entryIdList2 = GeneralFunction.GetFilteredEntryListFromRegCompany(txtSearch.Text.Trim(), true);

            // Changes by Shaik for adding new columns on 19 Oct 2015
            List <Guid> entryIdList3 = GeneralFunction.GetFilteredEntryListFromRegFirstName(txtSearch.Text.Trim(), true);
            List <Guid> entryIdList4 = GeneralFunction.GetFilteredEntryListFromRegLastName(txtSearch.Text.Trim(), true);

            foreach (Entry item in entryList)
            {
                // category strip out the prefix
                string category = ddlCategory.SelectedValue;
                if (category.Length > 3)
                {
                    category = category.Substring(3, category.Length - 3);
                }

                if (
                    (ddlDeadline.SelectedValue == "" || (ddlDeadline.SelectedValue != "" && item.Deadline == ddlDeadline.SelectedValue)) &&
                    (ddlEntryStatus.SelectedValue == "" || (ddlEntryStatus.SelectedValue != "" && item.Status == ddlEntryStatus.SelectedValue)) &&
                    (ddlMarket.SelectedValue == "" || (ddlMarket.SelectedValue != "" && item.CategoryMarket == ddlMarket.SelectedValue)) &&
                    //(ddlCategory.SelectedValue == "" || (ddlCategory.SelectedValue != "" && (item.CategoryPSDetail == ddlCategory.SelectedValue || GeneralFunction.IsCategoryInCategoryGroup(ddlCategory.SelectedValue, item.CategoryPSDetail)))) &&
                    (category == "" || (category != "" && (item.CategoryPSDetailFromRound("") == category || GeneralFunction.IsCategoryInCategoryGroup(category, item.CategoryPSDetailFromRound(""))))) &&
                    (ddlCountry.SelectedValue == "" || (ddlCountry.SelectedValue != "" && entryIdList.Contains(item.Id))) &&

                    (
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "entryId") && item.Serial.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "title") && item.Campaign.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "client") && item.Client.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "company") && entryIdList2.Contains(item.Id))) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "firstname") && entryIdList3.Contains(item.Id))) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "lastname") && entryIdList4.Contains(item.Id)))
                    )

                    &&
                    (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + item.Serial + "_CreativeMaterials_Video.mp4"))
                    )
                {
                    flist.Add(item);
                }
            }
        }
        else
        {
            foreach (Entry item in entryList)
            {
                if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + item.Serial + "_CreativeMaterials_Video.mp4"))
                {
                    flist.Add(item);
                }
            }
        }

        #region CustomSorting

        if (isCustomSort)
        {
            List <Registration> regList = RegistrationList.GetRegistrationList(string.Empty, string.Empty, string.Empty).ToList();

            if (sortExpression.Equals("Serial"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Serial select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Serial descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Serial select entry).ToList();
                    break;
                }
            }
            else if (sortExpression.Equals("DateSubmitted"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.DateSubmitted select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.DateSubmitted descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.DateSubmitted select entry).ToList();
                    break;
                }
            }
            else if (sortExpression.Equals("Campaign"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Campaign select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Campaign descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Campaign select entry).ToList();
                    break;
                }
            }
            else if (sortExpression.Equals("Client"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Client select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Client descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Client select entry).ToList();
                    break;
                }
            }
            else if (sortExpression.Equals("CategoryMarket"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.CategoryMarket orderby entry.CategoryPSDetail select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.CategoryMarket descending orderby entry.CategoryPSDetail descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.CategoryMarket orderby entry.CategoryPSDetail select entry).ToList();
                    break;
                }
            }
            else if (sortExpression.Equals("Status"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Status select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Status descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.Status select entry).ToList();
                    break;
                }
            }
            else if (sortExpression.Equals("Firstname"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby reg.Firstname select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby reg.Firstname descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby reg.Firstname select entry).ToList();
                    break;
                }
            }
            else if (sortExpression.Equals("Lastname"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby reg.Lastname select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby reg.Lastname descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby reg.Lastname select entry).ToList();
                    break;
                }
            }
            else if (sortExpression.Equals("IsVideoDownloaded"))
            {
                switch (order)
                {
                case GridSortOrder.Ascending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.IsVideoDownloaded select entry).ToList();
                    break;

                case GridSortOrder.Descending:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.IsVideoDownloaded descending select entry).ToList();
                    break;

                case GridSortOrder.None:
                    flist = (from entry in flist join reg in regList on entry.RegistrationId equals reg.Id orderby entry.IsVideoDownloaded select entry).ToList();
                    break;
                }
            }
        }
        else
        {
            flist = (from entry in flist orderby entry.Invoice descending, entry.DateCreated descending select entry).ToList();
        }

        #endregion

        radGridEntry.DataSource = flist;
        if (needRebind)
        {
            radGridEntry.DataBind();
        }
    }