Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Guid payGroupId = new Guid(Request.QueryString["ppId"]);



        // ok
        Guid      regId = Guid.Empty;
        EntryList list  = EntryList.GetEntryList(payGroupId, Guid.Empty, ""); // contains the pay group id

        // validate if the entries already have an invoice
        if (list.Count == 0)
        {
            lbError.Text = "ERROR: 1";
            return;
        }


        string invoice = "";

        foreach (Entry entry in list)
        {
            invoice = entry.Invoice;
            regId   = entry.RegistrationId;
        }


        //Send Email
        int rtn = Email.SendCompletedPaymentEmailPayPal(Registration.GetRegistration(regId), payGroupId, invoice); // payment group id

        GeneralFunction.UpdateEntryLastSendPaidEmailDate(payGroupId);

        lbError.Text = "OK. email code [" + rtn.ToString() + "]";
    }
Exemple #2
0
        public DateTime DateReminder(Guid ID, string type)
        {
            DateTime datereminder = DateTime.MinValue;

            try
            {
                List <RegistrationEmailSent> registrationEmailSentList = RegistrationEmailSentList.GetRegistrationEmailSentList()
                                                                         .Where(x => x.EntryType == type)
                                                                         .OrderByDescending(y => y.DateCreated).ToList();
                List <Registration>   registrationList      = RegistrationList.GetRegistrationList("", "", "").Where(x => x.Id == ID).ToList();
                List <Entry>          entryList             = EntryList.GetEntryList(Guid.Empty, ID, "").ToList();
                RegistrationEmailSent registrationEmailSent = (from entry in entryList
                                                               join res in registrationEmailSentList on entry.Id equals res.EntryId
                                                               orderby res.DateCreated descending
                                                               select res).FirstOrDefault();

                if (!(registrationEmailSent.DateCreated == DateTime.MaxValue) && !(registrationEmailSent.DateCreated == DateTime.MinValue))
                {
                    datereminder = registrationEmailSent.DateCreated;
                }
            }
            catch { datereminder = GeneralFunctionEffie2017App.GetDateReminder(ID, type); }

            return(datereminder);
        }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Entry    entry     = EntryList.GetEntryList(new Guid("B0696F18-3F16-419B-8A98-7A433C888F8D"), Guid.Empty, "").FirstOrDefault();
     string   Dateasdas = entry.DateSubmitted.ToString("dd MMMM yyyy");
     DateTime asdasd    = entry.DateSubmitted;
     int      asdasdas  = 2;
 }
Exemple #4
0
    public static MemoryStream GenerateEntryDetailsSummary(Registration reg, Guid paymentGroupId)
    {
        EntryList entries = EntryList.GetEntryList(paymentGroupId, reg.Id, "");

        PdfReader pdfReader = null;

        PdfStamper pdfStamper    = null;
        AcroFields pdfFormFields = null;

        List <MemoryStream> memoryStreamPdfStamperList = new List <MemoryStream>();

        int rowcounter = 0;

        foreach (Entry entry in entries)
        {
            MemoryStream memoryStreamPdfStamper = null;
            pdfReader = new PdfReader(System.Configuration.ConfigurationSettings.AppSettings["PdfTemplateLocation"] + "ENTRY DETAILS.pdf");
            memoryStreamPdfStamper = new MemoryStream();
            pdfStamper             = new PdfStamper(pdfReader, memoryStreamPdfStamper);
            pdfFormFields          = pdfStamper.AcroFields;


            // Form filling
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


            PopulateFeeRow(rowcounter, pdfFormFields, entry.Campaign, entry.Amount, 0, 1, false, "");

            pdfFormFields.SetField("ENTRY ID", entry.Serial);
            pdfFormFields.SetField("CAMPAIGN TITLE", entry.Campaign);
            pdfFormFields.SetField("CLIENT NAME", entry.Client);
            pdfFormFields.SetField("BRAND NAME", entry.Brand);
            pdfFormFields.SetField("CATEGORY", entry.CategoryPSDetail);

            rowcounter++;

            pdfStamper.FormFlattening     = true;
            pdfStamper.Writer.CloseStream = false;
            pdfStamper.Close();

            memoryStreamPdfStamperList.Add(memoryStreamPdfStamper);
        }


        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        MemoryStream docstream = CreatePdfDoc(memoryStreamPdfStamperList);

        foreach (MemoryStream memoryStreamPdfStamper in memoryStreamPdfStamperList)
        {
            memoryStreamPdfStamper.Dispose();
        }

        docstream.Position = 0;
        return(docstream);
    }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed).ToList();

        foreach (Entry entry in entryList)
        {
            string multiSingle      = "";
            string productSpecialty = "";
            string cat = "";

            if (entry.CategoryMarket == "MM")
            {
                multiSingle = "Multi Market";
            }
            else if (entry.CategoryMarket == "SM")
            {
                multiSingle = "Single Market";
            }

            if (entry.CategoryPS == "PSC")
            {
                productSpecialty = "Product & Services Category";
            }
            else if (entry.CategoryPS == "SC")
            {
                productSpecialty = "Specialty Category";
            }

            cat = entry.CategoryPSDetail.Replace("/", "");

            if (entry.CategoryMarket == "MM")
            {
                multiSingle = "Multi Market";
            }
            else if (entry.CategoryMarket == "SM")
            {
                multiSingle = "Single Market";
            }

            string From = From = System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\" + multiSingle + "\\" + productSpecialty + "\\" + cat + "\\" + entry.Serial + "\\";

            CheckFiles(entry);

            //if (Directory.Exists(From))
            //{
            //    //CopyAll(From, entry.Id);
            //}
            //else
            //{
            //    Response.Write("Error : Folder Not Found #### "+ From + " ####;<br>");
            //}
        }
    }
Exemple #6
0
        protected static void GetMissingEntries()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("No");
            dt.Columns.Add("Entry Id");
            dt.Columns.Add("File Name");
            dt.Columns.Add("Original Size (MB)");
            dt.Columns.Add("Date");

            List <FileInfo> sortedFiles = new List <FileInfo>();

            var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed)
                            .OrderBy(m => m.DateSubmitted).ToList();

            var videFileList = new DirectoryInfo(System.Configuration.ConfigurationSettings.AppSettings["VideosFileFolder"].ToString()).GetFiles().ToList();

            int counter = 1;

            foreach (FileInfo file in videFileList)
            {
                string entryId = file.Name.Split('_')[0];

                Entry entry = null;

                try
                {
                    entry = entryList.Where(m => m.Serial.Equals(entryId)).Single();
                }
                catch { }

                if (entry != null)
                {
                    if (!FileExistsInAmazonS3(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Original"], file.Name))
                    {
                        DataRow dr = dt.NewRow();

                        dr["No"]                 = counter.ToString();
                        dr["Entry Id"]           = entryId;
                        dr["File Name"]          = file.Name;
                        dr["Original Size (MB)"] = file.Length / 1048576;
                        dr["Date"]               = file.LastAccessTime;

                        dt.Rows.Add(dr);

                        counter++;
                    }
                }
            }

            CreateCSVFile(dt, System.Configuration.ConfigurationSettings.AppSettings["LogFileFolder"] + "Missing_Entry_List.csv");
        }
Exemple #7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ValidateForm())
        {
            SaveForm();

            // id admin mode, go back to admin page
            if (isAdminEdit)
            {
                Response.Redirect(GeneralFunction.GetRedirect("../Admin/InvoiceList.aspx"));
            }

            bool isEditMode = false;
            if (Request["pgId"] != null)
            {
                isEditMode = true;
            }

            GeneralFunction.CompletePendingPaymentEntrySubmission(payGroupId, rblPayment.SelectedValue, isEditMode);

            if (rblPayment.SelectedValue == PaymentType.PayPal)
            {
                // get the string of serial numbers
                string    serials = "";
                EntryList list    = EntryList.GetEntryList(payGroupId, Guid.Empty, ""); // contains the pay group id
                foreach (Entry entry in list)
                {
                    serials += entry.Serial + ",";
                }
                if (serials != "")
                {
                    serials = serials.Substring(0, serials.Length - 1);
                }

                PayPal(serials);
            }
            else
            {
                //if (rblPayment.Text == "")
                //{
                //Email.SendAdhocPendingPaymentEmail(payGroupId, lbTotalFees.Text);
                //}
                Response.Redirect("../Main/PendingPayment.aspx");
            }
        }
    }
Exemple #8
0
    private void BindGrid()
    {
        EntryList list = EntryList.GetEntryList(entry.PayGroupId, Guid.Empty, "");

        // add to cache
        GeneralFunction.ResetGroupPaymentCache();
        foreach (Entry e in list)
        {
            //total += e.AmountPlusFee;
            total    += e.GrandAmount;
            received += e.AmountReceived;
        }


        radGridEntry.DataSource = list;
        radGridEntry.Rebind();
    }
Exemple #9
0
        protected static void UpdateEntryFromFiletoRound2()
        {
            #region Log "Result Check - START"
            logClass = new Log();
            logClass.Begin();
            logClass.WriteLog("----------------------------------------------");
            logClass.WriteLog("...Started Reading Entries from Files...");
            logClass.WriteLog("----------------------------------------------");
            #endregion

            var entriesToRead = File.ReadAllLines(System.Configuration.ConfigurationSettings.AppSettings["EntryFilePath"].ToString());

            int counter = 0;

            foreach (var entry in entriesToRead)
            {
                if (!String.IsNullOrEmpty(entry))
                {
                    logClass.WriteLog("Processing : " + entry);

                    List <Entry> entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, entry).ToList();

                    if (entryList.Count == 1)
                    {
                        entryList[0].IsRound2 = true;

                        entryList[0].Save();
                        logClass.WriteLog("Processed : " + entry);
                    }

                    counter++;
                }
            }

            logClass.WriteLog("No of Entries processed : " + counter);

            #region Log "Result Check - END"
            logClass.WriteLog("----------------------------------------------");
            logClass.WriteLog("...Finished Reading Entries from Files...");
            logClass.WriteLog("----------------------------------------------");
            logClass.End();
            #endregion
        }
Exemple #10
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        string           storagePhysicalPath = System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"];
        List <Entry>     dbentryList         = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "").ToList();
        List <EntryForm> dbentryFormList     = EntryFormList.GetEntryFormList().Where(x => x.Status == StatusEntry.Completed).ToList();

        foreach (EntryForm entryForm in dbentryFormList)
        {
            Entry        entry        = dbentryList.FirstOrDefault(x => x.Id == entryForm.IdEntry);
            MemoryStream memoryStream = new System.IO.MemoryStream();
            string       path         = storagePhysicalPath + "EntryUpload/EntryForm";
            string       Filename     = entry.Serial + "_" + GeneralFunctionEntryForm.GetEntryCategory(entry) + ".pdf";
            string       Fullpath     = Path.Combine(path, Filename);
            try
            {
                using (memoryStream = GeneralFunctionEntryForm.Classification(entryForm, entry))
                {
                    Document  myDocument  = new Document();
                    PdfWriter myPDFWriter = PdfWriter.GetInstance(myDocument, memoryStream);
                    myDocument.Open();

                    byte[] content = memoryStream.ToArray();

                    var exists = Directory.Exists(path);
                    if (!exists)
                    {
                        System.IO.Directory.CreateDirectory(path);
                    }

                    // Write out PDF from memory stream.
                    using (FileStream fs = File.Create(Fullpath))
                    {
                        fs.Write(content, 0, (int)content.Length);
                    }
                }
            }
            catch
            {
                Response.Write("ERROR ==>  (entryForm.Id:" + entryForm.Id + ") - " + Fullpath + "<br>");
            }
        }
    }
