Esempio n. 1
0
        private ResultDto FederationInsertUpdateContraEntryWithDrawl(ContraEntryWithDrawlDto contraEntryWithDrawlDto)
        {
            ResultDto resultDto  = new ResultDto();
            string    objectName = "ContraEntryWithDrawl";

            try
            {
                string contraEntryTransactionsxml = CommonMethods.SerializeListDto <List <ContraEntryWithDrawlTransactionsDto> >(contraEntryWithDrawlDto.contraEntryWithDrawlTransactions);

                ObjectParameter paramaccounmasterID = new ObjectParameter("AccountMasterID", contraEntryWithDrawlDto.AccountMasterID);
                ObjectParameter paramreCEWCode;
                if (contraEntryWithDrawlDto.VoucherNumber == "")
                {
                    paramreCEWCode = new ObjectParameter("VoucherNumber", string.Empty);
                }
                else
                {
                    paramreCEWCode = new ObjectParameter("VoucherNumber", contraEntryWithDrawlDto.VoucherNumber);
                }

                _dbContext.uspFederationContraEntryWithDrawlInsertUpdate(paramaccounmasterID, contraEntryWithDrawlDto.TransactionDate, paramreCEWCode, contraEntryWithDrawlDto.VoucherRefNumber, contraEntryWithDrawlDto.CodeSno, contraEntryWithDrawlDto.PartyName, contraEntryWithDrawlDto.EmployeeID,
                                                                         contraEntryWithDrawlDto.AHID, contraEntryWithDrawlDto.SubHeadID, contraEntryWithDrawlDto.TransactionType, contraEntryWithDrawlDto.Amount, contraEntryWithDrawlDto.TransactionMode,
                                                                         contraEntryWithDrawlDto.ChequeNumber, contraEntryWithDrawlDto.ChequeDate, contraEntryWithDrawlDto.BankAccount, contraEntryWithDrawlDto.Narration, contraEntryTransactionsxml, contraEntryWithDrawlDto.IsGroup, contraEntryWithDrawlDto.UserID);

                resultDto.ObjectId   = Convert.ToInt32(paramaccounmasterID.Value);     //(int) contraEntryWithDrawlDto.AccountMasterID;
                resultDto.ObjectCode = string.IsNullOrEmpty((string)paramreCEWCode.Value) ? contraEntryWithDrawlDto.VoucherNumber : (string)paramreCEWCode.Value;

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