Esempio n. 1
0
        private static void FillGenericCollection(string tablEname, ObservableCollection <GenericViewModel> objectToFill)
        {
            if (objectToFill == null)
            {
                objectToFill = new ObservableCollection <GenericViewModel>();
            }
            var serviceClient = new CRUD_ManagerServiceClient();

            serviceClient.GetGenericAsync(tablEname, "%%", "%%", "%%", "Iserial", "ASC");

            serviceClient.GetGenericCompleted += (s, ev) =>
            {
                var i = 0;
                foreach (var item in ev.Result)
                {
                    objectToFill.Add(new GenericViewModel
                    {
                        Iserial = item.Iserial,
                        Code    = item.Code,
                        Aname   = item.Aname,
                        Ename   = item.Ename
                    });
                    objectToFill[i].Status.IsChanged     = false;
                    objectToFill[i].Status.IsNew         = false;
                    objectToFill[i].Status.IsSavedDBItem = true;
                    i++;
                }
            };
            serviceClient.CloseAsync();
        }
Esempio n. 2
0
        public SearchFabricViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new SortableCollectionView <tbl_FabricAttriputes>();
                SelectedMainRow = new tbl_FabricAttriputes();



                Client.GetTblFabricAttriputesCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        MainRowList.Add(row);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                };

                GetMaindata();
            }
        }
Esempio n. 3
0
        public SearchSupplierViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new ObservableCollection <TBLsupplier>();
                SelectedMainRow = new TBLsupplier();

                Client.GetTblRetailSupplierCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var axvendor = sv.AxVendors.FirstOrDefault(x => x.vendor_code == row.glcode);
                        if (axvendor != null)
                        {
                            row.Address1 = axvendor.Termsofpayment;
                            row.Address2 = axvendor.Methodofpayment;
                        }
                        else
                        {
                            row.Address1 = row.Address2 = null;
                        }
                        MainRowList.Add(row);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                };

                GetMaindata();
            }
        }
Esempio n. 4
0
        public void SaveMainRow()
        {
            CRUD_ManagerServiceClient _client = new CRUD_ManagerServiceClient();

            _client.SaveBrandSectionFamilySizeGroupAsync(SelectedBrand.Iserial, SelectedSection.Iserial,
                                                         SelectedFamily.Iserial,
                                                         SelectedSizeGroup.Iserial);
            _client.SaveBrandSectionFamilySizeGroupCompleted += (s, sv) =>
            {
                switch (sv.Result)
                {
                case 1:
                    MessageBox.Show("Operation Completed");
                    break;

                case 2:
                    MessageBox.Show("Already Exist");
                    break;

                default:
                    MessageBox.Show("Unexpected error, Operation Canceled");
                    break;
                }
            };
        }
Esempio n. 5
0
        public SearchSalesOrderColorViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new ObservableCollection <TblSalesOrderColor>();
                SelectedMainRow = new TblSalesOrderColor();

                Client.SearchSalesOrderColorCompleted += (s, sv) =>
                {
                    if (sv.Result != null)
                    {
                        foreach (var row in sv.Result)
                        {
                            if (!MainRowList.Contains(row))
                            {
                                MainRowList.Add(row);
                            }
                        }
                    }

                    Loading = false;
                    //   FullCount = sv.fullCount;
                };

                GetMaindata();
            }
        }
Esempio n. 6
0
        public ServiceCodingViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                MainRowList     = new SortableCollectionView <TblServiceViewModel>();
                SelectedMainRow = new TblServiceViewModel();

                var tblAssetsTypeclient = new CRUD_ManagerServiceClient();
                tblAssetsTypeclient.GetGenericAsync("TblServiceGroup", "%%", "%%", "%%", "Iserial", "ASC");

                tblAssetsTypeclient.GetGenericCompleted += (s, sv) =>
                {
                    ServiceGroupList = sv.Result;
                };

                Client.GetTblServiceCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblServiceViewModel();

                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Client.UpdateOrInsertTblServiceCompleted += (s, x) =>
                {
                    var savedRow = (TblServiceViewModel)MainRowList.GetItemAt(x.outindex);

                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                };
                Client.DeleteTblServiceCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        throw ev.Error;
                    }

                    var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        MainRowList.Remove(oldrow);
                    }
                };

                GetMaindata();
            }
        }
        public void GetMarkUpdata(bool header)
        {
            var client = new CRUD_ManagerServiceClient();

            SelectedMainRow.MarkUpTransList.Clear();
            PurchasePlanClient.DyeingOrderInvoiceMarkupTransProdAsync(0, SelectedMainRow.Iserial, LoggedUserInfo.DatabasEname);

            Loading = true;
        }