Exemple #11
0
    protected void btnReport_Click(object sender, EventArgs e)
    {
        int          x            = 1;
        int          y            = 1;
        string       sheetName    = "AWS Video";
        XLWorkbook   workbook     = new XLWorkbook();
        MemoryStream memoryStream = new MemoryStream();

        workbook.Worksheets.Add(sheetName);

        workbook.Worksheets.Worksheet(sheetName).Cell(y, x).SetValue("No"); x++;
        workbook.Worksheets.Worksheet(sheetName).Cell(y, x).SetValue("Entry ID"); x++;
        //workbook.Worksheets.Worksheet(sheetName).Cell(y, x).SetValue("Firstname"); x++;
        //workbook.Worksheets.Worksheet(sheetName).Cell(y, x).SetValue("Lastname"); x++;
        //workbook.Worksheets.Worksheet(sheetName).Cell(y, x).SetValue("Email"); x++;
        workbook.Worksheets.Worksheet(sheetName).Cell(y, x).SetValue("URL"); x++;

        y++;
        {
            List <Entry> Entrylist = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "")
                                     .Where(o => !string.IsNullOrEmpty(o.Serial)).ToList();
            foreach (Entry entry in Entrylist)
            {
                if (File.Exists(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EntryUpload\\CreativeVideo\\" + entry.Serial + "_CreativeMaterials_Video.mp4"))
                //(GeneralFunction.FileExistsInAmazonS3(System.Configuration.ConfigurationManager.AppSettings["AWSBucket_Small"], entry.Serial + "_CreativeMaterials_Video.mp4"))
                {
                    PopulateExcelRow(ref workbook, ref y, ref x, ref sheetName, entry);
                }
            }
        }

        workbook.SaveAs(memoryStream);

        Response.Clear();
        Response.ContentType = "application/vnd.ms-excel";
        Response.AddHeader("content-disposition", "attachment;filename=AWS Video Report.xlsx");

        memoryStream.WriteTo(Response.OutputStream);
        Response.End();
    }
Exemple #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Guid PayGroupId = new Guid("ff8488d6-9b30-44cd-be47-3ac3bf80b917");
        Guid PayGroupId = new Guid("ff8488d6-9b30-44cd-be47-3ac3bf80b917");
        var  list       = EntryList.GetEntryList(PayGroupId, Guid.Empty, "").ToList();

        foreach (var entry in list)
        {
            EntryPayment entryPayment = null;
            entryPayment = EntryPaymentList.GetEntryPaymentList().FirstOrDefault(x => x.EntryId == entry.Id);
            if (entryPayment == null)
            {
                entryPayment         = EntryPayment.NewEntryPayment();
                entryPayment.EntryId = entry.Id;
            }

            entryPayment.PayCompany     = entry.PayCompany;
            entryPayment.PayAddress1    = entry.PayAddress1;
            entryPayment.PayAddress2    = entry.PayAddress2;
            entryPayment.PayCity        = entry.PayCity;
            entryPayment.PayPostal      = entry.PayPostal;
            entryPayment.PayCountry     = entry.PayCountry;
            entryPayment.PayFirstname   = entry.PayFirstname;
            entryPayment.PayLastname    = entry.PayLastname;
            entryPayment.PayContact     = entry.PayContact;
            entryPayment.PaymentMethod  = entry.PaymentMethod;
            entryPayment.PayGroupId     = entry.PayGroupId;
            entryPayment.Amount         = entry.Amount;
            entryPayment.Fee            = entry.Fee;
            entryPayment.Tax            = entry.Tax;
            entryPayment.GrandAmount    = entry.GrandAmount;
            entryPayment.AmountReceived = entry.AmountReceived;
            entryPayment.Invoice        = entry.Invoice;
            entryPayment.Save();
        }

        //Registration reg = Registration.GetRegistration(new Guid("a48596b5-513e-4a1a-aa19-24160144db5b"));
        GeneralFunction.CompleteNewEntrySubmissionPayPal(PayGroupId);//ff8488d6-9b30-44cd-be47-3ac3bf80b917
    }
Exemple #13
0
    protected void radGridEntry_ItemCommand(object sender, GridCommandEventArgs e)
    {
        lblError.Text = "";

        if (e.CommandName == "Edit")
        {
            //Response.Redirect("./Entry.aspx?id=" + GeneralFunction.StringEncryption(((GridDataItem)e.Item)["Id"].Text));
            //Response.Redirect("./Summary.aspx?Id=" + ((GridDataItem)e.Item)["Id"].Text);

            EntryList entryList = EntryList.GetEntryList(new Guid(e.CommandArgument.ToString()), Guid.Empty, "");
            foreach (Entry entry in entryList)
            {
                GeneralFunction.AddIdToGroupPaymentCache(entry.Id);
            }
            //Response.Redirect("./Summary.aspx");
            Response.Redirect("./Summary.aspx?pgId=" + GeneralFunction.StringEncryption(e.CommandArgument.ToString()));
        }
        else if (e.CommandName == "Delete")
        {
            Effie2017.App.Entry.CleanDeleteEntry(new Guid(((GridDataItem)e.Item)["Id"].Text));

            //lblError.Text += ((GridDataItem)e.Item)["Serial"].Text + " has been deleted.<br>";
            lblError.Text += "Entry has been deleted.<br>";
            BindEntry();
        }
        else if (e.CommandName == "Invoice")
        {
            Effie2017.App.Registration registration = Security.GetLoginSessionUser();
            Effie2017.App.Entry        entry        = Effie2017.App.Entry.GetEntry(new Guid(((GridDataItem)e.Item)["Id"].Text));

            Session["registrationForPdfView"] = registration;
            Session["entryForPdfView"]        = entry;

            ltrJs.Text = "<script type=\"text/javascript\"> window.open('PaymentPdfView.aspx'); </script>";
        }
    }
Exemple #14
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ValidateForm())
        {
            AdhocInvoice adInv = SaveForm();

            if (adInv != null)
            {
                GeneralFunction.CompletePendingPaymentAdhoc(adInv.RegistrationId, adInv.PayGroupId, adInv.PaymentMethod, lbTotalFees.Text, false);

                //if (entrySelected != null)
                {
                    Administrator        admin            = Security.GetAdminLoginSession();
                    AdhocInvoiceItemList adhocInvItemList = AdhocInvoiceItemList.GetAdhocInvoiceItemList(payGroupId, adInv.Id);
                    EntryList            entries          = EntryList.GetEntryList(Guid.Empty, adInv.RegistrationId, "");
                    foreach (AdhocInvoiceItem adhocInvItem in adhocInvItemList)
                    {
                        try {
                            //FILTER For REOPEN ENTRY PROCESSING
                            Entry entry = entries.FirstOrDefault(x => x.Id == adhocInvItem.EntryId &&
                                                                 ((x.Status == StatusEntry.Completed) && (x.ProcessingStatus == StatusEntry.PendingVerification)));

                            if (adhocInvItem.InvoiceType == "ReOpen")
                            {
                                //To set to Upload Complete if Payment Method is selected
                                if (adInv.Invoice == "" && adInv.PaymentMethod != "")
                                {
                                    entry.Status           = StatusEntry.UploadCompleted;
                                    entry.ReopenedBy       = admin.Id.ToString();
                                    entry.ProcessingStatus = StatusEntry.Reopened;
                                    entry.IDAdhocInvoice   = adhocInvItem.AdhocInvoiceId.ToString();
                                }
                                else
                                {
                                    entry.ReopenedBy       = admin.Id.ToString();
                                    entry.ProcessingStatus = StatusEntry.PendingReopen;
                                    entry.IDAdhocInvoice   = adhocInvItem.AdhocInvoiceId.ToString();
                                }

                                entry.Save();
                            }
                        }
                        catch { }
                    }

                    //if (rblPayment.SelectedValue == PaymentType.PayPal)
                    //{
                    //    // get the string of serial numbers
                    //    string serials = "";
                    //    EntryList list = EntryList.GetEntryList(adInv.PayGroupId, Guid.Empty, ""); // contains the pay group id
                    //    foreach (Entry entry in list)
                    //    {
                    //        serials += entry.Serial + ",";
                    //    }
                    //    if (serials != "") serials = serials.Substring(0, serials.Length - 1);

                    //    PayPal(serials);
                    //}
                    //else
                    {
                        if (!string.IsNullOrEmpty(Request.QueryString["Page"]) && (entrySelected != null))
                        {
                            Response.Redirect("EntryProcessing.aspx?Page=Management");
                        }
                        else if (entrySelected != null)
                        {
                            Response.Redirect("EntryProcessing.aspx");
                        }
                        else
                        {
                            Response.Redirect("../Admin/AdhocInvoiceList.aspx");
                        }
                        //Response.Redirect("../Main/PendingPayment.aspx");
                    }
                }
            }
        }
    }
Exemple #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DeleteFolder("TempZip");
        DeleteFolder("EntryUpload/EntryForm/");

        var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed).ToList();

        foreach (Entry entry in entryList)
        {
            GenerateEF(entry);
            string multiSingle      = "";
            string productSpecialty = "";
            string cat = "";

            if (entry.CategoryMarket == "MM")
            {
                multiSingle = "Multi Market";
            }
            else if (entry.CategoryMarket == "SM")
            {
                multiSingle = "Single Market";
            }

            if (entry.CategoryPS == "PSC")
            {
                productSpecialty = "Product & Services Category";
            }
            else if (entry.CategoryPS == "SC")
            {
                productSpecialty = "Specialty Category";
            }

            cat = entry.CategoryPSDetail.Replace("/", "");

            CopyAll(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "EntryUpload\\Authorisation\\" + entry.Id.ToString() + "\\", System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\" + multiSingle + "\\" + productSpecialty + "\\" + cat + "\\" + entry.Serial + "\\");
            CopyAll(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "EntryUpload\\Case\\" + entry.Id.ToString() + "\\", System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\" + multiSingle + "\\" + productSpecialty + "\\" + cat + "\\" + entry.Serial + "\\");
            CopyAll(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "EntryUpload\\Creative\\" + entry.Id.ToString() + "\\", System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\" + multiSingle + "\\" + productSpecialty + "\\" + cat + "\\" + entry.Serial + "\\");
            //CopyAll(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "EntryUpload\\Entry\\" + entry.Id.ToString() + "\\", System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\" + multiSingle + "\\" + productSpecialty + "\\" + cat + "\\" + entry.Serial + "\\");
            CopyAll(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "EntryUpload\\EntryForm\\" + entry.Id.ToString() + "\\", System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\" + multiSingle + "\\" + productSpecialty + "\\" + cat + "\\" + entry.Serial + "\\");

            CopySingle(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "EntryUpload\\CreativeVideo\\" + entry.Serial.ToString() + "_CreativeMaterials_Video.mp4", System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\" + multiSingle + "\\" + productSpecialty + "\\" + cat + "\\" + entry.Serial + "\\" + entry.Serial.ToString() + "_CreativeMaterials_Video.mp4");
        }

        //preparing zipping program (7-zip)
        System.Diagnostics.Process Proc = new System.Diagnostics.Process();

        Proc.StartInfo.WorkingDirectory = System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "CompressorProgram\\";
        Proc.StartInfo.Arguments        = "a \"" + System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export.zip\" \"" + System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export\\*\"";
        Proc.StartInfo.FileName         = "7za.exe";

        //zipping files
        try
        {
            Proc.Start();
            Proc.WaitForExit();

            if (Proc.ExitCode == 0) //SUCCESSED
            {
                //cleaning temp
                if (Directory.Exists(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export"))
                {
                    Directory.Delete(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "TempZip\\Files Export", true);
                }

                //Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["storageVirtualPath"].ToString() + "TempZip/Files Export.zip", true);
            }
            else
            {
                Response.Write(Proc.ExitCode.ToString());
                return;
            }

            Proc.Dispose();
        }
        catch (Exception exp)
        {
            Response.Write(exp.Message);
            return;
        }

        //DeleteFolder("EntryUpload/EntryForm/");
    }
Exemple #16
0
    public static string GetDateDepentent(Guid paymentGroupId, Guid EntryId, DateTime DateSubmitted, string Type = "")
    {
        string   DateFormat        = "dd MMMM yyyy";
        DateTime OnTimeCutOff      = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["OnTimeCutOff"].ToString());
        DateTime ExtendedCutOff    = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["ExtendedCutOff"].ToString());
        DateTime Extended_2_CutOff = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["Extended_2_CutOff"].ToString());
        DateTime Extended_3_CutOff = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["Extended_3_CutOff"].ToString());

        if (paymentGroupId != Guid.Empty && paymentGroupId != null)
        {
            Entry entry = EntryList.GetEntryList(paymentGroupId, Guid.Empty, "").FirstOrDefault();
            DateSubmitted = entry.DateSubmitted;
        }

        string DateDependent = DateSubmitted.ToString(DateFormat);

        if (DateSubmitted == DateTime.MaxValue)
        {
            return("");
        }
        if (DateSubmitted < OnTimeCutOff)
        {
            if (Type == "D_String")
            {
                DateDependent = "D1";
            }
            else
            {
                DateDependent = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["DueDate1"].ToString()).ToString(DateFormat);
            }
        }
        else if (DateSubmitted < ExtendedCutOff)
        {
            if (Type == "D_String")
            {
                DateDependent = "D2";
            }
            else
            {
                DateDependent = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["DueDate2"].ToString()).ToString(DateFormat);
            }
        }
        else if (DateSubmitted < Extended_2_CutOff)
        {
            if (Type == "D_String")
            {
                DateDependent = "D3";
            }
            else
            {
                DateDependent = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["DueDate3"].ToString()).ToString(DateFormat);
            }
        }
        else if (DateSubmitted < Extended_3_CutOff)
        {
            if (Type == "D_String")
            {
                DateDependent = "D4";
            }
            else
            {
                DateDependent = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["DueDate4"].ToString()).ToString(DateFormat);
            }
        }
        else
        {
            if (Type == "D_String")
            {
                DateDependent = "D4";
            }
            else
            {
                DateDependent = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["DueDate5"].ToString()).ToString(DateFormat);
            }
        }
        return(DateDependent);
    }
