예제 #1
0
 private void PaymentMethodCheckBox_SelectedValueChanged(object sender, EventArgs e)
 {
     if (PaymentMethodCheckBox.SelectedValue != null)
     {
         DataRow aMethodRow = PaymentMethodMgmt.SelectMethodRowByID(int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()));
         AccountComboBox.SelectedValue   = int.Parse(aMethodRow["DefaultAccountID"].ToString()); //PaymentMethodMgmt.SelectDefaultAccountIDByMethodID(int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()));
         AccountDescriptionTxtBox.Text   = AccountsMgmt.SelectAccountDescriptionByID(int.Parse(aMethodRow["DefaultAccountID"].ToString()));
         PaymentMethodDescripTxtBox.Text = aMethodRow["Description"].ToString();                 //PaymentMethodMgmt.SelectDescriptionByID(int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()));
         if (aMethodRow["IsCash"].ToString() == "1")
         {
             CashPaymentGB.Show();
             CashPaymentGB.BringToFront();
             PayInVisaGB.Hide();
             CheckGB.Hide();
         }
         else if (aMethodRow["IsCredit"].ToString() == "1")
         {
             PayInVisaGB.Show();
             PayInVisaGB.BringToFront();
             CashPaymentGB.Hide();
             CheckGB.Hide();
         }
         else
         {
             CheckGB.Show();
             CheckGB.BringToFront();
             CashPaymentGB.Hide();
             PayInVisaGB.Hide();
             CheckNumberTxtBox.Text = ChecksMgmt.NextCheckNumber().ToString();
         }
     }
 }
예제 #2
0
 private void AccountComboBox_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (AccountComboBox.SelectedValue != null)
         {
             DataRow aAccountRow = AccountsMgmt.SelectAccountRowByID(int.Parse(AccountComboBox.SelectedValue.ToString()));
             if (AccountsMgmt.SelectAccountPaymentMethodByID(int.Parse(AccountComboBox.SelectedValue.ToString())) == int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()))
             {
                 if (aAccountRow["CurrencyID"].ToString() != "1")
                 {
                     AccountNotJOD = true;
                 }
                 else
                 {
                     AccountNotJOD = false;
                 }
                 AccountDescriptionTxtBox.Text = AccountsMgmt.SelectAccountDescriptionByID(int.Parse(aAccountRow["ID"].ToString()));
             }
             else
             {
                 MessageBox.Show(MsgTxt.AccountTxt + "\n[" + AccountComboBox.Text + "]\n" + MsgTxt.DoNotAcceptTxt + "\n" + PaymentMethodCheckBox.Text, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 //Same As Function on value change for the payment method combo box
                 DataRow aMethodRow = PaymentMethodMgmt.SelectMethodRowByID(int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()));
                 AccountComboBox.SelectedValue   = int.Parse(aMethodRow["DefaultAccountID"].ToString()); //PaymentMethodMgmt.SelectDefaultAccountIDByMethodID(int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()));
                 PaymentMethodDescripTxtBox.Text = aMethodRow["Description"].ToString();                 //PaymentMethodMgmt.SelectDescriptionByID(int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()));
                 if (aMethodRow["IsCash"].ToString() == "1")
                 {
                     CashPaymentGB.Show();
                     CashPaymentGB.BringToFront();
                     PayInVisaGB.Hide();
                     CheckGB.Hide();
                 }
                 else if (aMethodRow["IsCredit"].ToString() == "1")
                 {
                     PayInVisaGB.Show();
                     PayInVisaGB.BringToFront();
                     CashPaymentGB.Hide();
                     CheckGB.Hide();
                 }
                 else
                 {
                     CheckGB.Show();
                     CheckGB.BringToFront();
                     CashPaymentGB.Hide();
                     PayInVisaGB.Hide();
                 }
             }
         }
     }
     catch (Exception ex) //Unexpected Error
     {
         MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [AccountComboBox_SelectedValueChanged] \n Exception: \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
 }
예제 #3
0
 private void PaymentMethodCheckBox_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         //no need to lock because this changes the account table which needed to be updated
         if (PaymentMethodCheckBox.SelectedValue != null)
         {
             aMethodRow = PaymentMethodMgmt.SelectMethodRowByID(int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()));
             AccountComboBox.SelectedValue   = int.Parse(aMethodRow["DefaultAccountID"].ToString());
             AccountDescriptionTxtBox.Text   = AccountsMgmt.SelectAccountDescriptionByID(int.Parse(aMethodRow["DefaultAccountID"].ToString()));
             PaymentMethodDescripTxtBox.Text = aMethodRow["Description"].ToString();
             if (aMethodRow["IsCash"].ToString() == "1")
             {
                 PayInVisaGB.Hide();
                 CheckGB.Hide();
             }
             else if (aMethodRow["IsCredit"].ToString() == "1")
             {
                 PayInVisaGB.Show();
                 PayInVisaGB.BringToFront();
                 CheckGB.Hide();
             }
             else
             {
                 CheckGB.Show();
                 CheckGB.BringToFront();
                 PayInVisaGB.Hide();
                 CheckNumberTxtBox.Text = ChecksMgmt.NextCheckNumber().ToString();
             }
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [PaymentMethodCheckBox_SelectedValueChanged] \n Exception: \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
 }
예제 #4
0
        private void AddVendorPayment_Load(object sender, EventArgs e)
        {
            try
            {
                IsLoading = true;

                int PaymentNumber = VendorsPaymentsMgmt.NextPaymentNumber();

                if (PaymentNumber == 0)
                {
                    throw new Exception("Payment Number ==0");
                }
                else
                {
                    PaymentNumberTxtBox.Text = PaymentNumber.ToString();
                    DataRow aPaymentMethodRow = PaymentMethodMgmt.SelectDefaultPaymentMethod();
                    if (aPaymentMethodRow == null)
                    {
                        throw new Exception("aPaymentMethodRow ==null");
                    }
                    else
                    {
                        PaymentMethodCheckBox.Text          = aPaymentMethodRow["Name"].ToString();
                        PaymentMethodCheckBox.SelectedValue = aPaymentMethodRow["ID"].ToString();
                        PaymentMethodDescripTxtBox.Text     = aPaymentMethodRow["Description"].ToString();

                        AccountComboBox.SelectedValue = int.Parse(aPaymentMethodRow["DefaultAccountID"].ToString());//PaymentMethodMgmt.SelectDefaultAccountIDByMethodID(int.Parse(PaymentMethodCheckBox.SelectedValue.ToString()));
                        AccountDescriptionTxtBox.Text = AccountsMgmt.SelectAccountDescriptionByID(int.Parse(aPaymentMethodRow["DefaultAccountID"].ToString()));
                        IsLoading = false;
                    }
                }
            }
            catch (Exception ex)
            {
                IsLoading = false;
                MessageBox.Show(MsgTxt.ErrorLoadingFrom + "\nException: IN[AddVendorPayment_Load] \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Dispose();
            }
        }