/// <summary>
        /// Function to delete any selected item(s) from the bill list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnDelete_Click(object sender, EventArgs e)
        {
            bool       isSelected       = false;
            List <int> selectedItemList = new List <int>();

            for (int i = 0; i < gvBillWindow.Rows.Count; i++)
            {
                GridViewRow gvItemRow = gvBillWindow.Rows[i];
                isSelected = ((CheckBox)gvItemRow.FindControl("chkItemID")).Checked;
                if (isSelected)
                {
                    int itemId;
                    itemId = Convert.ToInt32(gvItemRow.Cells[1].Text);
                    selectedItemList.Add(itemId);
                }
                foreach (int selectedItem in selectedItemList)
                {
                    IItem item = ViewItemBOFactory.CreateItemobject();

                    item = billItemList.Find(x => (x.ItemID == selectedItem));
                    billItemList.Remove(item);
                }
            }
            gvBillWindow.DataSource = billItemList;
            gvBillWindow.DataBind();
        }
示例#2
0
        /// <summary>
        /// Function to view list of items of selected category
        /// </summary>
        /// <param name="CategoryId"> User selected categoryId </param>
        /// <returns> list of items of selected category </returns>
        public List <IItem> GetItemList(int CategoryId)
        {
            SqlConnection objSqlConn    = null;
            SqlCommand    objSqlCommand = null;
            List <IItem>  itemList      = new List <IItem>();

            try {
                objSqlConn = new SqlConnection(strConnectionString);

                objSqlCommand             = new SqlCommand("usp_getItemDetails", objSqlConn);
                objSqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

                objSqlConn.Open();

                objSqlCommand.Parameters.AddWithValue("@CategoryID", CategoryId);
                objSqlCommand.Parameters["@CategoryID"].Direction = System.Data.ParameterDirection.Input;


                SqlDataReader objSqlReader = objSqlCommand.ExecuteReader();
                while (objSqlReader.Read())
                {
                    IItem objItem = ViewItemBOFactory.CreateItemobject();

                    objItem.ItemID       = Convert.ToInt32(objSqlReader["ItemID"]);
                    objItem.ItemName     = objSqlReader["ItemName"].ToString();
                    objItem.CategoryName = objSqlReader["CategoryName"].ToString();
                    objItem.ItemCategory = Convert.ToInt32(objSqlReader["CategoryID"]);
                    objItem.ItemQuantity = Convert.ToInt32(objSqlReader["Quantity"]);
                    objItem.ItemPrice    = Convert.ToInt32(objSqlReader["ItemPrice"]);


                    itemList.Add(objItem);
                }
                objSqlReader.Close();
            }

            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (objSqlConn != null && objSqlConn.State != System.Data.ConnectionState.Closed)
                {
                    objSqlConn.Close();
                }
            }
            return(itemList);
        }
