/// <summary>
 ///     Takes the specified b u voucher list detail parallel entity.
 /// </summary>
 /// <param name="bUVoucherListDetailParallelEntity">The b u voucher list detail parallel entity.</param>
 /// <returns></returns>
 private static object[] Take(BUVoucherListDetailParallelEntity bUVoucherListDetailParallelEntity)
 {
     return(new object[]
     {
         "@RefDetailID", bUVoucherListDetailParallelEntity.RefDetailId,
         "@ParentRefDetailID", bUVoucherListDetailParallelEntity.ParentRefDetailId,
         "@RefID", bUVoucherListDetailParallelEntity.RefId,
         "@Description", bUVoucherListDetailParallelEntity.Description,
         "@DebitAccount", bUVoucherListDetailParallelEntity.DebitAccount,
         "@CreditAccount", bUVoucherListDetailParallelEntity.CreditAccount,
         "@Amount", bUVoucherListDetailParallelEntity.Amount,
         "@AmountOC", bUVoucherListDetailParallelEntity.AmountOC,
         "@BudgetSourceID", bUVoucherListDetailParallelEntity.BudgetSourceId,
         "@BudgetProvideCode", bUVoucherListDetailParallelEntity.BudgetProvideCode,
         "@BudgetChapterCode", bUVoucherListDetailParallelEntity.BudgetChapterCode,
         "@BudgetKindItemCode", bUVoucherListDetailParallelEntity.BudgetKindItemCode,
         "@BudgetSubKindItemCode", bUVoucherListDetailParallelEntity.BudgetSubKindItemCode,
         "@BudgetItemCode", bUVoucherListDetailParallelEntity.BudgetItemCode,
         "@BudgetSubItemCode", bUVoucherListDetailParallelEntity.BudgetSubItemCode,
         "@BudgetDetailItemCode", bUVoucherListDetailParallelEntity.BudgetDetailItemCode,
         "@MethodDistributeID", bUVoucherListDetailParallelEntity.MethodDistributeId,
         "@CashWithdrawTypeID", bUVoucherListDetailParallelEntity.CashWithdrawTypeId,
         "@AccountingObjectID", bUVoucherListDetailParallelEntity.AccountingObjectId,
         "@ActivityID", bUVoucherListDetailParallelEntity.ActivityId,
         "@ProjectID", bUVoucherListDetailParallelEntity.ProjectId,
         "@ListItemID", bUVoucherListDetailParallelEntity.ListItemId,
         "@Approved", bUVoucherListDetailParallelEntity.Approved,
         "@SortOrder", bUVoucherListDetailParallelEntity.SortOrder,
         "@OrgRefNo", bUVoucherListDetailParallelEntity.OrgRefNo,
         "@OrgRefDate", bUVoucherListDetailParallelEntity.OrgRefDate,
         "@FundStructureID", bUVoucherListDetailParallelEntity.FundStructureId,
         "@BankAccount", bUVoucherListDetailParallelEntity.BankAccount,
         "@BudgetExpenseID", bUVoucherListDetailParallelEntity.BudgetExpenseId
     });
 }
        /// <summary>
        ///     Inserts the bu voucher list detail parallel.
        /// </summary>
        /// <param name="bUVoucherListDetailParallelEntity">The b u voucher list detail parallel entity.</param>
        /// <returns></returns>
        public string InsertBUVoucherListDetailParallel(
            BUVoucherListDetailParallelEntity bUVoucherListDetailParallelEntity)
        {
            const string procedures = @"uspInsert_BUVoucherListDetailParallel";

            return(Db.Insert(procedures, true, Take(bUVoucherListDetailParallelEntity)));
        }
        /// <summary>
        ///     Updates the bu voucher list detail parallel.
        /// </summary>
        /// <param name="bUVoucherListDetailParallelEntity">The b u voucher list detail parallel entity.</param>
        /// <returns></returns>
        public string UpdateBUVoucherListDetailParallel(
            BUVoucherListDetailParallelEntity bUVoucherListDetailParallelEntity)
        {
            const string procedures = @"uspUpdate_BUVoucherListDetailParallel";

            return(Db.Update(procedures, true, Take(bUVoucherListDetailParallelEntity)));
        }
        public List <BUVoucherListDetailParallelEntity> BuVoucherListDetailParallels(List <BUVoucherListDetailParallel> details, string refid)
        {
            List <BUVoucherListDetailParallelEntity> lstDetailEntities = new List <BUVoucherListDetailParallelEntity>();

            foreach (var result in details)
            {
                var newresult = new BUVoucherListDetailParallelEntity();
                newresult.RefDetailId           = result.RefDetailID.ToString();
                newresult.ParentRefDetailId     = result.ParentRefDetailID.ToString();
                newresult.RefId                 = refid;
                newresult.Description           = result.Description;
                newresult.DebitAccount          = result.DebitAccount;
                newresult.CreditAccount         = result.CreditAccount;
                newresult.Amount                = result.Amount;
                newresult.AmountOC              = result.AmountOC;
                newresult.BudgetSourceId        = result.BudgetSource == null ? null : result.BudgetSource.BudgetSourceID.ToString();
                newresult.BudgetProvideCode     = result.BudgetProvidence == null ? null : result.BudgetProvidence.BudgetProvideCode;
                newresult.BudgetChapterCode     = result.BudgetChapterCode;
                newresult.BudgetKindItemCode    = result.BudgetKindItemCode;
                newresult.BudgetSubKindItemCode = result.BudgetSubKindItemCode;
                newresult.BudgetItemCode        = result.BudgetItemCode;
                newresult.BudgetSubItemCode     = result.BudgetSubItemCode;
                newresult.BudgetDetailItemCode  = result.BudgetDetailItemCode;
                newresult.MethodDistributeId    = result.MethodDistributeID;
                newresult.CashWithdrawTypeId    = ConvertCash.ConvertCash(result.CashWithdrawTypeID);
                newresult.AccountingObjectId    = result.AccountingObject == null ? null : result.AccountingObject.AccountingObjectID.ToString();
                newresult.ActivityId            = result.Activity == null ? null : result.Activity.ActivityID.ToString();
                newresult.ProjectId             = result.Project == null ? null : result.Project.ProjectID.ToString();
                newresult.ListItemId            = result.ListItem == null ? null : result.ListItem.ListItemID.ToString();
                newresult.Approved              = result.Approved;
                newresult.SortOrder             = result.SortOrder;
                newresult.OrgRefNo              = result.OrgRefNo;
                newresult.OrgRefDate            = result.OrgRefDate;
                newresult.FundStructureId       = result.FundStructure == null ? null : result.FundStructure.FundStructureID.ToString();
                newresult.BankAccount           = result.BankAccount;
                newresult.BudgetExpenseId       = result.BudgetExpenseID.ToString();

                lstDetailEntities.Add(newresult);
            }
            return(lstDetailEntities);
        }