Esempio n. 8
0
        public DirectionLinkViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                var client = new CRUD_ManagerServiceClient();

                Client.GetAllBrandsCompleted += (s, sv) =>
                {
                    BrandsList = sv.Result;
                };
                Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);
                client.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblLkpDirectionLinkViewModel
                        {
                            Aname   = row.Aname,
                            Ename   = row.Ename,
                            Iserial = row.Iserial,
                            Code    = row.Code
                        };
                        MainRowList.Add(newrow);
                    }
                };
                lkpClient.GetTblBrandSectionLinkCompleted += (s, sv) =>
                {
                    BrandSectionList.Clear();
                    foreach (var row in sv.Result)
                    {
                        BrandSectionList.Add(row.TblLkpBrandSection1);
                    }
                };
                lkpClient.GetTblDirectionLinkCompleted += (s, sv) =>
                {
                    MainSelectedRows.Clear();
                    MainSelectedRows = sv.Result;

                    foreach (var row in MainRowList)
                    {
                        row.UpdatedAllowed = false;
                        row.Checked        = false;
                    }
                    foreach (var row in MainSelectedRows)
                    {
                        var familyRow = MainRowList.SingleOrDefault(x =>
                                                                    x.Iserial == row.TblLkpDirection);
                        familyRow.Checked = true;
                    }
                };

                client.GetGenericAsync("TblLkpDirection", "%%", "%%", "%%", "Iserial", "ASC");
            }
        }
Esempio n. 9
0
        public SmlHeaderViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                SmlCollection            = new SeasonalMasterCollection();
                SmlCollection.OnRefresh += MainRowList_OnRefresh;
                Client = new CRUD_ManagerServiceClient();
                Client.GetAllBrandsCompleted += (s, e) =>
                {
                    try
                    {
                        Brands = new List <Brand>(e.Result);
                    }
                    catch (Exception ex)
                    {
                        var err = new ErrorWindow(ex);
                        err.Show();
                    }
                };
                Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

                var seasonClientclient = new CRUD_ManagerServiceClient();
                seasonClientclient.GetGenericCompleted += (s, e) =>
                {
                    Seasons = new List <GenericTable>(e.Result);
                };
                seasonClientclient.GetGenericAsync("TblLkpSeason", "%%", "%%", "%%", "Iserial", "ASC");

                FillGenericCollection("tbl_lkp_SMLStatus", StatusList);
                Client.GetSmlCompleted += (s, e) =>
                {
                    Loading = false;
                    foreach (var item in e.Result)
                    {
                        //                            SmlCollection.Add(MapItem(item));
                    }
                };

                GetMaindata();
            }
            else
            {
                SmlCollection.Add(new SeasonalMasterListViewModel {
                    StyleCode = "Test Style", Description = "Test Desc", ColorCode = "BL1"
                });
                SmlCollection.Add(new SeasonalMasterListViewModel {
                    StyleCode = "2Test Style", Description = "Test Desc2", ColorCode = "BL2"
                });
            }
        }
