public static void Load(this skSales Object) { ObjectMessenger OM = new ObjectMessenger(); OM.Send("TRANOBJ", Object); UI.Enviroment.LoadNewTab("SalesDetailsView", Object.Title); }
public NewMultiSaleViewModel() { if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } try { _SelectedStock = new skStock(); _SubmitSale = new Command(SubmitNewSaleMethod); _AddStocktoSale = new Command(AddStockToSaleMethod, false); _RemoveStockFromSale = new Command(RemoveStockFromSaleMethod, false); _ClearStockFromSale = new Command(ClearStockFromSaleMethod); _AddNewPersonCommand = new Command(AddNewPersonMethod); TransactionDetails = new skSales(); TransactionDetails.SaleDate = DateTime.Now; TransactionDetails.Amount = 0; PersonList = new ObservableCollection <skPerson>(skPerson.GetPersonList()); StockList = new ObservableCollection <skStock>(_SelectedStock.GetOrphanedStockList(TransactionType.Sale)); StockSaleList = new ObservableCollection <skStock>(); var InitialStockOBJ = ObjectMessenger.FindObject("STOCKOBJ") as skStock; TransactionDetails.Amount += InitialStockOBJ.SaleValue; StockSaleList.Add(InitialStockOBJ); StockList.Remove(InitialStockOBJ); TransactionDetails.Title = "Sale of " + InitialStockOBJ.Name; TransactionDetails.Description = InitialStockOBJ.Description; } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
public SaleDetailViewModel() { _Salesobj = new skSales(); _Purchaseobj = new skPurchase(); Data = new DataFunctions(); Salesobj = Data.GetSalesDetails(StaticDataReposityory.SelectedSaleID); if (Salesobj.AddressId != null) { Addressobj = Data.GetAddressObject(Convert.ToInt32(Salesobj.AddressId)); // Personobj = Data.GetPersonObject(Convert.ToInt32(Addressobj.PersonID)); } }
public void UpdateSale(skSales SaleObject) { dtSale SaleToUpdate = DB.dtSales.Single(x => x.tID == SaleObject.ID); if (SaleToUpdate != null) { SaleToUpdate.Description = SaleObject.Description; SaleToUpdate.Title = SaleObject.Title; SaleToUpdate.SoldDate = SaleObject.TransactionTime; SaleToUpdate.Updated = DateTime.Now; DB.SubmitChanges(); } else { throw new Exception("Sale record doesnt exist within the Database."); } }
public void AddNewSale(skAddresses AddressObject, skPerson PersonObject, skSales TransactionObject, int UserID) { TransactionRepo.AddNewSale(TransactionObject, PersonObject, AddressObject, UserID); }
public void AddNewSale(skSales TransactionObject, int UserID) { TransactionRepo.AddNewSale(TransactionObject, UserID); }
public void UpdateSale(skSales SaleObject) { TransactionRepo.UpdateSale(SaleObject); }
public void AddNewSale(skAddresses AddressObject, skPerson PersonObject, skSales TransactionObject, int UserID) { base.Channel.AddNewSale(AddressObject, PersonObject, TransactionObject, UserID); }
public void AddNewSale(skSales TransactionObject, int UserID) { base.Channel.AddNewSale(TransactionObject, UserID); }
public void UpdateSale(skSales SaleObject) { base.Channel.UpdateSale(SaleObject); }
public void AddNewSale(skSales TransactionObject, int UserID) { dtSale newtransaction = new dtSale { SoldValue = TransactionObject.Amount, PaypayFees = TransactionObject.PayPalFees, PandP = TransactionObject.Postage, SaleMethod = TransactionObject.SaleMethod, SoldDate = TransactionObject.SaleDate, SoldBy = UserID, PayPalTransactionID = TransactionObject.PayPalTransactionID, Updated = DateTime.Now, Created = DateTime.Now, Title = TransactionObject.Title, Description = TransactionObject.Description, PersonID = TransactionObject.PersonObj.pID }; DB.dtSales.InsertOnSubmit(newtransaction); DB.SubmitChanges(); int tid = MostRecentsalesID(); decimal pvalue = Math.Abs(Convert.ToDecimal(TransactionObject.PayPalFees)) * (-1); decimal ppvalue = Math.Abs(Convert.ToDecimal(TransactionObject.Postage)) * (-1); dtTransactionLedger newsaleledger = new dtTransactionLedger { SaleID = tid, PurchaseID = null, TotelAmount = Convert.ToDecimal(TransactionObject.Amount), TransactionType = "Item Sale", TransactionDateTime = Convert.ToDateTime(TransactionObject.SaleDate) }; dtTransactionLedger newspaypal = new dtTransactionLedger { SaleID = tid, PurchaseID = null, TotelAmount = pvalue, TransactionType = "PayPal Fees", TransactionDateTime = Convert.ToDateTime(TransactionObject.SaleDate) }; dtTransactionLedger newepostage = new dtTransactionLedger { SaleID = tid, PurchaseID = null, TotelAmount = ppvalue, TransactionType = "Sale Postage", TransactionDateTime = Convert.ToDateTime(TransactionObject.SaleDate) }; foreach (skStock s in TransactionObject.StockList) { dtStockHistory newstatus = new dtStockHistory { StoockID = Convert.ToInt32(s.Stockid), Status = "Stock Sold", Value = 0, UserID = UserID, Created = DateTime.Now, StatusID = 1 }; DB.dtStockHistories.InsertOnSubmit(newstatus); dtStockDetail SD = DB.dtStockDetails.Single(x => x.StockID == s.Stockid); SD.SaleValue = s.SaleValue; } List <long> StockIds = new List <long>(); foreach (skStock s in TransactionObject.StockList) { StockIds.Add(s.Stockid); } var setsold = from ST in DB.dtStocks where StockIds.Contains(ST.sID) select ST; foreach (dtStock s in setsold) { s.Sold = true; s.SaleID = tid; } DB.dtTransactionLedgers.InsertOnSubmit(newepostage); DB.dtTransactionLedgers.InsertOnSubmit(newspaypal); DB.dtTransactionLedgers.InsertOnSubmit(newsaleledger); DB.SubmitChanges(); }
public bool IsRecordDirty(object RecordToCheck) { Type typetocheck = RecordToCheck.GetType(); switch (typetocheck.Name) { case "skStock": skStock StockOBJ = (skStock)RecordToCheck; var newstockdate = (from S in DB.dtStocks where S.sID == StockOBJ.Stockid select new skStock { Updated = S.Updated }).SingleOrDefault().Updated; return(newstockdate > StockOBJ.Updated ? true : false); case "skSales": skSales SalesOBJ = (skSales)RecordToCheck; var newsaledate = (from S in DB.dtSales where S.tID == SalesOBJ.ID select new skSales { Updated = S.Updated }).SingleOrDefault().Updated; return(newsaledate > SalesOBJ.Updated ? true : false); case "skPurchase": skPurchase PurchaseOBJ = (skPurchase)RecordToCheck; var newpurchasedate = (from P in DB.dtPurcheses where P.pID == PurchaseOBJ.ID select new skPurchase { Updated = P.Updated }).SingleOrDefault().Updated; return(newpurchasedate > PurchaseOBJ.Updated ? true : false); default: throw new Exception("Object is not a valid record"); case "skRefund": skRefund RefundOBJ = (skRefund)RecordToCheck; var newrefunddate = (from R in DB.dtRefunds where R.rID == RefundOBJ.ID select new skRefund { Updated = R.Updated }).SingleOrDefault().Updated; return(newrefunddate > RefundOBJ.Updated ? true : false); } }