public override void button3_Click(object sender, EventArgs e)
        {
            if (nameTxt.Text == "")
            {
                nameErrorLbl.Visible = true;
            }
            else
            {
                nameErrorLbl.Visible = false;
            }
            if (usernametxt.Text == "")
            {
                UserNameLbl.Visible = true;
            }
            else
            {
                nameErrorLbl.Visible = false;
            }
            if (usernametxt.Text == "")
            {
                UserNameLbl.Visible = true;
            }
            else
            {
                UserNameLbl.Visible = false;
            }
            if (pwdTxt.Text == "")
            {
                PwdLbl.Visible = true;
            }
            else
            {
                PwdLbl.Visible = false;
            }
            if (phoneTxt.Text == "")
            {
                phoneLbl.Visible = true;
            }
            else
            {
                phoneLbl.Visible = false;
            }
            if (EmailTxt.Text == "")
            {
                EmailLbl.Visible = true;
            }
            else
            {
                EmailLbl.Visible = false;
            }
            if (statusDD.SelectedIndex == -1)
            {
                statusErrorLbl.Visible = true;
            }
            else
            {
                statusErrorLbl.Visible = false;
            }

            if (nameErrorLbl.Visible || UserNameLbl.Visible || PwdLbl.Visible || phoneLbl.Visible || EmailLbl.Visible || statusErrorLbl.Visible)
            {
                MainClass.showMG("Filds 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, pwdTxt.Text, EmailTxt.Text, phoneTxt.Text, stat);
                    r.Showusers(dataGridView1, userIDGV, NameGV, UserNameGV, PassGV, EmailGV, PhoneGV, statusGV);
                    MainClass.disable_reset(lftPanel);
                }
                else if (edit == 1)///for Updte Operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure, you want to updata 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, pwdTxt.Text, EmailTxt.Text, phoneTxt.Text, stat);
                        r.Showusers(dataGridView1, userIDGV, NameGV, UserNameGV, PassGV, EmailGV, PhoneGV, statusGV);
                        MainClass.disable_reset(lftPanel);
                    }
                }
            }
        }
