示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cmbCountry.Text.Equals("") || cmbCity.Text.Equals("") || cmbCompany.Equals("") || txtYear.Text.Equals("") || cmbProduct.Text.Equals("") || txtColor.Text.Equals(""))
            {
                MessageBox.Show("Data not completed...");
            }
            else
            {
                btnSave.Enabled = false;
                string billS = "";
                string QuotS = "";
                isbill = NumOfBill;
                isQuot = NumOfQuotation;
                if (isbill != 0)
                {
                    billS = "B_True";
                }
                else
                {
                    billS = "B_False";
                }
                if (isQuot != 0)
                {
                    QuotS = "Q_True";
                }
                else
                {
                    QuotS = "Q_False";
                }

                //************************************

                int       addtogal = ClassSetting.sp_AddToGallery(txtYear.Text, txtSeason.Text, billS, QuotS);
                DataTable lastGal  = ClassSetting.selectlastGal();
                int       addtoDet = ClassSetting.AddtoGalDetails(cat_id, (int)cmbProduct.SelectedValue, (int)cmbCompany.SelectedValue, color_id, type_id, int.Parse(lastGal.Rows[0][0].ToString()), (int)cmbCountry.SelectedValue, (int)cmbCity.SelectedValue);

                //************************************

                for (int iCat = 0; iCat < CatalogIMG.Count; iCat++)
                {
                    int addtocat = ClassSetting.AddtoCataloge(CatalogIMG[iCat], int.Parse(lastGal.Rows[0][0].ToString()));
                }

                //****************************************

                int       addBill  = ClassSetting.addbill(dtpBill.Value, int.Parse(lastGal.Rows[0][0].ToString()));
                DataTable lastBill = ClassSetting.selectLastBill();

                for (int ibill = 0; ibill < BillIMG.Count; ibill++)
                {
                    int addBillDet = ClassSetting.addtoBillDetails(BillIMG[ibill], int.Parse(lastBill.Rows[0][0].ToString()));
                }

                //******************************************

                int       addQuot  = ClassSetting.AddQuot(dtpQuotation.Value, int.Parse(lastGal.Rows[0][0].ToString()));
                DataTable lastQuot = ClassSetting.selectLastQuot();

                for (int iQuot = 0; iQuot < QuotationIMG.Count; iQuot++)
                {
                    int addQuotDet = ClassSetting.addtoQuotDetails(QuotationIMG[iQuot], int.Parse(lastQuot.Rows[0][0].ToString()));
                }

                //*****************************************

                MessageBox.Show("Done..");
                txtYear.Text = txtSeason.Text = txtColor.Text = txtType.Text = "";
                CatalogIMG.Clear();
                BillIMG.Clear();
                QuotationIMG.Clear();
                lbCatalog.Text  = lbBill.Text = lbQuotation.Text = "0";
                NumOfCatalog    = NumOfBill = NumOfQuotation = 0;
                btnSave.Enabled = true;
            }
        }