/// <summary>
        ///     Deletes the bu plan receipt.
        /// </summary>
        /// <param name="bUVoucherListEntity">The b u transfer.</param>
        /// <returns>
        ///     System.String.
        /// </returns>
        public string DeleteBUVoucherList(BUVoucherListEntity bUVoucherListEntity)
        {
            const string procedures = @"uspDelete_BUVoucherList";

            object[] parms = { "@RefId", bUVoucherListEntity.RefId };
            return(Db.Delete(procedures, true, parms));
        }
        public List <BUVoucherListEntity> GetBUVoucherLists(string connectionString)
        {
            List <BUVoucherListEntity> buentity = new List <BUVoucherListEntity>();

            using (var context = new MISAEntity(connectionString))
            {
                var querry           = context.BUVoucherListDetails.ToList();
                var projects         = context.Projects.ToList();
                var currencys        = context.CCies.ToList();
                var budgetsource     = context.BudgetSources.ToList();
                var listitems        = context.ListItems.ToList();
                var funds            = context.Funds.ToList();
                var fundstructures   = context.FundStructures.ToList();
                var budgetproviders  = context.BudgetProvidences.ToList();
                var accountingobject = context.AccountingObjects.ToList();
                var projectexpenses  = context.ProjectExpenses.ToList();
                var activity         = context.Activities.ToList();
                var tasks            = context.Tasks.ToList();
                var topics           = context.Topics.ToList();
                banks = context.BankInfoes.ToList();
                var parallel        = context.BUVoucherListDetailParallels.ToList();
                var detailtransfers = context.BUVoucherListDetailTransfers.ToList();
                var resultcontext   = context.BUVoucherLists.ToList();
                foreach (var result in resultcontext)
                {
                    var newresult = new BUVoucherListEntity();
                    newresult.RefId         = result.RefID.ToString();
                    newresult.RefType       = ConvRefType.ConvRefType(result.RefType);
                    newresult.RefDate       = result.RefDate;
                    newresult.PostedDate    = result.PostedDate;
                    newresult.RefNo         = result.RefNo;
                    newresult.ParalellRefNo = result.ParalellRefNo;
                    newresult.FromDate      = result.FromDate;
                    newresult.ToDate        = result.ToDate;
                    newresult.JournalMemo   = result.JournalMemo;
                    newresult.Posted        = result.Posted;
                    newresult.TotalAmount   = result.TotalAmount;
                    newresult.PostVersion   = result.PostVersion;
                    newresult.EditVersion   = result.EditVersion;
                    newresult.BUVoucherListDetailEntities         = result.BUVoucherListDetails.Count <= 0 ? null : BUVoucherListDetails(result.BUVoucherListDetails.ToList(), result.RefID.ToString());
                    newresult.BUVoucherListDetailParallelEntities = result.BUVoucherListDetailParallels.Count <= 0 ? null : BuVoucherListDetailParallels(result.BUVoucherListDetailParallels.ToList(), result.RefID.ToString());
                    newresult.BUVoucherListDetailTransferEntities = result.BUVoucherListDetailTransfers.Count <= 0 ? null : BUVoucherListDetailTransfers(result.BUVoucherListDetailTransfers.ToList(), result.RefID.ToString());
                    buentity.Add(newresult);
                }
            }
            return(buentity);
        }
 /// <summary>
 ///     Takes the specified b u voucher list entity.
 /// </summary>
 /// <param name="bUVoucherListEntity">The b u voucher list entity.</param>
 /// <returns></returns>
 private static object[] Take(BUVoucherListEntity bUVoucherListEntity)
 {
     return(new object[]
     {
         "@RefID", bUVoucherListEntity.RefId,
         "@RefType", bUVoucherListEntity.RefType,
         "@RefDate", bUVoucherListEntity.RefDate,
         "@PostedDate", bUVoucherListEntity.PostedDate,
         "@RefNo", bUVoucherListEntity.RefNo,
         "@ParalellRefNo", bUVoucherListEntity.ParalellRefNo,
         "@FromDate", bUVoucherListEntity.FromDate,
         "@ToDate", bUVoucherListEntity.ToDate,
         "@JournalMemo", bUVoucherListEntity.JournalMemo,
         "@Posted", bUVoucherListEntity.Posted,
         "@TotalAmount", bUVoucherListEntity.TotalAmount,
         "@PostVersion", bUVoucherListEntity.PostVersion,
         "@EditVersion", bUVoucherListEntity.EditVersion,
         "@CurrencyCode", bUVoucherListEntity.CurrencyCode,
         "@ExchangeRate", bUVoucherListEntity.ExchangeRate,
         "@TotalAmountOC", bUVoucherListEntity.TotalAmountOC
     });
 }
        /// <summary>
        ///     Updates the bu plan receipt.
        /// </summary>
        /// <param name="bUVoucherListEntity">The b u transfer.</param>
        /// <returns>
        ///     System.String.
        /// </returns>
        public string UpdateBUVoucherList(BUVoucherListEntity bUVoucherListEntity)
        {
            const string procedures = @"uspUpdate_BUVoucherList";

            return(Db.Update(procedures, true, Take(bUVoucherListEntity)));
        }
        /// <summary>
        ///     Inserts the bu voucher list.
        /// </summary>
        /// <param name="bUVoucherListEntity">The bu voucher list entity.</param>
        /// <returns></returns>
        public string InsertBUVoucherList(BUVoucherListEntity bUVoucherListEntity)
        {
            const string procedures = @"uspInsert_BUVoucherList";

            return(Db.Insert(procedures, true, Take(bUVoucherListEntity)));
        }