Exemple #2
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            //Here we enable and disable the red asterisc "*" in the form, validating that no txt left unfilled
            if (supplierCompanyTxt.Text == "")
            {
                supplierNameErrorLbl.Visible = true;
            }
            else
            {
                supplierNameErrorLbl.Visible = false;
            }
            if (personNameTxt.Text == "")
            {
                contactPersonErrorLbl.Visible = true;
            }
            else
            {
                contactPersonErrorLbl.Visible = false;
            }
            if (Phone1Txt.Text == "")
            {
                phone1ErrorLbl.Visible = true;
            }
            else
            {
                phone1ErrorLbl.Visible = false;
            }
            if (addressTxt.Text == "")
            {
                addressErrorLbl.Visible = true;
            }
            else
            {
                addressErrorLbl.Visible = false;
            }
            if (statusDD.SelectedIndex == -1)
            {
                statusErrorLbl.Visible = true;
            }
            else
            {
                statusErrorLbl.Visible = false;
            }

            if (supplierNameErrorLbl.Visible || contactPersonErrorLbl.Visible || phone1ErrorLbl.Visible || addressErrorLbl.Visible || statusErrorLbl.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error"); //Error is the type of msg
            }
            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();
                    //validating the null fields
                    if (phone2Txt.Text == "" && ntnTxt.Text != "")
                    {
                        i.insertSupplier(supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, addressTxt.Text, stat, null, ntnTxt.Text);
                    }
                    else if (phone2Txt.Text != "" && ntnTxt.Text == "")
                    {
                        i.insertSupplier(supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, addressTxt.Text, stat, phone2Txt.Text, null);
                    }
                    else if (phone2Txt.Text == "" && ntnTxt.Text == "")
                    {
                        i.insertSupplier(supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, addressTxt.Text, stat, null, null);
                    }
                    else
                    {
                        i.insertSupplier(supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, addressTxt.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;
                        }
                        //validating the null fields
                        if (phone2Txt.Text == "" && ntnTxt.Text != "")
                        {
                            u.updateSupplier(supplierID, supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, addressTxt.Text, stat, null, ntnTxt.Text);
                        }
                        else if (phone2Txt.Text != "" && ntnTxt.Text == "")
                        {
                            u.updateSupplier(supplierID, supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, addressTxt.Text, stat, phone2Txt.Text, null);
                        }
                        else if (phone2Txt.Text == "" && ntnTxt.Text == "")
                        {
                            u.updateSupplier(supplierID, supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, addressTxt.Text, stat, null, null);
                        }
                        else
                        {
                            u.updateSupplier(supplierID, supplierCompanyTxt.Text, personNameTxt.Text, Phone1Txt.Text, addressTxt.Text, stat, phone2Txt.Text, ntnTxt.Text);
                        }

                        r.showSuppliers(dataGridView1, SuppIDGV, companyGV, personGV, phone1GV, phone2GV, addressGV, ntnGV, StatusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
Exemple #3
0
        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 (catErrorLabel.Visible || activeErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error"); //Error is the type of msg
            }
            else
            {
                if (activeDD.SelectedIndex == 0)
                {
                    stat = 1; //this is sent to the stored procedure: status = 1 then 'Yes'
                }
                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; //this is sent to the stored procedure: status = 1 then 'Yes'
                        }
                        else if (activeDD.SelectedIndex == 1)
                        {
                            stat = 0;
                        }
                        u.updateCat(catID, catTxt.Text, stat);
                        r.showCategories(dataGridView1, catIDGV, NameGV, StatusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
 private void Users_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(lftPanel);
 }
Exemple #5
0
        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;
            }                                                                                       //this fix the problem that we can use the current date
            if (priceTxt.Text == "")
            {
                priceErrorLabel.Visible = true;
            }
            else
            {
                priceErrorLabel.Visible = false;
            }
            if (categoryDD.SelectedIndex == -1 || categoryDD.SelectedIndex == 0)
            {
                catErrorLabel.Visible = true;
            }
            else
            {
                catErrorLabel.Visible = false;
            }

            //final if
            if (proErrorLabel.Visible || barcodeErrorLabel.Visible || expiryErrorLabel.Visible || priceErrorLabel.Visible || catErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error");
            }
            else
            {
                if (edit == 0) //Code for SAVE operation
                {
                    insertion i = new insertion();
                    if (expiryPicker.Value.Date == DateTime.Now.Date) //if the expiry date is set now, then we set the value null
                    {
                        i.insertProduct(proTxt.Text, barcodeTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryDD.SelectedValue));
                    }
                    else //if the expiry date is set in another date different from now, we save the value
                    {
                        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) //if the expiry date is set now, then we set the value null
                        {
                            u.updateProduct(prodID, proTxt.Text, barcodeTxt.Text, Convert.ToSingle(priceTxt.Text), Convert.ToInt32(categoryDD.SelectedValue));
                        }
                        else //if the expiry date is set in another date different from now, we save the value
                        {
                            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);
                    }
                }
            }
        }
