public override void upodatebtn_Click(object sender, EventArgs e)
        {
            if (Quantitytxt.Text == "")
            {
                StockQTYerrorlbl.Visible = true;
            }
            else
            {
                StockQTYerrorlbl.Visible = false;
            }
            if (PerchaseRatetxt.Text == "")
            {
                PuchaserateErrorlbl.Visible = true;
            }
            else
            {
                PuchaserateErrorlbl.Visible = false;
            }
            if (SalesRatetxt.Text == "")
            {
                SalesRateErrorlbl.Visible = true;
            }
            else
            {
                SalesRateErrorlbl.Visible = false;
            }

            if (StockQTYerrorlbl.Visible || PuchaserateErrorlbl.Visible || SalesRateErrorlbl.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.InsertStock(Convert.ToInt32(ProductnameCB.SelectedValue), Convert.ToSingle(Quantitytxt.Text), Convert.ToSingle(PerchaseRatetxt.Text), Convert.ToSingle(SalesRatetxt.Text));
                    R.ShowStock(DataGridView1, StockIDGV, SprodIDGV, ProductNamepwGV, PQuantityGV, PurchaseRateGV, PSalesRateGV);
                    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.UpdateStock(StockID, Convert.ToInt32(ProductnameCB.SelectedValue), Convert.ToSingle(Quantitytxt.Text), Convert.ToSingle(PerchaseRatetxt.Text), Convert.ToSingle(SalesRatetxt.Text));
                        R.ShowStock(DataGridView1, StockIDGV, SprodIDGV, ProductNamepwGV, PQuantityGV, PurchaseRateGV, PSalesRateGV);
                        MainClass.disable_reset(leftpanel);
                    }
                }
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ObjUpdation                      = new Updation();
            ObjLPackages.PkgName             = txtpackagename.Text;
            ObjLPackages.PkgStartDate        = dtStartDate.Value;
            ObjLPackages.PkgEndDate          = dtEndDate.Value;
            ObjLPackages.PkgDesc             = txtDescription.Text;
            ObjLPackages.PkgBasePrice        = decimal.Parse(txtpkgBasePrice.Text);
            ObjLPackages.PkgAgencyCommission = decimal.Parse(txtPkgACommision.Text);
            ObjLPackages.PackageId           = Convert.ToInt32(treeView1.SelectedNode.Tag);

            bool success = ObjUpdation.UpdatePackages();

            if (success)
            {
                MessageBox.Show("Successfully Updated", "Project-207-Message", MessageBoxButtons.OK, MessageBoxIcon.None);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.Retry;
            }
        }
示例#3
0
        public override void BtnSave_Click(object sender, EventArgs e)
        {
            //validation for Users form
            if (SupplierCompanyTxt.Text == string.Empty)
            {
                supCompErrorLabel.Visible = true;
            }
            else
            {
                supCompErrorLabel.Visible = false;
            }
            if (contactPersonTxt.Text == string.Empty)
            {
                contactPerErrorLabel.Visible = true;
            }
            else
            {
                contactPerErrorLabel.Visible = false;
            }
            if (phone1Txt.Text == string.Empty)
            {
                phone1ErrorLabel.Visible = true;
            }
            else
            {
                phone1ErrorLabel.Visible = false;
            }
            if (AddressTxt.Text == string.Empty)
            {
                addressErrorLabel.Visible = true;
            }
            else
            {
                addressErrorLabel.Visible = false;
            }
            if (statusCb.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (supCompErrorLabel.Visible || contactPerErrorLabel.Visible || phone1ErrorLabel.Visible || addressErrorLabel.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();
                    if (phone2Txt.Text == string.Empty && ntnTxt.Text != string.Empty)
                    {
                        i.insertSupplier(SupplierCompanyTxt.Text, contactPersonTxt.Text, phone1Txt.Text, AddressTxt.Text, stat, null, ntnTxt.Text);
                    }
                    else if (phone2Txt.Text != string.Empty && ntnTxt.Text == string.Empty)
                    {
                        i.insertSupplier(SupplierCompanyTxt.Text, contactPersonTxt.Text, phone1Txt.Text, AddressTxt.Text, stat, phone2Txt.Text, null);
                    }
                    else if (phone2Txt.Text == string.Empty && ntnTxt.Text == string.Empty)
                    {
                        i.insertSupplier(SupplierCompanyTxt.Text, contactPersonTxt.Text, phone1Txt.Text, AddressTxt.Text, stat, null, null);
                    }
                    else
                    {
                        i.insertSupplier(SupplierCompanyTxt.Text, contactPersonTxt.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 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;
                        }
                        if (phone2Txt.Text == string.Empty && ntnTxt.Text != string.Empty)
                        {
                            u.updateSupplier(supplierID, SupplierCompanyTxt.Text, contactPersonTxt.Text, phone1Txt.Text, AddressTxt.Text, stat, null, ntnTxt.Text);
                        }
                        else if (phone2Txt.Text != string.Empty && ntnTxt.Text == string.Empty)
                        {
                            u.updateSupplier(supplierID, SupplierCompanyTxt.Text, contactPersonTxt.Text, phone1Txt.Text, AddressTxt.Text, stat, phone2Txt.Text, null);
                        }
                        else if (phone2Txt.Text == string.Empty && ntnTxt.Text == string.Empty)
                        {
                            u.updateSupplier(supplierID, SupplierCompanyTxt.Text, contactPersonTxt.Text, phone1Txt.Text, AddressTxt.Text, stat, null, null);
                        }
                        else
                        {
                            u.updateSupplier(supplierID, SupplierCompanyTxt.Text, contactPersonTxt.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);
                    }
                }
            }
        }
示例#4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            double x = double.Parse(txtpkgBasePrice.Text);
            double y = double.Parse(txtPkgACommision.Text);

            if (txtpackagename.Text.Length == 0)
            {
                MessageBox.Show("Package Name  should not be empty", "Travel Planet", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (dtEndDate.Value < dtStartDate.Value)
            {
                MessageBox.Show("Package End Date must be later that Package Start Date", "Travel Planet", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (dtStartDate.Value > dtEndDate.Value)
            {
                MessageBox.Show("Package Start Date must be earlier that Package End Date", "Travel Planet", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (txtPkgACommision.Text.Length == 0)
            {
                MessageBox.Show("Agency Commission should not be empty", "Travel Planet", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (txtpkgBasePrice.Text.Length == 0)
            {
                MessageBox.Show("Price should not be empty", "Travel Planet", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (y > x)
            {
                MessageBox.Show("Agency Commission not greater that basic price ", "Travel Planet", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Cursor.Current                   = Cursors.WaitCursor;
            ObjUpdation                      = new Updation();
            ObjLPackages.PkgName             = txtpackagename.Text;
            ObjLPackages.PkgStartDate        = dtStartDate.Value;
            ObjLPackages.PkgEndDate          = dtEndDate.Value;
            ObjLPackages.PkgDesc             = txtDescription.Text;
            ObjLPackages.PkgBasePrice        = decimal.Parse(txtpkgBasePrice.Text);
            ObjLPackages.PkgAgencyCommission = decimal.Parse(txtPkgACommision.Text);



            bool success = ObjUpdation.SaveProductsSuppliers((int)cmbPrId.SelectedValue, ProductData);


            if (success)
            {
                MessageBox.Show("Successfully Updated", "Project-207-Message", MessageBoxButtons.OK, MessageBoxIcon.None);
                checkedListBox1.Items.Clear();
                PopulatePackageTreeView();
            }

            else
            {
                this.DialogResult = DialogResult.Retry;
            }
            Cursor.Current = Cursors.Default;
        }