Beispiel #1
0
        public override void upodatebtn_Click(object sender, EventArgs e)
        {
            if (Categrytxt.Text == "")
            {
                Caterrorlbl.Visible = true;
            }
            else
            {
                Caterrorlbl.Visible = false;
            }
            if (ActiveDD.SelectedIndex == -1)
            {
                Activeerrorlbl.Visible = true;
            }
            else
            {
                Activeerrorlbl.Visible = false;
            }


            if (Caterrorlbl.Visible || Activeerrorlbl.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error"); //Error massage with main class
            }
            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(Categrytxt.Text, stat);
                    R.ShowCategories(dataGridView1, catIDGV, catNameGV, 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, Categrytxt.Text, stat);
                        R.ShowCategories(dataGridView1, catIDGV, catNameGV, StatusGV);
                        MainClass.disable_reset(leftpanel);
                    }
                }
            }
        }
        public override void upodatebtn_Click(object sender, EventArgs e)
        {
            if (nametxtusr.Text == "")
            {
                nameerrorlabl.Visible = true;
            }
            else
            {
                nameerrorlabl.Visible = false;
            }
            if (usernametxtusr.Text == "")
            {
                usrnameerrorlbl.Visible = true;
            }
            else
            {
                usrnameerrorlbl.Visible = false;
            }
            if (pswttxtusr.Text == "")
            {
                pswerrorlbl.Visible = true;
            }
            else
            {
                pswerrorlbl.Visible = false;
            }
            if (phonetxtusr.Text == "")
            {
                phoneerroelbl.Visible = true;
            }
            else
            {
                phoneerroelbl.Visible = false;
            }
            if (emailtxtusr.Text == "")
            {
                emailerroelbl.Visible = true;
            }
            else
            {
                emailerroelbl.Visible = false;
            }
            if (Statuscombousr.SelectedIndex == -1)
            {
                statuseror.Visible = true;
            }
            else
            {
                statuseror.Visible = false;
            }


            if (nameerrorlabl.Visible || usrnameerrorlbl.Visible || pswerrorlbl.Visible || phoneerroelbl.Visible || emailerroelbl.Visible || statuseror.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error"); //Error massage with main class
            }
            else
            {
                if (Statuscombousr.SelectedIndex == 0)
                {
                    stat = 1;
                }

                else if (Statuscombousr.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0) //code for save operation
                {
                    Insertion i = new Insertion();

                    i.InsertUser(nametxtusr.Text, usernametxtusr.Text, pswttxtusr.Text, emailtxtusr.Text, phonetxtusr.Text, stat);
                    R.ShowUsers(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, nametxtusr.Text, usernametxtusr.Text, pswttxtusr.Text, emailtxtusr.Text, phonetxtusr.Text, stat);
                        R.ShowUsers(dataGridView1, userIDGV, NameGV, UserNameGV, PasswordGV, PhoneGV, EmailGV, StatusGV);
                        MainClass.disable_reset(leftpanel);
                    }
                }
            }
        }
Beispiel #3
0
        public override void upodatebtn_Click(object sender, EventArgs e)
        {
            if (pronamtxtp.Text == "")
            {
                pnameerrorlbl.Visible = true;
            }
            else
            {
                pnameerrorlbl.Visible = false;
            }
            if (barcodetxtp.Text == "")
            {
                barcodeperrorlbl.Visible = true;
            }
            else
            {
                barcodeperrorlbl.Visible = false;
            }
            if (Expirypickerp.Value < DateTime.Now)
            {
                expiryerrorplbl.Visible = true; expiryerrorplbl.Text = "Invalid Date...";
            }
            else
            {
                expiryerrorplbl.Visible = false;
            }
            if (pptxt.Text == "")
            {
                pperrorlbl.Visible = true;
            }
            else
            {
                pperrorlbl.Visible = false;
            }
            if (categoryDD.SelectedIndex == -1 || categoryDD.SelectedIndex == 0)
            {
                caterrorlbl.Visible = true;
            }
            else
            {
                caterrorlbl.Visible = false;
            }
            if (pnameerrorlbl.Visible || barcodeperrorlbl.Visible || expiryerrorplbl.Visible || pperrorlbl.Visible || caterrorlbl.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory", "Stop", "Error"); //Error massage with main class
            }
            else
            {
                if (edit == 0) //code for save operation
                {
                    Insertion i = new Insertion();
                    i.InsertProduct(pronamtxtp.Text, barcodetxtp.Text, Convert.ToSingle(pptxt.Text), Expirypickerp.Value, Convert.ToInt32(categoryDD.SelectedValue));
                    R.ShowProducts(dataGridView1, proIDGV, proNameGV, 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();

                        u.updateProduct(prodID, pronamtxtp.Text, barcodetxtp.Text, Convert.ToSingle(pptxt.Text), Expirypickerp.Value, Convert.ToInt32(categoryDD.SelectedValue));
                        R.ShowProducts(dataGridView1, proIDGV, proNameGV, ExpiryGV, CatGV, PriceGV, barcodeGV, CatIDGV);
                        MainClass.disable_reset(leftpanel);
                    }
                }
            }
        }