示例#3
0
        public IItem GetItemByItemId(int itemId)
        {
            SqlConnection objSQLConn    = null;
            SqlCommand    objSQLCommand = null;
            IItem         objItem       = ViewItemBOFactory.CreateItemobject();

            try
            {
                objSQLConn = new SqlConnection(strConnectionString);
                objSQLConn.Open();

                objSQLCommand             = new SqlCommand("usp_GetItemByItemId", objSQLConn);
                objSQLCommand.CommandType = System.Data.CommandType.StoredProcedure;
                objSQLCommand.Parameters.AddWithValue("@ItemID", itemId);
                objSQLCommand.Parameters["@ItemID"].Direction = System.Data.ParameterDirection.Input;

                SqlDataReader objSQLReader = objSQLCommand.ExecuteReader();

                while (objSQLReader.Read())
                {
                    /*IEmployee objEmployee = EmployeeBOFactory.CreateEmployeeObject();*/
                    objItem.ItemID       = Convert.ToInt32(objSQLReader["ItemID"]);
                    objItem.ItemName     = Convert.ToString(objSQLReader["ItemName"]);
                    objItem.ItemPrice    = Convert.ToInt32(objSQLReader["ItemPrice"]);
                    objItem.ItemQuantity = Convert.ToInt32(objSQLReader["Quantity"]);
                    objItem.ItemCategory = Convert.ToInt32(objSQLReader["CategoryID"]);
                    objItem.ItemDiscount = Convert.ToInt32(objSQLReader["ItemDiscount"]);

                    /*objEmployee.Address = Convert.ToString(objSQLReader["Address"]);
                     * objEmployee.City = Convert.ToString(objSQLReader["State"]);
                     * objEmployee.State = Convert.ToString(objSQLReader["City"]);
                     * objEmployee.MobileNumber = Convert.ToInt64(objSQLReader["ContactNumber"]);*/
                }

                objSQLReader.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (objSQLConn != null && objSQLConn.State != System.Data.ConnectionState.Closed)
                {
                    objSQLConn.Close();
                }
            }
            return(objItem);
        }
        /// <summary>
        /// Function to add selected item(s) to bill list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AddItemToBill_click(object sender, EventArgs e)
        {
            btnAddItemToBill.Visible = true;
            bool         isSelected       = false;
            List <IItem> selectedItemList = new List <IItem>();

            for (int i = 0; i < gvshowItemList.Rows.Count; i++)
            {
                GridViewRow gvItemRow = gvshowItemList.Rows[i];
                isSelected = ((CheckBox)gvItemRow.FindControl("chkItemID")).Checked;
                if (isSelected)
                {
                    IItem billItem = ViewItemBOFactory.CreateItemobject();
                    billItem.ItemID       = Convert.ToInt32(gvItemRow.Cells[1].Text);
                    billItem.ItemName     = (gvItemRow.Cells[2].Text);
                    billItem.ItemQuantity = Convert.ToInt32(gvItemRow.Cells[3].Text);
                    billItem.ItemDiscount = Convert.ToInt32(gvItemRow.Cells[5].Text);
                    //billItem.ItemCategory = Convert.ToInt32(gvItemRow.FindControl("Category"));



                    billItem.ItemPrice = Convert.ToDouble(gvshowItemList.Rows[i].Cells[4].Text);


                    selectedItemList.Add(billItem);
                }
            }



            foreach (IItem item in selectedItemList)
            {
                IItem items = billItemList.Find(x => (x.ItemID == item.ItemID));
                if (billItemList.Contains(items))
                {
                    continue;
                }

                else
                {
                    billItemList.Add(item);
                }
            }

            gvBillWindow.DataSource = billItemList;
            gvBillWindow.DataBind();
            btnDelete.Visible   = true;
            btnCalcBill.Visible = true;
        }
示例#5
0
        /// <summary>
        /// This method is used to add checked items in report displayed in another grid view
        /// </summary>
        protected void addToReport_Click(object sender, EventArgs e)
        {
            bool         isSelected       = false;
            List <IItem> selectedItemList = new List <IItem>();

            for (int i = 0; i < gvshowInventoryList.Rows.Count; i++)
            {
                GridViewRow gvItemRow = gvshowInventoryList.Rows[i];
                isSelected = ((CheckBox)gvItemRow.FindControl("chkItems")).Checked;
                if (isSelected)
                {
                    IItem notavailableitemsObj = ViewItemBOFactory.CreateItemobject();
                    notavailableitemsObj.ItemID   = Convert.ToInt32(gvItemRow.Cells[1].Text);
                    notavailableitemsObj.ItemName = (gvItemRow.Cells[2].Text);
                    //notavailableitemsObj.ItemDiscount = Convert.ToInt32(gvItemRow.Cells[5].Text);
                    //billItem.ItemCategory = Convert.ToInt32(gvItemRow.FindControl("Category"));
                    notavailableitemsObj.ItemPrice    = Convert.ToDouble(gvshowInventoryList.Rows[i].Cells[3].Text);
                    notavailableitemsObj.ItemQuantity = Convert.ToInt32(gvItemRow.Cells[4].Text);
                    notavailableitemsObj.CategoryName = Convert.ToString(gvItemRow.Cells[5].Text);
                    notavailableitemsObj.ItemCategory = Convert.ToInt32(gvItemRow.Cells[6].Text);


                    selectedItemList.Add(notavailableitemsObj);
                }
            }

            foreach (IItem item in selectedItemList)
            {
                IItem items = notavailableItemList.Find(x => (x.ItemID == item.ItemID));
                if (notavailableItemList.Contains(items))
                {
                    continue;
                }

                else
                {
                    notavailableItemList.Add(item);
                }
            }

            gvSPnotAvailableItems.DataSource = notavailableItemList;
            gvSPnotAvailableItems.DataBind();
            BtnGenerateReport.Visible = true;
            btnaddToReport.Visible    = true;
            btnReset.Visible          = true;
        }