Exemple #17
0
        public static void GetAllFiles()
        {
            //Last Sync System
            CultureInfo cultureInfo = new CultureInfo("en-US");

            Effie2017.App.Gen_GeneralUseValueList generalUseValueList = Effie2017.App.Gen_GeneralUseValueList.GetGen_GeneralUseValueList("AWSLastSync");
            DateTime lastSyncDateTime = Convert.ToDateTime(generalUseValueList[0].Value);
            DateTime nowSyncDateTime  = DateTime.Now;

            //END Last Sync System

            #region Log "Result Check - START"
            logClass = new Log();
            logClass.Begin();
            logClass.WriteLog("----------------------------------------------");
            logClass.WriteLog("...Started Reading Videos...");
            logClass.WriteLog("----------------------------------------------");
            #endregion

            List <FileInfo> sortedFiles = new List <FileInfo>();

            DateTime latestProgramRunDate = GetLatestProgramDate();
            int      maximumFilesToRead   = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["MaximumFiles"].ToString());

            //var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed)
            //                .Where(m => m.DateSubmitted > latestProgramRunDate && m.DateSubmitted > Convert.ToDateTime(System.Configuration.ConfigurationSettings.AppSettings["Extended_2_CutOff"])).Take(maximumFilesToRead)
            //                .OrderBy(m => m.DateSubmitted).ToList();
            var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "")
                            .Take(maximumFilesToRead)
                            .OrderBy(m => m.DateSubmitted).ToList();

            //Check List
            int c = 0;
            foreach (Entry en in entryList)
            {
                c++;

                logClass.WriteLog(c.ToString() + ": " + en.Serial);
            }
            //End Check List

            var videFileList = new DirectoryInfo(System.Configuration.ConfigurationSettings.AppSettings["VideosFileFolder"].ToString()).GetFiles().ToList();

            c = 0;
            foreach (FileInfo file in videFileList)
            {
                c++;
                logClass.WriteLog(c.ToString() + ": " + file.Name + "=>" + file.Name.Split('_')[0]);

                string entryId = file.Name.Split('_')[0];

                Entry entry = null;

                try
                {
                    entry = entryList.FirstOrDefault(m => m.Serial.Equals(entryId));
                }
                catch {}

                if (entry != null && entry.MaterialsSubmitted != "" && DateTime.Parse(entry.MaterialsSubmitted, cultureInfo) >= lastSyncDateTime)
                {
                    file.LastAccessTime = entry.DateSubmitted;

                    sortedFiles.Add(file);
                }
            }

            sortedFiles = sortedFiles.OrderBy(m => m.LastAccessTime).ToList();

            //sortedFiles = new DirectoryInfo(System.Configuration.ConfigurationSettings.AppSettings["VideosFileFolder"].ToString()).GetFiles().Where(m => m.LastWriteTime > latestProgramRunDate)
            //                                      .OrderBy(f => f.LastWriteTime).Take(maximumFilesToRead)
            //                                      .ToList();


            int counter = 0;
            foreach (FileInfo file in sortedFiles)
            {
                string fileSize = (file.Length / 1048576).ToString("N");

                logClass.WriteLog("Uploading Video : " + file.Name + " FileSize :" + fileSize + " MB");

                UploadFileToAmazonS3(file.OpenRead(), System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Original"], file.Name);

                if (FileExistsInAmazonS3(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Small"], file.Name))
                {
                    DeleteFileInAmazonS3(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Small"], file.Name);
                }

                if (file.Length < Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["MaximumCutOffSize"]))
                {
                    logClass.WriteLog("Copying Video : " + file.Name);
                    CopyFilesFromBucketToBucket(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Original"], file.Name, System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Small"], file.Name);
                }
                else if (file.Length >= Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["MaximumCutOffSize"]))
                {
                    logClass.WriteLog("Transcoding Video : " + file.Name);
                    ConvertHDtoLD_Video(file.Name, System.Configuration.ConfigurationSettings.AppSettings["AWSPipeLineID"], System.Configuration.ConfigurationSettings.AppSettings["AWSPresetID"]);
                }

                logClass.WriteLog("Updating Setting File");


                using (FileStream stream = new FileStream(System.Configuration.ConfigurationSettings.AppSettings["SettingsFilePath"].ToString(), FileMode.Create))
                    using (TextWriter writer = new StreamWriter(stream))
                    {
                        writer.WriteLine(file.LastAccessTime.ToString("MM/dd/yyyy hh:mm:ss tt"));
                    }



                counter++;

                logClass.WriteLog("No of Videos processed : " + counter);
            }

            //Update Last Sync System
            Effie2017.App.Gen_GeneralUseValue generalUseValue = Effie2017.App.Gen_GeneralUseValue.GetGen_GeneralUseValue(generalUseValueList[0].Id);
            generalUseValue.Value = nowSyncDateTime.ToString();
            generalUseValue.DateModifiedString = DateTime.Now.ToString();
            generalUseValue.Save();
            //END Update Last Sync System

            #region Log "Result Check - END"
            logClass.WriteLog("----------------------------------------------");
            logClass.WriteLog("...Finished Reading Videos...");
            logClass.WriteLog("----------------------------------------------");
            logClass.End();
            #endregion
        }
Exemple #18
0
    public void GenerateEmails(Guid templateId)
    {
        string evetnYear = string.Empty;

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

        lblError.Text = string.Empty;
        List <RegEntry> regentrylist = new List <RegEntry>();

        foreach (GridDataItem item in radGridUser.Items)
        {
            CheckBox chkbox = (CheckBox)item.FindControl("chkbox");
            if (chkbox.Checked)
            {
                List <Entry> entryList = EntryList.GetEntryList(Guid.Empty, new Guid(item["Id"].Text), "").ToList();
                Registration reg       = Registration.GetRegistration(new Guid(item["Id"].Text));
                regentrylist.Add(new RegEntry {
                    entrylist = entryList, registration = reg
                });
            }
            chkbox.Checked = false;
        }

        if (regentrylist.Count() == 0)
        {
            lblError.Text = "Please select atleast one registration to send email.<br/>";
        }
        else
        {
            foreach (RegEntry regEntry in regentrylist.ToList())
            {
                GeneralFunction.SaveEmailSentLogReg(regEntry.registration, templateId, evetnYear, "UserList", regEntry.registration.Id);
                List <Guid> IDList = new List <Guid>();
                if (regEntry.entrylist.Count() == 0)
                {
                    //GeneralFunction.SaveEmailSentLogReg(regEntry.registration, templateId, evetnYear, "UserList", regEntry.registration.Id);
                }
                else
                {
                    foreach (Entry entry in regEntry.entrylist)
                    {
                        IDList.Add(entry.Id);
                        //GeneralFunction.SaveEmailSentLogReg(regEntry.registration, templateId, evetnYear, "UserList", entry.Id);
                        entry.LastSendSubmissionReminderEmailDateString = DateTime.Now.ToString();
                        entry.Save();
                    }
                }

                Email.SendReminderEmailTemplatelReg(regEntry.registration, GeneralFunction.CheckPlaceHolders(rEditorBody.Content, true), txtTemplateSubject.Text, IDList, "UserList");
                //Email.SendReminderEmailTemplatelReg(regEntry.registration, templateId, IDList, "UserList");
            }

            lblError.Text = "Email sent " + regentrylist.Count() + " .<br/>";
        }

        regentrylist.Clear();

        phSelectTemplate.Visible = false;
        radGridUser.Rebind();
    }
Exemple #19
0
    protected void btnGo2_Click(object sender, EventArgs e)
    {
        Guid      payGroupId = new Guid(txtGroupId.Text);
        Guid      regId      = Guid.Empty;
        EntryList list       = EntryList.GetEntryList(payGroupId, Guid.Empty, ""); // contains the pay group id

        bool isChange = false;

        if (list[0].Invoice != "")
        {
            isChange = true;
        }

        string  invoice     = "";
        decimal totalamount = 0;

        foreach (Entry entry in list)
        {
            entry.Status    = StatusEntry.UploadPending;
            entry.PayStatus = StatusPaymentEntry.Paid;
            if (!isChange)
            {
                if (entry.Serial.Trim() == "")
                {
                    entry.Serial = GeneralFunction.GetNewOrderNumber(entry);
                }
                if (invoice == "")
                {
                    invoice = GeneralFunction.GetNewInvoiceNumber();
                }
            }
            else
            {
                invoice = entry.Invoice;
            }
            entry.Invoice = invoice;
            //entry.DateSubmittedString = DateTime.Now.ToString();
            //entry.Save();
            regId = entry.RegistrationId;
            //totalamount += GetEntryPrice(entry);
        }

        // update again for the amount to the 1st entry
        list[0].AmountReceived = totalamount;
        //list[0].Save();


        // Save a new amount received
        AmountReceived amt = AmountReceived.NewAmountReceived();

        amt.Amount             = totalamount;
        amt.DateReceivedString = DateTime.Now.ToString();
        amt.PaygroupId         = payGroupId;
        amt.Invoice            = invoice;
        amt.Remarks            = "Received from Paypal";
        amt.IsSetPaid          = true;
        amt.DateCreatedString  = DateTime.Now.ToString();
        //amt.Save();



        //Send Email
        Email.SendCompletedPaymentEmailPayPalChange(Registration.GetRegistration(regId), payGroupId, invoice); // payment group id

        GeneralFunction.UpdateEntryLastSendPaidEmailDate(payGroupId);
    }
