Exemplo n.º 1
0
        private void New_Supplier_Load(object sender, EventArgs e)
        {
            bool focused = txtSupplierName.Focused;

            cmbStatus.SelectedIndex = 0;
            if (Sup_ID != null)
            {
                btnSave.Caption = "Update";
                Master.Database.SupplierData Sup = new Master.Database.SupplierData();

                DataTable dtSup = new DataTable();
                Sup.FnConn();
                dtSup = Sup.GetRow(Sup_ID);
                Sup.FnTrans();

                if (dtSup.Rows.Count > 0)
                {
                    txtSupplierName.Text = dtSup.Rows[0]["name"] + "";
                    txtFullName.Text     = dtSup.Rows[0]["fullName"] + "";
                    memAddr.Text         = dtSup.Rows[0]["address"] + "";
                    txtPhone.Text        = dtSup.Rows[0]["phoneNumber"] + "";
                    txtEmail.Text        = dtSup.Rows[0]["email"] + "";
                    txtWebAddr.Text      = dtSup.Rows[0]["webAddress"] + "";
                    txtLicenseNo.Text    = dtSup.Rows[0]["licenceNumber"] + "";
                    txtTinNo.Text        = dtSup.Rows[0]["tinNumber"] + "";
                    cmbStatus.Text       = dtSup.Rows[0]["status"] + "";
                    txtOppBal.Text       = dtSup.Rows[0]["openingBalance"] + "";
                    txtCreditLimit.Text  = dtSup.Rows[0]["creditLimit"] + "";
                    spnPaymentDays.Text  = dtSup.Rows[0]["paymentDays"] + "";
                }
            }
        }
Exemplo n.º 2
0
 private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (Sup_ID != null)
     {
         DialogResult rs = MessageBox.Show(" Procced ?", "Alert", MessageBoxButtons.YesNo);
         if (rs == DialogResult.Yes)
         {
             Master.Database.SupplierData Sup = new Master.Database.SupplierData();
             Sup.FnConn();
             Sup.DeleteData(Sup_ID);
             Sup.FnTrans();
             Clear();
         }
     }
 }
Exemplo n.º 3
0
        private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            bool focused = txtSupplierName.Focused;

            cmbStatus.SelectedIndex = 0;
            int slno = 0;

            if (txtSupplierName.Text != "" && memAddr.Text != "" && txtPhone.Text != "")
            {
                Master.Database.SupplierData Sup = new Master.Database.SupplierData();

                Sup.SupplierName = txtSupplierName.Text;
                Sup.FullName     = txtFullName.Text;
                Sup.Address      = memAddr.Text;
                Sup.Phone        = txtPhone.Text;
                Sup.Email        = txtEmail.Text;
                Sup.WebAddr      = txtWebAddr.Text;
                Sup.License      = txtLicenseNo.Text;
                Sup.TinNo        = txtTinNo.Text;
                Sup.Status       = cmbStatus.Text;
                Sup.OppBal       = txtOppBal.Text;
                Sup.CreditLimit  = txtCreditLimit.Text;
                Sup.PaymentDays  = (spnPaymentDays.Text).Split('.')[0];

                if (btnSave.Caption == "Save")
                {
                    Sup.FnConn();
                    slno = Convert.ToInt16(Sup.GetMaxValue()) + 1;
                    Sup.FnTrans();

                    Sup.Supplierid = "SUP000" + slno;

                    Sup.FnConn();
                    Sup.fnTransactionData("I");
                    Sup.FnTrans();
                    if (Sup.Result == "Success")
                    {
                        MessageBox.Show("Supplier Created", "ALERT", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Supplier Creation failed", "ALERT", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    Sup.Supplierid = Sup_ID;
                    Sup.FnConn();
                    Sup.fnTransactionData("U");
                    Sup.FnTrans();
                    if (Sup.Result == "Success")
                    {
                        MessageBox.Show("Suppler Details Updated..", "ALERT", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                Clear();
            }
            else
            {
                MessageBox.Show("Please input mandatory fields");
            }
        }