private SupplyLedgerEntity MakeSupplyLedger(OpeningSupplyEntryEntity openingSupplyEntry)
        {
            var result = new SupplyLedgerEntity();

            result.SupplyLedgerId    = 0;
            result.RefId             = openingSupplyEntry.RefId;
            result.RefDetailId       = 0;
            result.RefType           = openingSupplyEntry.RefType;
            result.RefNo             = "OPN";
            result.RefDate           = openingSupplyEntry.RefDate;
            result.PostedDate        = openingSupplyEntry.PostedDate;
            result.Description       = null;
            result.JournalMemo       = null;
            result.InventoryItemId   = openingSupplyEntry.InventoryItemId;
            result.DepartmentId      = openingSupplyEntry.DepartmentId;
            result.CurrencyCode      = openingSupplyEntry.CurrencyCode;
            result.ExchangeRate      = openingSupplyEntry.ExchangeRate;
            result.Unit              = InventoryItemDao.GetInventoryItem(openingSupplyEntry.InventoryItemId)?.Unit ?? null;
            result.Quantity          = openingSupplyEntry.Quantity;
            result.UnitPriceOc       = openingSupplyEntry.UnitPriceOc;
            result.UnitPriceExchange = openingSupplyEntry.UnitPriceExchange;
            result.AmountOc          = openingSupplyEntry.AmountOc;
            result.AmountExchange    = openingSupplyEntry.AmountExchange;
            return(result);
        }
 /// <summary>
 /// Takes the specified opening supply entry entity.
 /// </summary>
 /// <param name="openingSupplyEntryEntity">The opening supply entry entity.</param>
 /// <returns>System.Object[].</returns>
 private static object[] Take(OpeningSupplyEntryEntity openingSupplyEntryEntity)
 {
     return(new object[]
     {
         "@RefID", openingSupplyEntryEntity.RefId,
         "@RefType", openingSupplyEntryEntity.RefType,
         "@PostedDate", openingSupplyEntryEntity.PostedDate,
         "@CurrencyCode", openingSupplyEntryEntity.CurrencyCode,
         "@ExchangeRate", openingSupplyEntryEntity.ExchangeRate,
         "@AccountNumber", openingSupplyEntryEntity.AccountNumber,
         "@InventoryItemID", openingSupplyEntryEntity.InventoryItemId,
         "@InventoryItemCode", openingSupplyEntryEntity.InventoryItemCode,
         "@InventoryItemName", openingSupplyEntryEntity.InventoryItemName,
         "@DepartmentID", openingSupplyEntryEntity.DepartmentId,
         "@BudgetChapterCode", openingSupplyEntryEntity.BudgetChapterCode,
         "@Quantity", openingSupplyEntryEntity.Quantity,
         "@UnitPriceOC", openingSupplyEntryEntity.UnitPriceOC,
         "@UnitPrice", openingSupplyEntryEntity.UnitPrice,
         "@AmountOC", openingSupplyEntryEntity.AmountOC,
         "@Amount", openingSupplyEntryEntity.Amount,
         "@PostVersion", openingSupplyEntryEntity.PostVersion,
         "@EditVersion", openingSupplyEntryEntity.EditVersion,
         "@SortOrder", openingSupplyEntryEntity.SortOrder,
     });
 }
        public string DeleteOpeningSupplyEntry(OpeningSupplyEntryEntity openingCommitment)
        {
            const string procedures = @"uspDelete_OpeningSupplyEntry";

            object[] parms = { "@RefId", openingCommitment.RefId };
            return(Db.Delete(procedures, true, parms));
        }
