コード例 #1
0
        public override void saveBTN_Click(object sender, EventArgs e)
        {
            if (catTXT.Text == "")
            {
                catErrorLabel.Visible = true;
            }
            else
            {
                catErrorLabel.Visible = false;
            }
            if (isativeDD.SelectedIndex == -1)
            {
                isactiveErrorLabel.Visible = true;
            }
            else
            {
                isactiveErrorLabel.Visible = false;
            }
            if (catErrorLabel.Visible || isactiveErrorLabel.Visible)
            {
                MainClass.ShowMsg("Fields with * are mandatory", "Error", "Error"); //Error is the type of msg
            }
            else
            {
                if (isativeDD.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (isativeDD.SelectedIndex == 1)
                {
                    stat = 0;
                }

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


                    i.CatInsertion(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();
                        u.updateCat(catID, catTXT.Text, stat);
                        r.showCategories(dataGridView1, catIDGV, NameGV, statusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
コード例 #2
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;
            }

            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);
                    }
                }
            }
        }
コード例 #3
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 (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);
                    }
                }
            }
        }
コード例 #4
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);
                    }
                }
            }
        }
コード例 #5
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);
                    }
                }
            }
        }