public IHttpActionResult getBuyer()
        {
            var product                  = _db.product.ToList();
            var website                  = _db.website.ToList();
            var Buyer                    = _db.buyerinformation.ToList();
            var buyerdesignation         = _db.designation.ToList();
            var status                   = _db.buyerstatus.ToList();
            var source                   = _db.buyersource.ToList();
            var Communicationmedium      = _db.communicationmedium.ToList();
            var communicationinformation = _db.communicationinfo.ToList();
            var TransferTo               = _db.transferredto.ToList();
            var Priority                 = _db.buyerpriority.ToList();
            var SalesData                = new SalesData()
            {
                BuyerInfo           = Buyer,
                product             = product,
                web                 = website,
                Designation         = buyerdesignation,
                Status              = status,
                Source              = source,
                CommunicationMedium = Communicationmedium,
                communicationChain  = communicationinformation,
                TransferredTo       = TransferTo,
                Priority            = Priority,
            };

            return(Ok(SalesData));
        }
示例#2
0
        /// <summary>
        /// Base the specified CompanySlug and Data.
        /// </summary>
        /// <returns>The base..</returns>
        /// <param name="CompanySlug">Company slug.</param>
        /// <param name="Data">Data.</param>
        public List <Sales> Transaction(string CompanySlug, List <object> Data)
        {
            string          result   = "";
            HttpWebResponse response = Http.SyncList("protected/profiles/" + CompanySlug + "/backoffice/upload/transactions", Data);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                HttpListenerException ex = new HttpListenerException();
                throw ex;
            }

            using (var streamReader = new StreamReader(response.GetResponseStream()))
            {
                result = streamReader.ReadToEnd();
            }

            //List<Models.Sales> MyList = new List<Models.Sales>();
            //MyList = JsonConvert.DeserializeObject<List<Models.Sales>>(result);

            //return MyList;

            SalesData MyList = JsonConvert.DeserializeObject <SalesData>(result);

            return(MyList.data);
        }
示例#3
0
        public void AddSalesData(SalesData sales)
        {
            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
                SqlCommand cmd = new SqlCommand();

                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.CommandText = "AddSalesData";

                cmd.Parameters.AddWithValue("@Id", sales.vehicle_ID);
                cmd.Parameters.AddWithValue("@Name", sales.name);
                cmd.Parameters.AddWithValue("@Phone", sales.phone);
                cmd.Parameters.AddWithValue("@Email", sales.email);
                cmd.Parameters.AddWithValue("@Street1", sales.street_1);
                cmd.Parameters.AddWithValue("@Street2", (object)sales.street_2 ?? DBNull.Value);
                cmd.Parameters.AddWithValue("@City", sales.city);
                cmd.Parameters.AddWithValue("@StateID", sales.state_ID);
                cmd.Parameters.AddWithValue("@ZipCode", sales.zipCode);
                cmd.Parameters.AddWithValue("@PurchasePrice", sales.purchasePrice);
                cmd.Parameters.AddWithValue("@PurchaseTypeID", sales.purchaseType_ID);
                cmd.Parameters.AddWithValue("@userAdded", sales.userAdded);


                conn.Open();
                cmd.ExecuteNonQuery();
            }
        }
示例#4
0
        public bool AddSaleRecord(SalesData dailySales)
        {
            bool isSalesAdded = false;

            using (uow = new UnitOfWork.UnitOfWork())
            {
                try
                {
                    Sale dailySalesdb = new Sale();
                    dailySalesdb.EntryDate           = dailySales.EntryDate;
                    dailySalesdb.DailySaleAmount     = dailySales.DailySaleAmount;
                    dailySalesdb.MonthlySales        = dailySales.MonthlySales;
                    dailySalesdb.NetSales            = dailySales.NetSales;
                    dailySalesdb.Refunds             = dailySales.Refunds;
                    dailySalesdb.SalesPersonID       = dailySales.SalesPersonID;
                    dailySalesdb.QBTotalPay          = dailySales.QBTotalPay;
                    dailySalesdb.CashBonus           = dailySales.CashBonus;
                    dailySalesdb.MonthlyOfficeRent   = dailySales.MonthlyOfficeRent;
                    dailySalesdb.DrawTakenInMonth    = dailySales.DrawTakenInMonth;
                    dailySalesdb.DailyBonus          = dailySales.DailyBonus;
                    dailySalesdb.CommisionInUSD      = dailySales.CommisionInUSD;
                    dailySalesdb.CommisionPercentage = dailySales.CommisionPercentage;
                    uow.SaleRepository.Insert(dailySalesdb);
                    uow.Save();
                    isSalesAdded = true;
                }
                catch
                {
                    isSalesAdded = false;
                }
            }

            return(isSalesAdded);
        }