Example #4
0
        /// <summary>
        /// Inserts the bu commitment request.
        /// </summary>
        /// <param name="openingSupplyEntry">The b u commitment request.</param>
        /// <returns>OpeningSupplyEntryResponse.</returns>
        public OpeningSupplyEntryResponse InsertOpeningSupplyEntry(OpeningSupplyEntryEntity openingSupplyEntry)
        {
            var openingSupplyEntryResponse = new OpeningSupplyEntryResponse {
                Acknowledge = AcknowledgeType.Success
            };


            if (openingSupplyEntry != null && !openingSupplyEntry.Validate())
            {
                foreach (var error in openingSupplyEntry.ValidationErrors)
                {
                    openingSupplyEntryResponse.Message += error + Environment.NewLine;
                }
                openingSupplyEntryResponse.Acknowledge = AcknowledgeType.Failure;
                return(openingSupplyEntryResponse);
            }

            using (var scope = new TransactionScope())
            {
                if (openingSupplyEntry != null)
                {
                    if (!string.IsNullOrEmpty(openingSupplyEntryResponse.Message))
                    {
                        openingSupplyEntryResponse.Acknowledge = AcknowledgeType.Failure;
                        return(openingSupplyEntryResponse);
                    }
                    openingSupplyEntry.RefId           = Guid.NewGuid().ToString();
                    openingSupplyEntryResponse.Message = OpeningSupplyEntryDao.InsertOpeningSupplyEntry(openingSupplyEntry);

                    if (!string.IsNullOrEmpty(openingSupplyEntryResponse.Message))
                    {
                        openingSupplyEntryResponse.Acknowledge = AcknowledgeType.Failure;
                        return(openingSupplyEntryResponse);
                    }

                    if (openingSupplyEntryResponse.Message != null)
                    {
                        openingSupplyEntryResponse.Acknowledge = AcknowledgeType.Failure;
                        scope.Dispose();
                        return(openingSupplyEntryResponse);
                    }
                    openingSupplyEntryResponse.RefId = openingSupplyEntry.RefId;

                    scope.Complete();
                }

                return(openingSupplyEntryResponse);
            }
        }
 private static object[] Take(OpeningSupplyEntryEntity openingSupplyEntryEntity)
 {
     return(new object[]
     {
         "@RefID", openingSupplyEntryEntity.RefId,
         "@RefType", openingSupplyEntryEntity.RefType,
         "@PostedDate", openingSupplyEntryEntity.PostedDate,
         "@RefDate", openingSupplyEntryEntity.RefDate,
         "@CurrencyCode", openingSupplyEntryEntity.CurrencyCode,
         "@ExchangeRate", openingSupplyEntryEntity.ExchangeRate,
         "@AccountNumber", openingSupplyEntryEntity.AccountNumber,
         "@InventoryItemID", openingSupplyEntryEntity.InventoryItemId,
         "@DepartmentID", openingSupplyEntryEntity.DepartmentId,
         "@Quantity", openingSupplyEntryEntity.Quantity,
         "@UnitPriceOc", openingSupplyEntryEntity.UnitPriceOc,
         "@UnitPriceExchange", openingSupplyEntryEntity.UnitPriceExchange,
         "@AmountOc", openingSupplyEntryEntity.AmountOc,
         "@AmountExchange", openingSupplyEntryEntity.AmountExchange,
         "@SortOrder", openingSupplyEntryEntity.SortOrder
     });
 }
Example #6
0
        //private List<BankInfo> banks;
        public List <OpeningSupplyEntryEntity> GetOpeningSupplyEntrys(string connectionString)
        {
            List <OpeningSupplyEntryEntity> buentity = new List <OpeningSupplyEntryEntity>();

            using (var context = new MISAEntity(connectionString))
            {
                var inventoryitems = context.InventoryItems.ToList();
                //banks = context.BankInfoes.ToList();
                var resultcontext = context.OpeningSupplyEntries.ToList();
                foreach (var result in resultcontext)
                {
                    var newresult = new OpeningSupplyEntryEntity();
                    newresult.RefId             = result.RefID.ToString();
                    newresult.RefType           = ConvRefType.ConvRefType(result.RefType);
                    newresult.PostedDate        = result.PostedDate;
                    newresult.CurrencyCode      = result.CurrencyID;
                    newresult.ExchangeRate      = result.ExchangeRate ?? 0;
                    newresult.AccountNumber     = result.AccountNumber;
                    newresult.InventoryItemId   = result.InventoryItem == null ? null : result.InventoryItem.InventoryItemID.ToString();
                    newresult.InventoryItemCode = result.InventoryItem == null ? null : result.InventoryItem.InventoryItemCode;
                    newresult.InventoryItemName = result.InventoryItem == null ? null : result.InventoryItem.InventoryItemName;
                    newresult.DepartmentId      = result.DepartmentID.ToString();
                    newresult.BudgetChapterCode = result.BudgetChapterCode;
                    newresult.Quantity          = result.Quantity ?? 0;
                    newresult.UnitPriceOC       = result.UnitPriceOC ?? 0;
                    newresult.UnitPrice         = result.UnitPrice ?? 0;
                    newresult.AmountOC          = result.AmountOC ?? 0;
                    newresult.Amount            = result.Amount ?? 0;
                    newresult.PostVersion       = result.PostVersion ?? 0;
                    newresult.EditVersion       = result.EditVersion ?? 0;
                    newresult.SortOrder         = result.SortOrder ?? 0;
                    //newresult.OpeningAccountEntryDetail = result.CreateDate;

                    buentity.Add(newresult);
                }
            }
            return(buentity);
        }
        public string UpdateOpeningSupplyEntry(OpeningSupplyEntryEntity openingCommitment)
        {
            const string procedures = @"uspUpdate_OpeningSupplyEntry";

            return(Db.Update(procedures, true, Take(openingCommitment)));
        }
        public long InsertOpeningSupplyEntry(OpeningSupplyEntryEntity openingCommitment)
        {
            const string procedures = @"uspInsert_OpeningSupplyEntry";

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