public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (proTxt.Text == "")
            {
                proErrorLabel.Visible = true;
            }
            else
            {
                proErrorLabel.Visible = false;
            }

            if (barcodeTxt.Text == "")
            {
                barcodeErrorLabel.Visible = true;
            }
            else
            {
                barcodeErrorLabel.Visible = false;
            }

            if (expiryPicker.Value < DateTime.Now)
            {
                expiryErrorLabel.Visible = true; expiryErrorLabel.Text = "Invalid Date";
            }
            else
            {
                expiryErrorLabel.Visible = false;
            }
            if (expiryPicker.Value.Date == DateTime.Now.Date)
            {
                expiryErrorLabel.Visible = false;
            }

            if (priceTxt.Text == "")
            {
                priceErrorLabel.Visible = true;
            }
            else
            {
                priceErrorLabel.Visible = false;
            }

            if (categoryDD.SelectedIndex == -1 || categoryDD.SelectedIndex == 0)
            {
                catErrorLabel.Visible = true;
            }
            else
            {
                catErrorLabel.Visible = false;
            }

            if (proErrorLabel.Visible || barcodeErrorLabel.Visible || expiryErrorLabel.Visible || priceErrorLabel.Visible || catErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error");                //Error is the type of message.
            }
            else
            {
                if (edit == 0)                //code for SAVE operation.
                {
                    insertion i = new insertion();
                    if (expiryPicker.Value.Date == DateTime.Now.Date)
                    {
                        i.insertProduct(proTxt.Text, barcodeTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryDD.SelectedValue));
                    }
                    else
                    {
                        i.insertProduct(proTxt.Text, barcodeTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryDD.SelectedValue), expiryPicker.Value);
                    }

                    r.showProducts(dataGridView1, proIDGV, proGV, 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();
                        if (expiryPicker.Value.Date == DateTime.Now.Date)
                        {
                            u.updateProduct(prodID, proTxt.Text, barcodeTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryDD.SelectedValue));
                        }
                        else
                        {
                            u.updateProduct(prodID, proTxt.Text, barcodeTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryDD.SelectedValue), expiryPicker.Value);
                        }

                        r.showProducts(dataGridView1, proIDGV, proGV, expiryGV, catGV, priceGV, barcodeGV, catIDGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
Example #2
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (supplierCompanyTxt.Text == "")
            {
                supNameErrorLabel.Visible = true;
            }
            else
            {
                supNameErrorLabel.Visible = false;
            }

            if (personNameTxt.Text == "")
            {
                personErrorLabel.Visible = true;
            }
            else
            {
                personErrorLabel.Visible = false;
            }

            if (Phone1Txt.Text == "")
            {
                phone1ErrorLabel.Visible = true;
            }
            else
            {
                phone1ErrorLabel.Visible = false;
            }

            if (adderssTxt.Text == "")
            {
                addressErrorLabel.Visible = true;
            }
            else
            {
                addressErrorLabel.Visible = false;
            }


            if (statusDD.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (supNameErrorLabel.Visible || personErrorLabel.Visible || phone1ErrorLabel.Visible || addressErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error");                //Error is the type of message.
            }
            else
            {
                if (statusDD.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (statusDD.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0)                //code for SAVE operation.
                {
                    insertion i = new insertion();
                    if (phone2Txt.Text == "" && ntnTxt.Text != "")
                    {
                        i.insertSupplier(supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, adderssTxt.Text, stat, null, ntnTxt.Text);
                    }
                    else if (phone2Txt.Text != "" && ntnTxt.Text == "")
                    {
                        i.insertSupplier(supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, adderssTxt.Text, stat, phone2Txt.Text, null);
                    }
                    else if (phone2Txt.Text == "" && ntnTxt.Text == "")
                    {
                        i.insertSupplier(supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, adderssTxt.Text, stat, null, null);
                    }
                    else
                    {
                        i.insertSupplier(supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, adderssTxt.Text, stat, phone2Txt.Text, ntnTxt.Text);
                    }


                    r.showSuppliers(dataGridView1, suppIDGV, companyGV, personGV, phone1GV, phone2GV, addressGV, ntnGV, 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 (statusDD.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (statusDD.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        if (phone2Txt.Text == "" && ntnTxt.Text != "")
                        {
                            u.updateSupplier(SupplierID, supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, adderssTxt.Text, stat, null, ntnTxt.Text);
                        }
                        else if (phone2Txt.Text != "" && ntnTxt.Text == "")
                        {
                            u.updateSupplier(SupplierID, supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, adderssTxt.Text, stat, phone2Txt.Text, null);
                        }
                        else if (phone2Txt.Text == "" && ntnTxt.Text == "")
                        {
                            u.updateSupplier(SupplierID, supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, adderssTxt.Text, stat, null, null);
                        }
                        else
                        {
                            u.updateSupplier(SupplierID, supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, adderssTxt.Text, stat, phone2Txt.Text, ntnTxt.Text);
                        }

                        r.showSuppliers(dataGridView1, suppIDGV, companyGV, personGV, phone1GV, phone2GV, addressGV, ntnGV, statusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
 private void products_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(leftPanel);
     r.getList("st_getCategoriesList", categoryDD, "Category", "ID");
 }
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (proTxt.Text == "")
            {
                proErrorLabel.Visible = true;
            }
            else
            {
                proErrorLabel.Visible = false;
            }
            if (barTxt.Text == "")
            {
                barErrorLabel.Visible = true;
            }
            else
            {
                barErrorLabel.Visible = false;
            }
            if (expireTxt.Value < DateTime.Now)
            {
                expErrorLabel.Visible = true;
            }
            else
            {
                expErrorLabel.Visible = false;
            }
            if (expireTxt.Value.Date == DateTime.Now.Date)
            {
                expErrorLabel.Visible = false;
            }
            if (priceTxt.Text == "")
            {
                priceErrorLabel.Visible = true;
            }
            else
            {
                priceErrorLabel.Visible = false;
            }
            if (categoryCombo.SelectedIndex == -1 || categoryCombo.SelectedIndex == 0)
            {
                catErrorLabel.Visible = true;
            }
            else
            {
                catErrorLabel.Visible = false;
            }

            if (proErrorLabel.Visible || barErrorLabel.Visible || priceErrorLabel.Visible || catErrorLabel.Visible)
            {
                MainClass.showMessage("Fields with * are mandatory", "Stop", "Error");
            }
            else
            {
                if (edit == 0)//Code for Save Operation
                {
                    Insertion i = new Insertion();
                    if (expireTxt.Value.Date == DateTime.Now.Date)
                    {
                        i.insertProduct(proTxt.Text, barTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryCombo.SelectedValue));
                    }
                    else
                    {
                        i.insertProduct(proTxt.Text, barTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryCombo.SelectedValue), expireTxt.Value);
                    }


                    r.showProduct(dataGridView1, proidGV, productGV, barGV, expiryGV, priceGV, categoryGV, catidGV);
                    MainClass.disable_reset(leftPanel);
                }
                else if (edit == 1)//Code for Update Operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure, you want to update recored", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();
                        if (expireTxt.Value.Date == DateTime.Now.Date)
                        {
                            u.updateProduct(prodId, proTxt.Text, barTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryCombo.SelectedValue));
                        }
                        else
                        {
                            u.updateProduct(prodId, proTxt.Text, barTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryCombo.SelectedValue), expireTxt.Value);
                        }

                        r.showProduct(dataGridView1, proidGV, productGV, barGV, expiryGV, priceGV, categoryGV, catidGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
Example #5
0
 private void Supplier_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(leftPanel);
 }
Example #6
0
        public override void BtnSave_Click(object sender, EventArgs e)
        {
            //validation for Users form
            if (nameTxt.Text == string.Empty)
            {
                nameErrorLabel.Visible = true;
            }
            else
            {
                nameErrorLabel.Visible = false;
            }
            if (userNameTxt.Text == string.Empty)
            {
                usernameErrorLabel.Visible = true;
            }
            else
            {
                usernameErrorLabel.Visible = false;
            }
            if (pwdTxt.Text == string.Empty)
            {
                pwdErrorLabel.Visible = true;
            }
            else
            {
                pwdErrorLabel.Visible = false;
            }
            if (phoneTxt.Text == string.Empty)
            {
                phoneErrorLabel.Visible = true;
            }
            else
            {
                phoneErrorLabel.Visible = false;
            }
            if (emailTxt.Text == string.Empty)
            {
                emailErrorLabel.Visible = true;
            }
            else
            {
                emailErrorLabel.Visible = false;
            }
            if (statusCb.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (nameErrorLabel.Visible || usernameErrorLabel.Visible || pwdErrorLabel.Visible || phoneErrorLabel.Visible || emailErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.showMSG("Fields with * are mandatory", "Stop", "Error"); //Error is the type of message
            }
            else
            {
                if (statusCb.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (statusCb.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0) // Code for SAVE Operation
                {
                    Insertion i = new Insertion();
                    i.insertUser(nameTxt.Text, userNameTxt.Text, pwdTxt.Text, phoneTxt.Text, emailTxt.Text, stat);
                    r.showUsers(dataGridView1, UserIDGV, NameGV, UsernameGV, PassGV, PhoneGV, EmailGV, 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 (statusCb.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (statusCb.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        u.updateUser(userID, nameTxt.Text, userNameTxt.Text, pwdTxt.Text, phoneTxt.Text, emailTxt.Text, stat);
                        r.showUsers(dataGridView1, UserIDGV, NameGV, UsernameGV, PassGV, PhoneGV, EmailGV, StatusGV);
                        MainClass.disable_reset(LeftPanel);
                    }
                }
            }
        }
 private void Product_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(leftPanel);
     r.getlist("st_getCategorylist", categoryCombo, "Category", "ID");
 }
Example #8
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (supplierTxt.Text == "")
            {
                suppierErrorLabel.Visible = true;
            }
            else
            {
                suppierErrorLabel.Visible = false;
            }
            if (contactPersonTxt.Text == "")
            {
                contactpersonErrorlabe.Visible = true;
            }
            else
            {
                contactpersonErrorlabe.Visible = false;
            }
            if (phone1Txt.Text == "")
            {
                phone1ErrorLabel.Visible = true;
            }
            else
            {
                phone1ErrorLabel.Visible = false;
            }
            if (addressTxt.Text == "")
            {
                addressErrorLabel.Visible = true;
            }
            else
            {
                addressErrorLabel.Visible = false;
            }
            if (statusDD.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (suppierErrorLabel.Visible || contactpersonErrorlabe.Visible || phone1ErrorLabel.Visible || addressErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.showMessage("Fields with * are mandatory", "Stop", "Error");
            }
            else
            {
                if (statusDD.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (statusDD.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0)//Code for Save Operation
                {
                    Insertion i = new Insertion();
                    if (phone2Txt.Text == "" && ntnTxt.Text != "")
                    {
                        i.insertSupplier(supplierTxt.Text, contactPersonTxt.Text, phone1Txt.Text, addressTxt.Text, stat, null, ntnTxt.Text);
                    }
                    else if (phone2Txt.Text != "" && ntnTxt.Text == "")
                    {
                        i.insertSupplier(supplierTxt.Text, contactPersonTxt.Text, phone1Txt.Text, addressTxt.Text, stat, phone2Txt.Text, null);
                    }
                    else if (phone2Txt.Text == "" && ntnTxt.Text == "")
                    {
                        i.insertSupplier(supplierTxt.Text, contactPersonTxt.Text, phone1Txt.Text, addressTxt.Text, stat, null, null);
                    }
                    else
                    {
                        i.insertSupplier(supplierTxt.Text, contactPersonTxt.Text, phone1Txt.Text, addressTxt.Text, stat, phone2Txt.Text, ntnTxt.Text);
                    }
                    r.showSupplier(dataGridView1, supidGV, companyGV, contactpersonGV, phone1GV, phone2GV, addressGV, StatusGV, NTNGV);
                    MainClass.disable_reset(leftPanel);
                }
                else if (edit == 1)//Code for Update Operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure, you want to update recored", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();


                        if (statusDD.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (statusDD.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        if (edit == 1)//Code for Save Operation
                        {
                            if (phone2Txt.Text == "" && ntnTxt.Text != "")
                            {
                                u.updateSupplier(supplierId, supplierTxt.Text, contactPersonTxt.Text, phone1Txt.Text, addressTxt.Text, stat, null, ntnTxt.Text);
                            }
                            else if (phone2Txt.Text != "" && ntnTxt.Text == "")
                            {
                                u.updateSupplier(supplierId, supplierTxt.Text, contactPersonTxt.Text, phone1Txt.Text, addressTxt.Text, stat, phone2Txt.Text, null);
                            }
                            else if (phone2Txt.Text == "" && ntnTxt.Text == "")
                            {
                                u.updateSupplier(supplierId, supplierTxt.Text, contactPersonTxt.Text, phone1Txt.Text, addressTxt.Text, stat, null, null);
                            }
                            else
                            {
                                u.updateSupplier(supplierId, supplierTxt.Text, contactPersonTxt.Text, phone1Txt.Text, addressTxt.Text, stat, phone2Txt.Text, ntnTxt.Text);
                            }
                            r.showSupplier(dataGridView1, supidGV, companyGV, contactpersonGV, phone1GV, phone2GV, addressGV, StatusGV, NTNGV);
                            MainClass.disable_reset(leftPanel);
                        }
                    }
                }
            }
        }
Example #9
0
 public override void BtnSave_Click(object sender, EventArgs e)
 {
     //validation for Users form
     if (proNameTxt.Text == string.Empty)
     {
         proNameErrorLabel.Visible = true;
     }
     else
     {
         proNameErrorLabel.Visible = false;
     }
     if (barCodeTxt.Text == string.Empty)
     {
         BarcodeErrorLabel.Visible = true;
     }
     else
     {
         BarcodeErrorLabel.Visible = false;
     }
     if (ExpiryPicker.Value < DateTime.Now)
     {
         ExpiryErrorLabel.Visible = true; ExpiryErrorLabel.Text = "Invalid Date";
     }
     else
     {
         ExpiryErrorLabel.Visible = false;
     }
     if (ExpiryPicker.Value.Date == DateTime.Now.Date)
     {
         ExpiryErrorLabel.Visible = false;
     }
     if (PriceTxt.Text == string.Empty)
     {
         PriceErrorLabel.Visible = true;
     }
     else
     {
         PriceErrorLabel.Visible = false;
     }
     if (CatDD.SelectedIndex == -1 || CatDD.SelectedIndex == 0)
     {
         catErrorLabel.Visible = true;
     }
     else
     {
         catErrorLabel.Visible = false;
     }
     if (proNameErrorLabel.Visible || BarcodeErrorLabel.Visible || ExpiryErrorLabel.Visible || PriceErrorLabel.Visible || catErrorLabel.Visible)
     {
         MainClass.showMSG("Fields with * are mandatory", "Stop", "Error"); //Error is the type of message
     }
     else
     {
         if (edit == 0) // Code for SAVE Operation
         {
             Insertion i = new Insertion();
             if (ExpiryPicker.Value.Date == DateTime.Now.Date)
             {
                 i.insertProduct(proNameTxt.Text, barCodeTxt.Text, Convert.ToSingle(PriceTxt.Text), Convert.ToInt32(CatDD.SelectedValue));
             }
             else
             {
                 i.insertProduct(proNameTxt.Text, barCodeTxt.Text, Convert.ToSingle(PriceTxt.Text), Convert.ToInt32(CatDD.SelectedValue), ExpiryPicker.Value);
             }
             r.showProducts(dataGridView1, proIDGV, proNameGV, barcodeGV, expiryGV, priceGV, catGV, catIDGV);
             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 (ExpiryPicker.Value.Date == DateTime.Now.Date)
                 {
                     u.updateProduct(proID, proNameTxt.Text, barCodeTxt.Text, Convert.ToSingle(PriceTxt.Text), Convert.ToInt32(CatDD.SelectedValue));
                 }
                 else
                 {
                     u.updateProduct(proID, proNameTxt.Text, barCodeTxt.Text, Convert.ToSingle(PriceTxt.Text), Convert.ToInt32(CatDD.SelectedValue), ExpiryPicker.Value);
                 }
                 r.showProducts(dataGridView1, proIDGV, proNameGV, barcodeGV, expiryGV, priceGV, catGV, catIDGV);
                 MainClass.disable_reset(LeftPanel);
             }
         }
     }
     MainClass.enable_reset(LeftPanel);
 }
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (catagoryTxt.Text == "")
            {
                catErrorLabel.Visible = true;
            }
            else
            {
                catErrorLabel.Visible = false;
            }
            if (catCombo.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (catErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.showMessage("Fields with * are mandatory", "Stop", "Error");
            }
            else
            {
                if (catCombo.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (catCombo.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0)//Code for Save Operation
                {
                    Insertion i = new Insertion();
                    i.insertCat(catagoryTxt.Text, stat);

                    r.showCategories(dataGridView1, catGV, 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 recored", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();
                        if (catCombo.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (catCombo.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        u.updateCat(catId, catagoryTxt.Text, stat);

                        r.showCategories(dataGridView1, catGV, nameGV, StatusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
Example #11
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (nameTxt.Text == "")
            {
                namelabelError.Visible = true;
            }
            else
            {
                namelabelError.Visible = false;
            }
            if (userTxt.Text == "")
            {
                usrlabelError.Visible = true;
            }
            else
            {
                usrlabelError.Visible = false;
            }
            if (passTxt.Text == "")
            {
                passlabelError.Visible = true;
            }
            else
            {
                passlabelError.Visible = false;
            }
            if (phoneTxt.Text == "")
            {
                phonelabelError.Visible = true;
            }
            else
            {
                phonelabelError.Visible = false;
            }
            if (emailTxt.Text == "")
            {
                emaillabelError.Visible = true;
            }
            else
            {
                emaillabelError.Visible = false;
            }
            if (statusCombo.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (namelabelError.Visible || usrlabelError.Visible || passlabelError.Visible || phonelabelError.Visible || emaillabelError.Visible || statusErrorLabel.Visible)
            {
                MainClass.showMessage("Fields with * are mandatory", "Stop", "Error");
            }
            else
            {
                if (statusCombo.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (statusCombo.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0)//Code for Save Operation
                {
                    Insertion i = new Insertion();


                    i.insertUser(nameTxt.Text, userTxt.Text, passTxt.Text, phoneTxt.Text, emailTxt.Text, stat);

                    r.showUser(dataGridView1, USERGV, nameGV, usernameGV, passGV, EmailGV, PhoneGV, StatusGV);
                    MainClass.disable_reset(leftPanel);
                }
                else if (edit == 1)//Code for Update Operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure, you want to update recored", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();
                        if (statusCombo.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (statusCombo.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        u.updateUser(userId, nameTxt.Text, userTxt.Text, passTxt.Text, phoneTxt.Text, emailTxt.Text, stat);

                        r.showUser(dataGridView1, USERGV, nameGV, usernameGV, passGV, EmailGV, PhoneGV, StatusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (nameTxt.Text == "")
            {
                nameErrorLabel.Visible = true;
            }
            else
            {
                nameErrorLabel.Visible = false;
            }

            if (usernameTxt.Text == "")
            {
                usernameErrorLabel.Visible = true;
            }
            else
            {
                usernameErrorLabel.Visible = false;
            }

            if (passTxt.Text == "")
            {
                passErrorLabel.Visible = true;
            }
            else
            {
                passErrorLabel.Visible = false;
            }

            if (emailTxt.Text == "")
            {
                emailErrorLabel.Visible = true;
            }
            else
            {
                emailErrorLabel.Visible = false;
            }

            if (phoneTxt.Text == "")
            {
                phoneErrorLabel.Visible = true;
            }
            else
            {
                phoneErrorLabel.Visible = false;
            }

            if (statusDD.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (nameErrorLabel.Visible || usernameErrorLabel.Visible || passErrorLabel.Visible || emailErrorLabel.Visible || phoneErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error");               //Error is the type of message.
            }
            else
            {
                if (statusDD.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (statusDD.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0)                //code for SAVE operation.
                {
                    insertion i = new insertion();
                    i.insertUser(nameTxt.Text, usernameTxt.Text, passTxt.Text, emailTxt.Text, phoneTxt.Text, stat);
                    r.showUsers(dataGridView1, userIDGV, NameGV, USerNameGV, PassGV, EmailGV, PhoneGV, 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 (statusDD.SelectedIndex == 0)
                        {
                            stat = 1;
                        }
                        else if (statusDD.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        u.updateUser(userID, nameTxt.Text, usernameTxt.Text, passTxt.Text, emailTxt.Text, phoneTxt.Text, stat);
                        r.showUsers(dataGridView1, userIDGV, NameGV, USerNameGV, PassGV, EmailGV, PhoneGV, statusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
Example #13
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);
                    }
                }
            }
        }
Example #14
0
 private void products_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(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);
                    }
                }
            }
        }
Example #16
0
        public override void saveBTN_Click(object sender, EventArgs e)
        {
            if (nameTXT.Text == "")
            {
                nameErrorLabel.Visible = true;
            }
            else
            {
                nameErrorLabel.Visible = false;
            }
            if (usernameTXT.Text == "")
            {
                usernameErrorLabel.Visible = true;
            }
            else
            {
                usernameErrorLabel.Visible = false;
            }
            if (passwordTXT.Text == "")
            {
                passwordErrorLabel.Visible = true;
            }
            else
            {
                passwordErrorLabel.Visible = false;
            }
            if (phoneTXT.Text == "")
            {
                phoneErrorLabel.Visible = true;
            }
            else
            {
                phoneErrorLabel.Visible = false;
            }
            if (emailTXT.Text == "")
            {
                emailErrorLabel.Visible = true;
            }
            else
            {
                emailErrorLabel.Visible = false;
            }
            if (statusCB.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }
            if (nameErrorLabel.Visible || usernameErrorLabel.Visible || passwordErrorLabel.Visible || phoneErrorLabel.Visible || emailErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.ShowMsg("Fields with * are mandatory", "Error", "Error"); //Error is the type of msg
            }
            else
            {
                if (statusCB.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (statusCB.SelectedIndex == 1)
                {
                    stat = 0;
                }

                if (edit == 0) // Code for save operation
                {
                    insertion i = new insertion();


                    i.userInsertion(nameTXT.Text, usernameTXT.Text, passwordTXT.Text, phoneTXT.Text, emailTXT.Text, stat);
                    r.showUser(dataGridView1, userIDGV, NameGV, usernameGV, passwordGV, phoneGV, emailGV, 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();
                        u.updateUser(userID, nameTXT.Text, usernameTXT.Text, passwordTXT.Text, phoneTXT.Text, emailTXT.Text, stat);
                        r.showUser(dataGridView1, userIDGV, NameGV, usernameGV, passwordGV, phoneGV, emailGV, statusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }