Ejemplo n.º 1
0
        public override void SaveBtn_Click(object sender, EventArgs e)
        {
            if (CatnameTxt.Text == "")
            {
                CategoryErrorLbl.Visible = true;
            }
            else
            {
                CategoryErrorLbl.Visible = false;
            }

            if (activeCB.SelectedIndex == -1)
            {
                activeErrorLbl.Visible = true;
            }
            else
            {
                activeErrorLbl.Visible = false;
            }

            if (CategoryErrorLbl.Visible || activeErrorLbl.Visible)
            {
                MainClass.ShowMSG("fields with * are mandatory", "stop", "Error");//Error is the type of message
            }
            else
            {
                if (activeCB.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else if (activeCB.SelectedIndex == 1)
                {
                    stat = 0;
                }
                if (edit == 0)//code for save operation
                {
                    Insertion i = new Insertion();

                    i.insertCategory(CatnameTxt.Text, stat);
                    r.showCategory(CatdataGridView, categoryIDGV, CatNameGV, CatStatusGV);
                    MainClass.disable_reset(leftPanel);
                }
                else if (edit == 1)//code for update operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure, you want to update record?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();
                        u.updateCategory(catID, CatnameTxt.Text, stat);
                        r.showCategory(CatdataGridView, categoryIDGV, CatNameGV, CatStatusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void SaveBtn_Click(object sender, EventArgs e)
        {
            if (SuppNameTxt.Text == "")
            {
                suppnameErrorLbl.Visible = true;
            }
            else
            {
                suppnameErrorLbl.Visible = false;
            }
            if (ContactPersonTxt.Text == "")
            {
                contPersonErrorLbl.Visible = true;
            }
            else
            {
                contPersonErrorLbl.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 == "")
            {
                AddressErrorLbl.Visible = true;
            }
            else
            {
                AddressErrorLbl.Visible = false;
            }
            //if (TinTxt.Text == "")
            //{
            //    TinErrorLbl.Visible = true;
            //}
            //else
            //{
            //    TinErrorLbl.Visible = false;
            //}
            if (StatusDD.SelectedIndex == -1)
            {
                StatusErrorLbl.Visible = true;
            }
            else
            {
                StatusErrorLbl.Visible = false;
            }

            if (suppnameErrorLbl.Visible || contPersonErrorLbl.Visible || Phone1ErrorLbl.Visible || AddressErrorLbl.Visible || StatusErrorLbl.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 == "" && TinTxt.Text != "")
                    {
                        i.insertSupplier(SuppNameTxt.Text, ContactPersonTxt.Text, Phone1Txt.Text, AddressTxt.Text, stat, null, TinTxt.Text);
                    }
                    else if (Phone2Txt.Text != "" && TinTxt.Text == "")
                    {
                        i.insertSupplier(SuppNameTxt.Text, ContactPersonTxt.Text, Phone1Txt.Text, AddressTxt.Text, stat, Phone2Txt.Text, null);
                    }
                    else if (Phone2Txt.Text == "" && TinTxt.Text == "")
                    {
                        i.insertSupplier(SuppNameTxt.Text, ContactPersonTxt.Text, Phone1Txt.Text, AddressTxt.Text, stat, null, null);
                    }
                    else
                    {
                        i.insertSupplier(SuppNameTxt.Text, ContactPersonTxt.Text, Phone1Txt.Text, AddressTxt.Text, stat, Phone2Txt.Text, TinTxt.Text);
                    }
                    r.showSupplier(SupplierdataGridView, SupplierIDGV, CompanyGV, ContactPersonGV, Phone1GV, Phone2GV, AddressGV, TinGV, 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?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();
                        u.updateSupplier(suppID, SuppNameTxt.Text, ContactPersonTxt.Text, Phone1Txt.Text, AddressTxt.Text, stat, Phone2Txt.Text, TinTxt.Text);
                        r.showSupplier(SupplierdataGridView, SupplierIDGV, CompanyGV, ContactPersonGV, Phone1GV, Phone2GV, AddressGV, TinGV, StatusGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public override void SaveBtn_Click(object sender, EventArgs e)
        {
            if (nameTxt.Text == "")
            {
                nameErrorLbl.Visible = true;
            }
            else
            {
                nameErrorLbl.Visible = false;
            }
            if (usernameTxt.Text == "")
            {
                usernameErrorLbl.Visible = true;
            }
            else
            {
                usernameErrorLbl.Visible = false;
            }
            if (passTxt.Text == "")
            {
                passErrorLbl.Visible = true;
            }
            else
            {
                passErrorLbl.Visible = false;
            }
            if (emailTxt.Text == "")
            {
                emailErrorLbl.Visible = true;
            }
            else
            {
                emailErrorLbl.Visible = false;
            }
            if (phoneTxt.Text == "")
            {
                phoneErrorLbl.Visible = true;
            }
            else
            {
                phoneErrorLbl.Visible = false;
            }
            if (StatusDD.SelectedIndex == -1)
            {
                statusErrorLbl.Visible = true;
            }
            else
            {
                statusErrorLbl.Visible = false;
            }

            if (nameErrorLbl.Visible || usernameErrorLbl.Visible || passErrorLbl.Visible || emailErrorLbl.Visible || phoneErrorLbl.Visible || statusErrorLbl.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, 2);
                    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?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();
                        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);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public override void SaveBtn_Click(object sender, EventArgs e)
        {
            if (ProductTxt.Text == "")
            {
                productErrorLbl.Visible = true;
            }
            else
            {
                productErrorLbl.Visible = false;
            }
            if (barcodeTxt.Text == "")
            {
                barcodeErrorLbl.Visible = true;
            }
            else
            {
                barcodeErrorLbl.Visible = false;
            }
            if (ExpiryPicker.Value < DateTime.Now)
            {
                ExpiryErrorLbl.Visible = true;
                ExpiryErrorLbl.Text    = "Invalid Date";
            }
            else
            {
                ExpiryErrorLbl.Visible = false;
            }
            if (ExpiryPicker.Value.Date == DateTime.Now.Date)
            {
                ExpiryErrorLbl.Visible = false;
            }

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


            if (productErrorLbl.Visible || barcodeErrorLbl.Visible || CategoryErrorLbl.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(ProductTxt.Text, barcodeTxt.Text, Convert.ToInt32(categoryCB.SelectedValue));
                    }
                    else
                    {
                        i.insertProduct(ProductTxt.Text, barcodeTxt.Text, Convert.ToInt32(categoryCB.SelectedValue), ExpiryPicker.Value);
                    }

                    r.showProduct(ProductdataGridView, ProductIDGV, NameGV, BarcodeGV, ExpiryGV, CategoryGV, CategoryIDGV);
                    MainClass.disable_reset(leftPanel);
                }
                else if (edit == 1)//code for update operation
                {
                    DialogResult dr = MessageBox.Show("Are you sure, you want to update record?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        Updation u = new Updation();
                        if (ExpiryPicker.Value.Date == DateTime.Now.Date)
                        {
                            u.updateProduct(proID, ProductTxt.Text, barcodeTxt.Text, Convert.ToInt32(categoryCB.SelectedValue));
                        }
                        else
                        {
                            u.updateProduct(proID, ProductTxt.Text, barcodeTxt.Text, Convert.ToInt32(categoryCB.SelectedValue), ExpiryPicker.Value);
                        }
                        r.showProduct(ProductdataGridView, ProductIDGV, NameGV, BarcodeGV, ExpiryGV, CategoryGV, CategoryIDGV);
                        MainClass.disable_reset(leftPanel);
                    }
                }
            }
        }