Esempio n. 10
0
        public SearchSalesOrderViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new ObservableCollection <TblSalesOrder>();
                SelectedMainRow = new TblSalesOrder();
                Client.GetTblSalesOrderOperationCompleted += (s, sv) =>
                {
                    if (sv.Result != null)
                    {
                        foreach (var row in sv.Result)
                        {
                        }
                    }
                };
                Client.SearchSalesOrderCompleted += (s, sv) =>
                {
                    if (sv.Result != null)
                    {
                        foreach (var row in sv.Result)
                        {
                            //var newrow = new TblSalesOrder();

                            //newrow.InjectFrom(row);
                            if (!MainRowList.Contains(row))
                            {
                                //var fabric = sv.mainFabricList.FirstOrDefault(x => x.Iserial == newrow.tbl_FabricAttriputes);

                                //if (fabric != null)
                                //{
                                //    newrow.FabricPerRow = fabric;
                                //}
                                //newrow.SeasonPerRow = new GenericTable();
                                //newrow.SizeGroupPerRow = new TblSizeGroup();

                                MainRowList.Add(row);
                            }
                        }
                    }

                    Loading = false;
                    //   FullCount = sv.fullCount;
                };

                GetMaindata();
            }
        }
Esempio n. 11
0
        public SearchFabricServiceViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new ObservableCollection <ItemsDto>();
                SelectedMainRow = new ItemsDto();

                Client.GetFabricServiceSearchCompleted += (s, sv) =>
                {
                    if (sv.Result != null)
                    {
                        foreach (var row in sv.Result)
                        {
                            //var newrow = new FabricAccSearch();

                            //newrow.InjectFrom(row);

                            var newrow = new ItemsDto();
                            newrow.Iserial   = row.Iserial;
                            newrow.Code      = row.Code;
                            newrow.Name      = row.Name;
                            newrow.Unit      = row.Unit;
                            newrow.ItemGroup = row.ItemGroup;
                            if (!MainRowList.Contains(newrow))
                            {
                                //var fabric = sv.mainFabricList.FirstOrDefault(x => x.Iserial == newrow.tbl_FabricAttriputes);

                                //if (fabric != null)
                                //{
                                //    newrow.FabricPerRow = fabric;
                                //}
                                //newrow.SeasonPerRow = new GenericTable();
                                //newrow.SizeGroupPerRow = new TblSizeGroup();

                                MainRowList.Add(newrow);
                            }
                        }
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                };

                GetMaindata();
            }
        }
Esempio n. 12
0
        public void GetSeason()
        {
            var seasonClient = new CRUD_ManagerServiceClient();

            seasonClient.GetAllSeasonsCompleted += (s, sv) =>
            {
                foreach (var row in sv.Result)
                {
                    if (SeasonList.All(x => x.Iserial != row.Iserial))
                    {
                        SeasonList.Add(new TblLkpSeason().InjectFrom(row) as TblLkpSeason);
                    }
                }
            };
            seasonClient.GetAllSeasonsAsync();
        }
Esempio n. 13
0
        private void FillBasicCollections()
        {
            var serviceClient = new CRUD_ManagerServiceClient();

            serviceClient.GetVendorsCompleted += (a, b) =>
            {
                try
                {
                    foreach (var item in b.Result)
                    {
                        Vendors.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    var err = new ErrorWindow(ex);
                    err.Show();
                }
            };

            serviceClient.GetAllBrandsCompleted += (s, e) =>
            {
                try
                {
                    foreach (var item in e.Result)
                    {
                        Brands.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    var err = new ErrorWindow(ex);
                    err.Show();
                }
            };
            serviceClient.GetAllBrandsAsync(LoggedUserInfo.Iserial);

            serviceClient.GetAllSeasonsCompleted += (s, e) =>
            {
                foreach (var item in e.Result)
                {
                    Seasons.Add(item);
                }
            };
            serviceClient.GetAllSeasonsAsync();
        }
Esempio n. 14
0
 public ItemsSearchViewModel()
 {
     if (!DesignerProperties.IsInDesignTool)
     {
         Client = new CRUD_ManagerServiceClient();
         Client.SearchForRfqItemsCompleted += (s, e) =>
         {
             if (e.Error != null)
             {
                 return;
             }
             GenericItemsList = new PagedCollectionView(e.Result);
             OnSearchEnded();
             RaisePropertyChanged("GenericItemsList");
         };
     }
 }
Esempio n. 15
0
 public RFSViewModel()
 {
     if (!DesignerProperties.IsInDesignTool)
     {
         Client = new CRUD_ManagerServiceClient();
         InitiateCommands();
         // FormName = PermissionItemName.RFQForm;
         InitiatePermissionsMapper();
         ManagePermissions();
         ManageCustomePermissions();
         FormMode = new ObjectMode();
         FormMode = ObjectMode.StandBy;
         InitializeObjStatus();
         InitiateCollections();
         InitializeServiceEvents();
         FillBasicCollections();
     }
 }
Esempio n. 16
0
        public SearchAssetViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new SortableCollectionView <TblAssetsViewModel>();
                SelectedMainRow = new TblAssetsViewModel();

                Client.GetTblAssetsCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblAssetsViewModel();
                        if (row.TblAssetsType1 != null)
                        {
                            newrow.AssetTypePerRow.InjectFrom(row.TblAssetsType1);
                        }
                        if (row.TblHardDisk1 != null)
                        {
                            newrow.HardDiskPerRow.InjectFrom(row.TblHardDisk1);
                        }
                        if (row.TblMemory1 != null)
                        {
                            newrow.MemoryPerRow.InjectFrom(row.TblMemory1);
                        }
                        if (row.TblProcessor1 != null)
                        {
                            newrow.ProcessorPerRow.InjectFrom(row.TblProcessor1);
                        }
                        newrow.Pending = sv.PendingAssets.Any(x => x == row.Iserial);
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                };

                GetMaindata();
            }
        }
        public SearchPurchaseOrdersViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new SortableCollectionView <CRUD_ManagerServicePurchaseOrderDto>();
                SelectedMainRow = new CRUD_ManagerServicePurchaseOrderDto();

                Client.GetPurchaseOrderJournalsCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        MainRowList.Add(row);
                    }

                    Loading = false;
                };
            }
        }
Esempio n. 18
0
        private void FilterStyles(object sender)
        {
            var client  = new CRUD_ManagerServiceClient();
            var autobox = (sender as AutoCompleteBox);

            if (autobox == null)
            {
                return;
            }
            client.SearchSMLStylesAsync(autobox.Text);
            client.SearchSMLStylesCompleted += (s, e) =>
            {
                if (e.Error != null)
                {
                    return;
                }
                SMLStyles = new List <SMLDTO>(e.Result);
                autobox.PopulateComplete();
            };
        }
Esempio n. 19
0
        public SearchRetailStyleViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new SortableCollectionView <viewstyle>();
                SelectedMainRow = new viewstyle();


                Client.GetviewstyleCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        MainRowList.Add(row);
                    }

                    Loading = false;
                };
            }
        }
Esempio n. 20
0
        public SmlRowEditorViewModel()
        {
            if (DesignerProperties.IsInDesignTool)
            {
                return;
            }
            Client = new CRUD_ManagerServiceClient();
            Client.SearchAXStylesCompleted += (s, ee) =>
            {
                if (ee.Error != null)
                {
                    return;
                }

                SizeRangeWithSizes = new List <SizesWithGroups>(ee.sizesWithGroups);
                Styles             = new ObservableCollection <StylesDTO>((from x in ee.Result

                                                                           select new StylesDTO
                {
                    StyleCode = x.StyleCode,
                    Desc = x.StyleName
                }).ToList());
                OnStylesPupulated();
            };

            Client.GetTblColorLinkCompleted += (s, ee) =>
            {
                if (ee.Error != null)
                {
                    return;
                }
                ColorList = new List <TblColor>();
                foreach (var row in ee.Result)
                {
                    ColorList.Add(row.TblColor1);
                }

                OnColorspopulated();
            };
        }
Esempio n. 21
0
        private void FillGenericCollection(string tablEname, ObservableCollection <GenericViewModel> objectToFill)
        {
            objectToFill.Clear();
            var client = new CRUD_ManagerServiceClient();

            client.GetGenericAsync(tablEname, "%%", "%%", "%%", "Iserial", "ASC");

            client.GetGenericCompleted += (s, ev) =>
            {
                foreach (var item in ev.Result)
                {
                    objectToFill.Add(new GenericViewModel
                    {
                        Iserial = item.Iserial,
                        Code    = item.Code,
                        Aname   = item.Aname,
                        Ename   = item.Ename
                    });
                }
            };
            client.CloseAsync();
        }
Esempio n. 22
0
        public SeasonalMasterListViewModel()
        {
            if (DesignerProperties.IsInDesignTool)
            {
                return;
            }
            Client = new CRUD_ManagerServiceClient();
            Client.UpdateOrInsertTblSmlCompleted += (s, e) =>
            {
                if (e.Error != null)
                {
                    return;
                }
                ObjStatus.IsNew         = false;
                ObjStatus.IsSavedDBItem = true;
                Iserial = e.Result.Iserial;
            };
            Sizes.CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                {
                    foreach (SmlSizeDetails item in e.NewItems)
                    {
                        item.PropertyChanged
                            += (s1, e1) => RaisePropertyChanged(e1.PropertyName);
                    }
                }

                if (e.OldItems != null)
                {
                    foreach (SmlSizeDetails item in e.OldItems)
                    {
                        // ReSharper disable once EventUnsubscriptionViaAnonymousDelegate
                        item.PropertyChanged
                            -= (s1, e1) => RaisePropertyChanged(e1.PropertyName);
                    }
                }
            };
        }
Esempio n. 23
0
        public SearchEmpSecondViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new SortableCollectionView <EmployeesView>();
                SelectedMainRow = new EmployeesView();

                Client.GetEmpTableCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        MainRowList.Add(row);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                };

                GetMaindata();
            }
        }
Esempio n. 24
0
        public SearchGroupsViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new SortableCollectionView <TblGROUP1>();
                SelectedMainRow = new TblGROUP1();

                Client.GetRetailGroupsCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        MainRowList.Add(row);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                };

                //GetMaindata();
            }
        }
Esempio n. 25
0
        public SearchStoresForAllCompanyViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client = new CRUD_ManagerServiceClient();

                MainRowList     = new SortableCollectionView <StoreForAllCompany>();
                SelectedMainRow = new StoreForAllCompany();

                Client.GetStoresForAllCompanyCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        MainRowList.Add(row);
                    }

                    Loading   = false;
                    FullCount = sv.fullCount;
                };

                GetMaindata();
            }
        }
        public CuttingOrderChildWindow(RouteCardFabricViewModel markerViewModel)
        {
            RollUnitList = new List <string> {
                "KG", "Meter"
            };
            InitializeComponent();
            DataContext = markerViewModel;
            CuttingOrderListChildWindows = new ObservableCollection <CuttingOrderViewModel>();

            var client = new CRUD_ManagerServiceClient();

            if (markerViewModel.FabricColorPerRow != null)
            {
                if (markerViewModel.ItemId != null)
                {
                    client.InspectionRouteAsync(markerViewModel.ItemId, markerViewModel.FabricColorPerRow.Iserial);
                }
                else
                {
                    MessageBox.Show("You have to select Fabric First");
                }
            }
            else
            {
                MessageBox.Show("You have to select Fabric Color First");
            }

            client.InspectionRouteCompleted += (s, sv) =>
            {
                var list = new ObservableCollection <CuttingOrderViewModel>();
                foreach (var item in sv.Result)
                {
                    list.Add(MarkerMapper.MapToCuttingOrder(item, 1));
                }
                DgCuttingOrder.ItemsSource = list;
            };
        }
Esempio n. 27
0
        private void BtnOperation_OnClick(object sender, RoutedEventArgs e)
        {
            var Client = new CRUD_ManagerServiceClient();

            if (MainGrid.SelectedIndex != -1)
            {
                var b  = (Button)sender;
                var gt = b.TransformToVisual(Application.Current.RootVisual);
                var p  = gt.Transform(new Point(0, b.ActualHeight));

                MyPopup.HorizontalOffset = p.X;
                MyPopup.VerticalOffset   = 100;

                MyPopup.IsOpen = true;
                var salesorder = MainGrid.SelectedItem as TblSalesOrder;
                //_viewModel.Operation(salesorder.Iserial);
                Client.GetTblSalesOrderOperationAsync(salesorder.Iserial);

                Client.GetTblSalesOrderOperationCompleted += (s, sv) =>
                {
                    SalesOrderOperationGrid.ItemsSource = sv.Result;
                };
            }
        }
