/// <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();
         }
     }
 }
예제 #2
0
        /// <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;
            }
        }