示例#5
0
        public SalesData GetMonthYearSaleBySaleID(int month, int year, int saleID)
        {
            SalesData lstSales = new SalesData();

            using (uow = new UnitOfWork.UnitOfWork())
            {
                try
                {
                    lstSales = uow.SaleRepository.Get().Where(x => Convert.ToDateTime(x.EntryDate).Month == month && Convert.ToDateTime(x.EntryDate).Year == year && x.SaleID == saleID).Select(usd => new SalesData
                    {
                        SaleID              = usd.SaleID,
                        EntryDate           = usd.EntryDate,
                        DailySaleAmount     = usd.DailySaleAmount,
                        MonthlySales        = usd.MonthlySales,
                        NetSales            = usd.NetSales,
                        SalesPersonID       = usd.SalesPersonID,
                        Refunds             = usd.Refunds,
                        QBTotalPay          = usd.QBTotalPay,
                        MonthlyOfficeRent   = usd.MonthlyOfficeRent,
                        CashBonus           = usd.CashBonus,
                        DrawTakenInMonth    = usd.DrawTakenInMonth,
                        DailyBonus          = usd.DailyBonus,
                        CommisionInUSD      = usd.CommisionInUSD,
                        CommisionPercentage = usd.CommisionPercentage
                    }).FirstOrDefault();
                }
                catch
                {
                }
            }
            return(lstSales);
        }
示例#6
0
        // Fills dictionary with sales data
        // Gets passed dictionary
        // No return
        static void getInventory(Dictionary <string, SalesData> d)
        {
            char[]   delimiterChars = { ',' };
            string[] productCodes   = { "584-10", "584-30", "555-00", "580-00", "581-00", "587-00" };
            string   line;

            // Scotch plains file location
            StreamReader file = new StreamReader(@"C:\Dropbox\Work\Inventory\Report.txt");

            // Chatham file location
            //StreamReader file = new StreamReader(@"C:\Dropbox\Work\Chatham\Report.txt");

            while ((line = file.ReadLine()) != null)
            {
                string[] words = line.Split(delimiterChars);
                if (words[0] != productCodes[0] &&
                    words[0] != productCodes[1] &&
                    words[0] != productCodes[2] &&
                    words[0] != productCodes[3] &&
                    words[0] != productCodes[4] &&
                    words[0] != productCodes[5] ||
                    words[2] == "Total $:")
                {
                    continue;
                }
                SalesData s = new SalesData();

                s.Sold = double.Parse(words[9]);
                s.OH   = double.Parse(words[13]);
                s.Code = words[0];
                d.Add(words[2], s);
            }
            file.Close();
        }
        public void UpdateSalesData_ChangedValuesAreApplied()
        {
            using (var bc = new BusinessContext())
            {
                //Arrange
                var shipDate  = DateTime.Now;
                var salesData = new SalesData(shipDate, 10000, new Type1_Classifiers(), new Type2_Classifiers(), new Type3_Classifiers(), new Type4_Classifiers());
                bc.AddSalesData(salesData);

                const string newType1ClassifierName = "type1_____ClassifierName",
                             newType2ClassifierName = "type2_____ClassifierName",
                             newType3ClassifierName = "type2_____ClassifierName",
                             newType4ClassifierName = "type2_____ClassifierName";

                salesData.Type1Classifier.Type1_ClassifierName = newType1ClassifierName;
                salesData.Type2Classifier.Type2_ClassifierName = newType2ClassifierName;
                salesData.Type3Classifier.Type3_ClassifierName = newType3ClassifierName;
                salesData.Type4Classifier.Type4_ClassifierName = newType4ClassifierName;
                //Act
                bc.UpdateSalesData(salesData);
                bc.DataContext.Entry(salesData).Reload();
                //Assert
                Assert.AreEqual(newType1ClassifierName, salesData.Type1Classifier.Type1_ClassifierName);
                Assert.AreEqual(newType2ClassifierName, salesData.Type2Classifier.Type2_ClassifierName);
                Assert.AreEqual(newType3ClassifierName, salesData.Type3Classifier.Type3_ClassifierName);
                Assert.AreEqual(newType4ClassifierName, salesData.Type4Classifier.Type4_ClassifierName);
            }
        }
示例#8
0
        public void UpdateSales()
        {
            var _controller = new SalesController(_context);
            var _payments   = new List <Payments>();

            _payments.Add(new Payments()
            {
                Amount = 12222.55f, Description = "Test", Paymentdate = DateTime.Now, RecNo = 1
            });
            _payments.Add(new Payments()
            {
                Amount = 33333.55f, Description = "Test2", Paymentdate = DateTime.Now, RecNo = 2
            });
            SalesData _data = new SalesData()
            {
                CustomerId         = "1",
                Currency           = "AED",
                LocationName       = "Sydney",
                openingdebt        = 12456.23f,
                OperatorName       = "test",
                SalesInvoiceNumber = "12345-1234",
                Timestamp          = DateTime.Now,
                Payments           = _payments
            };
            var _response = _controller.Update(_data);

            Assert.IsTrue(_response, "Issue with update");
        }
示例#9
0
        /// <summary>
        /// Should forcast using 12 months data, falling back to 6 month if unavailable
        /// //ForcastSlope = _ForcastVals[0];
        //ForcastIntercept = _ForcastVals[1];
        //ForcastValue = _ForcastVals[2];
        //ForcastRangeUpperBount = _ForcastVals[3];
        /// </summary>
        /// <param name="SKUID"></param>
        private double[] Forcast(int SkuId, DateTime EndDate)
        {
            StatusMonContext db = new StatusMonContext();
            List <double>    SalesData;

            double[] xdata;
            double[] ydata;
            DateTime EndDate12 = EndDate.AddMonths(-12);
            DateTime EndDate6  = EndDate.AddMonths(-6);
            int      date      = (EndDate.Date.Year * 12 + EndDate.Date.Month);

            //Test if 12 Month of Data Exists
            if (db.SalesOrderDetails.Where(o => o.SalesOrder.OrderDate <= EndDate12).Count() > 0)
            {
                SalesData = MonthlySalesD(SkuId, EndDate.AddMonths(-11), EndDate);
                xdata     = new double[] { date - 11, date - 10, date - 9, date - 8, date - 7, date - 6, date - 5, date - 4, date - 3, date - 2, date - 1, date };
                //12 Months!
            }
            else if (db.SalesOrderDetails.Where(o => o.SalesOrder.OrderDate.Date <= EndDate6).Count() > 0)
            {
                //6 Months
                SalesData = MonthlySalesD(SkuId, EndDate.AddMonths(-5), EndDate);
                xdata     = new double[] { date - 5, date - 4, date - 3, date - 2, date - 1, date }; //Actual Values are nominal
            }
            else
            {
                //Not enough Data to forcast accurately
                db.Dispose();
                return(new double[] { 0, 0, 0, 0 });
            }
            db.Dispose();
            ydata = SalesData.ToArray();

            return(Linear.Forcast(date + 1, xdata, ydata));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            picker.Model = new ChartTypesModel(this);

            chart          = new FlexChart();
            chart.BindingX = "Name";
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Sales", Binding = "Sales,Sales"
            });
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Expenses", Binding = "Expenses,Expenses"
            });
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Downloads", Binding = "Downloads,Downloads"
            });
            chart.ItemsSource = SalesData.GetSalesDataList();
            this.Add(chart);

            C1Animation loadAnimation = new C1Animation();

            loadAnimation.Duration = new TimeSpan(1500 * 10000);
            loadAnimation.Easing   = C1Easing.Linear;
            chart.LoadAnimation    = loadAnimation;
            chart.AnimationMode    = AnimationMode.Point;
            //chart.ChartType = ChartType.Area;
            //chart.Stacking = Stacking.Stacked;
        }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Request"/> class.
 /// </summary>
 public Request()
 {
     TransactionData = new TransactionData();
     Enduser         = new EndUser();
     SalesData       = new SalesData();
     StatsData       = new StatsDetails();
 }
