Ejemplo n.º 1
0
        protected void txtQty_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (CategoriesDropDownList.SelectedIndex > 0)
                {
                    if (ItemsDropDownList.SelectedIndex > 0)
                    {
                        AddSaleItems();
                        txtQty.Text      = "";
                        txtSubTotal.Text = total.ToString();
                        CategoriesDropDownList.Focus();
                        DiscountCalculation();
                    }
                    else
                    {
                        ItemsDropDownList.Focus();

                        lblItems.ForeColor = Color.Red;
                    }
                }
                else
                {
                    CategoriesDropDownList.Focus();
                    lblCategories.ForeColor = Color.Red;
                }
            }
            catch
            { }
        }
Ejemplo n.º 2
0
 public void GetAllCategories()
 {
     CategoriesDropDownList.DataSource     = _ProductSetupRepository.GetAllCategories();
     CategoriesDropDownList.DataTextField  = "Name";
     CategoriesDropDownList.DataValueField = "Id";
     CategoriesDropDownList.DataBind();
     CategoriesDropDownList.Items.Insert(0, new ListItem("Select Category", "0"));
 }
Ejemplo n.º 3
0
 public void GetALLCategories()
 {
     CategoriesDropDownList.DataSource     = _ItemSalesRepository.GetAllCategories();
     CategoriesDropDownList.DataTextField  = "Name";
     CategoriesDropDownList.DataValueField = "Id";
     CategoriesDropDownList.DataBind();
     CategoriesDropDownList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Categories", "0"));
 }
Ejemplo n.º 4
0
        public void GetAllCategories()
        {
            CategoriesDropDownList.DataSource     = _PurchaseRepository.GetAllCategories();
            CategoriesDropDownList.DataTextField  = "Name";
            CategoriesDropDownList.DataValueField = "Id";
            CategoriesDropDownList.DataBind();

            CategoriesDropDownList.Items.Insert(0, new ListItem("Chose Category", "0"));
        }
Ejemplo n.º 5
0
 public void Refresh()
 {
     txtCode.Text = "";
     txtQty.Text  = "";
     txtCost.Text = "";
     txtMrp.Text  = "";
     CategoriesDropDownList.ClearSelection();
     SizeDropDownList.ClearSelection();
     ItemsDropDownList.ClearSelection();
 }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // Read the connection string from Web.config
            string connectionString =
                ConfigurationManager.ConnectionStrings["RB_RecipeBook"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                try
                {
                    // Get data about users from the database
                    SqlDataAdapter adapterUsers    = new SqlDataAdapter("SELECT idUser, UserName FROM RB_User", conn);
                    DataTable      storeTableUsers = new DataTable(); // table to store the sql command
                    adapterUsers.Fill(storeTableUsers);
                    // Populate dropdownlist
                    SubmittedByDropDownList.DataSource     = storeTableUsers;
                    SubmittedByDropDownList.DataTextField  = "UserName";
                    SubmittedByDropDownList.DataValueField = "idUser";
                    SubmittedByDropDownList.DataBind();
                    // Add extra item "All"
                    SubmittedByDropDownList.Items.Insert(0, new ListItem("All Users"));

                    // Get data about categories from the database
                    SqlDataAdapter adapterCategories    = new SqlDataAdapter("SELECT idCategory, CategoryName FROM RB_Category", conn);
                    DataTable      storeTableCategories = new DataTable(); // table to store the sql command
                    adapterCategories.Fill(storeTableCategories);
                    // Populate dropdownlist
                    CategoriesDropDownList.DataSource     = storeTableCategories;
                    CategoriesDropDownList.DataTextField  = "CategoryName";
                    CategoriesDropDownList.DataValueField = "idCategory";
                    CategoriesDropDownList.DataBind();
                    // Add extra item "All"
                    CategoriesDropDownList.Items.Insert(0, new ListItem("All Categories"));

                    // Get data about ingredients from the database
                    SqlDataAdapter adapterIngredients    = new SqlDataAdapter("SELECT idIngredient, IngredientName FROM RB_Ingredient", conn);
                    DataTable      storeTableIngredients = new DataTable(); // table to store the sql command
                    adapterIngredients.Fill(storeTableIngredients);
                    // Populate dropdownlist
                    IngredientsDropDownList.DataSource     = storeTableIngredients;
                    IngredientsDropDownList.DataTextField  = "IngredientName";
                    IngredientsDropDownList.DataValueField = "idIngredient";
                    IngredientsDropDownList.DataBind();
                    // Add extra item "All"
                    IngredientsDropDownList.Items.Insert(0, new ListItem("All Ingredients"));
                }
                catch (Exception ex)
                {
                    MessageLabel.Text = "ERROR: " + ex.Message;
                }
            }
        }
    }
