/// <summary> /// injects other tables /// </summary> /// <param name="cart">cart table</param> /// <param name="shoppingCartItem">shopping cart item table</param> /// <param name="order">order table</param> /// <param name="userManager">identityd table</param> /// <param name="ordereditems">ordered items table</param> /// <param name="emailSender">email table</param> public CheckoutController(ICart cart, IShoppingCartItem shoppingCartItem, IOrder order, UserManager <ApplicationUser> userManager, IOrderedItems ordereditems, IEmailSender emailSender) { _ordereditems = ordereditems; _cart = cart; _order = order; _shoppingCartItem = shoppingCartItem; _userManager = userManager; _emailSender = emailSender; }
/// <summary> /// This method displays the bill details on entering the bill number. /// </summary> /// <param name="sender"></param> /// <param name="e">returns void</param> protected void btnSubmit_Click(object sender, EventArgs e) { btnEdit.Visible = true; btnCalculate.Visible = false; btnCancel.Visible = true; //if (!IsPostBack) { IBillDetails objBillDetails = BillDetailsBOFactory.CreateBillDetailsObject(); IOrderedItems objItem = OrderedItemsBOFactory.CreateOrderedItemsObject(); ISalesPersonBLL objBLL = SalesPersonBLLFactory.CreateSalesPersonBLLObject(); int billNumber = Convert.ToInt32(txtBillNo.Text); List <IBillDetails> lstBillDetails = objBLL.GetBillDetails(billNumber); if (lstBillDetails.Count == 0) { lblMessage.Text = "No Bill Found"; } else { gvshowBillItems.DataSource = lstBillDetails; gvshowBillItems.DataBind(); } } }
/// <summary> /// This method will place an order for the selected item. /// </summary> protected void btnPlaceOrder_Click(object sender, EventArgs e) { IInventoryManagerBLL objInventoryManagerBLL = InventoryManagerBLLFactory.CreateInventoryManagerBLLObject(); // Iorder objOrder = BOFactory.OrderBOFactory.CreateOrderObject(); //for (int j = 0; j < gvshowItems.Rows.Count; j++) //objOrder.OrderDate = date; bool isPlaced = false; List <Iorder> lstOrders = new List <Iorder>(); List <IOrderedItems> lstOrderItems = new List <IOrderedItems>(); try { for (int i = 0; i < gvShowItems.Rows.Count; i++) { GridViewRow gvEmployeeRow = gvShowItems.Rows[i]; Iorder objOrders = OrderBOFactory.CreateOrderObject(); objOrders.VendorId = Convert.ToInt32(((DropDownList)gvEmployeeRow.FindControl("ddlVendor")).SelectedItem.Value); //objOrders.OrderDate = (gvEmployeeRow.Cells[2].Text); objOrders.OrderDate = date; //objOrders. = (gvEmployeeRow.Cells[3].Text); //objEmployee.MobileNumber = Convert.ToInt64(gvEmployeeRow.Cells[5].Text); lstOrders.Add(objOrders); } for (int i = 0; i < gvShowItems.Rows.Count; i++) { GridViewRow gvEmployeeRow = gvShowItems.Rows[i]; IOrderedItems objOrderItems = OrderedItemsBOFactory.CreateOrderedItemsObject(); objOrderItems.ItemCategory = Convert.ToInt32(gvEmployeeRow.Cells[3].Text); objOrderItems.ItemId = Convert.ToInt32(gvEmployeeRow.Cells[1].Text); objOrderItems.ItemName = gvEmployeeRow.Cells[2].Text; objOrderItems.ItemQuantity = Convert.ToInt32(((TextBox)gvEmployeeRow.FindControl("txtOrderQuantity")).Text); //objOrders. = (gvEmployeeRow.Cells[3].Text); //objEmployee.MobileNumber = Convert.ToInt64(gvEmployeeRow.Cells[5].Text); lstOrderItems.Add(objOrderItems); } isPlaced = objInventoryManagerBLL.PlaceOrder(lstOrders, lstOrderItems); if (isPlaced) { LabelMessage.Visible = true; LabelMessage.Text = "Ordered Placed Successfully"; } //List<Iorder> list = new List<Iorder>(); //list = lstOrders.Distinct().ToList(); //for (int i = 0; i < list.Count;i++ ) //{ // List<IOrderedItems> orderList = new List<IOrderedItems>(); // foreach (IOrderedItems item in lstOrderItems) // { // } //} //objEmployee.RoleId =Convert.ToInt32(ddlNewRole.SelectedValue); } catch (Exception ex) { lblMessage.Text = "An error occurred while updating Employee details"; } finally { //objOrder = null; objInventoryManagerBLL = null; } }
/// <summary> /// access to other tables /// </summary> /// <param name="order">order table</param> /// <param name="ordereditems">ordereditems tables</param> /// <param name="authorizationService">roles table</param> public AdminModel(IOrder order, IOrderedItems ordereditems, IAuthorizationService authorizationService) { _order = order; _ordereditems = ordereditems; _AuthorizationService = authorizationService; }