Esempio n. 1
0
        /// <summary>
        /// Formats string and replaces placeholders with actual values
        /// </summary>
        /// <param name="Format"></param>
        /// <returns></returns>
        public string FormatLine(string Format)
        {
            Dictionary <string, string> replacementTable = new Dictionary <string, string>
            {
                { "i", (Index + 1).ToString() },
                { "l", FeedUrl?.ToString() },
                { "n", Configuration.Instance.GetReadState(UnreadItems > 0) },
                { "U", UnreadItems.ToString() },
                { "T", TotalItems.ToString() },
                { "u", (UnreadItems.ToString() + "/" + TotalItems.ToString()).PadLeft(8) },
                { "t", Title },
                { "V", Configuration.MAJOR_VERSION },
                { "v", Configuration.VERSION },
                { "g", (Tags != null ? string.Join(" ", Tags) : "") }
            };

            var line = Formatter.FormatLine(Format, replacementTable);

            if (this.IsProcessing)
            {
                return(Configuration.Instance.LoadingPrefix + line + Configuration.Instance.LoadingSuffix);
            }
            else
            {
                return(line);
            }
        }
Esempio n. 2
0
        //printing document
        private void printDayEndReportDocs_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            //DateTime currentDate = DateTime.UtcNow.Date;
            DateTime      currentDate = DateTime.Parse("2018-12-09 20:44:02.3033333"); // for testing
            List <TOrder> listOfOrdersWithinCurrentDay = Helper.GetAllOrdersForDayEnd(currentDate);

            int      x = e.MarginBounds.Left;
            int      y = e.MarginBounds.Top;
            int      nxtLineIncrement = 20;
            Graphics g     = e.Graphics;
            var      font  = new Font("Arial", 16);
            var      brush = new SolidBrush(Color.Black);

            g.DrawString("\tDay End Summary Report", font, brush, x, y);
            g.DrawString("\t--------------------------------------", font, brush, x, y += nxtLineIncrement);

            g.DrawString("\tDate : " + currentDate.ToLongDateString(), font, brush, x, y += nxtLineIncrement);
            g.DrawString("\tTotal Orders : " + TotalOrder.ToString(), font, brush, x, y  += nxtLineIncrement);
            g.DrawString("\tTotal Items : " + TotalItems.ToString(), font, brush, x, y   += nxtLineIncrement);
            g.DrawString("\tTotal Income By Card : " + TotalIncomeByCard.ToString(), font, brush, x, y     += nxtLineIncrement);
            g.DrawString("\tTotal Income By Cash : " + TotalIncomeByCash.ToString(), font, brush, x, y     += nxtLineIncrement);
            g.DrawString("\tTotal Redeem Points Fee : " + TotalReedemsPoints.ToString(), font, brush, x, y += nxtLineIncrement);
            g.DrawString("\tTotal Income : " + TotalIncome.ToString(), font, brush, x, y            += nxtLineIncrement);
            g.DrawString("\tStarting Cash : " + StartingCash.ToString(), font, brush, x, y          += nxtLineIncrement);
            g.DrawString("\tTotal Till Balance : " + ActualCashInTill.ToString(), font, brush, x, y += nxtLineIncrement);
            g.DrawString("\tVariance : " + Variance.ToString(), font, brush, x, y += nxtLineIncrement);
        }
Esempio n. 3
0
        private void CreateLinkButton(string title, int index)
        {
            Literal litNewLine = new Literal();

            litNewLine.Text = System.Environment.NewLine;
            pnlPager.Controls.Add(litNewLine);

            LinkButton lnk = new LinkButton();

            if (title == PreviousPageText)
            {
                lnk.ID = "-1";
            }
            else if (title == NextPageText)
            {
                lnk.ID = TotalItems.ToString();
            }
            else
            {
                lnk.ID = index.ToString();
            }

            lnk.Text            = title;
            lnk.CommandArgument = index.ToString();
            lnk.Click          += new EventHandler(lnkPager_Click);
            HtmlGenericControl li = new HtmlGenericControl("li");

            li.Controls.Add(lnk);

            pnlPager.Controls.Add(li);
        }
Esempio n. 4
0
 public CTDLAPIRelatedItemForSearchResult(string name, string label, List <JObject> allSamples, int sampleSize = 10)
 {
     Name       = name;
     TotalItems = allSamples.Count();
     Label      = label.Replace("#", TotalItems.ToString());
     Samples    = allSamples.Take(sampleSize).ToList();
 }