Exemple #20
0
        public static void GetMissingFiles()
        {
            #region Log "Result Check - START"
            logClass = new Log();
            logClass.Begin();
            logClass.WriteLog("----------------------------------------------");
            logClass.WriteLog("...Started Reading Videos...");
            logClass.WriteLog("----------------------------------------------");
            #endregion

            List <FileInfo> sortedFiles = new List <FileInfo>();

            var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed)
                            .OrderBy(m => m.DateSubmitted).ToList();

            var videFileList = new DirectoryInfo(System.Configuration.ConfigurationSettings.AppSettings["VideosFileFolder"].ToString()).GetFiles().ToList();

            foreach (FileInfo file in videFileList)
            {
                string entryId = file.Name.Split('_')[0];

                Entry entry = null;

                try
                {
                    entry = entryList.Where(m => m.Serial.Equals(entryId)).Single();
                }
                catch { }

                if (entry != null)
                {
                    if (!FileExistsInAmazonS3(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Original"], file.Name))
                    {
                        sortedFiles.Add(file);
                    }
                }
            }

            sortedFiles = sortedFiles.OrderBy(m => m.LastAccessTime).ToList();


            int counter = 0;
            foreach (FileInfo file in sortedFiles)
            {
                string fileSize = (file.Length / 1048576).ToString("N");

                logClass.WriteLog("Uploading Video : " + file.Name + " FileSize :" + fileSize + " MB");

                UploadFileToAmazonS3(file.OpenRead(), System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Original"], file.Name);

                if (FileExistsInAmazonS3(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Small"], file.Name))
                {
                    DeleteFileInAmazonS3(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Small"], file.Name);
                }

                if (file.Length < Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["MaximumCutOffSize"]))
                {
                    logClass.WriteLog("Copying Video : " + file.Name);
                    CopyFilesFromBucketToBucket(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Original"], file.Name, System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Small"], file.Name);
                }
                else if (file.Length >= Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["MaximumCutOffSize"]))
                {
                    logClass.WriteLog("Transcoding Video : " + file.Name);
                    ConvertHDtoLD_Video(file.Name, System.Configuration.ConfigurationSettings.AppSettings["AWSPipeLineID"], System.Configuration.ConfigurationSettings.AppSettings["AWSPresetID"]);
                }

                logClass.WriteLog("Updating Setting File");

                counter++;

                logClass.WriteLog("No of Videos processed : " + counter);
            }


            #region Log "Result Check - END"
            logClass.WriteLog("----------------------------------------------");
            logClass.WriteLog("...Finished Reading Videos...");
            logClass.WriteLog("----------------------------------------------");
            logClass.End();
            #endregion
        }
Exemple #21
0
    public static MemoryStream GenerateGroupReceipt(Registration reg, Guid paymentGroupId)
    {
        EntryList           entries       = EntryList.GetEntryList(paymentGroupId, reg.Id, "");
        PdfReader           pdfReader     = null;
        PdfStamper          pdfStamper    = null;
        AcroFields          pdfFormFields = null;
        List <MemoryStream> memoryStreamPdfStamperList = new List <MemoryStream>();
        MemoryStream        memoryStreamPdfStamper     = null;

        bool    isPP        = false;
        bool    isBank      = false;
        int     rowcounter  = 1;
        decimal total       = 0;
        decimal fees        = 0;
        decimal tax         = 0;
        decimal grandtotal  = 0;
        int     CountEntry  = 1;
        int     Pages       = 1;
        int     MuchRow     = 22;
        string  TamplatePDF = "";

        //isPP = (entry.PaymentMethod == PaymentType.PayPal);
        //isBank = (entry.PaymentMethod == PaymentType.BankTransfer);
        // Form filling
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////
        foreach (Entry entry in entries)
        {
            if ((CountEntry % (MuchRow + 1)) == 0 || CountEntry == 1)
            {
                if ((entries.Count <= MuchRow) || ((entries.Count > MuchRow) && ((entries.Count - CountEntry) <= MuchRow)))
                {
                    TamplatePDF = "Invoice Template 2.pdf";
                }
                else if (entries.Count > MuchRow)
                {
                    TamplatePDF = "Invoice Template 1.pdf";
                }

                pdfReader = new PdfReader(System.Configuration.ConfigurationSettings.AppSettings["PdfTemplateLocation"] + TamplatePDF);
                memoryStreamPdfStamper = null;
                memoryStreamPdfStamper = new MemoryStream();
                pdfStamper             = new PdfStamper(pdfReader, memoryStreamPdfStamper);
                pdfFormFields          = pdfStamper.AcroFields;

                rowcounter = 1;

                string customerinfo = "";
                customerinfo += reg.Salutation + " " + reg.Firstname + " " + reg.Lastname + "\r\n";
                customerinfo += reg.Job + "\r\n";
                customerinfo += reg.Address1 + "\r\n";
                customerinfo += reg.Address2 + "\r\n";
                customerinfo += reg.City;
                if (reg.City.Trim() != "")
                {
                    customerinfo += " ";
                }
                customerinfo += reg.Postal + "\r\n";
                customerinfo += reg.Country + "\r\n";

                if (entries.Count > 0)
                {
                    customerinfo  = "";
                    customerinfo += entries[0].PayFirstname + " " + entries[0].PayLastname + "\r\n";
                    customerinfo += entries[0].PayCompany + "\r\n";
                    customerinfo += entries[0].PayAddress1 + "\r\n";
                    if (entries[0].PayAddress2.Trim() != "")
                    {
                        customerinfo += entries[0].PayAddress2 + "\r\n";
                    }
                    customerinfo += entries[0].PayCity;
                    if (entries[0].PayCity.Trim() != "")
                    {
                        customerinfo += " ";
                    }
                    customerinfo += entries[0].PayPostal + "\r\n";
                    customerinfo += entries[0].PayCountry + "\r\n";
                }

                { //HEADER
                    pdfFormFields.SetField("invno", entry.Invoice);
                    pdfFormFields.SetField("date", entry.DateSubmitted.ToString("dd MMM yyyy"));
                    pdfFormFields.SetField("customer", customerinfo);
                }
            }

            /////////////////////////////////////////////////////////////////////////////////////

            PopulateRow(rowcounter, pdfFormFields, entry.Serial, entry.Amount, entry.Campaign);

            total      += entry.Amount;
            fees       += entry.Fee;
            tax        += entry.Tax;
            grandtotal += entry.GrandAmount;

            rowcounter++;

            /////////////////////////////////////////////////////////////////////////////////////

            { //FOTTER
                pdfFormFields.SetField("st1", "S$ " + (total + fees).ToString("N"));
                pdfFormFields.SetField("st2", "S$ " + fees.ToString("N"));
                pdfFormFields.SetField("st3", "S$ " + grandtotal.ToString("N"));
                pdfFormFields.SetField("st4", "S$ " + tax.ToString("N"));
                pdfFormFields.SetField("page", Pages.ToString());
                pdfFormFields.SetField("blank", " ");
            }

            if (((CountEntry % 22) == 0) || (CountEntry == entries.Count))
            {
                pdfStamper.FormFlattening     = true;
                pdfStamper.Writer.CloseStream = false;
                pdfStamper.Close();
                memoryStreamPdfStamperList.Add(memoryStreamPdfStamper);
                Pages++;
            }

            CountEntry++;
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////


        MemoryStream docstream = CreatePdfDoc(memoryStreamPdfStamperList);

        foreach (MemoryStream memoryStreamPdfStamper1 in memoryStreamPdfStamperList)
        {
            memoryStreamPdfStamper1.Dispose();
        }

        docstream.Position = 0;
        return(docstream);
    }
Exemple #22
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ValidateForm())
        {
            Guid entryId = new Guid(hldEntryId.Value);
            entry = Entry.GetEntry(entryId);

            // save the amount to the first entry or this default entry
            entry.AmountReceived += decimal.Parse(txtAmountRecieved.Text);
            entry.Save();


            // paid?
            bool      isPaid         = false;
            Guid      paymentGroupId = entry.PayGroupId;
            EntryList list           = EntryList.GetEntryList(paymentGroupId, Guid.Empty, "");
            foreach (Entry ent in list)
            {
                string paidstatus_org = ent.PayStatus;

                // Allow Upload - only if its not aleady pending complete or completed
                if (rblPayment.SelectedValue == "AllowUpload" && ent.Status != StatusEntry.UploadCompleted && ent.Status != StatusEntry.Completed)
                {
                    //if (rblPayment.SelectedValue == "AllowUpload")
                    //{
                    ent.Status = StatusEntry.UploadPending;
                    //}
                    //else
                    //{
                    //    ent.Status = StatusEntry.PaymentPending;
                    //}
                }

                // make the change only if the status has changed.
                // if not do not change it
                if (rblPayment.SelectedValue == StatusPaymentEntry.Paid /*chkPaid.Checked*/ && paidstatus_org == StatusPaymentEntry.NotPaid)
                {
                    ent.PayStatus = StatusPaymentEntry.Paid;

                    // set if its not aleady pending complete or completed
                    if (ent.Status != StatusEntry.UploadCompleted && ent.Status != StatusEntry.Completed)
                    {
                        ent.Status = StatusEntry.UploadPending;
                    }

                    isPaid = true;
                }

                //if (paidstatus_org == StatusPaymentEntry.Paid)
                //{
                //    ent.PayStatus = StatusPaymentEntry.NotPaid;
                //}


                // double check if paid then it must be allow upload
                if (ent.PayStatus == StatusPaymentEntry.Paid && ent.Status != StatusEntry.UploadCompleted && ent.Status != StatusEntry.Completed)
                {
                    ent.Status = StatusEntry.UploadPending;
                }

                ent.Save();
            }


            // send email? if sent before do not send any more
            string lastdatesent = GeneralFunction.CleanDateTimeToString(entry.LastSendPaidEmailDate, "dd/MM/yy HH:mm tt");
            //if (chkAllowUpload.Checked && lastdatesent == "")
            if (lastdatesent == "")
            {
                if (entry.PaymentMethod != PaymentType.PayPal)
                {
                    //if (IsAmountFullyPaidIncludeThisAmount())
                    if (rblPayment.SelectedValue == StatusPaymentEntry.Paid || IsAmountFullyPaidIncludeThisAmount())
                    {
                        // Full payment
                        GeneralFunction.CompleteNewEntrySubmissionOthers(paymentGroupId);
                    }
                    else if (rblPayment.SelectedValue == "AllowUpload")
                    {
                        // Partial payment
                        Email.SendCompletedPaymentEmailOthers(Registration.GetRegistration(list[0].RegistrationId), paymentGroupId, "");
                        GeneralFunction.UpdateEntryLastSendPaidEmailDate(paymentGroupId);
                    }
                }
            }


            Administrator admin = Security.GetAdminLoginSession();
            Registration  reg   = Security.GetLoginSessionUser();
            // history
            AmountReceived amt = AmountReceived.NewAmountReceived();
            amt.Amount = decimal.Parse(txtAmountRecieved.Text);
            DateTime datetime     = DateTime.Parse(dpDateReceived.DateInput.SelectedDate.ToString());
            string   Date         = datetime.ToString("MM/dd/yyyy");
            string   Time         = DateTime.Now.ToString("hh:mm tt");
            DateTime DateReceived = DateTime.Parse(Date + " " + Time);
            amt.DateReceivedString = DateReceived.ToString();
            amt.PaygroupId         = entry.PayGroupId;
            amt.Invoice            = "";
            amt.Remarks            = txtRemarks.Text;
            amt.IsSetPaid          = isPaid;
            amt.DateCreatedString  = DateTime.Now.ToString();
            if (admin != null)
            {
                amt.isAdmin       = true;
                amt.CommentatorID = admin.Id;
            }
            else
            {
                amt.isAdmin       = false;
                amt.CommentatorID = reg.Id;
            }
            amt.Save();



            if (Save_Clicked != null)
            {
                Save_Clicked(this, EventArgs.Empty);
            }
        }
    }
Exemple #23
0
        protected static void GenerateReport()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("No");
            dt.Columns.Add("File Name");
            dt.Columns.Add("Original Size (MB)");
            dt.Columns.Add("Date");
            dt.Columns.Add("URL");


            List <FileInfo> sortedFiles = new List <FileInfo>();

            DateTime latestProgramRunDate = GetLatestProgramDate();

            //var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed)
            //                .Where(m => m.DateSubmitted > Convert.ToDateTime(System.Configuration.ConfigurationSettings.AppSettings["Extended_2_CutOff"]))
            //                .OrderBy(m => m.DateSubmitted).ToList();

            var entryList = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "", StatusEntry.Completed)
                            .OrderBy(m => m.DateSubmitted).ToList();


            var videFileList = new DirectoryInfo(System.Configuration.ConfigurationSettings.AppSettings["VideosFileFolder"].ToString()).GetFiles().ToList();

            foreach (FileInfo file in videFileList)
            {
                string entryId = file.Name.Split('_')[0];

                Entry entry = null;

                try
                {
                    entry = entryList.Where(m => m.Serial.Equals(entryId)).Single();
                }
                catch { }

                if (entry != null)
                {
                    file.LastAccessTime = entry.DateSubmitted;

                    sortedFiles.Add(file);
                }
            }

            sortedFiles = sortedFiles.OrderBy(m => m.LastAccessTime).ToList();

            int counter = 1;

            foreach (FileInfo file in sortedFiles)
            {
                if (FileExistsInAmazonS3(System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Small"], file.Name))
                {
                    DataRow dr = dt.NewRow();

                    dr["No"]                 = counter.ToString();
                    dr["File Name"]          = file.Name;
                    dr["Original Size (MB)"] = file.Length / 1048576;
                    dr["Date"]               = file.LastAccessTime;
                    dr["URL"]                = System.Configuration.ConfigurationSettings.AppSettings["AWSS3WebURL"] + System.Configuration.ConfigurationSettings.AppSettings["AWSBucket_Small"] + "/" + file.Name;

                    dt.Rows.Add(dr);

                    counter++;
                }
            }

            CreateCSVFile(dt, System.Configuration.ConfigurationSettings.AppSettings["LogFileFolder"] + DateTime.Now.Ticks.ToString() + ".csv");
        }
Exemple #24
0
    protected void radGridEntry_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Administrator admin    = (Administrator)e.Item.DataItem;
            CheckBox      chkAcDec = (CheckBox)e.Item.FindControl("chkAcDec");
            HiddenField   hdfId    = (HiddenField)e.Item.FindControl("hdfId");
            hdfId.Value = admin.Id.ToString();
            string userType = string.Empty;

            if (admin.IsActive)
            {
                chkAcDec.Checked = true;
            }
            else
            {
                chkAcDec.Checked = false;
            }


            LinkButton lnkBtnDelete = (LinkButton)e.Item.FindControl("lnkBtnDelete");
            lnkBtnDelete.Attributes.Add("onclick", "return DeleteConfirmation('" + admin.LoginId + "');");

            try {
                bool isAny = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "").Where(x => x.AdminidAssignedto == admin.Id).Any();
                if (isAny)
                {
                    lnkBtnDelete.Attributes.Clear();
                    lnkBtnDelete.Attributes.Add("onclick", "return alert(\"This account already tagged to entry(s), can not be removed.\");");
                    lnkBtnDelete.CommandName = "";
                }
            }
            catch { }



            if (Security.IsRoleSuperAdmin())
            {
                lnkBtnDelete.Visible = true;
            }
        }
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            item["Access"].Text = GeneralFunction.GetAdminType(item["Access"].Text);
        }
        else if (e.Item.ItemType == GridItemType.Pager)
        {
            //RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");

            //PageSizeCombo.Items.Clear();
            //PageSizeCombo.Items.Add(new RadComboBoxItem("20", "20"));
            //PageSizeCombo.FindItemByText("20").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID);
            //PageSizeCombo.Items.Add(new RadComboBoxItem("50", "50"));
            //PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID);
            //PageSizeCombo.Items.Add(new RadComboBoxItem("100", "100"));
            //PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID);
            //PageSizeCombo.Items.Add(new RadComboBoxItem("200", "200"));
            //PageSizeCombo.FindItemByText("200").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID);
            //PageSizeCombo.Items.Add(new RadComboBoxItem("All", "99999"));
            //PageSizeCombo.FindItemByText("All").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID);
            //string PageSize = e.Item.OwnerTableView.PageSize.ToString();
            //PageSizeCombo.FindItemByValue(PageSize).Selected = true;
        }
    }
