示例#1
0
        public override void saveBTN_Click(object sender, EventArgs e)
        {
            if (proTXT.Text == "")
            {
                proNameErrorLabel.Visible = true;
            }
            else
            {
                proNameErrorLabel.Visible = false;
            }
            if (barcodeTXT.Text == "")
            {
                barcodeErrorLabel.Visible = true;
            }
            else
            {
                barcodeErrorLabel.Visible = false;
            }
            if (expiryPicker.Value < DateTime.Now)
            {
                proExpiryErrorLabel.Visible = true; invalidDateErrorLabel.Visible = true;
            }
            else
            {
                proExpiryErrorLabel.Visible = false;
            }
            if (expiryPicker.Value.Date == DateTime.Now.Date)
            {
                proExpiryErrorLabel.Visible = false;
            }
            if (priceTXT.Text == "")
            {
                proPriceErrorLabel.Visible = true;
            }
            else
            {
                proPriceErrorLabel.Visible = false;
            }
            if (categoryCB.SelectedIndex == -1 || categoryCB.SelectedIndex == 0)
            {
                cateErrorLabel.Visible = true;
            }
            else
            {
                cateErrorLabel.Visible = false;
            }

            if (proNameErrorLabel.Visible || cateErrorLabel.Visible || barcodeErrorLabel.Visible || proPriceErrorLabel.Visible || proExpiryErrorLabel.Visible)
            {
                MainClass.ShowMsg("Fields with * are mandatory", "Error", "Error"); //Error is the type of msg
            }
            else
            {
                if (edit == 0) // Code for save operation
                {
                    insertion i = new insertion();

                    if (expiryPicker.Value == DateTime.Now)
                    {
                        i.productInsertion(proTXT.Text, barcodeTXT.Text, Convert.ToSingle(priceTXT.Text), null, Convert.ToInt32(categoryCB.SelectedValue));
                    }
                    else
                    {
                        i.productInsertion(proTXT.Text, barcodeTXT.Text, Convert.ToSingle(priceTXT.Text), expiryPicker.Value, Convert.ToInt32(categoryCB.SelectedValue));
                    }
                    r.showProducts(dataGridView1, proIDGV, proGV, expiryGV, priceGV, barcodeGV, catGV, 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();
                        if (expiryPicker.Value == DateTime.Now)
                        {
                            u.updateProduct(prodID, proTXT.Text, barcodeTXT.Text, Convert.ToSingle(priceTXT.Text), null, Convert.ToInt32(categoryCB.SelectedValue));
                        }

                        else
                        {
                            u.updateProduct(prodID, proTXT.Text, barcodeTXT.Text, Convert.ToSingle(priceTXT.Text), expiryPicker.Value, Convert.ToInt32(categoryCB.SelectedValue));
                        }
                        r.showProducts(dataGridView1, proIDGV, proGV, barcodeGV, expiryGV, priceGV, catGV, catIDGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
示例#2
0
 public override void addBTN_Click(object sender, EventArgs e)
 {
     MainClass.enable_reset(leftPanel);
     edit = 0;
     r.getCategoriesList("st_getCategoriesList", categoryCB, "Category", "ID");
 }
示例#3
0
 public override void editBTN_Click(object sender, EventArgs e)
 {
     edit = 1;
     MainClass.enable(leftPanel);
 }
示例#4
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            homeScreen home = new homeScreen();

            MainClass.showWindow(home, this, MDi.ActiveForm);
        }
示例#5
0
 private void products_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(leftPanel);
 }
示例#6
0
 public override void BtnEdit_Click(object sender, EventArgs e)
 {
     edit = 1;
     MainClass.enable(LeftPanel);
 }
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (catTxt.Text == "")
            {
                catErrorLabel.Visible = true;
            }
            else
            {
                catErrorLabel.Visible = false;
            }

            if (activeDD.SelectedIndex == -1)
            {
                activeErrorLabel.Visible = true;
            }
            else
            {
                activeErrorLabel.Visible = false;
            }

            if (activeErrorLabel.Visible || catErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error");                //Error is the type of message.
            }
            else
            {
                if (activeDD.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (activeDD.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0)                //code for SAVE operation.
                {
                    insertion i = new insertion();
                    i.insertCat(catTxt.Text, stat);
                    r.showCategories(dataGridView1, catIDGV, NameGV, statusGV);
                    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();
                        if (activeDD.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (activeDD.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        if (activeDD.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (activeDD.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        u.updateCat(catID, catTxt.Text, stat);
                        r.showCategories(dataGridView1, catIDGV, NameGV, statusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
示例#8
0
        private void suppBtn_Click(object sender, EventArgs e)
        {
            Supplier u = new Supplier();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
示例#9
0
        private void purchaseBtn_Click(object sender, EventArgs e)
        {
            PurchaseInvoice u = new PurchaseInvoice();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
示例#10
0
        private void catBtn_Click(object sender, EventArgs e)
        {
            Categories u = new Categories();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
示例#11
0
        private void proDD_Click(object sender, EventArgs e)
        {
            products u = new products();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
示例#12
0
        private void userBtn_Click(object sender, EventArgs e)
        {
            Users u = new Users();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
        public override void viewBtn_Click(object sender, EventArgs e)
        {
            PurchaseInvoiceDetails pid = new PurchaseInvoiceDetails();

            MainClass.showWindow(pid, this, MDI.ActiveForm);
        }
示例#14
0
        private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            settings set = new settings();

            MainClass.showWindow(set, this);
        }
示例#15
0
 private void categories_Load(object sender, EventArgs e)
 {
     MainClass.disable(LeftPanel);
 }
示例#16
0
        private void stockBtn_Click(object sender, EventArgs e)
        {
            Stocks u = new Stocks();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
示例#17
0
 public override void BtnAdd_Click(object sender, EventArgs e)
 {
     MainClass.enable_reset(LeftPanel);
     categoryNameTxt.Focus();
     edit = 0;
 }
示例#18
0
        private void button5_Click(object sender, EventArgs e)
        {
            Sales u = new Sales();

            MainClass.showWindow(u, this, MDI.ActiveForm);
        }
示例#19
0
        public override void BtnSave_Click(object sender, EventArgs e)
        {
            //validation for Users form
            if (categoryNameTxt.Text == string.Empty)
            {
                catNameErrorLabel.Visible = true;
            }
            else
            {
                catNameErrorLabel.Visible = false;
            }
            if (isActiveCB.SelectedIndex == -1)
            {
                IsActiveErrorLabel.Visible = true;
            }
            else
            {
                IsActiveErrorLabel.Visible = false;
            }

            if (catNameErrorLabel.Visible || IsActiveErrorLabel.Visible)
            {
                MainClass.showMSG("Fields with * are mandatory", "Stop", "Error"); //Error is the type of message
            }
            else
            {
                if (isActiveCB.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (isActiveCB.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0) // Code for SAVE Operation
                {
                    Insertion i = new Insertion();
                    i.insertCat(categoryNameTxt.Text, stat);
                    r.showCategories(CatDataGridView, catIDGV, NameGV, StatusGV);
                    MainClass.disable_reset(LeftPanel);
                }
                else if (edit == 1) // Code for EDIT 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();
                        if (isActiveCB.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (isActiveCB.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        u.updatetCat(catID, categoryNameTxt.Text, stat);
                        r.showCategories(CatDataGridView, catIDGV, NameGV, StatusGV);
                        MainClass.disable_reset(LeftPanel);
                    }
                }
            }
        }
 public override void addBtn_Click(object sender, EventArgs e)
 {
     MainClass.enable_reset(leftPanel);
     edit = 0;
 }