Ejemplo n.º 7
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            Items _Items = new Items();

            _Items.Code         = txtCode.Text;
            _Items.Name         = txtName.Text;
            _Items.ReorderLevel = 5;
            _Items.Size         = SizeDropDownList.SelectedItem.ToString();
            _Items.CategoriesId = Convert.ToInt32(CategoriesDropDownList.SelectedValue);

            if (CategoriesDropDownList.SelectedIndex > 0)
            {
                if (SizeDropDownList.SelectedIndex > 0)
                {
                    decimal AlreadyExistCaegory = _ItemRepository.AlreadyExistName(_Items);
                    if (AlreadyExistCaegory >= 1)
                    {
                        ShowMessage("This Item Already Here!!!...", MessageType.Warning);
                    }
                    else
                    {
                        int Savesuccess = _ItemRepository.Add(_Items);
                        if (Savesuccess > 0)
                        {
                            ShowMessage("Successfully Saved Item....", MessageType.Success);
                            LoadItem();
                            AutoCodeGenerate();
                            GetAllCategories();
                            txtName.Text = "";
                            CategoriesDropDownList.ClearSelection();
                            SizeDropDownList.ClearSelection();
                            //Response.Redirect(Request.Url.AbsoluteUri);
                        }
                        else
                        {
                            ShowMessage("Failed Saving Item", MessageType.Warning);
                        }
                    }
                }
                else
                {
                    ShowMessage("Select Size", MessageType.Warning);
                    SizeDropDownList.Focus();
                }
            }
            else
            {
                ShowMessage("At First Select Catgeory", MessageType.Warning);
                CategoriesDropDownList.Focus();
            }
        }
Ejemplo n.º 8
0
 public void Refresh()
 {
     GetALLCategories();
     AutoCodeGenerate();
     CategoriesDropDownList.ClearSelection();
     ItemsDropDownList.ClearSelection();
     txtCustomerName.Text = "";
     txtCustomerName.Focus();
     txtSubTotal.Text   = "";
     txtDiscount.Text   = "";
     txtDiscount.Text   = "0";
     txtTotalCost.Text  = "";
     txtPaidAmount.Text = "";
     lblChanges.Text    = "";
 }
Ejemplo n.º 9
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (CategoriesDropDownList.SelectedIndex > 0 && ShelfsDropDownList.SelectedIndex > 0)
                {
                    if (RemainShelf >= 0)
                    {
                        Items _Items = new Items();
                        _Items.Code         = txtCode.Text;
                        _Items.Name         = txtName.Text;
                        _Items.GenericName  = txtGenericName.Text;
                        _Items.ReorderLevel = Convert.ToInt32(txtReorderLevel.Text);
                        _Items.CategoriesId = Convert.ToInt32(CategoriesDropDownList.SelectedValue);
                        _Items.ShelfsId     = Convert.ToInt32(ShelfsDropDownList.SelectedValue);

                        int saveSuccess = _ItemRepository.Add(_Items);
                        if (saveSuccess > 0)
                        {
                            lblmsg.Text      = "This Item Save Successefully!!....";
                            lblmsg.ForeColor = Color.Green;
                            AutoCodeGenerate();

                            Response.Redirect(Request.Url.AbsoluteUri);
                        }
                        else
                        {
                            lblmsg.Text      = "This Item Saving Failed!!....";
                            lblmsg.ForeColor = Color.Red;
                        }
                    }
                    else
                    {
                        lblmsg.Text      = "This Shelf Fully Done!!....Please Try Another Shelf";
                        lblmsg.ForeColor = Color.Red;
                    }
                }
                else
                {
                    CategoriesDropDownList.Focus();
                }
            }
            catch (Exception ex)
            {
                lblmsg.Text = ex.Message;
            }
        }
Ejemplo n.º 10
0
        protected void AddItemButton_Click(object sender, EventArgs e)
        {
            try
            {
                ItemsM _ItemsM = new ItemsM();
                _ItemsM.Name         = txtItemName.Text;
                _ItemsM.Price        = Convert.ToDecimal(txtPrice.Text);
                _ItemsM.CategoriesId = Convert.ToInt32(CategoriesDropDownList.SelectedValue);

                decimal AlreadyExistItem = _ItemRepository.AlreadyExistItem(_ItemsM);
                if (AlreadyExistItem >= 1)
                {
                    ShowMessage("This Item Already Here!!..This Category", MessageType.Warning);
                }
                else
                {
                    int savesuccess = _ItemRepository.Add(_ItemsM);
                    if (savesuccess > 0)
                    {
                        ShowMessage("Successfully Saved Item", MessageType.Success);
                        LoadItem();
                        txtItemName.Text = "";
                        txtPrice.Text    = "";
                        CategoriesDropDownList.ClearSelection();
                    }
                    else
                    {
                        ShowMessage("Failed Saving Item", MessageType.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message, MessageType.Warning);
            }
        }