public UnitOfWork(LascarizadorDbContext context) { _context = context; Clients = new ClientRepository(_context); CardBrands = new CardBrandRepository(_context); CardTypes = new CardTypeRepository(_context); Cards = new CardRepository(_context); Transactions = new TransactionRepository(_context); TransactionTypes = new TransactionTypeRepository(_context); TransactionLogs = new TransactionLogRepository(_context); ErrorLogs = new ErrorLogRepository(_context); }
public void InsertLogs(int itemId, int quantiy) { TransactionLogRepository transactionLogRepo = new TransactionLogRepository(); TransactionLog transactionLog = new TransactionLog { ItemId = itemId, Quantity = quantiy, TransactionMethodId = (int)ETransactionMethod.ExcessPartsFromSet, CompanyId = Sessions.CompanyId.Value }; transactionLogRepo.Add(transactionLog); }
public void InsertLogs(int itemId, int quantiy, int companyId) { TransactionLogRepository transactionLogRepo = new TransactionLogRepository(); TransactionLog transactionLog = new TransactionLog { ItemId = itemId, Quantity = quantiy, TransactionMethodId = (int)ETransactionMethod.StockTransfer_Company, CompanyId = companyId, ItemTypeId = itemRepo.GetItemType(itemId) }; transactionLogRepo.Add(transactionLog); }
public int InsertLogs(int itemId, int quantiy, DateTime dateReceived, int itemType) { TransactionLogRepository transactionLogRepo = new TransactionLogRepository(); TransactionLog transactionLog = new TransactionLog { ItemId = itemId, Quantity = quantiy, TransactionMethodId = (int)ETransactionMethod.Receiving, CompanyId = Sessions.CompanyId.Value, Date = dateReceived, ItemTypeId = itemType }; transactionLogRepo.Add(transactionLog); return(transactionLog.Id); }
public StorageProcessor(string url, string connectionString, string prefix, bool postVm = false) { _web3 = url.EndsWith(".ipc") ? new Web3.Web3(new IpcClient(url)) : new Web3.Web3(url); var blockRepository = new BlockRepository(); var transactionRepository = new TransactionRepository(); var addressTransactionRepository = new AddressTransactionRepository(); var contractRepository = new ContractRepository(); var logRepository = new TransactionLogRepository(); var vmStackRepository = new TransactionVMStackRepository(); var contractTransactionProcessor = new ContractTransactionProcessor(_web3, contractRepository, transactionRepository //,addressTransactionRepository //,vmStackRepository, //logRepository ); var contractCreationTransactionProcessor = new ContractCreationTransactionProcessor(_web3, contractRepository, transactionRepository //, addressTransactionRepository ); var valueTrasactionProcessor = new ValueTransactionProcessor(transactionRepository //,addressTransactionRepository ); var transactionProcessor = new TransactionProcessor(_web3, contractTransactionProcessor, valueTrasactionProcessor, contractCreationTransactionProcessor); if (postVm) { _procesor = new BlockVmPostProcessor(_web3, blockRepository, transactionProcessor, transactionRepository); } else { transactionProcessor.ContractTransactionProcessor.EnabledVmProcessing = false; _procesor = new BlockProcessor(_web3, blockRepository, transactionProcessor, transactionRepository); } }
public StorageProcessor(string url, string connectionString, string prefix, bool postVm = false) { _web3 = url.EndsWith(".ipc") ? new Web3.Web3(new IpcClient(url)) : new Web3.Web3(url); var tableSetup = new CloudTableSetup(connectionString); _contractTable = tableSetup.GetContractsTable(prefix); var transactionsTable = tableSetup.GetTransactionsTable(prefix); var addressTransactionsTable = tableSetup.GetAddressTransactionsTable(prefix); var blocksTable = tableSetup.GetBlocksTable(prefix); var logTable = tableSetup.GetTransactionsLogTable(prefix); var vmStackTable = tableSetup.GetTransactionsVmStackTable(prefix); var blockRepository = new BlockRepository(blocksTable); var transactionRepository = new TransactionRepository(transactionsTable); var addressTransactionRepository = new AddressTransactionRepository(addressTransactionsTable); var contractRepository = new ContractRepository(_contractTable); var logRepository = new TransactionLogRepository(logTable); var vmStackRepository = new TransactionVMStackRepository(vmStackTable); var contractTransactionProcessor = new ContractTransactionProcessor(_web3, contractRepository, transactionRepository, addressTransactionRepository, vmStackRepository, logRepository); var contractCreationTransactionProcessor = new ContractCreationTransactionProcessor(_web3, contractRepository, transactionRepository, addressTransactionRepository); var valueTrasactionProcessor = new ValueTransactionProcessor(transactionRepository, addressTransactionRepository); var transactionProcessor = new TransactionProcessor(_web3, contractTransactionProcessor, valueTrasactionProcessor, contractCreationTransactionProcessor); if (postVm) { _procesor = new BlockVmPostProcessor(_web3, blockRepository, transactionProcessor); } else { transactionProcessor.ContractTransactionProcessor.EnabledVmProcessing = false; _procesor = new BlockProcessor(_web3, blockRepository, transactionProcessor); } }
public void Save(Receiving receiving, int itemid, string unitcost) { if (receiving.Id == 0) { if (receiving.SerialNo == null) { receiving.SerialNo = "N/A"; } context.Receivings.Add(receiving); context.SaveChanges(); int id; id = receiving.Id; InsertStockCard(id, itemid, Convert.ToDecimal(unitcost), receiving.Quantity, receiving.TransactionLogId); } else { Receiving dbEntry = context.Receivings.Find(receiving.Id); if (dbEntry != null) { dbEntry.PurchaseOrderItemId = receiving.PurchaseOrderItemId; dbEntry.Quantity = receiving.Quantity; dbEntry.SerialNo = receiving.SerialNo; dbEntry.DrNo = receiving.DrNo; dbEntry.DateReceived = receiving.DateReceived; dbEntry.TransactionLogId = receiving.TransactionLogId; context.SaveChanges(); TransactionLogRepository transLogRepo = new TransactionLogRepository(); transLogRepo.Update(dbEntry.TransactionLogId.Value, receiving.Quantity, receiving.DateReceived.Value); UpdateStockCard(receiving.Id, itemid, Convert.ToDecimal(unitcost), receiving.Quantity, receiving.TransactionLogId); } } context.SaveChanges(); }
static void Main(string[] args) { ItemRepository itemRepo = new ItemRepository(); TransactionLogRepository transLogRepo = new TransactionLogRepository(); ItemAssignmentRepository itemAssignementRepo = new ItemAssignmentRepository(); CNGDBContext context = new CNGDBContext(); List <ItemDTO> lstItemDTO = new List <ItemDTO>(); const Int32 BufferSize = 128; using (var fileStream = File.OpenRead(@"C:\fmt_inventory.csv")) using (var streamReader = new StreamReader(fileStream, Encoding.UTF8, true, BufferSize)) { String line; int lineCnt = 1; while ((line = streamReader.ReadLine()) != null) { //if (lineCnt > 3) //{ string[] strLine = line.Split(','); //string itemCode = Convert.ToString(strLine[0]); string itemDesc = Convert.ToString(strLine[0]); //int n; //bool isNumeric = int.TryParse(itemCode, out n); Item item = new Item(); //item.Code = itemCode.PadLeft(3, '0'); item.Description = Convert.ToString(strLine[0]); item.TypeId = 2; item.ClassificationId = 1; item.Brand = "n/a"; item.UnitCost = Convert.ToDecimal(strLine[2]); item.Active = true; ItemDTO itemDTO = new ItemDTO(); itemDTO.item = item; itemDTO.Quantity = Convert.ToInt32(strLine[1]); itemDTO.CompanyId = 4; itemDTO.UnitCost = item.UnitCost; lstItemDTO.Add(itemDTO); } lineCnt++; //} } //foreach (ItemDTO _itemDTO in lstItemDTO) //{ // int itemid = itemRepo.SaveByEncoder(_itemDTO.item); // TransactionLog transLog = new TransactionLog // { // ItemId = itemid, // CompanyId = _itemDTO.CompanyId,//cng // TransactionMethodId = 7, //in // Date = Convert.ToDateTime("01/01/17"), // Quantity = _itemDTO.Quantity, // UserId = 1 //admin // }; // transLogRepo.Add(transLog); // Console.WriteLine("Added " + _itemDTO.item.Code + " - " + _itemDTO.item.Description); //} List <ItemAssignment> lstItemAssignment = new List <ItemAssignment>(); foreach (ItemDTO item in lstItemDTO) { int x = 0; if (item.item.Id == 0) { x = itemRepo.GetItemId(item.item.Description); } else { x = item.item.Id; } ItemAssignment itemAssignment = context.ItemAssignments.FirstOrDefault(p => p.ItemId == x && p.CompanyId == 4); itemAssignment.UnitCost = item.UnitCost; context.SaveChanges(); //ItemAssignment itemAssignment = new ItemAssignment //{ // ItemId = x, // CompanyId = item.CompanyId, // UnitCost = item.UnitCost//cng //}; //lstItemAssignment.Add(itemAssignment); } //itemAssignementRepo.Save(lstItemAssignment); Console.WriteLine("Done!"); Console.ReadLine(); }
private LogService() { _context = new TurkcellFacebookDunyasiDb(); _webServiceLogRepository = new WebServiceLogRepository(_context); _transactionLogRepository = new TransactionLogRepository(_context); }