示例#12
0
 public PosMainViewModel(List <CategoryViewModel> goodsCategories, SaleListViewModel saleList, List <SaleListItemViewModel> saleListItems, List <SaleListViewModel> onHoldSaleLists)
 {
     this.GoodsCategoriesInfo = goodsCategories;
     this.SaleList            = saleList;
     this.SaleListItems       = new ObservableCollection <SaleListItemViewModel>(saleListItems);
     this.salesData           = new SalesData();
     this.OnHoldSaleLists     = new ObservableCollection <SaleListViewModel>(onHoldSaleLists);
 }
示例#13
0
        public IActionResult processExternalClients()
        {
            SalesData salesData  = new SalesData();
            int       numClients = salesData.processExternalClientData();

            ViewBag.Message = "Processed " + numClients + " client emails";
            return(View("Done"));
        }
示例#14
0
        public override global::System.Data.DataSet Clone()
        {
            SalesData cln = ((SalesData)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
示例#15
0
        // for development only.  Load Datascape emails
        public IActionResult DatascapeLoad(SalesData salesData)
        {
            Datascape datascape = new Datascape();

            datascape.loadEmails();
            ViewBag.Message = "Processed Datascape emails";
            return(View("Done"));
        }
示例#16
0
        // for development only.  Calculate commissions for payroll
        public IActionResult Commissions(SalesData salesData)
        {
            Payroll payroll = new Payroll();

            payroll.calculateWeeklyCommission(false);
            ViewBag.Message = "Processed commissions";
            return(View("Done"));
        }
示例#17
0
        // for development only.  Reconcile Datascape
        public IActionResult DatascapeReconciliation(SalesData salesData)
        {
            Datascape datascape = new Datascape();

            datascape.reconcileAll();
            ViewBag.Message = "Reconciled Datascape";
            return(View("Done"));
        }
示例#18
0
 private void DataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     SelectedData        = (SalesData)DataGrid.SelectedRows[0].DataBoundItem;
     Support1Upper.Value = (decimal)SelectedData.SupportRange1.SupportRange.UpperLimit;
     Support1Lower.Value = (decimal)SelectedData.SupportRange1.SupportRange.LowerLimit;
     Support2Upper.Value = (decimal)SelectedData.SupportRange2.SupportRange.UpperLimit;
     Support2Lower.Value = (decimal)SelectedData.SupportRange2.SupportRange.LowerLimit;
 }
 public OrderProcessorTest()
 {
     priceList      = new PriceList();
     salesData      = new SalesData();
     salesRegister  = new SalesRegister(salesData, priceList);
     mockNotifier   = new Mock <EmailNotifier>();
     mockChecker    = new Mock <BeverageQuantityChecker>();
     orderProcessor = new OrderProcessor(priceList, salesRegister, mockNotifier.Object, mockChecker.Object);
 }
示例#20
0
        public void ReturnErrorWhenSalesmanNameIsEmpty()
        {
            SalesData client = new SalesData(lineType: (ELineType)EnumeratorHelper.GetValueFromDescription <ELineType>("003"),
                                             saleId: "03",
                                             salesmanName: "");

            Assert.IsTrue(client.Notifications.Count == 1);
            Assert.IsTrue(client.Notifications.Count(c => c.Property.Equals("SalesData.SalesmanName") && c.Message.Equals("Informacao nao definida")) == 1);
        }
示例#21
0
        public IActionResult ProcessDatascape(SalesData salesData)
        {
            Datascape datascape = new Datascape();

            datascape.loadEmails();
            datascape.reconcileAll();
            ViewBag.Message = "Processed Datascape";
            return(View("Done"));
        }
示例#22
0
        protected void btnAddSales_Click(object sender, EventArgs e)
        {
            bool isDateAdded = salesHelper.CheckSaleDate(txtDate.Text, Convert.ToInt32(drpSalesGuy.SelectedItem.Value));

            if (!isDateAdded)
            {
                SalesData dailySale = new SalesData();
                dailySale.EntryDate       = txtDate.Text;
                dailySale.DailySaleAmount = txtDaySales.Text;
                dailySale.MonthlySales    = Request.Form[txtMonthlySales.UniqueID]; //txtMonthlySales.Text;
                dailySale.NetSales        = Request.Form[txtNetSales.UniqueID];     //txtNetSales.Text;
                if (Convert.ToInt32(dailySale.MonthlySales) > 0 && Convert.ToInt32(dailySale.MonthlySales) <= 4000)
                {
                    dailySale.CommisionPercentage = "20%";
                }
                else if (Convert.ToInt32(dailySale.MonthlySales) > 4000 && Convert.ToInt32(dailySale.MonthlySales) <= 7000)
                {
                    dailySale.CommisionPercentage = "25%";
                }
                else if (Convert.ToInt32(dailySale.MonthlySales) > 7000 && Convert.ToInt32(dailySale.MonthlySales) <= 9500)
                {
                    dailySale.CommisionPercentage = "28%";
                }
                else if (Convert.ToInt32(dailySale.MonthlySales) > 9501)
                {
                    dailySale.CommisionPercentage = "30%";
                }
                else if (drpSalesGuy.SelectedItem.Value == "5")
                {
                    dailySale.CommisionPercentage = "30%";
                }

                dailySale.Refunds           = txtRefunds.Text;
                dailySale.CashBonus         = txtBonus.Text;
                dailySale.DrawTakenInMonth  = txtMonthlyDrawsTaken.Text;
                dailySale.QBTotalPay        = Request.Form[txtQBTotalPay.UniqueID]; //txtQBTotalPay.Text;
                dailySale.SalesPersonID     = Convert.ToInt32(drpSalesGuy.SelectedItem.Value);
                dailySale.MonthlyOfficeRent = txtMonthlyOfficeRent.Text;
                dailySale.DailyBonus        = txtDailyBonusForMonth.Text;
                dailySale.CommisionInUSD    = Request.Form[txtCommision.UniqueID];
                bool isSalesAdded = salesHelper.AddSaleRecord(dailySale);
                if (isSalesAdded)
                {
                    Response.Write("<script>alert('Sales record added Successfully.');</script>");
                    ResetAll();
                }
                else
                {
                    Response.Write("<script>alert('Some error occured.');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Sale for this already added.Kindly edit the sale if you want any changes.');</script>");
            }
        }
        public void IngestAValidSalesData()
        {
            var salesData = new SalesData();

            var salesmanData = "003ç10ç[1-10-100,2-30-2.50,3-40-3.10]çPedro";

            var response = salesData.Parse(salesmanData);

            Assert.True(response.IsValid);
        }
示例#24
0
        public void ShouldPrintSalesReport()
        {
            var salesData = new SalesData();

            salesData.Coffee     = 1;
            salesData.TotalSales = (decimal)0.60;
            var salesReporter = new SalesReporter(salesData);
            var result        = salesReporter.GenerateReport();

            Assert.Equal("Coffee: 1\nTea: 0\nHot Chocolate: 0\nOrange Juice: 0\n\nTotal Sales: $0.60", result);
        }
示例#25
0
        public void UpdateSalesData(SalesData salesData)
        {
            var data = _context.SalesStatisticItems.FirstOrDefault(x => x.Id == salesData.Id);

            if (data == null)
            {
                throw new NotImplementedException();
            }
            _context.Entry(data).CurrentValues.SetValues(salesData);
            _context.SaveChanges();
        }
示例#26
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            SalesData ds = new SalesData();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
 //some fields....
 public object Clone()
 {
     return(new Foo()
     {
         Zipcode = Zipcode,
         StateCode = StateCode,
         SalesData = SalesData == null ? null : SalesData.Copy(),
         OtherDataTable = OtherDataTable == null ? null : OtherDataTable.Copy(),
         VehicleDetails = VehicleDetails.Clone() as VehicleDetails,
         VehicleCondition = VehicleCondition.Clone() as VehicleCondition,
     });
 }
示例#28
0
        /// <summary>
        /// Initializes the sales data.
        /// </summary>
        private void InitializeSalesData()
        {
            DateTime now = DateTime.Now;

            for (int month = 1; month <= 12; month++)
            {
                var monthDate = new DateTime(now.Year, month, 1);
                SalesData.Add(new MonthlySalesData(GetRandomSalesValue(), monthDate));
            }

            this.SalesData2 = new TimeAggregatedDataGenerator(new double[] { 10.5, 19.5, 14.3, 4.8, 8.4, -1.3, 7.7, 1.8, -1.8, -9.4, -9.7, -6.2, 2.0, 11.2, 18.6, 27.4, 18.7, 11.3, 9.2 });
            this.SalesData3 = new TimeAggregatedDataGenerator(new double[] { -1800, -6200, 11300, 9200, 9500, 18500, 14300, 4800, 8400, -1300, 9700, 4000, 10200, 19000, 12000, 11000, 9000, 100, 1800 });
        }
示例#29
0
        public PosMain()
        {
            InitializeComponent();
            var category       = new CategoryInfo();
            var salesData      = new SalesData();
            var saleList       = salesData.GetCurrentSaleList();
            var saleListItems  = salesData.GetSaleListItem(saleList.SheetID);
            var saleListOnHold = salesData.GetOnHoldSaleList();
            //TO DO: get on hold sheet list from salesData
            var vm = new PosMainViewModel(category.GetGoodsCategoryInfo(), saleList, saleListItems, saleListOnHold);

            DataContext = vm;
        }
        public void IngestAValidSalesDataVerifySalesId()
        {
            var salesData = new SalesData();

            var salesmanData = "003ç08ç[1-34-10,2-33-1.50,3-40-0.10]çPaulo Açaí";

            var response = salesData.Parse(salesmanData);

            Assert.True(response.IsValid);

            Assert.IsType <SalesData>(response.Model);

            Assert.Equal(8, response.Model?.SaleId);
        }
        public BillDetailsWindow(SalesData salesData)
        {
            InitializeComponent();

            datePicker.SelectedDate = salesData.dateSales;
            invoiceNumberTB.Text = salesData.invoiceNo;
            customerInfoTb.Text = salesData.customerId;
            long totAmount = Convert.ToInt64(salesData.totalAmount);
            totalAmountLabel.Content = totAmount;
            paymentAmountTB.Text = salesData.payment.ToString();
            priceInWordLabel.Content = SPTHelper.NumberToWords(totAmount) + " Only.";
            ConnectFetchFromSaleslistTable(salesData.invoiceNo);

            SetSalesBillingInfoFromSPTSettings();
        }
        private Sale ToObject(SalesData.Sale sale)
        {
            var objectSale = new Sale(sale.SaleID, ToObject(sale.Manager), ToObject(sale.Client), ToObject(sale.Product), sale.SaleDate);

            return objectSale;
        }
        private Product ToObject(SalesData.Product product)
        {
            var objectProduct = new Product(product.ProductID, product.ProductName, product.ProductCost);

            return objectProduct;
        }
        private Client ToObject(SalesData.Client client)
        {
            var objectClient = new Client(client.ClientID, client.ClientName);

            return objectClient;
        }
        private Manager ToObject(SalesData.Manager manager)
        {
            var objectManager = new Manager(manager.ManagerID, manager.MangerName);

            return objectManager;
        }
        private void ConnectFetchFromSaleslistTable()
        {
            //define the connection reference and initialize it
            msqlConnection = new MySql.Data.MySqlClient.MySqlConnection("server=localhost;user id=root;Password=technicise;database=sptdb;persist security info=False");

            try
            {
                //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();

                //define the connection used by the command object
                msqlCommand.Connection = msqlConnection;

                //open the connection
                if (msqlConnection.State != System.Data.ConnectionState.Open)
                    msqlConnection.Open();

                TimeSpan diff = (TimeSpan)(endDatePicker.SelectedDate - startDatePicker.SelectedDate);
                msqlCommand.CommandText = "SELECT * FROM saleslist where date(saleslist.dateSales) >= DATE_SUB( @enddate, INTERVAL @diff DAY);";
                msqlCommand.Parameters.AddWithValue("@enddate", endDatePicker.SelectedDate);
                msqlCommand.Parameters.AddWithValue("@diff", diff.Days);

                MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();

                _salesDataCollection.Clear();

                while (msqlReader.Read())
                {
                    SalesData salesData = new SalesData();
                    salesData.customerId = msqlReader.GetString("customerId");
                    salesData.customerName = msqlReader.GetString("customerName"); //add
                    salesData.dateSales = msqlReader.GetDateTime("dateSales");
                    salesData.invoiceNo = msqlReader.GetString("invoiceNo");
                    salesData.payment = msqlReader.GetDouble("payment");
                    salesData.totalAmount = msqlReader.GetDouble("totalAmount");
                    //salesData.serialNo = (_salesDataCollection.Count + 1).ToString();

                    _salesDataCollection.Add(salesData);
                }

            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
        }