Exemple #25
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ValidateForm())
        {
            AdhocInvoice adInv = SaveForm();

            // id admin mode, go back to admin page
            if (isAdminEdit)
            {
                Response.Redirect(GeneralFunction.GetRedirect("../Admin/InvoiceList.aspx"));
            }

            //To set to Upload Complete if Payment Method is selected
            //Administrator admin = Security.GetAdminLoginSession();
            AdhocInvoiceItemList adhocInvItemList = AdhocInvoiceItemList.GetAdhocInvoiceItemList(payGroupId, adInv.Id);
            EntryList            entries          = EntryList.GetEntryList(Guid.Empty, adInv.RegistrationId, "");
            foreach (AdhocInvoiceItem adhocInvItem in adhocInvItemList)
            {
                try
                {
                    //FILTER For REOPEN ENTRY PROCESSING
                    Entry entry = entries.FirstOrDefault(x => x.Id == adhocInvItem.EntryId &&
                                                         ((x.Status == StatusEntry.Completed) && (x.ProcessingStatus == StatusEntry.PendingReopen)));

                    if (adhocInvItem.InvoiceType == "ReOpen")
                    {
                        //To set to Upload Complete if Payment Method is selected
                        if (adInv.Invoice == "" && adInv.PaymentMethod != "")
                        {
                            entry.Status           = StatusEntry.UploadCompleted;
                            entry.ReopeningDate    = DateTime.Now.ToString();                //
                            entry.ProcessingStatus = StatusEntry.Reopened;                   //
                            entry.IDAdhocInvoice   = adhocInvItem.AdhocInvoiceId.ToString(); //
                        }

                        entry.Save();
                    }
                }
                catch { }
            }

            GeneralFunction.CompletePendingPaymentAdhoc(adInv.RegistrationId, adInv.PayGroupId, adInv.PaymentMethod, lbTotalFees.Text, true);

            if (rblPayment.SelectedValue == PaymentType.PayPal)
            {
                // get the string of serial numbers
                string    serials = "";
                EntryList list    = EntryList.GetEntryList(adInv.PayGroupId, Guid.Empty, ""); // contains the pay group id
                foreach (Entry entry in list)
                {
                    serials += entry.Serial + ",";
                }
                if (serials != "")
                {
                    serials = serials.Substring(0, serials.Length - 1);
                }

                PayPal(serials);
            }
            else
            {
                Response.Redirect("../Main/PendingPayment.aspx");
            }
        }
    }