示例#1
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);
                    }
                }
            }
        }
        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);
                    }
                }
            }
        }
示例#3
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);
 }
示例#4
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);
                        }
                    }
                }
            }
        }
示例#5
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 (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);
                    }
                }
            }
        }
示例#7
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);
                    }
                }
            }
        }