Exemplo n.º 1
0
        public void CRUD_Bank()
        {
            #region Commented Code

            #endregion

            BankBE mod = new BankBE();
            mod.SiteCode = "QST";
            mod.EntityName = "Bank Alrijhi";
            //mod.Phone = "111222333";

            int id = _bdmSvc.AddBank(mod);
            //int vchId = _alKhairSvc.AddVoucher(mod);

            var list = _bdmSvc.GetAllBanks("QST");// _alKhairSvc.GetAllVouchers("QST");//.GetViewOfAllVouchers("QST");
            if (list != null && list.Count > 0)
            {
                mod = list[0];
                //mod.VchNo = " ...";
                mod.EntityName = mod.EntityName + "...";

                if (_bdmSvc.ModifyBank(mod))
                {

                }
                //p = _bdmSvc.GetPersonById(pv.SiteCode, pv.EntityTypeCode, pv.ID);
            }
        }
Exemplo n.º 2
0
 public int AddBank(BankBE mod)
 {
     return AddEntity(mod.ToEntity());
 }
Exemplo n.º 3
0
 public bool ModifyBank(BankBE mod)
 {
     return ModifyEntity(mod.ToEntity());
 }
Exemplo n.º 4
0
 public BankViewModel()
 {
     Bank = new BankBE();
     Banks = new List<BankBE>();
 }
Exemplo n.º 5
0
        public BankViewModel ModifyBank(BankBE mod)
        {
            BankViewModel model = new BankViewModel();

            try
            {
                DBOperations op = mod.IsActive ? DBOperations.Update : DBOperations.Delete;
                mod.SiteCode = AppConstants.SITE_CODE;
                model.Bank = mod;
                model.IsValid = model.Validate();
                if (op == DBOperations.Delete || model.IsValid)
                {
                    //_bdmSvc.ModifyEntity(mod);
                    _bdmSvc.ModifyBank(mod);

                    model.FieldId = "BankName";
                    model.Bank = new BankBE();
                    model.Banks = _bdmSvc.GetAllBanks(AppConstants.SITE_CODE).Where(m => m.IsActive = true).ToList();
                    model.Message = op == DBOperations.Update ? string.Format(AppConstants.CRUD_UPDATE, "Bank Name") : string.Format(AppConstants.CRUD_DELETE, "Bank Name");
                }
            }
            catch (Exception ex)
            {
                model.IsValid = false;
                model.Message = ex.Message;
                if (ex.Message.Contains("Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions."))
                    model.Message = "Unable to modify Region Code";
            }
            return model;
        }