Esempio n. 28
0
        public NewRFQViewModel()
        {
            if (DesignerProperties.IsInDesignTool)
            {
                return;
            }
            FillGenericCollection("tbl_lkp_Currency", RFQGlobalLkps.CurrenciesList);
            Client = new CRUD_ManagerServiceClient();
            Client.GetNewRfqCompleted += (s, e) =>
            {
                if (e.Error != null)
                {
                    return;
                }
                MapToMe(e.Result);
            };
            Client.UpdateOrInsertNewRfqCompleted += (s, e) =>
            {
                if (e.Error != null)
                {
                    MessageBox.Show(strings.FailSavingMessage);
                    return;
                }
                MapToMe(e.Result);
                MessageBox.Show(strings.SavedMessage);
            };

            Client.GetAllBrandsCompleted += (s, e) =>
            {
                try
                {
                    Brands = new List <Brand>(e.Result);
                }
                catch (Exception ex)
                {
                    var err = new ErrorWindow(ex);
                    err.Show();
                }
            };
            Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

            Client.GetAllSeasonsCompleted += (s, e) =>
            {
                Seasons = new List <TblLkpSeason>(e.Result);
            };
            Client.GetAllSeasonsAsync();

            tblNewRFQDetails.CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                {
                    foreach (NewRFQDetailsViewModel item in e.NewItems)
                    {
                        item.PropertyChanged
                            += (s1, e1) => RaisePropertyChanged(e1.PropertyName);
                        var item1 = item;
                        item.DeleteDetails += (s1, e1) =>
                        {
                            var res = MessageBox.Show(strings.DeleteConfirmationMessage, strings.Delete, MessageBoxButton.OKCancel);
                            if (res == MessageBoxResult.Cancel)
                            {
                                return;
                            }
                            RfqHeaderDeletedList.Add(item1);
                            tblNewRFQDetails.Remove(item1);
                        };
                    }
                }

                if (e.OldItems == null)
                {
                    return;
                }
                foreach (NewRFQDetailsViewModel item in e.OldItems)
                {
                    item.PropertyChanged
                        -= ((s1, e1) => RaisePropertyChanged(e1.PropertyName));
                }
            };
            Client.SearchVendorsCompleted += (s, e) =>
            {
                if (e.Error != null)
                {
                    return;
                }
                Vendros = new ObservableCollection <Vendor>(e.Result);
                OnVendorPopulatingCompleted();
            };
        }
