示例#1
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            if (BaseValidator.IsFormValid(this.components))
            {
                if (RbtnIncome.Checked || RbtnOutgoing.Checked)
                {
                    db = new UnitofWork();
                    DataLayer.Accounting accounting = new DataLayer.Accounting()
                    {
                        Amount      = int.Parse(NumericAmount.Value.ToString()),
                        TypeID      = (RbtnIncome.Checked) ? 1 : 2,
                        CustomerID  = db.CustomerRepository.GetCustomerIdByName(TxtName.Text),
                        Description = TxtDecription.Text,
                        Datetime    = DateTime.Now
                    };
                    if (AccountId == 0)
                    {
                        db.accountingrepository.Insert(accounting);
                    }
                    else
                    {
                        accounting.AccID = AccountId;
                        db.accountingrepository.Update(accounting);
                    }

                    db.Save();
                    db.Dispose();
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    RtlMessageBox.Show("لطفا نوع تراکنش را انتخاب کنید");
                }
            }
        }
示例#2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (BaseValidator.IsFormValid(this.components))
     {
         if (rbPay.Checked || rbRecieve.Checked)
         {
             db = new UnitOfWork();
             DataLayer.Accounting accounting = new DataLayer.Accounting()
             {
                 Amount      = int.Parse(txtAmount.Value.ToString()),
                 CustomerID  = db.CustomerRepository.GetCustomerByName(txtName.Text),
                 TypeID      = (rbRecieve.Checked) ? 1 : 2,
                 DateTitle   = DateTime.Now,
                 Description = txtDescription.Text
             };
             if (AccountId == 0)
             {
                 db.AccountingRepository.Insert(accounting);
                 db.Save();
             }
             else
             {
                 accounting.ID = AccountId;
                 db.AccountingRepository.Update(accounting);
             }
             db.Save();
             db.Dispose();
             DialogResult = DialogResult.OK;
         }
         else
         {
             MessageBox.Show("Please choose the transaction type");
         }
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (BaseValidator.IsFormValid(this.components))
            {
                if (rbPay.Checked || rbReceive.Checked)
                {
                    DataLayer.Accounting accounting = new DataLayer.Accounting()
                    {
                        Amount      = int.Parse(txtAmount.Value.ToString()),
                        CustomerID  = db.CustomerRepository.GetCustomerIdByName(txtName.Text),
                        TypeID      = (rbReceive.Checked) ? 1 : 2,
                        DateTitle   = DateTime.Now,
                        Description = txtDescription.Text
                    };
                    if (AccountID == 0)
                    {
                        db.AccountingRepository.Insert(accounting);
                    }
                    else
                    {
                        accounting.ID = AccountID;
                        db.AccountingRepository.Update(accounting);
                    }

                    db.Save();
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("لطفا نوع تراکنش را انتخاب کنید");
                }
            }
        }