示例#6
0
        /// <summary>
        /// This is the Page Load method for adding an item
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject();


            int itemId = Convert.ToInt32(Request.QueryString["ItemID"]);

            if (!IsPostBack)
            {
                List <IItemCategory> itemList = objBLL.GetCategoryList();

                ddlCategory.DataSource     = itemList;
                ddlCategory.DataTextField  = "CategoryName";
                ddlCategory.DataValueField = "CategoryID";
                ddlCategory.DataBind();

                if (itemId != 0)
                {
                    //itemId = Convert.ToInt32(Request.QueryString["ItemID"]);
                    IItem objItem = ViewItemBOFactory.CreateItemobject();
                    // IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject();
                    objItem        = objBLL.GetItemByItemId(itemId);
                    objItem.ItemID = itemId;

                    txtItemName.Text          = Convert.ToString(objItem.ItemName);
                    ddlCategory.SelectedValue = Convert.ToString(objItem.ItemCategory);
                    txtItemPrice.Text         = Convert.ToString(objItem.ItemPrice);
                    txtItemQuantity.Text      = Convert.ToString(objItem.ItemQuantity);
                    txtItemDiscount.Text      = Convert.ToString(objItem.ItemDiscount);

                    //objBLL.UpdateItemDetails(objItem);
                }


                lblNewCat.Visible = false;
                btnCat.Visible    = false;
                txtnewCat.Visible = false;
            }

            /*else
             * {
             *  int itemId = Convert.ToInt32(tx);
             * }*/
        }
        public List <IItem> ViewRportGeneratedBySP()
        {
            List <IItem>  itemList      = new List <IItem>();
            SqlConnection objSQLConn    = null;
            SqlCommand    objSQLCommand = null;

            try
            {
                objSQLConn = new SqlConnection(strConnectionString);
                objSQLConn.Open();

                objSQLCommand             = new SqlCommand("usp_getNotAvailableItems", objSQLConn);
                objSQLCommand.CommandType = System.Data.CommandType.StoredProcedure;

                SqlDataReader objSQLReader = objSQLCommand.ExecuteReader();

                while (objSQLReader.Read())
                {
                    IItem objItemDetails = ViewItemBOFactory.CreateItemobject();
                    objItemDetails.ItemID       = Convert.ToInt32(objSQLReader["ItemID"]);
                    objItemDetails.ItemName     = objSQLReader["ItemName"].ToString();
                    objItemDetails.ItemCategory = Convert.ToInt32(objSQLReader["CategoryID"]);
                    objItemDetails.ItemPrice    = Convert.ToInt64(objSQLReader["ItemPrice"]);
                    objItemDetails.ItemQuantity = Convert.ToInt32(objSQLReader["Quantity"]);
                    itemList.Add(objItemDetails);
                }

                objSQLReader.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (objSQLConn != null && objSQLConn.State != System.Data.ConnectionState.Closed)
                {
                    objSQLConn.Close();
                }
            }

            return(itemList);
        }
示例#8
0
        /// <summary>
        /// This method will remove items from gridview.
        /// </summary>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            bool       isSelected       = false;
            List <int> selectedItemList = new List <int>();

            for (int i = 0; i < gvShowItems.Rows.Count; i++)
            {
                GridViewRow gvItemRow = gvShowItems.Rows[i];
                isSelected = ((CheckBox)gvItemRow.FindControl("chkItemID")).Checked;
                if (isSelected)
                {
                    int itemId;
                    itemId = Convert.ToInt32(gvItemRow.Cells[1].Text);
                    selectedItemList.Add(itemId);
                }
                foreach (int selectedItem in selectedItemList)
                {
                    IItem item = ViewItemBOFactory.CreateItemobject();

                    item = ItemList.Find(x => (x.ItemID == selectedItem));
                    ItemList.Remove(item);
                }
            }
            gvShowItems.DataSource = ItemList;
            gvShowItems.DataBind();

            if (gvShowItems.Rows.Count == 0)
            {
                btnPlaceOrder.Visible  = false;
                btnReset.Visible       = false;
                btnDelete.Visible      = false;
                btnCancel.Visible      = false;
                btnCalcAmnt.Visible    = false;
                lbltotalAmount.Visible = false;
                lbltotalAmnt.Visible   = false;
            }
        }
示例#9
0
        /// <summary>
        /// This method displays the non available item details based on category in the database
        /// </summary>



        protected void btnAddCart_Click(object sender, EventArgs e)
        {
            IInventoryManagerBLL objBLL   = InventoryManagerBLLFactory.CreateInventoryManagerBLLObject();
            bool         isSelected       = false;
            List <IItem> selectedItemList = new List <IItem>();
            List <int>   selectedCat      = new List <int>();


            for (int i = 0; i < gvItemDetailList.Rows.Count; i++)
            {
                GridViewRow gvItemRow = gvItemDetailList.Rows[i];

                isSelected = ((CheckBox)gvItemRow.FindControl("chkItemID")).Checked;
                if (isSelected)
                {
                    IItem billItem = ViewItemBOFactory.CreateItemobject();
                    billItem.ItemID       = Convert.ToInt32(gvItemRow.Cells[1].Text);
                    billItem.ItemName     = (gvItemRow.Cells[2].Text);
                    billItem.ItemPrice    = Convert.ToDouble(gvItemRow.Cells[4].Text);
                    billItem.ItemCategory = Convert.ToInt32(gvItemRow.Cells[3].Text);
                    //vendorListForDDL.Add(objBLL.GetVendorDetailsCategoryWise(billItem.ItemCategory));

                    selectedItemList.Add(billItem);
                }
            }


            foreach (IItem item in selectedItemList)
            {
                IItem items = ItemList.Find(x => (x.ItemID == item.ItemID));
                if (ItemList.Contains(items))
                {
                    lblMessage.Visible = true;
                    lblMessage.Text    = "Item Already Selected";
                    continue;
                }

                else
                {
                    lblMessage.Visible = false;
                    ItemList.Add(item);
                }
            }
            gvShowItems.DataSource = ItemList;
            gvShowItems.DataBind();
            //  gvshowItems.Controls.AddAt(5, );
            btnPlaceOrder.Visible = true;
            btnReset.Visible      = true;
            btnDelete.Visible     = true;
            btnCalcAmnt.Visible   = true;
            btnCancel.Visible     = true;
            if (gvShowItems.Rows.Count == 0)
            {
                btnPlaceOrder.Visible = false;
                btnReset.Visible      = false;
                btnDelete.Visible     = false;
                btnCalcAmnt.Visible   = false;
                btnCancel.Visible     = false;
                lblMessage.Visible    = true;
                lblMessage.Text       = "No Items Available";
            }
        }