//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); }
public void AcceptanceCreateBacklogTest() { IBacklogRepo repo = new BacklogRepoTest(); ITotalOrder totalOrder = new TotalOrder(); RequestHandler requestHandler = new RequestHandler(repo, totalOrder, _userRepo.Object, null, null); BacklogCreationRequest backlogCreationRequest = new BacklogCreationRequest { Title = "The backlog", UserStories = new string[] { "A", "B", "C" }, UserId = 123 }; var(status, result) = requestHandler.HandleBacklogCreationRequest(backlogCreationRequest); status.Should().BeOfType(typeof(Success)); // expected result BacklogEvalQueryResult expectedResult = new BacklogEvalQueryResult { Id = "7", NumberOfSubmissions = 1, Title = "The backlog", UserStories = new string[] { "A", "B", "C" } }; result.Should().BeEquivalentTo(expectedResult); }
public void No_orders() { var itemOrders = new string[0][]; var result = TotalOrder.Calculate(itemOrders); Assert.AreEqual(0, result.Length); }
public static void IntTotalOrderTest(int x, int y) { var order = TotalOrder.Make <int>((a, b) => a <= b); Assert.Equal(x < y, order.Le(x, y)); Assert.Equal(x <= y, order.Leq(x, y)); Assert.Equal(x >= y, order.Geq(x, y)); Assert.Equal(x > y, order.Ge(x, y)); }
public void Calculate_just_one() { var itemOrders = new[] { new[] { "1", "2", "3" } }; var result = TotalOrder.Calculate(itemOrders); Assert.AreEqual(new[] { "1", "2", "3" }, result); }
public static void FromComparableTest(int x, int y) { var r = TotalOrder.FromComparable <int>(); Assert.Equal(x < y, r.Le(x, y)); Assert.Equal(x <= y, r.Leq(x, y)); Assert.Equal(x == y, r.Eq(x, y)); Assert.Equal(x != y, r.Neq(x, y)); Assert.Equal(x >= y, r.Geq(x, y)); Assert.Equal(x > y, r.Ge(x, y)); }
public static void TotalOrderTest(int x, int y) { var r = TotalOrder.Make <int>((x, y) => x <y ? (short)-1 : x> y ? (short)1 : (short)0); Assert.Equal(x < y, r.Le(x, y)); Assert.Equal(x <= y, r.Leq(x, y)); Assert.Equal(x == y, r.Eq(x, y)); Assert.Equal(x != y, r.Neq(x, y)); Assert.Equal(x >= y, r.Geq(x, y)); Assert.Equal(x > y, r.Ge(x, y)); }
public ActionResult Payment(long customerID, decimal?TotalMoney, string shipName, string mobile, string address) { var totalorderdao = new TotalOrderDAO(); var totalorder = new TotalOrder(); totalorder.CustomerID = customerID; totalorder.CreateDate = DateTime.Now; totalorder.CustomerName = shipName; totalorder.Phone = mobile; totalorder.Address = address; totalorder.TotalPrice = TotalMoney; totalorder.Status = 0; try { var idTotalOrder = totalorderdao.Insert(totalorder); var cart = (List <CartItem>)Session[CartSession]; var listshopID = cart.GroupBy(x => x.Product.CreateBy).Select(group => new { ID = group.Key }); foreach (var shop in listshopID) { var shoporderdao = new ShopOrderDAO(); var shoporder = new ShopOrder(); shoporder.IDTotalOrder = idTotalOrder; shoporder.IDMerchant = shop.ID; shoporder.Status = 0; var idShopoder = shoporderdao.Insert(shoporder); decimal?tongtienshop = 0; foreach (var detail in cart) { if (detail.Product.CreateBy == shop.ID) { var detailorderdao = new OrderDetailDAO(); var detailorder = new OrderDetail(); detailorder.IDProduct = detail.Product.ID; detailorder.Price = detail.Product.Price; detailorder.Quantity = detail.Quantity; detailorder.IDShopOrder = idShopoder; tongtienshop += detailorder.Price * detailorder.Quantity; detailorderdao.Insert(detailorder); } new ProductDAO().UpdateQuantity(detail.Product.ID, detail.Quantity); } shoporderdao.UpdateTotalPrice(idShopoder, tongtienshop); } } catch (Exception ex) { // de cho vui return(Redirect("/loi-thanh-toan")); } Session[CartSession] = null; new ProductDAO().SetProductOutOfStock(); return(RedirectToAction("SuccessPayment")); }
public void Calculate_several() { var itemOrders = new[] { new[] { "1", "2", "3" }, new[] { "3", "1", "2" } }; var result = TotalOrder.Calculate(itemOrders); // 1=0+1=1, 2=1+2=3, 3=2+0=2 Assert.AreEqual(new[] { "1", "3", "2" }, result); }
//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(); }
public void HandleGetBacklogsFailureTest() { var repo = new Mock <BacklogRepoTest>(); ITotalOrder totalOrder = new TotalOrder(); repo.Setup(s => s.GetAll()).Throws(new Exception()); var requestHandler = new RequestHandler(repo.Object, totalOrder, null, null, null); var result = requestHandler.HandleBacklogsShowRequest(); Assert.That(result is Failure); }
public static void IntInfinityTotalOrderTest(Maybe <int> x, Maybe <int> y, int expected) { var order = TotalOrder.Make <int>((a, b) => a <= b).LiftTotalOrderWithInfinity(); Assert.Equal(expected < 0, order.Le(x, y)); Assert.Equal(expected >= 0, !order.Le(x, y)); Assert.Equal(expected <= 0, order.Leq(x, y)); Assert.Equal(expected > 0, !order.Leq(x, y)); Assert.Equal(expected >= 0, order.Geq(x, y)); Assert.Equal(expected < 0, !order.Geq(x, y)); Assert.Equal(expected > 0, order.Ge(x, y)); Assert.Equal(expected <= 0, !order.Ge(x, y)); }
public void HandleGetBacklogsSuccessfulTest() { IBacklogRepo repo = new BacklogRepoTest(); ITotalOrder totalOrder = new TotalOrder(); RequestHandler requestHandler = new RequestHandler(repo, totalOrder, null, null, null); var result = (Success <BacklogShowQueryResult>)requestHandler.HandleBacklogsShowRequest(); Assert.That(result.Data.Backlogs.Count == 2); foreach (var backlog in result.Data.Backlogs) { Assert.That(backlog.UserStoryCount == 3); Assert.That(backlog.VoteCount == 1); } }
public void TestOrder2() { TotalOrder totalOrder = new TotalOrder(); Submission[] submissions = new[] { new Submission { Indexes = new[] { 3, 4, 1, 0, 2 } }, new Submission { Indexes = new[] { 0, 2, 1, 3, 4 } } }; int[] testRef = new int[] { 0, 3, 1, 2, 4 }; var result = totalOrder.Order(submissions); result.Should().Equal(testRef); }
private void btn_Clear_Click(object sender, EventArgs e) { Small.Value = 0; Medium.Value = 0; Large.Value = 0; ExtraCheese.Checked = false; Pepperoni.Checked = false; Sausage.Checked = false; Soda.Clear(); Wings.Clear(); BreadSticks.Clear(); Pizzas.Clear(); Topings.Clear(); Extras.Clear(); TotalOrder.Clear(); }
//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."); } }
public long Insert(TotalOrder totaloder) { db.TotalOrders.Add(totaloder); db.SaveChanges(); return(totaloder.ID); }