Esempio n. 29
0
        public CheckListLinkViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                MainRowList       = new ObservableCollection <GenericViewModel>();
                SelectedMainRow   = new GenericViewModel();
                SelectedDetailRow = new TblCheckListLinkViewModel();

                Client.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new GenericViewModel
                        {
                            Aname   = row.Aname,
                            Ename   = row.Ename,
                            Iserial = row.Iserial,
                            Code    = row.Code
                        };
                        MainRowList.Add(newrow);
                    }
                };
                Client.GetGenericAsync("TblCheckListGroup", "%%", "%%", "%%", "Iserial", "ASC");

                var detailservice = new CRUD_ManagerServiceClient();

                detailservice.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblCheckListLinkViewModel
                        {
                            Aname            = row.Aname,
                            Ename            = row.Ename,
                            Iserial          = row.Iserial,
                            Code             = row.Code,
                            TblCheckListItem = row.Iserial
                        };
                        DetailList.Add(newrow);
                    }
                };
                detailservice.GetGenericAsync("TblCheckListItem", "%%", "%%", "%%", "Iserial", "ASC");

                var header1Service = new CRUD_ManagerServiceClient();

                header1Service.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new GenericTable
                        {
                            Aname   = row.Aname,
                            Ename   = row.Ename,
                            Iserial = row.Iserial,
                            Code    = row.Code,
                        };
                        CheckListDesignGroupHeader1List.Add(newrow);
                    }
                };
                header1Service.GetGenericAsync("TblCheckListDesignGroupHeader1", "%%", "%%", "%%", "Iserial", "ASC");
                var header2 = new CRUD_ManagerServiceClient();
                header2.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new GenericTable
                        {
                            Aname   = row.Aname,
                            Ename   = row.Ename,
                            Iserial = row.Iserial,
                            Code    = row.Code,
                        };
                        CheckListDesignGroupHeader2List.Add(newrow);
                    }
                };
                header2.GetGenericAsync("TblCheckListDesignGroupHeader2", "%%", "%%", "%%", "Iserial", "ASC");

                Client.GetTblCheckListLinkCompleted += (s, sv) =>
                {
                    foreach (var row in DetailList)
                    {
                        row.UpdatedAllowed = false;
                        row.Checked        = false;
                        row.CheckListDesignGroupHeader1PerRow = null;
                        row.CheckListDesignGroupHeader2PerRow = null;
                        row.TblCheckListDesignGroupHeader1    = null;
                        row.TblCheckListDesignGroupHeader2    = null;
                    }
                    foreach (var row in sv.Result)
                    {
                        var subCheckListRow = DetailList.SingleOrDefault(x =>
                                                                         x.Iserial == row.TblCheckListItem);
                        if (subCheckListRow != null)
                        {
                            subCheckListRow.Checked = true;
                            if (row.TblCheckListDesignGroupHeader11 != null)
                            {
                                subCheckListRow.CheckListDesignGroupHeader1PerRow.InjectFrom(row.TblCheckListDesignGroupHeader11);
                            }

                            if (row.TblCheckListDesignGroupHeader21 != null)
                            {
                                subCheckListRow.CheckListDesignGroupHeader2PerRow.InjectFrom(row.TblCheckListDesignGroupHeader21);
                            }
                        }
                    }
                };
            }
        }
Esempio n. 30
0
        public void LoadViewModel()
        {
            ObjStatus = new ObjectStatus {
                IsNew = true
            };
            Client         = new CRUD_ManagerServiceClient();
            WarehousesList = new ObservableCollection <V_Warehouse>();
            WarehousesList.CollectionChanged += WarehousesList_CollectionChanged;
            CreationDate = DateTime.Now;
            Client.GetAllWarehousesByCompanyNameCompleted += (s, e) =>
            {
                foreach (var item in e.Result)
                {
                    WarehousesList.Add(item);
                }
            };
            Client.GetAllWarehousesByCompanyNameAsync("CCR");
            PurchaseOrderDetails = new ObservableCollection <NewRfqPurchasOrderDetailsViewModel>();

            PurchaseOrderDetails.CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                {
                    foreach (NewRfqPurchasOrderDetailsViewModel item in e.NewItems)
                    {
                        item.PropertyChanged
                            += (s1, e1) =>
                            {
                            RaisePropertyChanged(e1.PropertyName);
                            if (e1.PropertyName == "RowTotal")
                            {
                                GrandTotal = PurchaseOrderDetails.Sum(x => x.RowTotal);
                            }
                            };

                        var item1 = item;
                        item.DeletePurchLine += (ss, ee) =>
                        {
                            var res = MessageBox.Show("Delete?", "", MessageBoxButton.OKCancel);
                            if (res == MessageBoxResult.Cancel)
                            {
                                return;
                            }
                            PurchaseOrderDetails.Remove(item1);
                        };
                    }
                }

                if (e.OldItems != null)
                {
                    foreach (NewRfqPurchasOrderDetailsViewModel item in e.OldItems)
                    {
                        item.PropertyChanged
                            -= ((s1, e1) => RaisePropertyChanged(e1.PropertyName));
                        var item1 = item;
                        item.DeletePurchLine -= ((ss, ee) =>
                        {
                            if (item1.ObjStatus.IsSavedDBItem)
                            {
                                PurchaseOrderDeletedDetails.Add(item1);
                            }
                            PurchaseOrderDetails.Remove(item1);
                        });
                    }
                }
            };

            Client.PostPoToAxCompleted += (s, e)
                                          =>
            {
                MessageBox
                .Show(e.Error == null ? "PO Successfully Posted" : "PO Was not posted");
                IsPosted = e.Error == null;
            };
        }