public static void CreateRefund(this skStock Object) { ObjectMessenger OM = new ObjectMessenger(); OM.Send("STOCKITEM", Object); Stocky.UI.Enviroment.LoadNewTab("RefundView|"); }
public void AddNewStockItem(skStock StockOb, int UserID) { dtStock newstock = new dtStock { CategoryID = StockOb.CategoryObject.StockTypeID, ItemDesc = StockOb.Description, ItemTitle = StockOb.Name, ValueBandID = StockOb.ValueBandObject.ID, Batch = 0, Sold = false, CreatedBy = UserID, Created = DateTime.Now }; dtStockDetail newdetails = new dtStockDetail { PurchaseValue = StockOb.purchasedvalue }; dtStockHistory newstatus = new dtStockHistory { Status = "Stock Created", Value = 0, UserID = UserID, Created = DateTime.Now, StatusID = 0 }; newstock.dtStockHistories.Add(newstatus); newstock.dtStockDetails.Add(newdetails); DB.dtStocks.InsertOnSubmit(newstock); DB.SubmitChanges(); }
public void LinkTranToStock(ITransaction TransactionObject, skStock StockOBJ, int UserID) { dtStock StockObj = DB.dtStocks.Single(x => x.sID == StockOBJ.Stockid); dtStockDetail StockDetais = DB.dtStockDetails.Single(x => x.StockID == StockOBJ.Stockid); switch (TransactionObject.TransactionType) { case TransactionType.Sale: StockDetais.SaleValue = StockOBJ.SaleValue; dtSale SaleObj = DB.dtSales.Single(x => x.tID == TransactionObject.ID); SaleObj.SoldValue += StockDetais.SaleValue; StockObj.SaleID = TransactionObject.ID; CreateNewStockStatus(StockOBJ.Stockid, "Linked To sale " + SaleObj.tID, UserID, Convert.ToDecimal(StockOBJ.SaleValue)); break; case TransactionType.Purchase: StockDetais.PurchaseValue = StockOBJ.purchasedvalue; dtPurchese PurchaseObj = DB.dtPurcheses.Single(x => x.pID == TransactionObject.ID); PurchaseObj.PurchesedValue += StockDetais.PurchaseValue; StockObj.PurchaseID = TransactionObject.ID; CreateNewStockStatus(StockOBJ.Stockid, "Linked To Purchase " + PurchaseObj.pID, UserID, Convert.ToDecimal(StockOBJ.purchasedvalue)); break; } DB.SubmitChanges(); }
public void AddToExistingPurchase(skStock StockOb, int PurchaseID, int UserID) { dtStockDetail newdetails = new dtStockDetail { PurchaseValue = StockOb.purchasedvalue }; dtStock newstock = new dtStock { CategoryID = StockOb.CategoryObject.StockTypeID, ItemDesc = StockOb.Description, ItemTitle = StockOb.Name, ValueBandID = StockOb.ValueBandObject.ID, Batch = 0, Sold = false, CreatedBy = UserID, Created = DateTime.Now, PurchaseID = PurchaseID, }; newstock.dtStockDetails.Add(newdetails); DB.dtStocks.InsertOnSubmit(newstock); DB.SubmitChanges(); dtPurchese purchase = DB.dtPurcheses.Single(x => x.pID == PurchaseID); purchase.PurchesedValue += StockOb.purchasedvalue; DB.SubmitChanges(); }
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 static void Load(this skStock Object) { ObjectMessenger OM = new ObjectMessenger(); OM.Send("SelectedStockItem", Object); UI.Enviroment.LoadNewTab("StockDetailsView", Object.Name); }
public NewMultiStockViewModel() { if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } try { StockDetails = new skStock(); PurchaseDetails = new skPurchase(); _AddStock = new Command(Add); _RemoveStock = new Command(Remove, false); _ClearStock = new Command(Clear); _SubmitNewStockItem = new Command(SubmitData); VendorList = new ObservableCollection <skvendors>(skvendors.VendorList()); CategoryList = new ObservableCollection <skCategory>(skCategory.CategoryList()); ValueBandList = new ObservableCollection <skValueBands>(skValueBands.ValueBandList()); StockToAdd = new ObservableCollection <skStock>(); Notification = new Notification(); PurchaseDetails.Amount = 0; } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
public StockContract GetStockList(skStock StockOBj) { StockContract retunobject = new StockContract(); retunobject.StockList = StockRepo.GetStockList(StockOBj).ToList(); return(retunobject); }
public LoginViewModel() { _Enter = new AsynchronousCommand(Login); skStock s = new skStock(); _userobj = new skUser(); }
public IEnumerable <skStock> GetStockList(skStock stockOBJ) { long tempval; long?sIDv = long.TryParse(stockOBJ.Stockid.ToString(), out tempval) ? tempval : (long?)null; var query = (from SL in DB.dtStocks join ST in DB.dtCategories on SL.CategoryID equals ST.CatID join VB in DB.dtValueBands on SL.ValueBandID equals VB.ivID from SD in DB.dtStockDetails.AsEnumerable() .Where(o => o.StockID == SL.sID) .DefaultIfEmpty() from TR in DB.dtPurcheses.AsEnumerable() .Where(o => SL.PurchaseID == o.pID) .DefaultIfEmpty() where SL.ItemTitle.IndexOf(stockOBJ.SearchFilter.ObjectName == null ? SL.ItemTitle : stockOBJ.SearchFilter.ObjectName) >= 0 && SL.ItemDesc.IndexOf(stockOBJ.SearchFilter.ObjectDescription == null ? SL.ItemDesc : stockOBJ.SearchFilter.ObjectDescription) >= 0 && SL.sID.Equals(sIDv == 0 ? SL.sID : sIDv) && SL.Sold.Equals(stockOBJ.Sold == false ? SL.Sold : stockOBJ.Sold) && SL.ItemTitle.IndexOf(stockOBJ.SearchFilter.ObjectName == null ? SL.ItemTitle : stockOBJ.SearchFilter.ObjectName) >= 0 && (SL.Created >= stockOBJ.SearchFilter.ObjectCreatedFrom && SL.Created <= stockOBJ.SearchFilter.ObjectCreatedTo) orderby SL.Created descending select new skStock { Stockid = SL.sID, Name = SL.ItemTitle, Description = SL.ItemDesc, purchaseddate = TR.Purchesed_Date, purchasedvalue = SD.PurchaseValue, Sold = SL.Sold, Created = SL.Created, Updated = SL.Updated, CategoryObject = new skCategory { Description = ST.Description, Name = ST.Title, StockTypeID = ST.CatID }, ValueBandObject = new skValueBands { Description = VB.Description, HighValue = VB.HighValue, ID = VB.ivID, LowValue = VB.LowValue, } }).Take(stockOBJ.SearchFilter.RecordsToReturn == 0 ? 100000 : stockOBJ.SearchFilter.RecordsToReturn); return(query); }
private void RemoveStockFromSaleMethod() { try { if (SelectedStock != null && StockSaleList.Contains(SelectedStock)) { TransactionDetails.Amount -= SelectedStock.SaleValue; StockList.Add(SelectedStock); StockSaleList.Remove(SelectedStock); SelectedStock = new skStock(); } } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
private void Add() { try { if (StockDetails.IsObjectValid) { StockToAdd.Add(StockDetails); PurchaseDetails.Amount += Convert.ToDecimal(_StockDetails.purchasedvalue); PurchaseDetails.TotalValue += Convert.ToDecimal(_StockDetails.purchasedvalue); StockDetails = new skStock(CurrentSession.CurrentUserObject); PurchaseDetails.Validate();; } } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
private void AddStockToSaleMethod() { try { if (SelectedStock != null) { SelectedStock.SaleValue = StockItemSaleValue; TransactionDetails.Amount += SelectedStock.SaleValue; StockSaleList.Add(_SelectedStock); StockList.Remove(StockList.FirstOrDefault(x => x.Stockid == SelectedStock.Stockid)); SelectedStock = new skStock(); StockItemSaleValue = 0; } } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
public StockManagerViewModel() { try { if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { return; } SearchFilter = new skStock(); _GetRecordsCommand = new AsynchronousCommand(SearchMethod); _Export = new Command(ExportList); LoadToolBar(); } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
public StockLingViewModel() { if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } try { _StockObj = new skStock(); TransactionOBJ = ObjectMessenger.FindObject("TRANLEDGEROBJ") as ITransaction; StockList = new ObservableCollection <skStock>(_StockObj.GetOrphanedStockList(TransactionOBJ.TransactionType)); _Submit = new Command(CreateLink); } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
public NewStockViewModel() { try { if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } StockDetails = new skStock(); VendorList = new ObservableCollection <skvendors>(skvendors.VendorList()); CategoryList = new ObservableCollection <skCategory>(skCategory.CategoryList()); ValueBandList = new ObservableCollection <skValueBands>(skValueBands.ValueBandList()); _SubmitStock = new Command(AddNewStockItem); } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
public void UpdateStock(skStock StockObj, int UserID) { dtStock stock = DB.dtStocks.Single(s => s.sID == StockObj.Stockid); stock.ItemTitle = StockObj.Name; stock.ItemDesc = StockObj.Description; stock.CategoryID = StockObj.CategoryObject.StockTypeID; stock.ValueBandID = StockObj.ValueBandObject.ID; stock.Updated = DateTime.Now; dtStockHistory ST = new dtStockHistory { StoockID = Convert.ToInt32(StockObj.Stockid), Status = "Stock Details Updated", Value = null, UserID = UserID, Created = DateTime.Now, StatusID = 3 }; DB.dtStockHistories.InsertOnSubmit(ST); 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); } }
public void LinkTranToStock(ITransaction TransactionObject, skStock StockOBJ, int UserID) { base.Channel.LinkTranToStock(TransactionObject, StockOBJ, UserID); }
public void AddNewStockItem(skStock StockOb, skPurchase PurchaseOb, int UserID) { dtPurchese newpurchase = new dtPurchese { ItemTitle = StockOb.Name, ItemDescription = StockOb.Description, PurchesedValue = PurchaseOb.Amount, ShippingCosts = PurchaseOb.Postage, InvoiceID = PurchaseOb.Invoice, Purchesed_Date = PurchaseOb.PurchaseDate, AddedBy = UserID, VendorID = PurchaseOb.VendorObject.VendorID, IsExpense = false, Created = DateTime.Now, Updated = DateTime.Now }; dtStock newstock = new dtStock { CategoryID = StockOb.CategoryObject.StockTypeID, ItemDesc = StockOb.Description, ItemTitle = StockOb.Name, ValueBandID = StockOb.ValueBandObject.ID, Batch = 0, Sold = false, CreatedBy = UserID, Created = DateTime.Now, dtPurchese = newpurchase }; dtStockDetail newdetails = new dtStockDetail { PurchaseValue = StockOb.purchasedvalue }; newstock.dtStockDetails.Add(newdetails); DB.dtStocks.InsertOnSubmit(newstock); DB.SubmitChanges(); decimal pVALUE = System.Math.Abs(Convert.ToDecimal(PurchaseOb.Amount)) * (-1); decimal pPOSTAGE = System.Math.Abs(PurchaseOb.Postage) * (-1); int pID = TopPurchase(); int? stockID = GetTop1MostrecentSid(); dtStockHistory newstatus = new dtStockHistory { StoockID = stockID, Status = "Stock Created", Value = StockOb.purchasedvalue, UserID = UserID, Created = DateTime.Now, StatusID = 0 }; dtTransactionLedger newpurchaseledger = new dtTransactionLedger { PurchaseID = pID, TransactionType = "Purchase", TotelAmount = pVALUE, SaleID = null, TransactionDateTime = Convert.ToDateTime(PurchaseOb.PurchaseDate) }; dtTransactionLedger newshippingledger = new dtTransactionLedger { PurchaseID = pID, TransactionType = "Shipping", TotelAmount = pPOSTAGE, SaleID = null, TransactionDateTime = Convert.ToDateTime(PurchaseOb.PurchaseDate) }; DB.dtStockHistories.InsertOnSubmit(newstatus); DB.dtTransactionLedgers.InsertOnSubmit(newpurchaseledger); DB.dtTransactionLedgers.InsertOnSubmit(newshippingledger); DB.SubmitChanges(); }
public void UpdateStock(skStock StockObj, int UserID) { base.Channel.UpdateStock(StockObj, UserID); }
public void AddToExistingPurchase(skStock StockOb, int PurchaseID, int UserID) { base.Channel.AddToExistingPurchase(StockOb, PurchaseID, UserID); }
public void AddNewStock(skStock StockOb, skPurchase PurchaseOb, int UserID) { base.Channel.AddNewStock(StockOb, PurchaseOb, UserID); }
public void AddNewStock(skStock StockOb, skPurchase PurchaseOb, int UserID) { StockRepo.AddNewStockItem(StockOb, PurchaseOb, UserID); }
public void AddNewStock(skStock StockOBJ, int UserID) { StockRepo.AddNewStockItem(StockOBJ, UserID); }
public void AddToExistingPurchase(skStock StockOb, int PurchaseID, int UserID) { StockRepo.AddToExistingPurchase(StockOb, PurchaseID, UserID); }
public void UpdateStock(skStock StockObj, int UserID) { StockRepo.UpdateStock(StockObj, UserID); }
public void AddNewStock(skStock StockOBJ, int UserID) { base.Channel.AddNewStock(StockOBJ, UserID); }
public void LinkTranToStock(ITransaction TransactionObject, skStock StockOBJ, int UserID) { TransactionRepo.LinkTranToStock(TransactionObject, StockOBJ, UserID); }
public StockContract GetStockList(skStock StockOBj) { return(base.Channel.GetStockList(StockOBj)); }