public ActionResult SalesOrderLine_Delete([DataSourceRequest] DataSourceRequest request, salesOrderLineModel modelSalesOrderLine) { var iResult = new List <salesOrderLineModel>(); if (!ModelState.IsValid) { iResult.Add(modelSalesOrderLine); } else { try { var iUri = new Uri(ODataWebService.BuildODataUrl()); var iWebService = new NAV(iUri) { Credentials = ODataWebService.CreateCredentials(iUri.ToString()) }; var salesOrderLine = (from lsalesOrderLine in iWebService.salesOrderLines where lsalesOrderLine.id == modelSalesOrderLine.id select lsalesOrderLine).FirstOrDefault(); if (salesOrderLine != null) { iWebService.DeleteObject(salesOrderLine); iWebService.SaveChanges(); } } catch (DataServiceRequestException ex) { ModelState.AddModelError("", ex.Message); iResult.Add(modelSalesOrderLine); } } return(Json(iResult.ToDataSourceResult(request, ModelState))); }
public ActionResult SalesOrderLines_Read([DataSourceRequest] DataSourceRequest request, Guid documentId) { var salesOrderLinesModel = new List <salesOrderLineModel>(); try { var iUri = new Uri(ODataWebService.BuildODataUrl()); var iWebService = new NAV(iUri) { Credentials = ODataWebService.CreateCredentials(iUri.ToString()) }; var salesOrderLines = (from lsalesOrderLine in iWebService.salesOrderLines where lsalesOrderLine.documentId == documentId orderby lsalesOrderLine.sequence select lsalesOrderLine); foreach (salesOrderLine lsalesOrderLine in salesOrderLines) { salesOrderLinesModel.Add(new salesOrderLineModel(lsalesOrderLine)); } } catch (DataServiceRequestException ex) { ModelState.AddModelError("", ex.Message); } return(Json(salesOrderLinesModel.ToDataSourceResult(request, ModelState))); }
public async Task SaveChanges() { State = ModelState.Loading; LoadAnimation = true; Rack modifiedrack = new Rack(); SaveFields(modifiedrack); try { LoadingText = AppResources.RackEditPage_SaveProcessText + " " + modifiedrack.No; int rackid = await NAV.ModifyRack(modifiedrack, ACD.Default).ConfigureAwait(true); int result = await NAV.DeleteBinsFromRack(modifiedrack, ACD.Default).ConfigureAwait(true); int index = 0; int count = BinsViewModel.BinViewModels.Count; foreach (BinViewModel bvm in BinsViewModel.BinViewModels) { index++; await SaveBinChanges(bvm, index, count).ConfigureAwait(true); } LoadAnimation = false; State = ModelState.Normal; await Navigation.PopAsync(); } catch (Exception e) { LoadAnimation = false; State = ModelState.Error; ErrorText = e.Message; } }
private async Task SaveBinChanges(BinViewModel bmv, int index, int count) { try { string text1 = String.Format(AppResources.RackEditPage_SaveProcessBinText, No, index, count); LoadingText = text1; bmv.SaveFields(); int binexist = await NAV.GetBinCount(LocationCode, "", "", bmv.Bin.Code, ACD.Default).ConfigureAwait(true); if (binexist > 0) { bmv.Bin.PrevCode = bmv.Bin.Code; await NAV.ModifyBin(bmv.Bin, ACD.Default).ConfigureAwait(true); } else { await NAV.CreateBin(BinTemplateCode, bmv.Bin, ACD.Default).ConfigureAwait(true); } } catch (Exception e) { throw e; } }
private async void Bvm_OnTap(BinViewModel bvm) { Select(bvm); if (bvm.IsContent) { bvm.LoadAnimation = true; try { NAVFilter navfilter = new NAVFilter { LocationCodeFilter = LocationCode, ZoneCodeFilter = ZoneCode, BinCodeFilter = bvm.Code }; List <BinContent> bincontent = await NAV.GetBinContentList(navfilter, ACD.Default).ConfigureAwait(true); FillBinContent(bvm, bincontent); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } bvm.LoadAnimation = false; } SetSelectedBinContent(); if (OnBinClick is Action <BinsViewModel> ) { OnBinClick(this); } }
public async Task RunBinContentTap(BinContentShortViewModel bcsvm) { try { State = ModelState.Loading; LoadAnimation = true; NAVFilter navfilter = new NAVFilter { LocationCodeFilter = LocationCode, ZoneCodeFilter = ZoneCode, RackIDFilter = ID.ToString(), BinCodeFilter = bcsvm.BinCode, ItemNoFilter = bcsvm.ItemNo, DescriptionFilter = bcsvm.Description }; string response = await NAV.RunBCTap(navfilter, ACD.Default).ConfigureAwait(true); State = ModelState.Normal; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } finally { LoadAnimation = false; } }
public async Task DeleteLocation(object obj) { if (NotNetOrConnection) { return; } try { LocationViewModel lvm = (LocationViewModel)obj; State = ModelState.Loading; await NAV.DeleteLocation(lvm.Code, ACD.Default).ConfigureAwait(true); LocationViewModels.Remove(lvm); State = ModelState.Normal; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; } finally { LoadAnimation = false; } }
public override async void SaveChangesAsync() { if (NotNetOrConnection) { return; } List <LocationViewModel> list = LocationViewModels.ToList().FindAll(x => x.Selected == true); foreach (LocationViewModel lvm in list) { try { Location location = new Location(); lvm.SaveFields(location); await NAV.ModifyLocation(location, ACD.Default).ConfigureAwait(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } } UpdateMinSizes(); }
public override async void SaveChangesAsync() { if (NotNetOrConnection) { return; } List <ZoneViewModel> list = ZoneViewModels.ToList().FindAll(x => x.IsSelected == true); foreach (ZoneViewModel zvm in list) { try { Zone zone = new Zone(); zvm.SaveFields(zone); await NAV.ModifyZone(zone, ACD.Default).ConfigureAwait(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } } UpdateMinSizes(); }
public async Task Load() { if (NotNetOrConnection) { return; } try { State = ModelState.Loading; List <Zone> zones = await NAV.GetZoneList(Location.Code, "", true, 1, int.MaxValue, ACD.Default).ConfigureAwait(true); if (NotDisposed) { CheckPlanSizes(); if (zones is List <Zone> ) { FillModel(zones); } } } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = AppResources.Error_LoadZones; } }
public override async void SaveChangesAsync() { if (NotNetOrConnection) { return; } List <RackViewModel> list = RackViewModels.ToList().FindAll(x => x.IsSelected == true); foreach (RackViewModel rvm in list) { try { Rack rack = new Rack(); rvm.SaveFields(rack); await NAV.ModifyRack(rack, ACD.Default).ConfigureAwait(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } } UpdateMinSizes(); }
public async Task Search(string request) { if (request.Length < 4) { State = ModelState.Error; ErrorText = AppResources.FindPage_RequestLengthError; return; } try { State = ModelState.Loading; LoadingText = AppResources.FindPage_Search; Global.SearchRequest = request; Global.SearchResponses = await NAV.Search(Global.SearchLocationCode, request, ACD.Default); LoadAnimation = true; await Navigation.PopAsync(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } }
public async Task LoadAll() { if (NotNetOrConnection) { return; } try { State = ModelState.Loading; List <Zone> zones = await NAV.GetZoneList(Location.Code, "", false, 1, int.MaxValue, ACD.Default); if (zones is List <Zone> ) { FillModel(zones); } } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); } catch { State = ModelState.Error; ErrorText = AppResources.Error_LoadZoneList; } }
public async Task LoadUDF(AsyncCancelationDispatcher acd) { try { List <UserDefinedFunction> list = await NAV.LoadUserDefinedFunctionList(LocationCode, ZoneCode, RackNo, ACD.Default).ConfigureAwait(true); if (list is List <UserDefinedFunction> ) { ObservableCollection <UserDefinedFunctionViewModel> nlist = new ObservableCollection <UserDefinedFunctionViewModel>(); foreach (UserDefinedFunction udf in list) { UserDefinedFunctionViewModel udfvm = new UserDefinedFunctionViewModel(Navigation, udf); nlist.Add(udfvm); } UserDefinedFunctions = nlist; } } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine("Cancel LoadUDF", e.Message); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.ToString(); } }
public async Task CreateRackInNAV() { State = ModelState.Loading; LoadAnimation = true; Rack newrack = new Rack(); NewModel.SaveFields(newrack); try { LoadingText = AppResources.RackNewPage_LoadingProgressRack + " " + newrack.No; int rackid = await NAV.CreateRack(newrack, ACD.Default).ConfigureAwait(true); NewModel.ID = rackid; foreach (BinViewModel bvm in NewModel.BinsViewModel.BinViewModels) { await SaveBin(bvm).ConfigureAwait(true); } LoadAnimation = false; State = ModelState.Normal; await Navigation.PopAsync(); } catch (Exception e) { LoadAnimation = false; State = ModelState.Error; ErrorText = e.Message; } }
private async Task SaveBin(BinViewModel bmv) { try { bmv.SaveFields(); LoadingText = AppResources.RackNewPage_LoadingProgressBin + " " + bmv.Bin.Code; int binexist = await NAV.GetBinCount(NewModel.LocationCode, "", "", bmv.Bin.Code, ACD.Default).ConfigureAwait(true); if (binexist > 0) { LoadingText = AppResources.RackNewPage_LoadingProgressModifyBin + " " + bmv.Bin.Code; bmv.Bin.PrevCode = bmv.Bin.Code; await NAV.ModifyBin(bmv.Bin, ACD.Default).ConfigureAwait(true); } else { if (CreateNewBins) { LoadingText = AppResources.RackNewPage_LoadingProgressBin + " " + bmv.Bin.Code; await NAV.CreateBin(NewModel.BinsViewModel.BinTemplate.Code, bmv.Bin, ACD.Default).ConfigureAwait(true); } } } catch (Exception e) { throw e; } }
public async Task SaveToRackSchemeVisible() { if (IsSaveToNAVEnabled) { if (NotNetOrConnection) { return; } try { IsBeenSavingToNAV = true; Rack rack = new Rack(); SaveFields(rack); await NAV.SetRackVisible(rack, ACD.Default).ConfigureAwait(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } finally { IsBeenSavingToNAV = false; } } }
public async Task OK() { if (NotNetOrConnection) { return; } if (CheckFields()) { SaveFields(BinTemplate); try { if (CreateMode) { await NAV.CreateBinTemplate(BinTemplate, ACD.Default).ConfigureAwait(true); await Navigation.PopAsync(); } else { await NAV.ModifyBinTemplate(BinTemplate, ACD.Default).ConfigureAwait(true); await Navigation.PopAsync(); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } } }
public async Task SaveToZoneSchemeVisible(bool value) { if (IsSaveToNAVEnabled) { if (NotNetOrConnection) { return; } try { IsBeenSavingToNAV = true; Zone zone = new Zone(); SaveFields(zone); zone.SchemeVisible = value; await NAV.SetZoneVisible(zone, ACD.Default).ConfigureAwait(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; } finally { IsBeenSavingToNAV = false; } } }
public async Task SetLocation(Location location) { if (CanChangeLocationAndZone) { LocationCode = location.Code; IsBusy = true; try { ZoneCode = ""; ZonesIsLoaded = false; List <Zone> zones = await NAV.GetZoneList(location.Code, "", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true); Zones.Clear(); foreach (Zone zone in zones) { Zones.Add(zone); } ZonesIsLoaded = CanChangeLocationAndZone && zones.Count > 0; await ReloadBinTemplates().ConfigureAwait(true); MessagingCenter.Send <RackViewModel>(this, "ZonesIsLoaded"); await CheckNo().ConfigureAwait(true); } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } finally { IsBusy = false; } } }
public async Task LoadRacks() { if (IsEditMode) { return; } RacksIsLoaded = false; RacksIsBeingLoaded = true; try { List <Rack> racks = await NAV.GetRackList(LocationCode, Code, true, 1, int.MaxValue, ACD.Default).ConfigureAwait(true); if (NotDisposed) { FillRacks(racks); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } finally { RacksIsBeingLoaded = false; } }
public async Task LoadUDS() { if (NotNetOrConnection) { return; } try { if (UserDefinedSelectionViewModels.Count == 0) { UserDefinedSelectionViewModels.Clear(); List <UserDefinedSelection> list = await NAV.LoadUDS(Zone.LocationCode, Zone.Code, ACD.Default).ConfigureAwait(true); if ((NotDisposed) && (list is List <UserDefinedSelection>)) { FillUDSList(list); } } } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.ToString(); } }
public async Task LoadAll() { if (NotNetOrConnection) { return; } try { State = ModelState.Loading; List <Location> list = await NAV.GetLocationList("", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true); if ((!IsDisposed) && (list is List <Location>)) { FillModel(list); } } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; ErrorText = AppResources.Error_LoadLocationList; } }
public async Task Load() { if (NotNetOrConnection) { return; } try { LocationsIsBeingLoaded = true; BinTypesIsBeingLoaded = true; List <Location> locations = await NAV.GetLocationList("", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true); List <BinType> bintypes = await NAV.GetBinTypeList(1, int.MaxValue, ACD.Default).ConfigureAwait(true); if (NotDisposed) { AddLocations(locations); AddBinTypes(bintypes); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } finally { BinTypesIsBeingLoaded = false; LocationsIsBeingLoaded = false; } }
public async Task LoadZones() { if (IsEditMode) { return; } ZonesIsLoaded = false; ZonesIsBeingLoaded = true; try { List <Zone> zones = await NAV.GetZoneList(Code, "", true, 1, int.MaxValue, ACD.Default).ConfigureAwait(true); if (NotDisposed) { AddSubSchemeElements(zones); } } catch (OperationCanceledException e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } finally { ZonesIsBeingLoaded = false; } }
public Task <string> CheckLocationCode(string code) { var tcs = new TaskCompletionSource <string>(); string rv = ""; Task.Run(async() => { try { if (!string.IsNullOrEmpty(code)) { string code1 = code.Trim().ToUpper(); int exist = await NAV.GetLocationCount(code1, false, ACD.Default); if (exist > 0) { rv = AppResources.LocationNewPage_CodeAlreadyExist; } } tcs.SetResult(rv); } catch { tcs.SetResult(rv); } }); return(tcs.Task); }
public async Task SaveToLocationSchemeVisible(bool value) { if (IsSaveToNAVEnabled) { if (NotNetOrConnection) { return; } try { IsBeenSavingToNAV = true; Location location = new Location(); SaveFields(location); location.SchemeVisible = value; await NAV.SetLocationVisible(location, ACD.Default); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } finally { IsBeenSavingToNAV = false; } } }
protected void Page_Load(object sender, EventArgs e) { oNAVDemo.NAV nav = new NAV(new Uri("http://wcf-uat.nav.issworld.com:8058/NAV71_UATWS/OData/Company('ID_007%20IFS%20Test%20140215')")); nav.Credentials = CredentialCache.DefaultNetworkCredentials; var customer = from c in nav.Customer select c; }
public async Task LoadIndicators() { if (IsEditMode) { return; } try { List <Indicator> list = await NAV.GetIndicatorsByZone(LocationCode, Code, ACD.Default).ConfigureAwait(true); if (NotDisposed) { ObservableCollection <IndicatorViewModel> nlist = new ObservableCollection <IndicatorViewModel>(); foreach (Indicator indicator in list) { IndicatorViewModel ivm = new IndicatorViewModel(Navigation, indicator); ivm.LocationCode = LocationCode; ivm.ZoneCode = Code; nlist.Add(ivm); } Indicators = nlist; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; } }
public IQueryable <salesOrder> GetSalesOrders(ODataQueryOptions queryOptions) { IQueryable <salesOrder> iQuery = null; Uri iUri = new Uri(ODataWebService.BuildODataUrl()); NAV iWebService = new NAV(iUri) { Credentials = ODataWebService.CreateCredentials(iUri.ToString()) }; try { //var iCustomerId = ClaimsPrincipal.Current.Claims.Where(w => w.Type == "extension_CustomerId").Select(s => s.Value).FirstOrDefault(); //iQuery = from salesOrder in iWebService.salesOrders // where salesOrder.customerId == new Guid(iCustomerId) // select salesOrder; iQuery = (IQueryable <salesOrder>)queryOptions.ApplyTo(iWebService.salesOrders); } catch (Exception ex) { // return ex; } return(iQuery); }