Example #1
0
        private ResultDto InsertUpdateBankMaster(BankMasterDto bank)
        {
            ResultDto resultDto = new ResultDto();
            string    obectName = "bank master";

            try
            {
                ObjectParameter paramBankEntryId = new ObjectParameter("BankEntryId", bank.BankEntryID);
                ObjectParameter paramBankCode    = new ObjectParameter("BankCode", string.Empty);
                _dbContext.uspBankMasterInsertUpdate(paramBankEntryId, bank.BankName, bank.BranchName, bank.IFSC, bank.AccountNumber, bank.AccountType, bank.ContactNumber, bank.Email, bank.Address, bank.isMasterEntry, bank.UserID, paramBankCode);

                if (bank.BankEntryID > 0)
                {
                    resultDto.ObjectCode = bank.BankCode;
                }
                else
                {
                    resultDto.ObjectCode = (string)paramBankCode.Value;
                }
                resultDto.ObjectId = (int)paramBankEntryId.Value;

                if (resultDto.ObjectId > 0)
                {
                    resultDto.Message = string.Format("{0} details saved successfully with code : {1}", obectName, resultDto.ObjectCode);
                }
                else if (resultDto.ObjectId == -1)
                {
                    resultDto.Message = string.Format("Error occured while generating {0} code", obectName);
                }
                else
                {
                    resultDto.Message = string.Format("Error occured while saving {0} details", obectName);
                }
            }
            catch (Exception)
            {
                resultDto.Message  = string.Format("Service layer error occured while saving the {0} details", obectName);
                resultDto.ObjectId = -98;
            }
            return(resultDto);
        }