Exemple #6
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            //Here we enable and disable the red asterisc "*" in the form, validating that no txt left unfilled
            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 (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 || passwordErrorLabel.Visible || emailErrorLabel.Visible || phoneErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error"); //Error is the type of msg
            }
            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, passwordTxt.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, passwordTxt.Text, emailTxt.Text, phoneTxt.Text, stat);
                        r.showUsers(dataGridView1, UserIDGV, NameGV, UserNameGV, PassGV, EmailGV, PhoneGV, StatusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
 private void Products_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(lftPanel);
     r.getList("st_getCategoriesList", categoryDD, "Category", "ID");
     groupBox1.Enabled = false;
 }
        public override void button3_Click(object sender, EventArgs e)
        {
            if (CategoryTxt.Text == "")
            {
                CategoryErrorLbl.Visible = true;
            }
            else
            {
                CategoryErrorLbl.Visible = false;
            }
            if (activeDD.SelectedIndex == -1)
            {
                ActiveErrorlbl.Visible = true;
            }
            else
            {
                ActiveErrorlbl.Visible = false;
            }

            if (ActiveErrorlbl.Visible || CategoryErrorLbl.Visible)
            {
                MainClass.showMG("Filds 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(CategoryTxt.Text, stat);
                    r.ShowCategories(dataGridView1, catIDGV, NameGV, statusGV);
                    MainClass.disable_reset(lftPanel);
                }
                else if (edit == 1)///for Updte Operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure, you want to updata 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;
                        }
                        u.updateCat(catID, CategoryTxt.Text, stat);
                        r.ShowCategories(dataGridView1, catIDGV, NameGV, statusGV);
                        MainClass.disable_reset(lftPanel);
                    }
                }
            }
        }
        public override void button3_Click(object sender, EventArgs e)
        {
            if (supplierComTxt.Text == "")
            {
                nameErrorLbl.Visible = true;
            }
            else
            {
                nameErrorLbl.Visible = false;
            }
            if (personNameTxt.Text == "")
            {
                ContPerErrorlbl.Visible = true;
            }
            else
            {
                ContPerErrorlbl.Visible = false;
            }
            if (phone1txt.Text == "")
            {
                phone1Errorlbl.Visible = true;
            }
            else
            {
                phone1Errorlbl.Visible = false;
            }
            //   if (phone2txt.Text == "") { phone2Errorlbl.Visible = true; } else { phone2Errorlbl.Visible = false; }
            if (addresstxt.Text == "")
            {
                AddressErroorlbl.Visible = true;
            }
            else
            {
                AddressErroorlbl.Visible = false;
            }
            //  if (TaxNotxt.Text == "") { TaxNoErrorlbl.Visible = true; } else { TaxNoErrorlbl.Visible = false; }
            if (statusDD.SelectedIndex == -1)
            {
                statusErrorlbl.Visible = true;
            }
            else
            {
                statusErrorlbl.Visible = false;
            }

            if (nameErrorLbl.Visible || ContPerErrorlbl.Visible || phone1Errorlbl.Visible || AddressErroorlbl.Visible || statusErrorlbl.Visible)
            {
                MainClass.showMG("Filds 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 == "" && TaxNotxt.Text != "")
                    {
                        i.insertSupplier(supplierComTxt.Text, personNameTxt.Text, phone1txt.Text, addresstxt.Text, stat, null, TaxNotxt.Text);
                    }
                    else if (phone2txt.Text != "" && TaxNotxt.Text == "")
                    {
                        i.insertSupplier(supplierComTxt.Text, personNameTxt.Text, phone1txt.Text, addresstxt.Text, stat, phone2txt.Text, null);
                    }
                    else if (phone2txt.Text == "" && TaxNotxt.Text == "")
                    {
                        i.insertSupplier(supplierComTxt.Text, personNameTxt.Text, phone1txt.Text, addresstxt.Text, stat, null, null);
                    }
                    else
                    {
                        i.insertSupplier(supplierComTxt.Text, personNameTxt.Text, phone1txt.Text, addresstxt.Text, stat, phone2txt.Text);
                    }
                    r.showSupplier(dataGridView1, suppIDGV, companyGV, personGV, phone1GV, phone2GV, addressGV, ntnGV, statusGV);
                    MainClass.disable_reset(lftPanel);
                }
                else if (edit == 1)///for Updte Operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure, you want to updata 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 == "" && TaxNotxt.Text != "")
                        {
                            u.updateSupplier(SupplierID, supplierComTxt.Text, personNameTxt.Text, phone1txt.Text, addresstxt.Text, stat, null, TaxNotxt.Text);
                        }
                        else if (phone2txt.Text != "" && TaxNotxt.Text == "")
                        {
                            u.updateSupplier(SupplierID, supplierComTxt.Text, personNameTxt.Text, phone1txt.Text, addresstxt.Text, stat, phone2txt.Text, null);
                        }
                        else if (phone2txt.Text == "" && TaxNotxt.Text == "")
                        {
                            u.updateSupplier(SupplierID, supplierComTxt.Text, personNameTxt.Text, phone1txt.Text, addresstxt.Text, stat, null, null);
                        }
                        else
                        {
                            u.updateSupplier(SupplierID, supplierComTxt.Text, personNameTxt.Text, phone1txt.Text, addresstxt.Text, stat, phone1txt.Text, phone2txt.Text);
                        }
                        r.showSupplier(dataGridView1, suppIDGV, companyGV, personGV, phone1GV, phone2GV, addressGV, ntnGV, statusGV);


                        MainClass.disable_reset(lftPanel);
                    }
                }
            }
        }