Exemple #1
0
    protected void PopulateForm()
    {
        if (Page.Request["id"] != null)
        {
            Effie2017.App.Entry entry = Effie2017.App.Entry.GetEntry(GeneralFunction.GetValueGuid(Request["id"].ToString(), true));

            //-------
            try {
                EntryForm entryForm = EntryForm.GetEntryForm(Guid.Empty, entry.Id);
                //string url = "../Main/" + GeneralFunctionEntryForm.GetEntryCategory(entry) + ".aspx?Id=" + GeneralFunction.StringEncryption(entry.Id.ToString());
                string url = "../Main/" + GeneralFunctionEntryForm.GetEntryCategory(entry) + "PDF.aspx?Id=" + entry.Id;
                lnkFileDownload0.NavigateUrl = url;
            }
            catch { }

            //-------
            if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Authorisation\\" + entry.Id.ToString() + "\\" + entry.Serial + "_AuthorizationForm_PDF.pdf"))
            {
                lnkFileDownload2.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Authorisation/" + entry.Id.ToString() + "/" + entry.Serial + "_AuthorizationForm_PDF.pdf";
            }

            //-------
            if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CaseImage.jpg"))
            {
                lnkFileDownload3.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Case/" + entry.Id.ToString() + "/" + entry.Serial + "_CaseImage.jpg";
            }
            else if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CaseImage.jpeg"))
            {
                lnkFileDownload3.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Case/" + entry.Id.ToString() + "/" + entry.Serial + "_CaseImage.jpeg";
            }

            //-------
            if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Creative\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CreativeMaterials_PDF.pdf"))
            {
                tblFile4.Visible             = true;
                lnkFileDownload4.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Creative/" + entry.Id.ToString() + "/" + entry.Serial + "_CreativeMaterials_PDF.pdf";
            }

            if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + entry.Serial + "_CreativeMaterials_Video.mp4"))
            {
                tblFile5.Visible = true;
                //lnkFileDownload5.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/CreativeVideo/" + entry.Id.ToString() + "/" + entry.Serial + "_CreativeMaterials_Video.mp4";

                lnkFileDownload5.NavigateUrl = "../Video/DownloadMedia.aspx?filePath=" + System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + "&MediaID=" + entry.Serial + "_CreativeMaterials_Video.mp4";
            }
            //if (GeneralFunction.FileExistsInAmazonS3(System.Configuration.ConfigurationManager.AppSettings["AWSBucket_Small"], entry.Serial + "_CreativeMaterials_Video.mp4"))
            //{
            //    tblFile5.Visible = true;
            //    lnkFileDownload5.NavigateUrl = "../Video/DownloadMedia.aspx?BucketID=" + System.Configuration.ConfigurationManager.AppSettings["AWSBucket_Small"] + "&MediaID=" + entry.Serial + "_CreativeMaterials_Video.mp4";
            //}
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
        {
            EntryId = new Guid(Request.QueryString["Id"]);
            //EntryId = new Guid(GeneralFunction.StringDecryption(Request.QueryString["Id"]));
            entry = Entry.GetEntry(EntryId);

            //Check if entry is closed
            if (entry.Status == StatusEntry.Completed)
            {
                Response.Redirect("./Dashboard.aspx");
            }

            PDFURL = "../Main/" + GeneralFunctionEntryForm.GetEntryCategory(entry) + "PDF.aspx?temp=Preview&Id=" + entry.Id;
            PopulateHeaderForm();
            try
            {
                entryForm = EntryForm.GetEntryForm(Guid.Empty, EntryId);
            }
            catch
            {
                entryForm = EntryForm.NewEntryForm();
            }
        }

        if (!IsPostBack)
        {
            LoadForm();
            PopulateForm();
            ViewState["IsPreview"]  = false;
            ViewState["SessionKey"] = DateTime.Now.ToString("HHmmss");
        }

        initJavascript();

        PDFURL = "../Main/" + GeneralFunctionEntryForm.GetEntryCategory(entry) + "PDF.aspx?temp=Preview&Id=" + entry.Id + "&skey=" + (string)ViewState["SessionKey"];

        doPostBack(sender, e);
    }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["id"] == null)
        {
            Response.Redirect("./Dashboard.aspx");
        }

        entryForm = null;

        try
        {
            //EntryId = new Guid(GeneralFunction.StringDecryption(Request.QueryString["Id"]));
            EntryId = new Guid(Request.QueryString["Id"]);

            if (Request["temp"] != null)
            {
                if (Session["Entry-" + EntryId.ToString() + Request["skey"]] == null)
                {
                    return;
                }

                entryForm = (EntryForm)Session["Entry-" + EntryId.ToString() + Request["skey"]];
                //HttpContext.Current.Session.Remove("Entry-" + EntryId.ToString() + Request["skey"]);
            }
            else
            {
                entryForm = EntryForm.GetEntryForm(Guid.Empty, EntryId);
            }

            entry = Entry.GetEntry(EntryId);
        }
        catch
        {
            Response.Redirect("./Dashboard.aspx");
        }

        MemoryStream memoryStream = new System.IO.MemoryStream();
        StringReader srdr         = new StringReader(GetDocument());
        Document     pdfDoc       = new Document(PageSize.A4, 40, 40, 20, 35);
        HTMLWorker   hparse       = new HTMLWorker(pdfDoc);
        PdfWriter    pdfWriter    = PdfWriter.GetInstance(pdfDoc, memoryStream);

        //Define the page number
        PageEventHelper pageEventHelper = new PageEventHelper();

        pdfWriter.PageEvent = pageEventHelper;
        // Define the page header
        pageEventHelper.Title       = "";
        pageEventHelper.HeaderFont  = FontFactory.GetFont(BaseFont.COURIER_BOLD, 10, Font.BOLD);
        pageEventHelper.HeaderLeft  = "";
        pageEventHelper.HeaderRight = "";

        pdfDoc.Open();
        hparse.Parse(srdr);

        pdfWriter.CloseStream = false;
        pdfDoc.Close();
        pdfWriter.Close();

        Response.ContentType = "application/pdf";
        memoryStream.WriteTo(Response.OutputStream);
        memoryStream.Close();
    }
Exemple #4
0
    private void PopulateForm()
    {
        GeneralFunction.GetAllScoreCache(true);
        score = GeneralFunction.GetScoreFromMatchingEntryCache(entry, jury.Id, round);
        GeneralFunction.SetddlNomination(ref ddlNomination);

        // Jury Info
        lbJuryId.Text   = jury.SerialNo;
        lbJuryName.Text = jury.FirstName + " " + jury.LastName;
        lbCompany.Text  = jury.Company;
        lbRound.Text    = round;

        //string panel = "";
        //if (round == "1") panel = jury.Round1PanelId;
        //if (round == "2") panel = jury.Round2PanelId;
        //lbPanel.Text = panel;

        // panel information, filter off inactive panels
        SystemData sys           = GeneralFunction.GetSystemData();
        string     jurypanelinfo = jury.Round1PanelId;
        string     activepanels  = sys.ActivePanelsRound1;

        if (round == "2")
        {
            jurypanelinfo = jury.Round2PanelId;
            activepanels  = sys.ActivePanelsRound2;
        }
        string[] jurypanelinfoitem = jurypanelinfo.Split('|');

        for (int i = 0; i < jurypanelinfoitem.Length; i++)
        {
            if (GeneralFunction.IsInList(jurypanelinfoitem[i], activepanels, '|'))
            {
                lbPanel.Text += jurypanelinfoitem[i] + "&nbsp;";
            }
        }



        lbScoreCompletion.Text = "Pending";
        if (score != null && score.IsSubmitted)
        {
            lbScoreCompletion.Text = "Completed";
        }


        // Entry Info
        lbEntryId.Text  = entry.Serial;
        lbTitle.Text    = entry.Campaign;
        lbCategory.Text = GeneralFunction.GetEntryMarket(entry.CategoryMarketFromRound(round)) + "<br/>" + entry.CategoryPSDetailFromRound(round);
        lbBrand.Text    = entry.Brand;
        lbClient.Text   = entry.Client;

        // uploads - entry form
        #region old method
        //if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Entry\\" + entry.Id.ToString() + "\\" + entry.Serial + "_EntryForm_PDF.pdf"))
        //{
        //    lnkEntryFormPDF.Visible = true;
        //    lnkEntryFormPDF.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Entry/" + entry.Id.ToString() + "/" + entry.Serial + "_EntryForm_PDF.pdf?" + DateTime.Now.Ticks.ToString();
        //}
        #endregion
        #region new method
        try
        {
            EntryForm entryForm = EntryForm.GetEntryForm(Guid.Empty, entry.Id);
            if (entryForm.Status != StatusEntry.Draft)
            {
                string url = "../Main/" + GeneralFunctionEntryForm.GetEntryCategory(entry) + "PDF.aspx?Id=" + entry.Id;

                lnkEntryFormPDF.Visible     = true;
                lnkEntryFormPDF.NavigateUrl = url;
            }
        }
        catch
        {
        }
        #endregion

        // entry form word is not shown to jury
        //if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Entry\\" + entry.Id.ToString() + "\\" + entry.Serial + "_EntryForm_Word.doc"))
        //{
        //    lnkEntryFormDOC.Visible = true;
        //    lnkEntryFormDOC.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Entry/" + entry.Id.ToString() + "/" + entry.Serial + "_EntryForm_Word.docx";
        //}
        //else if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Entry\\" + entry.Id.ToString() + "\\" + entry.Serial + "_EntryForm_Word.docx"))
        //{
        //    lnkEntryFormDOC.Visible = true;
        //    lnkEntryFormDOC.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Entry/" + entry.Id.ToString() + "/" + entry.Serial + "_EntryForm_Word.docx";
        //}


        //// uploads - authorization form
        //// not shown to jury, aspx commented out
        //if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Authorisation\\" + entry.Id.ToString() + "\\" + entry.Serial + "_AuthorizationForm_PDF.pdf"))
        //{
        //    lnkAutPDF.Visible = true;
        //    lnkAutPDF.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Authorisation/" + entry.Id.ToString() + "/" + entry.Serial + "_AuthorizationForm_PDF.pdf";
        //}


        //// uploads - case image
        //// not shown to jury, aspx commented out
        //if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CaseImage.jpg"))
        //{
        //    lnkCaseImage.Visible = true;
        //    lnkCaseImage.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Case/" + entry.Id.ToString() + "/" + entry.Serial + "_CaseImage.jpeg";
        //}
        //if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CaseImage.jpeg"))
        //{
        //    lnkCaseImage.Visible = true;
        //    lnkCaseImage.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Case/" + entry.Id.ToString() + "/" + entry.Serial + "_CaseImage.jpeg";
        //}


        // uploads - creative materials
        if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Creative\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CreativeMaterials_PDF.pdf"))
        {
            lnkCreativePDF.Visible     = true;
            lnkCreativePDF.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Creative/" + entry.Id.ToString() + "/" + entry.Serial + "_CreativeMaterials_PDF.pdf?" + DateTime.Now.Ticks.ToString();
        }
        if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Creative\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CreativeMaterialsTranslate_PDF.pdf"))
        {
            lnkCreativePDFTranslate.Visible     = true;
            lnkCreativePDFTranslate.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Creative/" + entry.Id.ToString() + "/" + entry.Serial + "_CreativeMaterialsTranslate_PDF.pdf?" + DateTime.Now.Ticks.ToString();
        }
        //if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\"  + entry.Serial + "_CreativeMaterials_Video.mp4"))
        //{
        //    //btnCreativeVid.Visible = true;
        //    //btnCreativeVid.CommandArgument = "EntryUpload/Creative/" + entry.Id.ToString() + "/" + entry.Serial + "_CreativeMaterials_Video.mp4";
        //    lnkCreativeVid.Visible = true;
        //    lnkCreativeVid.NavigateUrl = "../Video/DownloadMedia.aspx?filePath=" + System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + "&MediaID=" + entry.Serial + "_CreativeMaterials_Video.mp4";
        //}
        if (GeneralFunction.FileExistsInAmazonS3(System.Configuration.ConfigurationManager.AppSettings["AWSBucket_Small"], entry.Serial + "_CreativeMaterials_Video.mp4"))
        {
            //btnCreativeVid.Visible = true;
            //btnCreativeVid.CommandArgument = "EntryUpload/Creative/" + entry.Id.ToString() + "/" + entry.Serial + "_CreativeMaterials_Video.mp4";
            lnkCreativeVid.Visible     = true;
            lnkCreativeVid.NavigateUrl = System.Configuration.ConfigurationManager.AppSettings["AWSS3WebURL"] + System.Configuration.ConfigurationManager.AppSettings["AWSBucket_Small"] + "/" + entry.Serial + "_CreativeMaterials_Video.mp4?" + DateTime.Now.Ticks.ToString();
        }
        else
        if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + entry.Serial + "_CreativeMaterials_Video.mp4"))
        {
            lnkCreativeVid.Visible     = true;
            lnkCreativeVid.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload\\CreativeVideo\\" + entry.Serial + "_CreativeMaterials_Video.mp4";
        }

        // scores
        if (score != null)
        {
            txtSC.Text         = score.ScoreSC.ToString();
            txtID.Text         = score.ScoreID.ToString();
            txtIL.Text         = score.ScoreIL.ToString();
            txtRE.Text         = score.ScoreRE.ToString();
            lbCScoreTotal.Text = score.ScoreComposite.ToString();

            // calculations
            lbCScoreSC.Text    = GeneralFunction.CalculateSC(score.ScoreSC).ToString("N");
            lbCScoreID.Text    = GeneralFunction.CalculateID(score.ScoreID).ToString("N");
            lbCScoreIL.Text    = GeneralFunction.CalculateIL(score.ScoreIL).ToString("N");
            lbCScoreRE.Text    = GeneralFunction.CalculateRE(score.ScoreRE).ToString("N");
            lbCScoreTotal.Text = GeneralFunction.CalculateCompositeScore(score.ScoreSC, score.ScoreID, score.ScoreIL, score.ScoreRE).ToString("N");

            txtFeedbackStrong.Text  = score.FeedbackStrong;
            txtFeedbackWeak.Text    = score.FeedbackWeak;
            ddlFlag.SelectedValue   = score.Flag;
            txtFlagOthers.Text      = score.FlagOthers;
            ddlRecuse.SelectedValue = "No";
            if (score.IsRecuse)
            {
                ddlRecuse.SelectedValue = "Yes";
            }
            txtRecuseRemarks.Text           = score.RecuseRemarks;
            txtAdditionalComments.Text      = score.AdditionalComments;
            ddlRecommendation.SelectedValue = (score.IsAdvancement) ? "Yes" : "No";
            ddlNomination.SelectedValue     = score.Nomination;
        }

        ddlRecommendation.Attributes.Add("onchange", "OnChangeddlRecom('" + AdvancementFlag.ClientID + "','" + ddlRecommendation.ClientID + "', '" + round + "');");


        // enable or disable
        ddlRecuse_SelectedIndexChanged(null, null);


        // admin spoof to disable the form fields and submission
        //btnSave.Visible = !isAdminSpoof;
        //btnSubmit.Visible = !isAdminSpoof;
        if (isAdminSpoof)
        {
            GeneralFunction.ChangeStateControls(this, false);
        }



        if (score != null && score.IsSubmitted)
        {
            btnSave.Visible      = false;
            btnSaveDraft.Visible = false;

            GeneralFunction.ChangeStateControls(this, false);
        }
    }
