示例#1
0
        public bool ObjectExists(ChartofAccountDTO chartofAccount)
        {
            var objectExists = false;
            var iDbContext   = DbContextUtil.GetDbContextInstance();

            try
            {
                var catRepository = new Repository <ChartofAccountDTO>(iDbContext);
                var catExists     = catRepository
                                    .Query()
                                    .Filter(bp => bp.AccountId == chartofAccount.AccountId && bp.Id != chartofAccount.Id)
                                    .Get()
                                    .FirstOrDefault();
                if (catExists != null)
                {
                    objectExists = true;
                }
            }
            finally
            {
                iDbContext.Dispose();
            }

            return(objectExists);
        }
示例#2
0
        public string Validate(ChartofAccountDTO chartofAccount)
        {
            if (null == chartofAccount)
            {
                return(GenericMessages.ObjectIsNull);
            }

            return(string.Empty);
        }
示例#3
0
 private void ExecuteAddNewAccountCommand()
 {
     SelectedChartofAccount = new ChartofAccountDTO
     {
     };
     if (AccountTypes != null)
     {
         var comercialBank = AccountTypes.FirstOrDefault();
         SelectedAccountType = comercialBank ?? AccountTypes.FirstOrDefault();
     }
     AddNewAccountCommandVisibility = true;
 }
示例#4
0
        public string Disable(ChartofAccountDTO chartofAccount)
        {
            if (chartofAccount == null)
            {
                return(GenericMessages.ObjectIsNull);
            }

            string stat;

            try
            {
                _chartofAccountRepository.Update(chartofAccount);
                _unitOfWork.Commit();
                stat = string.Empty;
            }
            catch (Exception exception)
            {
                stat = exception.Message;
            }
            return(stat);
        }
示例#5
0
        public string InsertOrUpdate(ChartofAccountDTO chartofAccount)
        {
            try
            {
                var validate = Validate(chartofAccount);
                if (!string.IsNullOrEmpty(validate))
                {
                    return(validate);
                }

                if (ObjectExists(chartofAccount))
                {
                    return(GenericMessages.DatabaseErrorRecordAlreadyExists);
                }

                _chartofAccountRepository.InsertUpdate(chartofAccount);
                _unitOfWork.Commit();
                return(string.Empty);
            }
            catch (Exception exception)
            {
                return(exception.Message);
            }
        }