public TransactionModel(string transactionNumber) { var records = new List<CloneableDictionary<string, string>>(); var trans = new TransactionModel(); records = db.SelectMultiple("select * from view_transaction_entry where transaction_number = '" + transactionNumber + "' "); foreach (var attribute in records) { trans.Id = int.Parse(attribute["id"]); trans.TransactionNumber = attribute["transaction_number"]; trans.TransactionType = attribute["transaction_type"]; trans.DocumentNumber = attribute["document_number"]; trans.TransactionDate = DateTime.Parse(attribute["transaction_date"]); trans.SourceWarehouse = attribute["source_warehouse"]; trans.SourceLocation = attribute["source_location"]; trans.SourceSalesman = attribute["source_salesman"]; trans.DestinationWarehouse = attribute["destination_warehouse"]; trans.DestinationLocation = attribute["destination_location"]; trans.DestinationSalesman = attribute["destination_salesman"]; trans.PriceCategory = attribute["price_category"]; trans.PriceType = attribute["price_type"]; trans.Reason = attribute["reason_description"]; trans.ReasonCode = attribute["reason_code"]; trans.Comment = attribute["comment"]; if (attribute["status"] == "0") { trans.IsPosted = false; } else { trans.IsPosted = true; } _allTransactions.Add(trans); } }
public TransactionModel(TransactionModel source) { Id = source.Id; TransactionNumber = source.TransactionNumber; TransactionCode = source.TransactionCode; TransactionType = source.TransactionType; DocumentNumber = source.DocumentNumber; TransactionDate = source.TransactionDate; SourceWarehouse = source.SourceWarehouse; SourceWarehouseCode = source.SourceWarehouseCode; SourceLocation = source.SourceLocation; SourceLocationCode = source.SourceLocationCode; DestinationWarehouse = source.DestinationWarehouse; DestinationWarehouseCode = source.DestinationWarehouseCode; DestinationLocation = source.DestinationLocation; DestinationLocationCode = source.DestinationLocationCode; PriceCategory = source.PriceCategory; PriceType = source.PriceType; Reason = source.Reason; ReasonCode = source.ReasonCode; Comment = source.Comment; IsPosted = source.IsPosted; }
public LineItemViewModel(TransactionModel trans) { transactionModel = trans; Load(); }
public void AddTransactionEntry(TransactionModel trans) { //foreign key id holders string transactionTypeId = string.Empty; string wareHouseIdSource = string.Empty; string wareHouseIdDestination = string.Empty; string locationIdSource = string.Empty; string locationIdDestination = string.Empty; string reasonId = string.Empty; int isPosted; transactionTypeId = db.Select("select id from transaction_type where transaction_code = '" + trans.TransactionCode + "'"); wareHouseIdSource = db.Select("select warehouse_id from warehouse where code = '" + trans.SourceWarehouse + "'"); wareHouseIdDestination = db.Select("select warehouse_id from warehouse where code = '" + trans.DestinationWarehouse + "'"); locationIdSource = db.Select("select location_id from location where code = '" + trans.SourceLocation + "'"); locationIdDestination = db.Select("select location_id from location where code = '" + trans.DestinationLocation + "'"); reasonId = db.Select("select reasoncode_id from reason_code where reason_code = '" + trans.ReasonCode + "'"); if (trans.IsPosted == true) { isPosted = 1; } else { isPosted = 0; } insert.Clear(); insert.Append("insert into transaction_entry values("); insert.Append("null,"); insert.Append("'" + trans.TransactionNumber + "',"); insert.Append("'" + transactionTypeId + "',"); insert.Append("'" + trans.DocumentNumber + "',"); insert.Append("'" + trans.TransactionDate.ToString("MM/dd/yyyy") + "',"); insert.Append("'" + wareHouseIdSource + "',"); insert.Append("'" + locationIdSource + "',"); insert.Append("null,"); insert.Append("'" + wareHouseIdDestination + "',"); insert.Append("'" + locationIdDestination + "',"); insert.Append("null,"); insert.Append("'" + trans.PriceCategory + "',"); insert.Append("'" + trans.PriceType + "',"); insert.Append("'" + reasonId + "',"); insert.Append("'" + trans.Comment + "',"); insert.Append("'" + isPosted + "'"); insert.Append(")"); db.Insert(insert.ToString()); insert.Clear(); }
public List<TransactionModel> FetchAll() { var records = new List<Dictionary<string, string>>(); var trans = new TransactionModel(); //records.AddRange(db.SelectMultiple("select * from view_transaction_entry where status = 0 ")); foreach (Dictionary<string, string> attribute in (db.SelectMultiple("select * from view_transaction_entry where status = 0 "))) { trans.Id = int.Parse(attribute["id"]); trans.TransactionNumber = attribute["transaction_number"]; trans.TransactionCode = attribute["transaction_code"]; trans.TransactionType = attribute["transaction_type"]; trans.DocumentNumber = attribute["document_number"]; trans.TransactionDate = DateTime.Parse(attribute["transaction_date"]); trans.SourceWarehouse = attribute["source_warehouse"]; trans.SourceWarehouseCode = attribute["source_warehouse_code"]; trans.SourceLocation = attribute["source_location"]; trans.SourceLocationCode = attribute["source_location_code"]; //trans.SourceSalesman = attribute["source_salesman"]; trans.DestinationWarehouse = attribute["destination_warehouse"]; trans.DestinationLocation = attribute["destination_location"]; //trans.DestinationSalesman = attribute["destination_salesman"]; trans.PriceCategory = attribute["price_category"]; trans.PriceType = attribute["price_type"]; trans.Reason = attribute["reason_description"]; trans.ReasonCode = attribute["reason_code"]; trans.Comment = attribute["comment"]; trans.IsPosted = attribute["status"] != "0"; _allTransactions.Add(trans); } return _allTransactions; }