Exemple #5
0
    protected void radGridEntry_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Effie2017.App.Entry entry = (Effie2017.App.Entry)e.Item.DataItem;

            LinkButton lnkBtn = null;

            lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnDelete");
            //lnkBtn.Attributes.Add("onclick", "return DeleteConfirmation('" + ((GridDataItem)e.Item)["Serial"].Text + "');");
            lnkBtn.Attributes.Add("onclick", "return DeleteConfirmation('Entry');");

            try {
                Label lblno = (Label)e.Item.FindControl("lblno");
                //lblno.Text = Number.ToString();
                lblno.Text = (e.Item.ItemIndex + 1).ToString();
                Number++;
            }
            catch {
            }

            CheckBox  chk = null;
            HyperLink lnk = null;

            ((GridDataItem)e.Item)["DateSubmitted"].Text = entry.DateSubmitted.ToString("dd/MM/yy");
            ((GridDataItem)e.Item)["DateModified"].Text  = entry.DateModified.ToString("dd/MM/yy");

            if (entry.CategoryMarket == "SM")
            {
                ((GridDataItem)e.Item)["CategoryMarket"].Text = "Single Market";
            }
            else if (entry.CategoryMarket == "MM")
            {
                ((GridDataItem)e.Item)["CategoryMarket"].Text = "Multi Market";
            }
            ((GridDataItem)e.Item)["CategoryMarket"].Text = entry.CategoryPSDetail; //+= "<br>" +

            if (entry.PayStatus == "NOT")
            {
                ((GridDataItem)e.Item)["PayStatus"].Text = "<a href='../Admin/PaymentPdfView.aspx?id=" + GeneralFunction.StringEncryption(entry.Id.ToString()) + "' target='_blank' class='fontRed'>" + GeneralFunction.GetPaymentEntryStatus(entry.PayStatus) + "</a>";
            }
            else
            {
                ((GridDataItem)e.Item)["PayStatus"].Text = "<a href='../Admin/PaymentPdfView.aspx?id=" + GeneralFunction.StringEncryption(entry.Id.ToString()) + "' target='_blank'>" + GeneralFunction.GetPaymentEntryStatus(entry.PayStatus) + "</a>";
            }

            ((GridDataItem)e.Item)["Status"].Text = GeneralFunction.GetEntryStatus(entry.Status);

            if (entry.Status == StatusEntry.Draft || GeneralFunction.IsEntrantSubmissionCutOff())
            {
                try
                {
                    lnkBtn         = (LinkButton)e.Item.FindControl("LinkCloning");
                    lnkBtn.Visible = false;
                }
                catch { }
            }

            if (GeneralFunction.IsEntrantSubmissionCutOff() || !GeneralFunction.IsAllowClone())
            {
                try
                {
                    lnkBtn         = (LinkButton)e.Item.FindControl("lnkBtnCloning");
                    lnkBtn.Visible = false;
                }
                catch { }
            }

            if (entry.Status == StatusEntry.Completed)
            {
                ((GridDataItem)e.Item)["Status"].Text = "<span style=\"font-weight:bold\">" + GeneralFunction.GetEntryStatus(entry.Status) + "</span>";
            }

            if (entry.WithdrawnStatus != "")
            {
                ((GridDataItem)e.Item)["Status"].Text += "<br/><span style=\"color:Red;\">" + GeneralFunction.GetWithdrawnStatus(entry.WithdrawnStatus) + "</span>";
            }

            lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnViewCampaign");
            if (lnkBtn.Text == "")
            {
                lnkBtn.Text = entry.Campaign;
            }

            #region Condition for radGridEntry
            //if (entry.PayStatus == StatusPaymentEntry.Paid)
            if (true)
            {
                if (entry.WithdrawnStatus == "" && (entry.Status == StatusEntry.UploadPending || entry.Status == StatusEntry.UploadCompleted || entry.Status == StatusEntry.Completed))
                {
                    //Guid EntryId = new Guid(((GridDataItem)e.Item)["Id"].Text);
                    if (entry != null)
                    {
                        string    url             = "./" + GeneralFunctionEntryForm.GetEntryCategory(entry) + ".aspx?Id=" + entry.Id;
                        string    urlPdf          = "./" + GeneralFunctionEntryForm.GetEntryCategory(entry) + "PDF.aspx?Id=" + entry.Id;
                        string    StatusEntryForm = "";
                        HyperLink Edit            = (HyperLink)e.Item.FindControl("lnkEntry1");
                        HyperLink ViewPDF         = (HyperLink)e.Item.FindControl("lnkEntry2");
                        HyperLink hlEntryForm     = (HyperLink)e.Item.FindControl("lnkEntryForm");
                        hlEntryForm.Enabled     = true;
                        hlEntryForm.Visible     = true;
                        hlEntryForm.NavigateUrl = url;
                        hlEntryForm.CssClass    = "tblLinkRed";
                        try
                        {
                            EntryForm entryForm = EntryForm.GetEntryForm(Guid.Empty, entry.Id);
                            if (entry.Status == StatusEntry.Completed || entryForm.Status == StatusEntry.Completed)
                            {
                                StatusEntryForm     = "Completed";
                                hlEntryForm.Visible = false;

                                Edit.Enabled     = true;
                                Edit.Visible     = true;
                                Edit.NavigateUrl = url;
                                Edit.Text        = "Edit";
                                Edit.CssClass    = "tblLinkBlack";

                                ViewPDF.Enabled     = true;
                                ViewPDF.Visible     = true;
                                ViewPDF.NavigateUrl = urlPdf;
                                ViewPDF.Text        = "<br>View PDF";
                                ViewPDF.CssClass    = "tblLinkBlack";
                            }
                            else
                            {
                                StatusEntryForm = "Draft";
                            }

                            if (entry.Status == StatusEntry.Completed)
                            {
                                Edit.Visible        = false;
                                hlEntryForm.Visible = false;
                            }

                            hlEntryForm.Text = "Entry Form (" + StatusEntryForm + ")";
                        }
                        catch { }
                    }

                    //////lnk = (HyperLink)e.Item.FindControl("lnkUploadEntry");
                    //////lnk.CssClass = "fancybox fancybox.iframe tblLinkRed";
                    //////lnk.NavigateUrl = "./UploadForAll.aspx?md=UE&id=" + GeneralFunction.StringEncryption(((GridDataItem)e.Item)["Id"].Text);
                    //////lnk.Enabled = true;
                    //////lnk.Visible = true;
                    lnk             = (HyperLink)e.Item.FindControl("lnkUploadAuthorisation");
                    lnk.CssClass    = "fancybox fancybox.iframe tblLinkRed";
                    lnk.NavigateUrl = "./UploadForAll.aspx?md=UA&id=" + GeneralFunction.StringEncryption(((GridDataItem)e.Item)["Id"].Text);
                    lnk.Enabled     = true;
                    lnk.Visible     = true;
                    lnk             = (HyperLink)e.Item.FindControl("lnkUploadCase");
                    lnk.CssClass    = "fancybox fancybox.iframe tblLinkRed";
                    lnk.NavigateUrl = "./UploadForAll.aspx?md=UC&id=" + GeneralFunction.StringEncryption(((GridDataItem)e.Item)["Id"].Text);
                    lnk.Enabled     = true;
                    lnk.Visible     = true;
                    lnk             = (HyperLink)e.Item.FindControl("lnkUploadCreative");
                    lnk.CssClass    = "fancybox2 fancybox.iframe tblLinkRed";
                    lnk.NavigateUrl = "./UploadForCr.aspx?md=UCr&id=" + GeneralFunction.StringEncryption(((GridDataItem)e.Item)["Id"].Text);
                    lnk.Enabled     = true;
                    lnk.Visible     = true;

                    if (entry.Status == StatusEntry.Completed)
                    {
                        lnk         = (HyperLink)e.Item.FindControl("lnkEntryForm");
                        lnk.Visible = false;
                        //////lnk = (HyperLink)e.Item.FindControl("lnkUploadEntry");
                        //////lnk.Visible = false;
                        lnk         = (HyperLink)e.Item.FindControl("lnkUploadAuthorisation");
                        lnk.Visible = false;
                        lnk         = (HyperLink)e.Item.FindControl("lnkUploadCase");
                        lnk.Visible = false;
                        lnk         = (HyperLink)e.Item.FindControl("lnkUploadCreative");
                        lnk.Visible = false;
                    }

                    //-------
                    //if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Entry\\" + entry.Id.ToString() + "\\" + entry.Serial + "_EntryForm_PDF.pdf"))
                    //{
                    //    lnk = (HyperLink)e.Item.FindControl("lnkEntry1");
                    //    lnk.Visible = true;
                    //    lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Entry/" + entry.Id.ToString() + "/" + entry.Serial + "_EntryForm_PDF.pdf?" + DateTime.Now.Ticks.ToString();

                    //    //////lnk = (HyperLink)e.Item.FindControl("lnkUploadEntry");
                    //    //////lnk.Text = "Edit";
                    //    //////lnk.CssClass = "fancybox fancybox.iframe tblLinkBlack";

                    //    lnk = (HyperLink)e.Item.FindControl("lnkEntryForm");
                    //    lnk.Text = "Edit";
                    //    lnk.CssClass = "tblLinkBlack"; //fancybox fancybox.iframe
                    //}

                    //if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Entry\\" + entry.Id.ToString() + "\\" + entry.Serial + "_EntryForm_Word.doc"))
                    //{
                    //    lnk = (HyperLink)e.Item.FindControl("lnkEntry2");
                    //    lnk.Visible = true;
                    //    lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Entry/" + entry.Id.ToString() + "/" + entry.Serial + "_EntryForm_Word.doc?" + DateTime.Now.Ticks.ToString();
                    //}
                    //else if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Entry\\" + entry.Id.ToString() + "\\" + entry.Serial + "_EntryForm_Word.docx"))
                    //{
                    //    lnk = (HyperLink)e.Item.FindControl("lnkEntry2");
                    //    lnk.Visible = true;
                    //    lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Entry/" + entry.Id.ToString() + "/" + entry.Serial + "_EntryForm_Word.docx?" + DateTime.Now.Ticks.ToString();
                    //}

                    //-------
                    if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Authorisation\\" + entry.Id.ToString() + "\\" + entry.Serial + "_AuthorizationForm_PDF.pdf"))
                    {
                        lnk             = (HyperLink)e.Item.FindControl("lnkAuthorisation1");
                        lnk.Visible     = true;
                        lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Authorisation/" + entry.Id.ToString() + "/" + entry.Serial + "_AuthorizationForm_PDF.pdf?" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadAuthorisation");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox fancybox.iframe tblLinkBlack";
                    }

                    //-------
                    if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CaseImage.jpg"))
                    {
                        lnk             = (HyperLink)e.Item.FindControl("lnkCase1");
                        lnk.Visible     = true;
                        lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Case/" + entry.Id.ToString() + "/" + entry.Serial + "_CaseImage.jpg?" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadCase");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox fancybox.iframe tblLinkBlack";
                    }
                    else if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CaseImage.jpeg"))
                    {
                        lnk             = (HyperLink)e.Item.FindControl("lnkCase1");
                        lnk.Visible     = true;
                        lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Case/" + entry.Id.ToString() + "/" + entry.Serial + "_CaseImage.jpeg?" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadCase");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox fancybox.iframe tblLinkBlack";
                    }

                    //-------
                    if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Creative\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CreativeMaterials_PDF.pdf"))
                    {
                        lnk             = (HyperLink)e.Item.FindControl("lnkCreative1");
                        lnk.Visible     = true;
                        lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Creative/" + entry.Id.ToString() + "/" + entry.Serial + "_CreativeMaterials_PDF.pdf?" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadCreative");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox2 fancybox.iframe tblLinkBlack";
                    }

                    if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + entry.Serial + "_CreativeMaterials_Video.mp4"))
                    {
                        lnkBtn         = (LinkButton)e.Item.FindControl("lnkBtnCreative2");
                        lnkBtn.Visible = true;
                        //lnkBtn.CommandArgument = "EntryUpload\\CreativeVideo\\" + entry.Serial + "_CreativeMaterials_Video.mp4";
                        lnkBtn.CommandArgument = "../Video/DownloadMedia.aspx?filePath=" + ConfigurationManager.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + "&MediaID=" + entry.Serial + "_CreativeMaterials_Video.mp4&t" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadCreative");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox2 fancybox.iframe tblLinkBlack";
                    }
                    if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Creative\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CreativeMaterialsTranslate_PDF.pdf"))
                    {
                        lnk             = (HyperLink)e.Item.FindControl("lnkCreative3");
                        lnk.Visible     = true;
                        lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Creative/" + entry.Id.ToString() + "/" + entry.Serial + "_CreativeMaterialsTranslate_PDF.pdf?" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadCreative");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox2 fancybox.iframe tblLinkBlack";
                    }
                    //if (GeneralFunction.FileExistsInAmazonS3(ConfigurationManager.AppSettings["AWSBucket_Original"], entry.Serial + "_CreativeMaterials_Video.mp4"))
                    //{
                    //    if (GeneralFunction.FileExistsInAmazonS3(ConfigurationManager.AppSettings["AWSBucket_Small"], entry.Serial + "_CreativeMaterials_Video.mp4"))
                    //    {
                    //        lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnCreative2");
                    //        lnkBtn.Visible = true;
                    //        lnkBtn.CommandArgument = "../Video/DownloadMedia.aspx?BucketID=" + ConfigurationManager.AppSettings["AWSBucket_Small"] + "&MediaID=" + entry.Serial + "_CreativeMaterials_Video.mp4";

                    //        lnk = (HyperLink)e.Item.FindControl("lnkUploadCreative");
                    //        lnk.Text = "Edit";
                    //        lnk.CssClass = "fancybox2 fancybox.iframe tblLinkBlack";
                    //    }
                    //    else
                    //    {
                    //        lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnCreative2");
                    //        lnkBtn.Visible = true;
                    //        lnkBtn.Text = "Processing";
                    //        lnkBtn.Enabled = false;
                    //        lnk = (HyperLink)e.Item.FindControl("lnkUploadCreative");
                    //        lnk.Text = "Edit";
                    //        lnk.CssClass = "fancybox2 fancybox.iframe tblLinkBlack";
                    //        lnk.Visible = false;
                    //    }
                    //}
                }
            }

            if (entry.Status == StatusEntry.PaymentPending || entry.WithdrawnStatus != "")
            {
                lnk         = (HyperLink)e.Item.FindControl("lnkEntryForm");
                lnk.Enabled = false;
                lnk.Visible = true;

                //////lnk = (HyperLink)e.Item.FindControl("lnkUploadEntry");
                //////lnk.Enabled = false;
                //////lnk.Visible = true;

                lnk         = (HyperLink)e.Item.FindControl("lnkUploadAuthorisation");
                lnk.Enabled = false;
                lnk.Visible = true;
                lnk         = (HyperLink)e.Item.FindControl("lnkUploadCase");
                lnk.Enabled = false;
                lnk.Visible = true;
                lnk         = (HyperLink)e.Item.FindControl("lnkUploadCreative");
                lnk.Enabled = false;
                lnk.Visible = true;
            }

            lnk = (HyperLink)e.Item.FindControl("lnkConfirm");
            if (lnk != null)
            {
                //if (entry.PayStatus == StatusPaymentEntry.Paid && entry.Status == StatusEntry.UploadCompleted)
                if (entry.Status == StatusEntry.UploadCompleted)
                {
                    lnk.CssClass    = "fancybox3 fancybox.iframe tblLinkBlack";
                    lnk.ForeColor   = System.Drawing.Color.Red;
                    lnk.NavigateUrl = "./UploadConfirm.aspx?md=UCr&id=" + GeneralFunction.StringEncryption(((GridDataItem)e.Item)["Id"].Text);
                    lnk.Visible     = true;
                }
                else if (entry.Status == StatusEntry.Completed)
                {
                    lnk.Visible = false;
                }
                else
                {
                    lnk.CssClass = "tblLinkDisable";
                    lnk.Enabled  = false;
                }
            }
            #endregion

            #region Condition for radGridEntryPending
            if (entry.Status == StatusEntry.Ready)
            {
                chk            = (CheckBox)e.Item.FindControl("chkSubmit");
                chk.Enabled    = true;
                lnkBtn         = (LinkButton)e.Item.FindControl("lnkBtnView");
                lnkBtn.Visible = true;
            }
            //else
            //{
            //    lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnEdit");
            //    if (lnkBtn != null)
            //        lnkBtn.Visible = true;
            //}
            #endregion


            //if (GeneralFunction.IsEntrantSubmissionCutOff())
            //{
            //    lnk = (HyperLink)e.Item.FindControl("lnkConfirm");
            //    if (lnk != null) lnk.Visible = false;
            //}



            #region Allow Upload Files
            if (GeneralFunction.IsAllowUploadFiles())
            {
                try
                {
                    lnk = (HyperLink)e.Item.FindControl("lnkUploadAuthorisation");
                    //lnk.CssClass = "fancybox fancybox.iframe tblLinkRed";
                    lnk.NavigateUrl = "./UploadForAll.aspx?md=UA&id=" + GeneralFunction.StringEncryption(((GridDataItem)e.Item)["Id"].Text);
                    lnk.Enabled     = true;
                    lnk.Visible     = true;
                    lnk             = (HyperLink)e.Item.FindControl("lnkUploadCase");
                    //lnk.CssClass = "fancybox fancybox.iframe tblLinkRed";
                    lnk.NavigateUrl = "./UploadForAll.aspx?md=UC&id=" + GeneralFunction.StringEncryption(((GridDataItem)e.Item)["Id"].Text);
                    lnk.Enabled     = true;
                    lnk.Visible     = true;

                    if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Authorisation\\" + entry.Id.ToString() + "\\" + entry.Serial + "_AuthorizationForm_PDF.pdf"))
                    {
                        lnk             = (HyperLink)e.Item.FindControl("lnkAuthorisation1");
                        lnk.Visible     = true;
                        lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Authorisation/" + entry.Id.ToString() + "/" + entry.Serial + "_AuthorizationForm_PDF.pdf?" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadAuthorisation");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox fancybox.iframe tblLinkBlack";
                    }

                    //-------
                    if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CaseImage.jpg"))
                    {
                        lnk             = (HyperLink)e.Item.FindControl("lnkCase1");
                        lnk.Visible     = true;
                        lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Case/" + entry.Id.ToString() + "/" + entry.Serial + "_CaseImage.jpg?" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadCase");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox fancybox.iframe tblLinkBlack";
                    }
                    else if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\" + entry.Serial + "_CaseImage.jpeg"))
                    {
                        lnk             = (HyperLink)e.Item.FindControl("lnkCase1");
                        lnk.Visible     = true;
                        lnk.NavigateUrl = System.Configuration.ConfigurationSettings.AppSettings["storageVirtualPath"] + "EntryUpload/Case/" + entry.Id.ToString() + "/" + entry.Serial + "_CaseImage.jpeg?" + DateTime.Now.Ticks.ToString();

                        lnk          = (HyperLink)e.Item.FindControl("lnkUploadCase");
                        lnk.Text     = "Edit";
                        lnk.CssClass = "fancybox fancybox.iframe tblLinkBlack";
                    }
                }
                catch { }
            }
            #endregion
        }
    }