Esempio n. 5
0
 //showing calculated values on form
 private void DisplayReportData()
 {
     labelCurrentDate.Text           = CurrentDate.ToLongDateString();
     labelTotalOrders.Text           = TotalOrder.ToString() + " orders.";
     labelTotalItems.Text            = TotalItems.ToString() + " items.";
     labelTotalByCard.Text           = "$ " + TotalIncomeByCard.ToString();
     labelTotalByCash.Text           = "$ " + TotalIncomeByCash.ToString();
     labelTotalRedeems.Text          = "$ " + TotalReedemsPoints.ToString();
     labelTotalIncome.Text           = "$ " + TotalIncome.ToString();
     labelStartingCash.Text          = "$ " + StartingCash.ToString();
     labelTotalActualTillIncome.Text = "$ " + ActualCashInTill.ToString();
     labelVariance.Text = "$ " + Variance.ToString();
 }
 void Find()
 {
     new WorkerHelper(
         (s, e) =>
     {
         try
         {
             if (FindText.IsNotEmpty())
             {
                 if (FindText.Length > 3)
                 {
                     e.Result = Factory.MercadoLibre.Publicaciones.BuscarPaginado(ItemsPorPagina.Value.ToInt(), FindText, CuentaML.JarseIndustrial, CuentaML.DRLINEABLANCA);
                 }
                 else
                 {
                     e.Result = null;
                 }
             }
             else
             {
                 e.Result = Factory.MercadoLibre.Publicaciones.BuscarPaginado(ItemsPorPagina.Value.ToInt(), CuentaML.JarseIndustrial, CuentaML.DRLINEABLANCA);
             }
         }
         catch (Exception ex)
         {
             e.Result = ex;
         }
     },
         (s, e) =>
     {
         if (e.Result is Exception)
         {
             App.MessageController.Error(e.Result.ToStr(), "Intentá continuar o informá del error si este vuelve a ocurrir.");
             Pagina = 0;
         }
         else if (e.Result is List <DataTable> )
         {
             TotalItems = e.Result as List <DataTable>;
             if (TotalItems.HasRows())
             {
                 Pagina = 1;
             }
             else
             {
                 Pagina = 0;
             }
             OnPropertyChanged();
         }
     }).Run();
 }
        private void CheckIfFileExists(IReadOnlyList <PodcastDownloadModel> podcastModels)
        {
            for (var index = 0; index < podcastModels.Count; index++)
            {
                var podcastModel = podcastModels[index];

                if (podcastModel.EpisodeNumber == 0)
                {
                    podcastModel.EpisodeNumber = index + 1;
                }

                CheckFilePath(podcastModel);
            }

            TotalItems?.Invoke(podcastModels.Count(x => !x.FileExists));
        }
Esempio n. 8
0
 //exporting file in debug folder
 private void btnExportData_Click(object sender, EventArgs e)
 {
     try
     {
         using (StreamWriter writer = new StreamWriter(Helper.FILE_PATH_DAYEND_REPORT))
         {
             writer.WriteLine("\t\t\t" + "--------DAY END SUMMARY REPORT-----------");
             writer.WriteLine("\t" + "Date: " + CurrentDate.ToLongDateString());
             writer.WriteLine("\t" + "Total Orders: " + TotalOrder.ToString());
             writer.WriteLine("\t" + "Total Items: " + TotalItems.ToString());
             writer.WriteLine("\t" + "Total Income By Card: " + TotalIncomeByCard.ToString());
             writer.WriteLine("\t" + "Total Income By Cash: " + TotalIncomeByCash.ToString());
             writer.WriteLine("\t" + "Total Redeems Fee: " + TotalReedemsPoints.ToString());
             writer.WriteLine("\t" + "Total Income: " + TotalIncome.ToString());
             writer.WriteLine("\t" + "Variance: " + Variance.ToString());
         }
         MessageBox.Show("Day end report is saved successfully.");
     }
     catch (Exception)
     {
         MessageBox.Show("The report isn't saved successfully. Try again.");
     }
 }
Esempio n. 9
0
 /// <summary>
 /// Function to calculate the total number of pages depending on TotalItems and PageSize
 /// </summary>
 public int TotalPages()
 {
     return(int.Parse(Math.Ceiling(decimal.Parse(TotalItems.ToString())
                                   / decimal.Parse(PageSize.ToString())).ToString()));
 }
        private bool AddNewBill(int id, Bill newBill, List <Product> products)
        {
            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "BillDateTime", DateTime.Now.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Id", id.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Name", Name);
            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Address", Address);
            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "PIN", PIN.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Mobile", Mobile);
            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "Email", Email);
            string[] ProductNameAndId = SysRegedit.GetSubKeyNames(MyShopConfigration.Products);
            for (int i = 0; i < products.Count; i++)
            {
                SysRegedit.SaveReg(MyShopConfigration.Bill + "\\" + id.ToString() + "." + newBill.Name, products[i].Name, "Name", products[i].Name);
                SysRegedit.SaveReg(MyShopConfigration.Bill + "\\" + id.ToString() + "." + newBill.Name, products[i].Name, "CompanyName", products[i].CompanyName);
                SysRegedit.SaveReg(MyShopConfigration.Bill + "\\" + id.ToString() + "." + newBill.Name, products[i].Name, "Quntity", products[i].Quntity.ToString());
                SysRegedit.SaveReg(MyShopConfigration.Bill + "\\" + id.ToString() + "." + newBill.Name, products[i].Name, "Price", products[i].Price.ToString());

                for (int j = 0; j < ProductNameAndId.Length; j++)
                {
                    if (ProductNameAndId[j].Remove(0, ProductNameAndId[j].IndexOf('.') + 1) == products[i].Name)
                    {
                        int a = Convert.ToInt32(SysRegedit.ReadReg(MyShopConfigration.Products, ProductNameAndId[j], "Quntity")) - Convert.ToInt32(products[i].Quntity);
                        SysRegedit.SaveReg(MyShopConfigration.Products + "\\" + ProductNameAndId[j], "Quntity", a.ToString());
                    }
                }
            }

            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "TotalItems", TotalItems.ToString());
            SysRegedit.SaveReg(MyShopConfigration.Bill, id.ToString() + "." + newBill.Name, "TotalPrice", TotalPrice.ToString());
            return(true);
        }
