Exemplo n.º 1
0
 public override void editbtn_Click(object sender, EventArgs e)
 {
     edit = 1;
     MainClass.enable(leftpanel);
     categoryDD.Enabled = false;
 }
Exemplo n.º 2
0
        public override void upodatebtn_Click(object sender, EventArgs e)
        {
            if (pronamtxtp.Text == "")
            {
                pnameerrorlbl.Visible = true;
            }
            else
            {
                pnameerrorlbl.Visible = false;
            }
            if (barcodetxtp.Text == "")
            {
                barcodeperrorlbl.Visible = true;
            }
            else
            {
                barcodeperrorlbl.Visible = false;
            }
            if (Expirypickerp.Value < DateTime.Now)
            {
                expiryerrorplbl.Visible = true; expiryerrorplbl.Text = "Invalid Date...";
            }
            else
            {
                expiryerrorplbl.Visible = false;
            }
            if (pptxt.Text == "")
            {
                pperrorlbl.Visible = true;
            }
            else
            {
                pperrorlbl.Visible = false;
            }
            if (categoryDD.SelectedIndex == -1 || categoryDD.SelectedIndex == 0)
            {
                caterrorlbl.Visible = true;
            }
            else
            {
                caterrorlbl.Visible = false;
            }
            if (pnameerrorlbl.Visible || barcodeperrorlbl.Visible || expiryerrorplbl.Visible || pperrorlbl.Visible || caterrorlbl.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error"); //Error massage with main class
            }
            else
            {
                if (edit == 0) //code for save operation
                {
                    Insertion i = new Insertion();
                    i.InsertProduct(pronamtxtp.Text, barcodetxtp.Text, Convert.ToSingle(pptxt.Text), Expirypickerp.Value, Convert.ToInt32(categoryDD.SelectedValue));
                    R.ShowProducts(dataGridView1, proIDGV, proNameGV, ExpiryGV, CatGV, PriceGV, barcodeGV, CatIDGV);
                    MainClass.disable_reset(leftpanel);
                }


                else if (edit == 1) //code for update operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure , you want to update record?", "Question...", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();

                        u.updateProduct(prodID, pronamtxtp.Text, barcodetxtp.Text, Convert.ToSingle(pptxt.Text), Expirypickerp.Value, Convert.ToInt32(categoryDD.SelectedValue));
                        R.ShowProducts(dataGridView1, proIDGV, proNameGV, ExpiryGV, CatGV, PriceGV, barcodeGV, CatIDGV);
                        MainClass.disable_reset(leftpanel);
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void products_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(leftpanel);
 }
Exemplo n.º 4
0
 public override void addbtn_Click(object sender, EventArgs e)
 {
     MainClass.enable_reset(leftpanel);
     edit = 0;
     R.getCategoriesList("st_getCategoriesList", categoryDD, "category", "ID");
 }
        private void button3_Click(object sender, EventArgs e)
        {
            Stocks sd = new Stocks();

            MainClass.showWindow(sd, this, MDI.ActiveForm);
        }
        private void button7_Click(object sender, EventArgs e)
        {
            Login log = new Login();

            MainClass.showWindow(log, this, MDI.ActiveForm);
        }
        private void proDD_Click(object sender, EventArgs e)
        {
            products u = new products();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
        private void catbtn_Click(object sender, EventArgs e)
        {
            Categories u = new Categories();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Users u = new Users();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }