public SalesAddViewModel(ISalesDatabase isd, ICustomerDatabase icd, ISalesLineDatabase isld, IDialogService ids, IGeoCoder geocoder) { salesDb = isd; customerDb = icd; salesLineDb = isld; dialog = ids; this.geocoder = geocoder; if (!GlobalVars.customerListIsLoaded) { loadCustomer(); } RaisePropertyChanged(() => CustomerSelection); if (SelectedCustomer != null) { RaisePropertyChanged(() => SelectedCustomer); } if (InsertSalesItemsList != null) { if (InsertSalesItemsList.Count() > 0) { RaisePropertyChanged(() => InsertSalesItemsList); RaisePropertyChanged(() => TotalDiscountAmount); RaisePropertyChanged(() => Total); } } }
public SalesViewModel(IDialogService ids, ISalesDatabase isd, ICustomerDatabase icd, ISalesLineDatabase isld) { dialog = ids; salesDb = isd; customerDb = icd; salesLineDb = isld; }
public LoginViewModel(IDialogService ids, ISalesDatabase isd, ISalesLineDatabase isld, ICustomerDatabase icd, IItemDatabase iid) { this.dialog = ids; salesDb = isd; salesLineDb = isld; customerDb = icd; itemDb = iid; }
public CustomerViewModel(ICustomerDatabase icd, IDialogService ids, ISalesDatabase isd, ISalesLineDatabase isld) { customerDb = icd; salesDb = isd; salesLineDb = isld; dialog = ids; if (!GlobalVars.customerListIsLoaded) { loadCustomers(); } syncCustomer(); OnNetworkChange(); }
public ShipmentViewModel(IDialogService ids, ISalesDatabase isd, ICustomerDatabase icd, ISalesLineDatabase isld, IItemDatabase iid) { dialog = ids; salesDb = isd; customerDb = icd; salesLineDb = isld; itemDb = iid; //Load sales list Task.Run(async() => { SalesList = await salesDb.GetAllSales(); RaisePropertyChanged(() => SalesList); LoadAutoCompleteList(); }); }
public SalesUpdateViewModel(IDialogService ids, ISalesDatabase isd, ISalesLineDatabase isld, ICustomerDatabase icd) { dialog = ids; salesDb = isd; salesLineDb = isld; customerDb = icd; Task.Run(async() => { var temp = await salesLineDb.GetAllSalesLinesWhere(GlobalVars.selectedSales.DocumentNo); UpdateSalesItemsList = new ObservableCollection <SalesItem>(); foreach (Models.SalesLineTable data in temp) { UpdateSalesItemsList.Add(new SalesItem(data.LineNumber, data.DocumentNo, data.ItemId, data.ItemName, data.ActualPrice, data.Quantity, data.UnitMeasurement, data.DiscountAmount, data.DiscountPercentage)); } RaisePropertyChanged(() => UpdateSalesItemsList); RaisePropertyChanged(() => TotalDiscountAmount); RaisePropertyChanged(() => Total); }); }
public PromotionViewModel(IPromotionDatabase ipd, ISalesDatabase isd, ISalesLineDatabase isld, IDialogService ids) { promotionDb = ipd; salesDb = isd; salesLineDb = isld; dialog = ids; Task.Run(async() => { var initTemp = await promotionDb.GetAllPromotions(); PromotionList = new ObservableCollection <PromotionItem>(); foreach (Models.Promotion promotion in initTemp) { PromotionList.Add(new PromotionItem(promotion.PromotionId, promotion.PromotionTitle, promotion.PromotionDetail, promotion.PeriodStart, promotion.PeriodEnd, promotion.ImageName)); } RaisePropertyChanged(() => PromotionList); if (CrossConnectivity.Current.IsConnected) { if (await CrossConnectivity.Current.IsRemoteReachable(Services.ServerDatabaseApi.ipAddress, int.Parse(ServerDatabaseApi.port))) { var serverDb = new ServerDatabaseService(); var deleteLocal = await promotionDb.DeleteAll(); var downloadFromServer = await serverDb.getAllPromotions(); var insertToLocal = promotionDb.InsertAll(downloadFromServer); var PromotionTemp = downloadFromServer; PromotionList = new ObservableCollection <PromotionItem>(); foreach (Models.Promotion promotion in PromotionTemp) { //var x = new PromotionItem(promotion.PromotionId, promotion.PromotionTitle, promotion.PromotionDetail, // promotion.PeriodStart, promotion.PeriodEnd, promotion.ImageName); PromotionList.Add(new PromotionItem(promotion.PromotionId, promotion.PromotionTitle, promotion.PromotionDetail, promotion.PeriodStart, promotion.PeriodEnd, promotion.ImageName)); /*if (await rootFolder.CheckExistsAsync(promotion.ImageName) == ExistenceCheckResult.NotFound) * { * //download * byte[] buffer = await client.GetByteArrayAsync(x.ImageURL); * temp = await rootFolder.CreateFileAsync(x.ImageName, CreationCollisionOption.FailIfExists); * }*/ } RaisePropertyChanged(() => PromotionList); //download and save /*HttpClient client = new HttpClient(); * IFolder rootFolder = FileSystem.Current.LocalStorage; * IFile temp; * foreach (Models.Promotion promotion in PromotionTemp) * { * if (await rootFolder.CheckExistsAsync(promotion.ImageName) == ExistenceCheckResult.NotFound) * { * var x = new PromotionItem(promotion.PromotionId, promotion.PromotionTitle, promotion.PromotionDetail, * promotion.PeriodStart, promotion.PeriodEnd, promotion.ImageName); * //download * byte[] buffer = await client.GetByteArrayAsync(x.ImageURL); * temp = await rootFolder.CreateFileAsync(promotion.ImageName, CreationCollisionOption.FailIfExists); * } * }*/ } } }); }