public SaleInfo GetSaleInfo( ) { DateTime s = DateTime.Now; Logs.LogMe("Sale Info Date: " + s.ToShortDateString()); string cd = "" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/" + DateTime.Now.Year; string cy = "" + DateTime.Now.Year; string cm = "" + DateTime.Now.Month; Logs.LogMe("Date " + cd + "=" + DateTime.Now.ToLongDateString()); SqlCommand cmd = new SqlCommand(SaleQuery.QueryAll, Db.DBCon); cmd.Parameters.AddWithValue("@CDate", cd); cmd.Parameters.AddWithValue("@CYear2", cy); cmd.Parameters.AddWithValue("@CMon", cm); cmd.Parameters.AddWithValue("@CYear", cy); SqlDataReader reader = cmd.ExecuteReader(); SaleInfo info = new SaleInfo(); if (reader != null && reader.HasRows) { reader.Read(); info.MonthlySale = "" + reader["MAmount"]; info.TodaySale = "" + reader["TAmount"]; info.YearlySale = "" + reader["YAmount"]; Logs.LogMe("Sale Info: " + reader["TAmount"] + "==" + reader["MAmount"] + "==" + reader["YAmount"]); } reader.Close(); return(info); }
// GET: Sale public ActionResult Index() { var model = new List <SaleInfo>(); using (var db = new Task1Entities()) { var query = (from ps in db.ProductSold join c in db.Customer on ps.Customer_Id equals c.Id join p in db.Product on ps.Product_Id equals p.Id join s in db.Store on ps.Store_Id equals s.Id select new { c.Cust_Name, p.Product_Name, s.Store_Name, ps.Date_Sold }).ToList(); foreach (var item in query) { SaleInfo sale = new SaleInfo(); sale.Cust_Name = item.Cust_Name; sale.Product_Name = item.Product_Name; sale.Store_Name = item.Store_Name; sale.Date_Sold = item.Date_Sold; model.Add(sale); } } return(View("SaleIndex", model)); }
private void button10_Click(object sender, EventArgs e) { SaleInfo si = new SaleInfo(userId); si.Show(); this.Hide(); }
public Task <SaleInfo> AddSaleAsync(SaleInfo sale) { Random randNum = new Random(); sale.NumberOrder = randNum.Next(2000000000); return(_dal.AddSaleAsync(sale)); }
public void CanCreateSale2() { ISalesInfoRepository repo = RepoFactory.CreateSaleInfoRepo(); SaleInfo sale = new SaleInfo() { City = "City", ZipCode = 12345, Name = "TestSale", Email = "*****@*****.**", PurchasePrice = 100M, Phone = "123-123-1234", State = "MN", StreetOne = "Street one", PurchaseDate = DateTime.Today, StreetTwo = "", PurchaseType = "Bank", UserId = "0000-000000-0000000-0000000", VehicleId = 300, }; var result = repo.Create(sale); Assert.AreEqual(sale, result); }
public ActionResult SaleEdit(SaleInfo sale) { TryValidateModel(sale); if (ModelState.IsValid) { var repositoryTransfer = new RepoTransfer(); var saleDTO = repositoryTransfer.GetSales().FirstOrDefault(s => (s.Id == sale.Id)); saleDTO.Date = sale.Date; saleDTO.Manager = sale.Manager; saleDTO.Client = sale.Client; saleDTO.Product = sale.Product; saleDTO.PriceSum = sale.PriceSum; repositoryTransfer.UpdateSaleInfo(saleDTO); if (Request.IsAjaxRequest()) { return new EmptyResult(); } else { return View("Index"); } } else { return View("Error"); } }
public void CancelSale_Success() { SetupMessage(creator, 0); var store = new NFTStore(mContractState.Object); var saleInfo = new SaleInfo { Price = 100, Seller = tokenOwner }; SetSaleInfo(saleInfo); SetupMessage(tokenOwner, 0); SetupSafeTransferToken(contract, tokenOwner, tokenId, TransferResult.Succeed()); store.CancelSale(tokenContract, tokenId); store.GetSaleInfo(tokenContract, tokenId) .Should() .Be(default(SaleInfo)); VerifyLog(new TokenSaleCanceledLog { Contract = tokenContract, TokenId = tokenId, Seller = tokenOwner }); }
//======================================= //Return the sale info against give order id //From sale file //======================================= public SaleInfo getInfo(int order_Id) { SaleInfo i = new SaleInfo(); StreamReader sr = new StreamReader("Sale.txt"); string data; while ((data = sr.ReadLine()) != null) { string[] breaker = data.Split(';'); i.OrderId = int.Parse(breaker[0]); i.CostumerId1 = int.Parse(breaker[1]); i.Creationdate = breaker[2]; i.Status = Boolean.Parse(breaker[3]); if (i.OrderId.Equals(order_Id)) { sr.Close(); return(i); } } sr.Close(); return(i); }
public void Buy_Token_Buying_Success() { SetupMessage(creator, 0); var store = new NFTStore(mContractState.Object); var saleInfo = new SaleInfo { Price = 100, Seller = tokenOwner }; SetSaleInfo(saleInfo); SetupMessage(buyer, 100); SetupSafeTransferToken(contract, buyer, tokenId, TransferResult.Succeed()); SetupTransfer(tokenOwner, 100, TransferResult.Succeed()); store.Buy(tokenContract, tokenId); VerifyLog(new TokenPurchasedLog { Contract = tokenContract, TokenId = tokenId, Seller = tokenOwner, Buyer = buyer }); store.GetSaleInfo(tokenContract, tokenId) .Should() .Be(default(SaleInfo)); }
/// <summary> /// Marks car as sold with date /// </summary> /// <param name=”sold”> /// Parameter sold requires a SaleInfo object argument. /// </param> /// <returns> /// NULL - If the car does not exist /// List of CarCardDTO - List of cars that are not sold /// </returns> public IEnumerable <CarCardDTO> SellCar(SaleInfo sold) { var carInfo = _db.SaleInfos.SingleOrDefault(si => si.SerialNum == sold.SerialNum); if (carInfo == null) { return(null); } else { carInfo.DateOfSale = sold.DateOfSale; _db.SaveChanges(); var cars = (from c in _db.SaleInfos where c.CarSaleID == carInfo.CarSaleID && c.DateOfSale.Year < 2017 select new CarCardDTO { serialNum = c.SerialNum, manufacturer = (from car in _db.Cars join ma in _db.Manufacturers on car.ManufacturerID equals ma.ID where c.CarID == car.ID select ma.Name).SingleOrDefault(), model = (from car in _db.Cars join mo in _db.Models on car.ModelID equals mo.ID where c.CarID == car.ID select mo.Name).SingleOrDefault(), modelType = (from car in _db.Cars join mt in _db.ModelTypes on car.ModelTypeID equals mt.ID where c.CarID == car.ID select mt.Name).SingleOrDefault(), imgLink = (from img in _db.Pictures where c.SerialNum == img.CarSerialNum && img.Primary == true select img.Link).SingleOrDefault(), price = c.Price, offerPrice = c.OfferPrice, milage = (from car in _db.Cars where car.ID == c.CarID select car.Milage).SingleOrDefault(), transmission = (from car in _db.Cars join trans in _db.Transmissions on car.TransmissionID equals trans.ID where car.ID == c.CarID select trans.Name).SingleOrDefault(), onSite = c.OnSite, year = (from car in _db.Cars where c.CarID == car.ID select car.Year).SingleOrDefault(), regNum = (from car in _db.Cars where c.CarID == car.ID select car.LicenceNumber).SingleOrDefault(), }).ToArray(); return(cars); } }
//constructor public ManageSalesOrderList() { //loading sale list SaleManager saleManager = new SaleManager(); for (Iterator i = saleManager.getAllSaleOrders().iterator(); i.hasNext();) { SaleInfo saleInfo = (SaleInfo)i.next(); SaleInfoNJ saleInfoNJ = new SaleInfoNJ(); saleInfoNJ.OrderNo = saleInfo.getOrderNo(); saleInfoNJ.StatusId = saleInfo.getStatusId(); saleInfoNJ.Remarks = saleInfo.getRemarks(); for (Iterator j = saleInfo.getProductList().iterator(); j.hasNext();) { ProductInfo productInfo = (ProductInfo)j.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); productInfoNJ.Quantity = productInfo.getQuantity(); saleInfoNJ.ProductList.Add(productInfoNJ); } CustomerInfo customerInfo = new CustomerInfo(); CustomerInfoNJ customerInfoNJ = new CustomerInfoNJ(); customerInfoNJ.ProfileInfoNJ.Id = saleInfo.getCustomerInfo().getProfileInfo().getId(); customerInfoNJ.ProfileInfoNJ.FirstName = saleInfo.getCustomerInfo().getProfileInfo().getFirstName(); customerInfoNJ.ProfileInfoNJ.LastName = saleInfo.getCustomerInfo().getProfileInfo().getLastName(); saleInfoNJ.CustomerInfoNJ = customerInfoNJ; SaleOrderList.Add(saleInfoNJ); } }
private void Autogenerate() { SaleController saleController = new SaleController(); SaleInfo saleInfo = saleController.AutogenerateCode(code); this.txtSaleNo.Text = saleInfo.AutoCode; }
private void NewEditExit_NewClick(object sender, EventArgs e) { try { switch (NewEditExit.BtnNewText) { case "&New": this.NewControl(); break; case "&Save": if (this.CheckRequiredFields()) { SaleController saleController = new SaleController(); SaleInfo saleInfo = new SaleInfo(); CustomerInfo custInfo = new CustomerInfo(); SaleDetailInfo saleDetailInfo = new SaleDetailInfo(); GetCustomerInfo(custInfo); GetSaleInfo(saleInfo); GetSaleDetailInfo(saleDetailInfo); saleController.Insert(saleInfo, custInfo, saleDetailInfo); this.InitializeControls(); Globalizer.ShowMessage(MessageType.Information, "Saved Successfully"); this.ResetControl(); } break; case "&Update": if (this.CheckRequiredFields()) { SaleController saleController = new SaleController(); SaleInfo saleInfo = new SaleInfo(); CustomerInfo custInfo = new CustomerInfo(); SaleDetailInfo saleDetailInfo = new SaleDetailInfo(); GetCustomerInfo(custInfo); GetSaleInfo(saleInfo); GetSaleDetailInfo(saleDetailInfo); saleController.Update(saleInfo, custInfo, saleDetailInfo); this.InitializeControls(); //this.ResetControl(); Globalizer.ShowMessage(MessageType.Information, "Updated Successfully"); this.ResetControl(); } break; } } catch (Exception ex) { Globalizer.ShowMessage(MessageType.Critical, ex.Message); } }
public async Task <SaleInfo> AddSaleAsync(SaleInfo sale) { await _dbContext.AddAsync(sale); await _dbContext.SaveChangesAsync(); return(sale); }
public ActionResult DeleteConfirmed(int id) { SaleInfo saleInfo = db.SaleInfo.Find(id); db.SaleInfo.Remove(saleInfo); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Post([FromBody] SaleInfo saleInfo) { Console.Out.WriteLine("Received post message with the seller Id " + saleInfo.sellerId + " and the totalprice " + saleInfo.totalPrice); double taxedPrice = _taxCalculator.NewTaxValue(saleInfo); _externalTaxComms.SendToExternalTaxSystems(saleInfo, taxedPrice); }
public SaleInfo Create(SaleInfo sale) { sale.SaleInfoId = GetNextId(); var vehicleRepo = new VehicleRepoMock(); vehicleRepo.ChangeToSold(sale.VehicleId); _sales.Add(sale); return(sale); }
//======================================= //Start new payment //======================================= public void startPayment(int order_id) { r_add = new ReceiptDal(); info = new saleDal(); s = info.getInfo(order_id); c_info = new customerBll(); c = c_info.Search(s.CostumerId1); calculateTotal(); calCulatePayed(); }
//======================================= //Add new sale //======================================= public void recordSale(SaleInfo obj) { string itemToAdd = obj.OrderId + ";" + obj.CostumerId1 + ";" + obj.Creationdate + ";" + obj.Status; FileStream add = new FileStream("Sale.txt", FileMode.Append); StreamWriter addItem = new StreamWriter(add); addItem.WriteLine(itemToAdd); addItem.Close(); add.Close(); }
public double NewTaxValue(SaleInfo saleInfo) { logger.LogInformation("Calculating tax for " + saleInfo.sellerId); double newTaxValue = (saleInfo.totalPrice * 0.02) + saleInfo.totalPrice; logger.LogInformation("Taxed totalprice is " + newTaxValue); return(newTaxValue); }
public ActionResult Edit([Bind(Include = "SaleInfoID,ManagerID,ClientName,ProductName,ProductCost,DateOfSale")] SaleInfo saleInfo) { if (ModelState.IsValid) { db.Entry(saleInfo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ManagerID = new SelectList(db.Managers, "ManagerID", "LastName", saleInfo.ManagerID); return(View(saleInfo)); }
public ActionResult SaleEdit(int id) { var repositoryTransfer = new RepositoryTransfer(); var saleDTO = repositoryTransfer.GetSales().FirstOrDefault(s => (s.Id == id)); var sale = new SaleInfo() { Id = saleDTO.Id, Date = saleDTO.Date, Manager = saleDTO.Manager, Client = saleDTO.Client, Product = saleDTO.Product, Amount = saleDTO.Amount }; return(PartialView("SaleEdit", sale)); }
public bool AddSellerInfo(SaleInfo newInfo) { if (newInfo == null) { return(false); } _db.SaleInfos.Add(newInfo); _db.SaveChanges(); return(true); }
private static List <SaleInfo> ReadCurrentExcel(string path) { List <SaleInfo> allSales = new List <SaleInfo>(); using (OleDbConnection conn = new OleDbConnection(path)) { conn.Open(); string command = @"select * from [Sales$]"; OleDbDataAdapter adapter = new OleDbDataAdapter(command, conn); DataTable table = new DataTable(); using (adapter) { adapter.FillSchema(table, SchemaType.Source); adapter.Fill(table); } int counter = 0; string[] splittedName = path.Split(new string[] { "-Sales-Report-" }, StringSplitOptions.RemoveEmptyEntries); string location = splittedName[0].Substring(splittedName[0].LastIndexOf('\\')); int dotIndex = splittedName[1].IndexOf('.'); string date = splittedName[1].Substring(0, dotIndex); foreach (DataRow row in table.Rows) { SaleInfo currentSale = new SaleInfo(); List <decimal> info = new List <decimal>(); bool getInside = false; foreach (DataColumn col in table.Columns) { if (row[col].ToString() != "") { info.Add(decimal.Parse(row[col].ToString())); // Console.Write(row[col].ToString() + " "); getInside = true; } } if (getInside && counter != table.Rows.Count - 1) { currentSale.ProductId = (int)info[0]; currentSale.Quantity = (int)info[1]; currentSale.UnitPrice = info[2]; currentSale.Sum = info[3]; currentSale.Location = location; currentSale.SaleDate = DateTime.ParseExact(date, "dd-MMM-yyyy", CultureInfo.InvariantCulture); allSales.Add(currentSale); } counter++; } } return(allSales); }
public IEnumerable <CarCardDTO> SellCar(int serialNum) { DateTime localDate = DateTime.Now; SaleInfo soldCar = new SaleInfo() { DateOfSale = localDate, SerialNum = serialNum }; return(_repo.SellCar(soldCar)); }
public ActionResult Edit(SaleInfo item) { if (ModelState.IsValid) { _repository.Update(item); _repository.Save(); return(RedirectToAction("Index")); } else { return(View(item)); } }
public ActionResult Edit([Bind(Include = "Id,Dato,Sum,ID_Manager,ID_Client,ID_Product")] SaleInfo saleInfo) { if (ModelState.IsValid) { db.Entry(saleInfo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_Client = new SelectList(db.Client, "Id", "ClientName", saleInfo.Client.ClientName); ViewBag.ID_Manager = new SelectList(db.Manager, "Id", "ManagerName", saleInfo.ID_Manager); ViewBag.ID_Product = new SelectList(db.Product, "Id", "ProductName", saleInfo.ID_Product); return(View(saleInfo)); }
public async Task <int> SellBallotAsync(SaleInfo saleInfo) { Draw draw = _drawRepository.Get(saleInfo.DrawNumber); Customer customer = _customerRepository.Get(saleInfo.CustomerNumber); Ballot soldBallot = await _lottery.SellBallotAsync(draw, saleInfo.LastNumber); customer.AddBallot(soldBallot); _ballotRepository.Update(soldBallot, soldBallot.Id); _customerRepository.Update(customer, customer.Number); return(soldBallot.Number); }
//======================================== // update() Add the total of current bill in costumer payables and save sale information //======================================== public void update(string dta) { purchaser.Payables = purchaser.Payables + Total(); c_Info.updateCustomer(purchaser); SaleInfo s = new SaleInfo(); s.CostumerId1 = purchaser.CustomerId; s.OrderId = count.OrderCounter; s.Creationdate = dta; s.Status = false; recordDate.recordSale(s); recordDate.saleLine(saleLineItems); itemPurchased = null; }
// GET: Default/SaleInfoes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SaleInfo saleInfo = db.SaleInfo.Find(id); if (saleInfo == null) { return(HttpNotFound()); } return(View(saleInfo)); }
/// <summary> /// Called when Button SendToViewModel is clicked /// </summary> private void OnAdd() { ProductInfo productInfo = new ProductInfo(); productInfo.setUnitPrice(Price); productInfo.setQuantity(OrderItemQuantity); productInfo.setDiscount(OrderItemDiscount); productInfo.setPurchaseOrderNo(productInfo.getPurchaseOrderNo()); List productList = new ArrayList(); productList.add(productInfo); SaleInfo saleInfo = new SaleInfo(); CustomerInfo customerInfo = new CustomerInfo(); saleInfo.setProductList(productList); saleInfo.setCustomerUserId(customerInfo.getUserInfo().getId()); saleInfo.setOrderNo(saleInfo.getOrderNo()); saleInfo.setStatusId(saleInfo.getStatusId()); saleInfo.setRemarks(saleInfo.getRemarks()); SaleManager saleManager = new SaleManager(); saleManager.addSaleOrder(saleInfo); MessageBox.Show("Save Successfully"); }