Ejemplo n.º 1
0
        private void dgrdChequeBook_SelectionChanged(object sender, EventArgs e)
        {
            if (dgrdChequeBook.SelectedRows.Count != 0)
            {

                SelectedChequeID = Convert.ToInt32(dgrdChequeBook.SelectedRows[0].Cells[0].Value);
                _chequebook = ChequeBookList.Find(a => a.ChequeBookID == SelectedChequeID);
                if (_chequebook != null)
                {
                    ShowGUI(_chequebook);
                }
                //  financialyear = SelectedFinancialYear;
            }
        }
Ejemplo n.º 2
0
        public static List<ChequeBook> GetAllCheques()
        {
            List<ChequeBook> ChequeBookList = new List<ChequeBook>();
            NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
            var _ChequeBook = from Cheque in newAppsCnn.Acc_ChequeBook select Cheque;

            foreach (var chequebook in _ChequeBook)
            {
                ChequeBook chkbook = new ChequeBook();
                chkbook.ChequeBookID = chequebook.ChequeBookID;
                chkbook.CheuqeBookName_Ara = chequebook.CheuqeBookName_Ara;
                chkbook.CheuqeBookName_Eng = chequebook.CheuqeBookName_Eng;
                chkbook.ChequeStartNo = chequebook.ChequeStartNo;
                chkbook.CHequeEndno = chequebook.CHequeEndno;
                chkbook.IsDisable = chequebook.IsDisable;
                chkbook.ChequeCurrancyId = chequebook.ChequeCurrancyId;
                chkbook.BankAccountId = chequebook.BankAccountId;
                ChequeBookList.Add(chkbook);

            }
            return ChequeBookList;
        }
Ejemplo n.º 3
0
        public static List<ChequeBook> GetAllAccounts()
        {
            List<ChequeBook> ChequeBookList = new List<ChequeBook>();
            NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
            var _BankAccounts = from Cheque in newAppsCnn.Acc_Accounts.Where(a => a.AccountCategoryId == 1) select Cheque;

            foreach (var account in _BankAccounts)
            {
                ChequeBook bankaccount = new ChequeBook();
                bankaccount.AccountName_Ar = account.AccountName_Ar;
                bankaccount.AccountName_En = account.AccountName_Eng;
                bankaccount.AccountId = account.AccountID;
                ChequeBookList.Add(bankaccount);
            }
            return ChequeBookList;
        }
Ejemplo n.º 4
0
        private Acc_ChequeBook BuildDBRecord(Acc_ChequeBook _Acc_ChequeBook, ChequeBook _ChequeBook)
        {
            if (_ChequeBook.ChequeBookID != -1)
            {
                _Acc_ChequeBook.ChequeBookID = _ChequeBook.ChequeBookID;

            }
            _Acc_ChequeBook.CheuqeBookName_Ara = _ChequeBook.CheuqeBookName_Ara;
            _Acc_ChequeBook.CheuqeBookName_Eng = _ChequeBook.CheuqeBookName_Eng;
            _Acc_ChequeBook.ChequeStartNo = _ChequeBook.ChequeStartNo;
            _Acc_ChequeBook.CHequeEndno = _ChequeBook.CHequeEndno;
            _Acc_ChequeBook.IsDisable = _ChequeBook.IsDisable;
            _Acc_ChequeBook.BankAccountId = _ChequeBook.BankAccountId;
            _Acc_ChequeBook.ChequeCurrancyId = _ChequeBook.ChequeCurrancyId;
            return _Acc_ChequeBook;
        }
Ejemplo n.º 5
0
        public DataSaveResult Save(ChequeBook _ChequeBook)
        {
            try
            {
                Acc_ChequeBook Acc_ChequeBook;
                NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);

                Acc_ChequeBook = newAppsCnn.Acc_ChequeBook.Where(a => a.ChequeBookID == _ChequeBook.ChequeBookID).FirstOrDefault();
                if (Acc_ChequeBook != null)
                {
                    BuildDBRecord(Acc_ChequeBook, _ChequeBook);
                }

                else
                {

                    Acc_ChequeBook = new Acc_ChequeBook();
                    Acc_ChequeBook = BuildDBRecord(Acc_ChequeBook, _ChequeBook);
                    newAppsCnn.Acc_ChequeBook.Add(Acc_ChequeBook);
                }

                newAppsCnn.SaveChanges();
                //   Audit.AddDataAudit(Audit.AuditActionTypes.AddNew, "Acc_VouchersType", this);

                return new DataSaveResult() { SaveStatus = true };
            }
            catch (Exception ex)
            {
                return new DataSaveResult() { SaveStatus = false };
            }
        }
Ejemplo n.º 6
0
        private void ShowGUI(ChequeBook _ChequeBook)
        {
            if (!string.IsNullOrEmpty(_ChequeBook.CheuqeBookName_Ara))
            {
                txtArabicName.Text = _ChequeBook.CheuqeBookName_Ara;
            }
            if (!string.IsNullOrEmpty(_ChequeBook.CheuqeBookName_Eng))
            {
                txtEnglishName.Text = _ChequeBook.CheuqeBookName_Eng;
            }

            cbxCurrency.SelectedValue = _ChequeBook.ChequeCurrancyId;

            if (!string.IsNullOrEmpty(_ChequeBook.BankAccountId))
            {
                cbxBanckAccounts.SelectedValue = _ChequeBook.BankAccountId;
            }
            chkIsDisabled.Checked = _ChequeBook.IsDisable;
            numStart.Value = Convert.ToDecimal(_ChequeBook.ChequeStartNo);
            numEnd.Value = Convert.ToDecimal(_ChequeBook.CHequeEndno);
        }
Ejemplo n.º 7
0
 private void GetDataFromGUI()
 {
     _chequebook = new ChequeBook();
     _chequebook.ChequeBookID = SelectedChequeID;
     _chequebook.CheuqeBookName_Ara = txtArabicName.Text;
     _chequebook.CheuqeBookName_Eng = txtEnglishName.Text;
     _chequebook.ChequeCurrancyId = Convert.ToInt32(cbxCurrency.SelectedValue);
     _chequebook.IsDisable = chkIsDisabled.Checked;
     _chequebook.BankAccountId = cbxBanckAccounts.SelectedValue.ToString();
     _chequebook.ChequeStartNo = Convert.ToInt32(numEnd.Value);
     _chequebook.CHequeEndno = Convert.ToInt32(numEnd.Value);
 }
Ejemplo n.º 8
0
        private void frmChequeBook_Save(object sender, ref bool _status)
        {
            ChequeBook cheque = new ChequeBook();
            GetDataFromGUI();

            DataSaveResult saveResult = cheque.Save(_chequebook);
            if (saveResult.SaveStatus == false)
            {
                _status = false;

            }
            else
            {
                ChequeBookList = ChequeBook.GetAllCheques();
                LoadDataGrid(ChequeBookList);
            }
            dgrdChequeBook.Enabled = true;
            dgrdChequeBook.Rows[SelectedRow].Selected = true;
            dgrdChequeBook_SelectionChanged(dgrdChequeBook, new EventArgs());
        }
Ejemplo n.º 9
0
        private void frmChequeBook_Delete(object sender, ref bool _status)
        {
            _chequebook = new ChequeBook();
            if (SelectedChequeID == -1)
            {
                _status = false;
                return;
            }
            DataDeleteResult result = _chequebook.Delete(SelectedChequeID);
            _status = result.DeleteStatus;
            if (result.DeleteStatus == false)
            {
                MessageBox.Show(result.ErrorMessage);
            }
            else
            {

                ChequeBookList = ChequeBook.GetAllCheques();
                LoadDataGrid(ChequeBookList);
                dgrdChequeBook.Rows[0].Selected = true;
            }
        }