Esempio n. 11
0
 private double CalculateTotal()
 {
     return(TotalItems.Sum(id => id.Total));
 }
Esempio n. 12
0
 private double CalculateSalesTaxes()
 {
     return(TotalItems.Sum(id => id.SaleTax));
 }
Esempio n. 13
0
 public override int GetHashCode()
 {
     return(base.GetHashCode() ^ TotalItems.GetHashCode() ^ ItemsPerPage.GetHashCode() ^ CurrentPage.GetHashCode());
 }
Esempio n. 14
0
        //====================== END OF UI FUNCATIONALITY BUTTONS  =========================



        //====================== START OF SALE FUNCATIONALITY METHODS  =========================

        /*
         * Event Handler for Order Button in Sale Windows
         */
        private void OrderButton_Click(object sender, EventArgs e)
        {
            StreamWriter FileWriter;
            string       Reciept = "", CurrentLine, Seperator = "_", Message = "";

            //Generating Dynamic Confirmation Message Based on Cart Items
            Message = "Please Confirm the below order:\n\n";
            foreach (CartList CartItems in CartFlowLayoutPanel.Controls)
            {
                Message = Message + "\nProduct Name: " + CartItems.ProdName +
                          "\nQuantity(s)      : " + CartItems.ProdQuantity + Environment.NewLine;
            }
            Message = Message + "\n\nYou will have to pay €" + GrandTotal.ToString() + " for " + TotalItems.ToString() + " items.";
            Message = Message + "\n\nDo you want to confirm the order?";

            DialogResult DR = MessageBox.Show(Message, "Confirm the Order", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (DR == DialogResult.Yes)
            {
                foreach (CartList CartItems in CartFlowLayoutPanel.Controls)
                {
                    int i;
                    // Modifying Original Stock ProductList
                    // Substracting Cart Quantities from stock
                    for (i = 0; i < ProductList.Count; i++)
                    {
                        if (ProductList[i].ProductQuantity > 0)
                        {
                            if (CartItems.ProdID == ProductList[i].ProductID)
                            {
                                ProductList[i].ProductQuantity -= CartItems.ProdQuantity;
                                break;
                            }
                        }
                    }
                    // Adding quantities into Sold Product List
                    //Adding Cart Quantities from stock
                    for (i = 0; i < SaleProductIDs.Count; i++)
                    {
                        if (CartItems.ProdID == SaleProductIDs[i].ProductID)
                        {
                            SaleProductIDs[i].ProductQuantity += CartItems.ProdQuantity;
                            break;
                        }
                    }
                    CurrentLine = CartItems.ProdCat + Seperator + CartItems.ProdName + Seperator + CartItems.ProdQuantity + Seperator + CartItems.ProdTotal;
                    if (Reciept == "")
                    {
                        Reciept = CurrentLine;
                    }
                    else
                    {
                        Reciept = Reciept + Seperator + CurrentLine;
                    }
                }
                TodaysSaleTotal += GrandTotal;
                //Writing current Transaction to file
                try
                {
                    FileWriter = File.AppendText(TRANSACTIONDATABASEFILENAME);
                    FileWriter.WriteLine(TransactionIDLabel.Text);
                    FileWriter.WriteLine(DateTime.Today.ToShortDateString());
                    FileWriter.WriteLine(TotalItems.ToString());
                    FileWriter.WriteLine(GrandTotal.ToString());
                    FileWriter.WriteLine(Reciept);
                    FileWriter.Close();

                    MessageBox.Show("Transaction " + TransactionIDLabel.Text + " completed successfully");

                    CartFlowLayoutPanel.Controls.Clear();
                    ProductsFlowLayoutPanel.Controls.Clear();
                    CurrentCartProducts.Clear();
                    TotalItems           = 0;
                    GrandTotal           = 0;
                    TotalItemsLabel.Text = "";
                    GrandTotalLabel.Text = "";
                }
                catch
                {
                    MessageBox.Show("Some Error Occured while Completing your order. Try again Later", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }