Exemplo n.º 1
0
        private void ManagerPage_Load(object sender, EventArgs e)
        {
            ManagerService ms = new ManagerService();

            dataGridView1.DataSource         = ms.GetAll();
            dataGridView1.Columns[3].Visible = false;
        }
Exemplo n.º 2
0
        private void btnQuantity_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtItem.Text == string.Empty || txtQuantity.Text == string.Empty)
                {
                    MessageBox.Show("Please select one row from girdview");
                }
                else
                {
                    ManagerService ms = new ManagerService();

                    int newquan = quan + Convert.ToInt32(txtQuantity.Text);
                    itemName = txtItem.Text;

                    int result1 = ms.Update(newquan, itemName);
                    if (result1 > 0)
                    {
                        MessageBox.Show("Updated");
                        UpdateGridView();
                        Clear();
                    }
                    else
                    {
                        MessageBox.Show("Update Error!!");
                    }
                }
            }
            catch
            {
                MessageBox.Show("Please select one row from girdview");
            }
        }
Exemplo n.º 3
0
        private void btnPrice_Click(object sender, EventArgs e)
        {
            ManagerService ms = new ManagerService();

            try
            {
                if (txtItem.Text == string.Empty || txtPrice.Text == string.Empty)
                {
                    MessageBox.Show("Please select one row from girdview");
                }
                else
                {
                    int price1 = Convert.ToInt32(txtPrice.Text);
                    itemName = txtItem.Text;

                    int result1 = ms.UpdatePrice(price1, itemName);
                    if (result1 > 0)
                    {
                        MessageBox.Show("Updated");
                        UpdateGridView();
                        Clear();
                    }
                    else
                    {
                        MessageBox.Show("Update Error!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        private void deletebutton_Click(object sender, EventArgs e)
        {
            ManagerService ms = new ManagerService();

            try
            {
                string itemName = txtItem.Text;
                if (txtItem.Text != "")
                {
                    int result = ms.DeleteItem(itemName);
                    if (result > 0)
                    {
                        UpdateGridView();
                        Clear();
                        MessageBox.Show("Deleted");
                    }
                    else
                    {
                        MessageBox.Show("Delete not successful");
                    }
                }
                else
                {
                    MessageBox.Show("Select a row first.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
        private void btnPayment_Click(object sender, EventArgs e)
        {
            if (txtItem.Text == string.Empty || txtQuantity.Text == string.Empty || txtPayment.Text == string.Empty)
            {
                MessageBox.Show("Requirement must be fillup");
            }
            else
            {
                Orders         or         = new Orders();
                ManagerService manService = new ManagerService();

                or.ItemName = txtItem.Text;
                or.Quantity = Convert.ToInt32(txtQuantity.Text);
                or.Payment  = Convert.ToInt32(txtPayment.Text);
                int sId = user.UserID;

                string itemName = txtItem.Text;
                int    odrQuan  = Convert.ToInt32(txtQuantity.Text);
                int    newQuan  = quan - odrQuan;

                if (odrQuan < quan)
                {
                    int result = manService.InsertSold(or.ItemName, or.Quantity, or.Payment, sId);
                    if (result > 0)
                    {
                        MessageBox.Show("Inserted");
                    }
                    else
                    {
                        MessageBox.Show("Insert Error!!");
                    }


                    int result1 = manService.Update(newQuan, itemName);
                    if (result1 > 0)
                    {
                        MessageBox.Show("Updated");
                        UpdateGridView();
                        Clear();
                    }
                    else
                    {
                        MessageBox.Show("Update Error!!");
                    }
                }
                else
                {
                    MessageBox.Show("Sorry we don't have that much...");
                }
            }
        }
Exemplo n.º 6
0
        private void addbutton_Click(object sender, EventArgs e)
        {
            ManagerService manService = new ManagerService();

            try
            {
                if (txtItem.Text == string.Empty || txtQuantity.Text == string.Empty || txtPrice.Text == string.Empty ||
                    (rbtnOffline.Checked == false && rbtnOnline.Checked == false))
                {
                    MessageBox.Show("Requirement must be fillup");
                }
                else
                {
                    string itemName = txtItem.Text;
                    int    quantity = Convert.ToInt32(txtQuantity.Text);
                    int    price    = Convert.ToInt32(txtPrice.Text);

                    string itemType = "";
                    if (rbtnOffline.Checked)
                    {
                        itemType = "Offline";
                    }
                    else
                    {
                        itemType = "Online";
                    }


                    int result = manService.ItemInsert(itemName, quantity, price, itemType);
                    if (result > 0)
                    {
                        MessageBox.Show("Inserted");
                        UpdateGridView();
                        RClear();
                        Clear();
                    }
                    else
                    {
                        MessageBox.Show("Insert Error!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 7
0
        private void btnItemType_Click(object sender, EventArgs e)
        {
            ManagerService ms = new ManagerService();

            try
            {
                if (txtItem.Text == string.Empty || (rbtnOnline.Checked == false && rbtnOffline.Checked == false))
                {
                    MessageBox.Show("Please select one row from girdview");
                }
                else
                {
                    string itemType = "";
                    if (rbtnOnline.Checked)
                    {
                        itemType = "Online";
                    }
                    if (rbtnOffline.Checked)
                    {
                        itemType = "Offline";
                    }

                    itemName = txtItem.Text;

                    int result1 = ms.UpdateItemType(itemType, itemName);
                    if (result1 > 0)
                    {
                        MessageBox.Show("Updated");
                        UpdateGridView();
                        RClear();
                        Clear();
                    }
                    else
                    {
                        MessageBox.Show("Update Error!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 8
0
        public void UpdateGridView()
        {
            ManagerService ms = new ManagerService();

            dataGridView1.DataSource = ms.GetAll();
        }
Exemplo n.º 9
0
        private void ChangeItem_Load(object sender, EventArgs e)
        {
            ManagerService ms = new ManagerService();

            dataGridView1.DataSource = ms.GetAll();
        }