Пример #1
0
        public BrandSectionFamilySizeGroupViewModelViewModel()
        {
            Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

            Client.GetAllBrandsCompleted += (d, s) =>
            {
                BrandList = s.Result;
            };

            lkpClient.GetTblBrandSectionLinkCompleted += (s, sv) =>
            {
                BrandSectionList.Clear();
                foreach (var row in sv.Result)
                {
                    BrandSectionList.Add(row.TblLkpBrandSection1);
                }
            };
            lkpClient.GetTblFamilyLinkCompleted += (s, sv) =>
            {
                FamilyList.Clear();
                foreach (var row in sv.Result)
                {
                    FamilyList.Add(row.TblFamily1);
                }
            };
        }
Пример #2
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");
            }
        }
Пример #3
0
        private void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            RaisePropertyChanged(e.PropertyName);

            if (e.PropertyName == "Brand")
            {
                if (SelectedMainRow.Brand != null)
                {
                    var brandSectionClient = new LkpData.LkpDataClient();
                    brandSectionClient.GetTblBrandSectionLinkCompleted += (s, sv) =>
                    {
                        BrandSectionList.Clear();
                        foreach (var row in sv.Result)
                        {
                            BrandSectionList.Add(row.TblLkpBrandSection1);
                        }
                    };
                    brandSectionClient.GetTblBrandSectionLinkAsync(SelectedMainRow.Brand, LoggedUserInfo.Iserial);
                }
            }
        }
Пример #4
0
        public DyeingPlanAccViewModel()
        {
            DyeingSummeryViewModelList = new ObservableCollection <DyeingSummeryViewModel>();
            FabricStorageList          = new ObservableCollection <FabricStorage_Result>();

            lkpClient.GetTblBrandSectionLinkCompleted += (s, sv) =>
            {
                BrandSectionList.Clear();
                foreach (var row in sv.Result)
                {
                    BrandSectionList.Add(row.TblLkpBrandSection1);
                    if (row.TblLkpBrandSection == HeaderViewModel.TblLkpBrandSection)
                    {
                        HeaderViewModel.BrandSectionPerRow = row.TblLkpBrandSection1;
                    }
                }
                //HeaderViewModel.BrandSectionPerRow =
                //    BrandSectionList.Where(
                //        x =>
                //            x.TblLkpBrandSectionLinks.FirstOrDefault(
                //                w => w.TblLkpBrandSection == HeaderViewModel.TblLkpBrandSection)).;
            };

            Client.GetBomfabricDyeingServiceCompleted += (s, sv) =>
            {
            };
            _webService.GetFabricWithUnitAndDyeingClassCompleted += (d, sv) =>
            {
                FabricAttList = sv.Result;
            };
            ChaingSetupMethod.GetSettings("Dyeing Order acc", _webService);

            _webService.GetChainSetupCompleted += (a, s) =>
            {
                foreach (var item in s.Result)
                {
                    if (item.sGlobalSettingCode == "DefaultDyeingVendorCode")
                    {
                        DefaultDyeingVendor = item.sSetupValue;
                    }
                    else if (item.sGlobalSettingCode == "DefaultFinishedFabricWarehouse")
                    {
                        DefaultFinishedFabricWarehouse = item.sSetupValue;
                    }
                }
            };

            WareHouseList = new ObservableCollection <TblWarehouse>();
            _webService.GetTblWarehouseAsync(0, int.MaxValue, "it.Iserial", null, null);
            _webService.GetTblWarehouseCompleted += (s, w) =>
            {
                foreach (var item in w.Result)
                {
                    WareHouseList.Add(item);
                }
            };

            _webService.GetLocationDetailsCompleted += (s, sv) =>
            {
                FabricStorageList = sv.Result;
            };

            BrandsList      = new ObservableCollection <Brand>();
            SeasonList      = new ObservableCollection <TblLkpSeason>();
            FabricList      = new ObservableCollection <FabricsDyedGroup>();
            VendorList      = new ObservableCollection <Vendor>();
            HeaderViewModel = new TblDyeingPlanHeaderViewModel();

            SelectedRow = new TblDyeingPlanViewModel();
            DyeingAxServiceSummaryList      = new ObservableCollection <DyeingAxService>();
            HeaderViewModel.FromDate        = null;
            HeaderViewModel.ToDate          = null;
            HeaderViewModel.TransactionDate = DateTime.Now;
            _webService.GetAllBrandsAsync(LoggedUserInfo.Iserial);
            _webService.SeasonsAsync();
            _webService.GetWarehouseswithOnHandAsync();
            _webService.GetAxSummaryServicesAsync();

            _webService.GetAxSummaryServicesCompleted += (d, s) =>
            {
                foreach (var item in s.Result)
                {
                    DyeingAxServiceSummaryList.Add(item);
                }
            };

            //_webService.GetSavedSummaryServicesCompleted += (d, e) =>
            //{
            //    DyeingSummaryServices = new ObservableCollection<DyeingSummaryServicesViewModel>();
            //    foreach (var item in DyeingAxServiceSummaryList)
            //    {
            //        DyeingSummaryServices.Add(new DyeingSummaryServicesViewModel
            //        {
            //            ServiceCode = item.ServiceCode,
            //            ServicEname = item.ServiceName
            //        });
            //    }

            //    foreach (var row in e.Result)
            //    {
            //        var serviceRow = DyeingSummaryServices.SingleOrDefault(x => x.ServiceCode == row.ServiceCode);
            //        if (serviceRow != null)
            //        {
            //            serviceRow.SummaryRowIserial = row.SummaryRowIserial;
            //            serviceRow.Notes = row.Notes;
            //            serviceRow.ItemChecked = true;
            //        }
            //    }
            //};

            _webService.GetEstimatedDyeingListAccCompleted += (s, sv) =>
            {
                HeaderViewModel.DyeingViewModelList = new ObservableCollection <TblDyeingPlanViewModel>();
                ColorHeader = new ObservableCollection <ColorHeader>();

                foreach (var item in sv.ColorsValues.Distinct())
                {
                    var test = new ColorHeader
                    {
                        ColorName = item.FabricColor
                    };

                    if (ColorHeader.All(x => x.ColorName != test.ColorName))
                    {
                        test.BatchNo = test.BatchNo;
                        ColorHeader.Add(test);
                    }
                }

                foreach (var item in sv.Result)
                {
                    HeaderViewModel.DyeingViewModelList.Add(DyeingPlanMapper.VmMapToDyeingPLanEstimated(item, sv.ColorsValues.Where(x => x.Fabric_Code == item.FabricCode && x.SalesOrderID == item.SalesOrderID).ToList(), 0, ColorHeader));
                }

                foreach (var variable in HeaderViewModel.DyeingViewModelList)
                {
                    variable.DyedFabric = variable.FabricCode + "Dy";
                }
            };
            _webService.GetVendorsCompleted += (d, s) =>
            {
                foreach (var item in s.Result)
                {
                    VendorList.Add(item);
                }
            };
            _webService.SeasonsCompleted += (d, s) =>
            {
                SeasonList = s.Result;
            };
            _webService.GetAllBrandsCompleted += (a, b) =>
            {
                foreach (var item in b.Result)
                {
                    BrandsList.Add(item);
                }
            };

            //_webService.GetFabricDyedListCompleted += (r, f) =>
            //{
            //    foreach (var item in f.Result)
            //    {
            //        FabricList.Add(item);
            //    }
            //};

            _webService.GetWarehouseswithOnHandCompleted += (l, c) =>
            {
                WarehouseWithOnHandList = c.Result;
            };

            _webService.GetDyeingSummaryAccCompleted += (l, s) =>
            {
                DyeingSummeryViewModelList.Clear();
                foreach (var item in s.Result)
                {
                    DyeingSummeryViewModelList.Add(DyeingPlanMapper.VmMapToDyeingSummary(new TblDyeingSummary().InjectFrom(item) as TblDyeingSummary));
                }
                SummaryPagedCollection = new PagedCollectionView(DyeingSummeryViewModelList);
                SummaryPagedCollection.GroupDescriptions.Add(new PropertyGroupDescription("FabricCode"));
            };
            HeaderViewModel.PropertyChanged += DyeingHeaderViewModel_PropertyChanged;

            _webService.GetDyeingListAccCompleted += webService_GetDyeingListCompleted;

            _webService.GetDyeingHeaderListAccCompleted += (h, ho) =>
            {
                HeaderViewModel.DyeingViewModelList = new ObservableCollection <TblDyeingPlanViewModel>();
                ColorHeader = new ObservableCollection <ColorHeader>();

                var childWindowSeach = new DyeingPlanSearchResults(this);
                foreach (var row in ho.Result)
                {
                    var newrow = new TblDyeingPlanHeaderViewModel();
                    newrow.InjectFrom(row);
                    newrow.BrandSectionPerRow = new LkpData.TblLkpBrandSection().InjectFrom(row.TblLkpBrandSection1) as LkpData.TblLkpBrandSection;
                    newrow.SeasonPerRow       = row.TblLkpSeason1;
                    DyeingPlanHeaderViewModelList.Add(newrow);
                }

                childWindowSeach.Show();

                DyeingSummeryViewModelList.Clear();
            };
        }
Пример #5
0
        internal void InitializeCompleted()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Types = new ObservableCollection <Transactions>();
                if (LoggedUserInfo.CurrLang == 0)
                {
                    Types.Add(new Transactions {
                        TransactionId = 0, TransactionName = "أمر الشراء"
                    });
                    Types.Add(new Transactions {
                        TransactionId = 1, TransactionName = "صباغة"
                    });
                    Types.Add(new Transactions {
                        TransactionId = 2, TransactionName = "Transfer"
                    });
                }
                else
                {
                    Types.Add(new Transactions {
                        TransactionId = 0, TransactionName = "Purshase Order"
                    });
                    Types.Add(new Transactions {
                        TransactionId = 1, TransactionName = "Dyeing"
                    });
                    Types.Add(new Transactions {
                        TransactionId = 2, TransactionName = "Transfer"
                    });
                }
                Client = new CRUD_ManagerServiceClient();
                GetItemPermissions(PermissionItemName.Reservation.ToString());
                ObservableCollection <GetItemOnhand_Result> OnHandList = new ObservableCollection <GetItemOnhand_Result>();
                Client.GetReservationMainDetailByFabricCompleted += (s, f) =>
                {
                    if (f.OnHandList != null)
                    {
                        OnHandList = f.OnHandList;
                    }
                    TransactionHeader = new TblReservationHeaderViewModel();
                    foreach (var variable in f.Result)
                    {
                        TransactionHeader.TransactionMainDetails.Add(ReservationMappers.MaptoViewModel(variable, f.mainFabricList, OnHandList));
                    }
                    Loading = false;
                };
                Client.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);
                        }
                    }
                };
                Client.GetAllSeasonsAsync();
                Client.GetAllBrandsCompleted += (s, sv) =>
                {
                    BrandsList.Clear();
                    foreach (var variable in sv.Result.OrderBy(x => x.Brand_Code))
                    {
                        BrandsList.Add(variable);
                    }
                };
                Client.GetAllBrandsAsync(0);
                TransactionGuid   = Guid.NewGuid().ToString();
                TransactionHeader = new TblReservationHeaderViewModel {
                    DocDate = DateTime.Now.Date
                };
                SelectedMainDetails = new TblReservationMainDetailsViewModel();

                Client.GetReservationHeaderListCompleted += (d, i) =>
                {
                    foreach (var item in i.Result)
                    {
                        TransactionHeaderList.Add(ReservationMappers.MaptoViewModel(item));
                    }
                };

                lkpClient.GetTblBrandSectionLinkCompleted += (x, sv) =>
                {
                    BrandSectionList.Clear();
                    foreach (var row in sv.Result)
                    {
                        BrandSectionList.Add(row.TblLkpBrandSection1);
                    }
                };
                SalesorderList = new ObservableCollection <CRUD_ManagerServiceSalesOrderDto>();

                SalesorderList.CollectionChanged += SalesorderList_CollectionChanged;

                Client.GetPurchaseOrderSalesOrdersCompleted += (d, s) =>
                {
                    foreach (var variable in s.Result)
                    {
                        if (!SalesorderList.Any(
                                x =>
                                x.SalesOrder.Contains(variable.SalesOrder) &&
                                x.SalesOrderColor.Contains(variable.SalesOrderColor)) && !SelectedMainDetails.ReservationDetailsViewModelList.Any(x => x.SalesOrder.Contains(variable.SalesOrder) &&
                                                                                                                                                  x.SalesOrderColor.Contains(variable.SalesOrderColor)))
                        {
                            SalesorderList.Add(variable);
                        }
                    }
                };

                Client.GetPurchaseOrderLinesCompleted += (s, f) =>
                {
                    foreach (var item in f.Result.Where(item => !OrderLineList.Contains(FabricInspectionMapper.MapToOrderLine(item))))
                    {
                        OrderLineList.Add(FabricInspectionMapper.MapToOrderLine(item));
                    }
                    Loading = false;
                };


                Client.GetRecivedDyedOrdersCompleted += (s, f) =>
                {
                    foreach (var item in f.Result.Where(item => !OrderLineList.Contains(FabricInspectionMapper.MapToOrderLine(item))))
                    {
                        OrderLineList.Add(FabricInspectionMapper.MapToOrderLine(item));
                    }
                };
                Client.GetTransferInventDimLinesCompleted += (s, f) =>
                {
                    foreach (var item in f.Result.Where(item => !OrderLineList.Contains(FabricInspectionMapper.MapToOrderLine(item))))
                    {
                        OrderLineList.Add(FabricInspectionMapper.MapToOrderLine(item));
                    }
                };
                Client.GetReservationMainDetailsCompleted += (s, f) =>
                {
                    foreach (var variable in f.Result)
                    {
                        if (variable.Inspected)
                        {
                            Client.GetResInspectionListAsync(variable.LineNum, TransactionHeader.TransOrder);
                        }
                        //f.mainFabricList;
                        TransactionHeader.TransactionMainDetails.Add(ReservationMappers.MaptoViewModel(variable, f.mainFabricList));
                    }
                };

                Client.SaveReservationCompleted += (a, f) =>
                {
                    if (f.ErrorExists)
                    {
                        var visList = TransactionHeader.TransactionMainDetails.Where(x => f.Result.All(s => s.Fabric == x.Fabric && s.FabricColor == x.FabricColor));

                        foreach (var item in TransactionHeader.TransactionMainDetails)
                        {
                            item.ErrorVisbility = visList.Contains(item) ? Visibility.Visible : Visibility.Collapsed;
                        }
                    }
                    else
                    {
                        var tblFabricInspectionDetail = f.Result.FirstOrDefault();
                        if (tblFabricInspectionDetail != null)
                        {
                            TransactionHeader.Iserial = tblFabricInspectionDetail.Tbl_ReservationHeader;
                        }
                        TransactionHeader.TransactionMainDetails.Clear();
                        foreach (var item in f.Result)
                        {
                            TransactionHeader.TransactionMainDetails.Add((TblReservationMainDetailsViewModel) new TblReservationMainDetailsViewModel().InjectFrom(item));
                        }
                        var currentUi = Thread.CurrentThread.CurrentUICulture;
                        if (currentUi.DisplayName == "العربية")
                        {
                            MessageBox.Show("Saved");
                        }
                        else
                        {
                            MessageBox.Show("Saved");
                        }
                    }
                };


                Client.GenerateReservationFromPlanCompleted += (s, sv) => Client.GetReservationMainDetailsAsync(TransactionHeader.Iserial);
                Client.GetSalesOrderReservationCompleted    += (s, sv) =>
                {
                    GenericMapper.InjectFromObCollection(SelectedMainDetails.ReservationDetailsViewModelList, sv.Result);
                    foreach (var item in (SelectedMainDetails.ReservationDetailsViewModelList))
                    {
                        item.Tbl_ReservationMainDetails = SelectedMainDetails.Iserial;
                    }
                };
                Client.ReservationLineNumCompleted += (s, p) =>
                {
                    var lines = new ObservableCollection <decimal>(p.Result);

                    if (TransactionHeader.TransactionMainDetails.Count() != 0)
                    {
                        foreach (var variable in TransactionHeader.TransactionMainDetails.Select(x => x.LineNum))
                        {
                            lines.Add(variable);
                        }
                    }
                    if (SortBy == null)
                    {
                        SortBy = "it.PURCHQTY";
                    }
                    if (TransactionHeader.TransactionType == 0)
                    {
                        Client.GetPurchaseOrderLinesAsync(OrderLineList.Count, PageSize, "ccm", TransactionHeader.TransOrder, lines, "it.PURCHQTY desc", Filter, ValuesObjects);
                    }
                    if (TransactionHeader.TransactionType == 1)
                    {
                        Client.GetRecivedDyedOrdersAsync(OrderLineList.Count, PageSize, TransactionHeader.TransOrder, lines, "it.PURCHQTY desc", Filter, ValuesObjects);
                    }
                    else if (TransactionHeader.TransactionType == 2)
                    {
                        Client.GetTransferInventDimLinesAsync(OrderLineList.Count, PageSize, "ccm", TransactionHeader.TransOrder, lines, "it.PURCHQTY desc", Filter, ValuesObjects);
                    }
                };
            }
        }
Пример #6
0
        public BrandSectionPermissionViewModel()
        {
            if (DesignerProperties.IsInDesignTool)
            {
                return;
            }
            Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

            Client.GetAllBrandsCompleted += (d, s) =>
            {
                BrandList = s.Result;
            };

            lkpClient.GetTblBrandSectionLinkCompleted += (s, sv) =>
            {
                BrandSectionList.Clear();
                foreach (var row in sv.Result)
                {
                    BrandSectionList.Add(row.TblLkpBrandSection1);
                }
            };

            Client.GetUserSpectialPermissionsAsync();
            Client.GetUserSpectialPermissionsCompleted += (s, sv) =>
            {
                foreach (var row in sv.Result)
                {
                    PermissionList.Add(new TblBrandSectionPermissionViewModel
                    {
                        TblAuthPermission = row.Iserial,
                        Ename             = row.Ename,
                    });
                }
            };

            Client.GetTblBrandSectionPermissionCompleted += (s, sv) =>
            {
                foreach (var oldrow in PermissionList)
                {
                    oldrow.Iserial   = 0;
                    oldrow.Financial = oldrow.Retail = oldrow.Technical = false;
                }

                foreach (var row in sv.Result)
                {
                    var permissionRow = PermissionList.SingleOrDefault(x => x.TblAuthPermission == row.TblAuthPermission && row.BrandCode == SelectedBrand.Brand_Code && row.TblLkpBrandSection == SelectedBrandSection.Iserial
                                                                       );
                    if (permissionRow != null)
                    {
                        permissionRow.InjectFrom(row);
                    }
                }
            };

            Client.UpdateOrInsertTblBrandSectionPermissionCompleted += (s, x) =>
            {
                var savedRow = (TblBrandSectionPermissionViewModel)PermissionList.GetItemAt(x.outindex);

                if (savedRow != null)
                {
                    savedRow.InjectFrom(x.Result);
                }
            };

            Client.DeleteTblBrandSectionPermissionCompleted += (s, ev) =>
            {
                var oldrow = PermissionList.FirstOrDefault(x => x.Iserial == ev.Result);
                if (oldrow != null)
                {
                    oldrow.Iserial   = 0;
                    oldrow.Financial = oldrow.Retail = oldrow.Technical = false;
                }
            };
        }
Пример #7
0
        public UserBrandViewModel()
        {
            if (DesignerProperties.IsInDesignTool)
            {
                return;
            }
            Client.GetAllBrandsAsync(0);

            Client.GetAllBrandsCompleted += (d, s) =>
            {
                BrandList = s.Result;
            };
            Client.GetAllUsersAsync(0, int.MaxValue, "it.Ename", null, null);
            Client.GetAllUsersCompleted += (d, s) =>
            {
                UsersList    = s.Result;
                SelectedUser = s.Result.FirstOrDefault();
            };

            //Client.GetGenericCompleted += (s, sv) =>
            //{
            //    foreach (var row in sv.Result)
            //    {
            //        var newrow = new TblUserBrandSectionViewModel
            //        {
            //            Aname = row.Aname,
            //            Ename = row.Ename,
            //            Iserial = row.Iserial,
            //            Code = row.Code,
            //            TblLkpBrandSection = row.Iserial,
            //            BrandCode = SelectedBrand.Brand_Code,
            //            TblAuthUser = SelectedUser.Iserial,
            //        };
            //        BrandSectionList.Add(newrow);
            //    }
            //};

            lkpClient.GetTblAllBrandSectionLinkCompleted += (s, sv) =>
            {
                BrandSectionList = new ObservableCollection <TblUserBrandSectionViewModel>();
                foreach (var row in sv.Result)
                {
                    var newrow = new TblUserBrandSectionViewModel
                    {
                        Aname = row.TblLkpBrandSection1.Aname,
                        Ename = row.TblLkpBrandSection1.Ename,
                        TblLkpBrandSection = row.TblLkpBrandSection,
                        Code        = row.TblLkpBrandSection1.Code,
                        BrandCode   = row.TblBrand,
                        TblAuthUser = SelectedUser.Iserial,
                        TblBrandSectionPermissions = row.TblLkpBrandSection1.TblBrandSectionPermissions
                    };
                    BrandSectionList.Add(newrow);
                }
                GetBrandSectionPerUser();
            };

            Client.GetUserSpectialPermissionsAsync();
            Client.GetUserSpectialPermissionsCompleted += (s, sv) =>
            {
                foreach (var row in sv.Result)
                {
                    PermissionList.Add(new TblUserBrandSectionPermissionViewModel
                    {
                        TblAuthPermission = row.Iserial,
                        Ename             = row.Ename,
                    });
                }
            };

            Client.GetTblUserBrandSectionPermissionCompleted += (s, sv) =>
            {
                foreach (var row in PermissionList)
                {
                    row.UpdatedAllowed = false;
                    row.Retail         = row.Technical = row.Financial = row.RetailEnabled = row.TechnicalEnabled = row.FinancialEnabled = row.Checked = false;
                    var brandSectionPermissions =
                        SelectedUserBrandSection.TblBrandSectionPermissions.SingleOrDefault(
                            x => x.TblAuthPermission == row.TblAuthPermission && x.BrandCode == SelectedBrand.Brand_Code);

                    var permissionRow = PermissionList.SingleOrDefault(x => x.TblAuthPermission == row.TblAuthPermission

                                                                       );
                    if (permissionRow != null)
                    {
                        if (brandSectionPermissions != null)
                        {
                            permissionRow.FinancialEnabled = brandSectionPermissions.Financial;
                            permissionRow.TechnicalEnabled = brandSectionPermissions.Technical;
                            permissionRow.RetailEnabled    = brandSectionPermissions.Retail;
                        }
                    }
                }
                foreach (var row in sv.Result)
                {
                    if (SelectedUserBrandSection != null)
                    {
                        var permissionRow = PermissionList.SingleOrDefault(x => x.TblAuthPermission == row.TblAuthPermission && SelectedUserBrandSection.Iserial == row.TblUserBrandSection
                                                                           );
                        if (permissionRow != null)
                        {
                            permissionRow.Checked             = true;
                            permissionRow.TblUserBrandSection = row.Iserial;
                            permissionRow.Retail    = row.Retail;
                            permissionRow.Technical = row.Technical;
                            permissionRow.Financial = row.Financial;
                        }
                    }
                }
            };

            Client.GetTblUserBrandSectionCompleted += (s, sv) =>
            {
                foreach (var row in BrandSectionList)
                {
                    row.UpdatedAllowed = false;
                    row.Checked        = false;
                }
                foreach (var row in sv.Result)
                {
                    var brandSectionRow = BrandSectionList.SingleOrDefault(x => x.TblLkpBrandSection == row.TblLkpBrandSection && x.TblAuthUser == row.TblAuthUser
                                                                           );
                    if (brandSectionRow != null)
                    {
                        brandSectionRow.Iserial = row.Iserial;
                        brandSectionRow.Checked = true;
                    }
                }
            };
        }
Пример #8
0
        public BrandSectionMailViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

                Client.GetAllBrandsCompleted += (d, s) =>
                {
                    BrandList = s.Result;
                };

                lkpClient.GetTblBrandSectionLinkCompleted += (s, sv) =>
                {
                    BrandSectionList.Clear();
                    foreach (var row in sv.Result)
                    {
                        BrandSectionList.Add(row.TblLkpBrandSection1);
                    }
                };
                MainRowList     = new SortableCollectionView <TblBrandSectionMailViewModel>();
                SelectedMainRow = new TblBrandSectionMailViewModel();

                Client.GetTblBrandSectionMailCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblBrandSectionMailViewModel();
                        newrow.InjectFrom(row);

                        var newEmp = sv.EmpList.FirstOrDefault(x => x.EMPLID == newrow.Emp);

                        if (newEmp != null)
                        {
                            newrow.EmpPerRow = new EmployeesView
                            {
                                Emplid = newEmp.EMPLID,
                                Name   = newEmp.name
                            }
                        }
                        ;

                        MainRowList.Add(newrow);
                    }
                    Loading = false;

                    if (MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

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

                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                };
                Client.DeleteTblBrandSectionMailCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        throw ev.Error;
                    }
                    var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result.Iserial);
                    if (oldrow != null)
                    {
                        MainRowList.Remove(oldrow);
                    }
                };

                GetMaindata();
            }
        }
Пример #9
0
        public SalesOrderColorThemeViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                GetItemPermissions(PermissionItemName.ColorThemesForm.ToString());

                lkpClient.GetTblBrandSectionLinkCompleted += (s, sv) =>
                {
                    BrandSectionList.Clear();
                    foreach (var row in sv.Result)
                    {
                        BrandSectionList.Add(new GenericTable().InjectFrom(row.TblLkpBrandSection1) as GenericTable);
                    }
                };
                var seasonClient = new CRUD_ManagerServiceClient();
                seasonClient.GetGenericCompleted += (s, sv) =>
                {
                    SeasonList = sv.Result;
                };
                seasonClient.GetGenericAsync("TblLkpSeason", "%%", "%%", "%%", "Iserial", "ASC");

                MainRowList = new SortableCollectionView <TblSalesOrderColorThemeViewModel>();
                MainRowList.CollectionChanged += MainRowList_CollectionChanged;
                SelectedMainRow = new TblSalesOrderColorThemeViewModel();


                Client.GetAllBrandsCompleted += (s, sv) =>
                {
                    BrandList = sv.Result;
                };
                Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

                Client.GetTblSalesOrderColorThemeCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblSalesOrderColorThemeViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null || SelectedMainRow.Iserial == 0))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }

                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }

                    if (Export)
                    {
                        Export = false;
                        ExportGrid.ExportExcel("Style");
                    }
                };

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

                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                };

                Client.DeleteTblSalesOrderColorThemeCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        throw ev.Error;
                    }

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

                //   Client.GetSeasonalMasterListNotLinkedToSalesorder
            }
        }
Пример #10
0
        public ColorLinkViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                Client.GetAllBrandsCompleted += (s, sv) =>
                {
                    BrandsList = sv.Result;
                };
                Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

                var seasonClient = new CRUD_ManagerServiceClient();
                seasonClient.GetGenericCompleted += (s, sv) =>
                {
                    SeasonList = sv.Result;
                };
                seasonClient.GetGenericAsync("TblLkpSeason", "%%", "%%", "%%", "Iserial", "ASC");

                Client.GetTblColorCompleted += (s, sv) =>
                {
                    // ColorsList.Clear();
                    //  GenericMapper.InjectFromObCollection(ColorsList, sv.Result);

                    foreach (var row in sv.Result)
                    {
                        ColorsList.Add(new TblColor().InjectFrom(row) as TblColor);
                    }

                    Loading         = false;
                    DetailFullCount = sv.fullCount;
                };
                Client.GetTblColorLinkCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        //if (!MainRowList.Contains(row.TblColor1))
                        //{
                        TblColor col = new TblColor();
                        col.Iserial    = row.TblColor1.Iserial;
                        col.Code       = row.TblColor1.Code;
                        col.Ename      = row.TblColor1.Ename;
                        col.Aname      = row.TblColor1.Aname;
                        col.PantonCode = row.PantonCode;

                        MainRowList.Add(col);
                        // }
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                };

                lkpClient.GetTblBrandSectionLinkCompleted += (s, sv) =>
                {
                    if (Copy)
                    {
                        BrandSectionListCopy.Clear();
                        foreach (var row in sv.Result)
                        {
                            BrandSectionListCopy.Add(row.TblLkpBrandSection1);
                        }
                        Copy = false;
                    }
                    else
                    {
                        BrandSectionList.Clear();
                        foreach (var row in sv.Result)
                        {
                            BrandSectionList.Add(row.TblLkpBrandSection1);
                        }
                    }
                    Loading = false;
                };

                Client.UpdateOrDeleteTblColorLinkCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                    }
                    else
                    {
                        MainRowList.Clear();
                        GetMaindata();
                    }
                    Loading = false;
                };

                Client.CopyColorLinkCompleted += (s, sv) =>
                {
                    Loading = false;
                };
            }
        }
Пример #11
0
        public StandardBomViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                GetItemPermissions(PermissionItemName.StandardBomForm.ToString());
                GetSeason();
                var calculationClient = new CRUD_ManagerServiceClient();
                calculationClient.GetGenericCompleted += (s, sv) =>
                {
                    BomCalcMethodList = sv.Result;
                };
                calculationClient.GetGenericAsync("BOM_CalcMethod", "%%", "%%", "%%", "Iserial", "ASC");
                //Client.GetTblPaymentScheduleCompleted += (s, sv) =>
                //{
                //    PaymentScheduleList = sv.Result;
                //};
                //Client.GetTblPaymentScheduleAsync(0, int.MaxValue, "it.Iserial", null, null);
                var uomClient = new CRUD_ManagerServiceClient();
                uomClient.GetGenericCompleted += (s, sv) =>
                {
                    UomList = sv.Result;
                };
                uomClient.GetGenericAsync("tbl_lkp_UoM", "%%", "%%", "%%", "Iserial", "ASC");

                MainRowList     = new SortableCollectionView <TblStandardBomHeaderViewModel>();
                SelectedMainRow = new TblStandardBomHeaderViewModel();
                //
                MainRowList.CollectionChanged += MainRowList_CollectionChanged;

                var factorGroupClient = new CRUD_ManagerServiceClient();
                factorGroupClient.GetGenericCompleted += (s, sv) =>
                {
                    FactoryGroupList = sv.Result;
                };
                factorGroupClient.GetGenericAsync("TblFactoryGroup", "%%", "%%", "%%", "Iserial", "ASC");

                var complixtyGroupClient = new CRUD_ManagerServiceClient();
                complixtyGroupClient.GetGenericCompleted += (s, sv) =>
                {
                    //complix GroupList = sv.Result;
                };
                factorGroupClient.GetGenericAsync("TblFactoryGroup", "%%", "%%", "%%", "Iserial", "ASC");

                Client.GetAllBrandsCompleted += (s, sv) =>
                {
                    BrandList = sv.Result;
                };
                Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

                Client.GetTblStandardBOMHeaderCompleted += (s, sv) =>
                {
                    Loading = false;
                    if (sv.Result != null)
                    {
                        foreach (var row in sv.Result)
                        {
                            var newrow = new TblStandardBomHeaderViewModel();

                            newrow.InjectFrom(row);
                            if (!MainRowList.Contains(newrow))
                            {
                                newrow.SeasonPerRow          = new TblLkpSeason();
                                newrow.FactoryGroupPerRow    = new GenericTable();
                                newrow.ComplexityGroupPerRow = new GenericTable();
                                if (BrandSectionList.All(x => x.Iserial != row.TblLkpBrandSection1.Iserial))
                                {
                                    BrandSectionList.Add(new LkpData.TblLkpBrandSection().InjectFrom(row.TblLkpBrandSection1) as LkpData.TblLkpBrandSection);
                                }
                                if (SeasonList.All(x => x.Iserial != row.TblLkpSeason))
                                {
                                    SeasonList.Add(new TblLkpSeason().InjectFrom(row.TblLkpSeason1) as TblLkpSeason);
                                }
                                newrow.FactoryGroupPerRow = new GenericTable().InjectFrom(row.TblFactoryGroup1) as GenericTable;
                                if (row.TblComplexityGroup1 != null)
                                {
                                    newrow.ComplexityGroupPerRow = new GenericTable().InjectFrom(row.TblComplexityGroup1) as GenericTable;
                                }
                                newrow.SectionPerRow = row.TblLkpBrandSection1;

                                newrow.SeasonPerRow = SeasonList.FirstOrDefault(x => x.Iserial == newrow.TblLkpSeason);

                                MainRowList.Add(newrow);
                            }
                        }
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (MainRowList.Any() && (SelectedMainRow == null || SelectedMainRow.Iserial == 0))
                    {
                        SelectedMainRow = MainRowList.FirstOrDefault();
                    }

                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }

                    if (Export)
                    {
                        Export = false;

                        var handler = ExportCompleted;
                        if (handler != null)
                        {
                            handler(this, EventArgs.Empty);
                        }
                        //ExportGrid.ExportExcel("Style");
                    }
                };
                GetMaindata();
                Client.UpdateOrInsertTblStandardBOMHeaderCompleted += (s, sv) =>
                {
                    var savedRow = MainRowList.ElementAt(sv.outindex);

                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(sv.Result);
                    }

                    Loading = false;
                };

                Client.DeleteTblStandardBOMHeaderCompleted += (s, ev) =>
                {
                    var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result.Iserial);
                    if (oldrow != null)
                    {
                        MainRowList.Remove(oldrow);
                    }
                    Loading = false;
                    if (!MainRowList.Any())
                    {
                        AddNewMainRow(false);
                    }
                };

                Client.DeleteTblStandardBOMCompleted += (s, sv) =>
                {
                    Loading = false;
                    if (sv.Error != null)
                    {
                        throw sv.Error;
                    }

                    var oldrow = SelectedMainRow.BomList.FirstOrDefault(x => x.Iserial == sv.Result);
                    if (oldrow != null)
                    {
                        SelectedMainRow.BomList.Remove(oldrow);
                    }
                };

                Client.GetTblStandardBOMCompleted += (s, sv) =>
                {
                    SelectedMainRow.BomList.Clear();
                    foreach (var row in sv.Result)
                    {
                        var newrow = new BomViewModel
                        {
                            BOM_CalcMethodPerRow = new GenericTable().InjectFrom(row.BOM_CalcMethod) as GenericTable,
                            BOM_FabricTypePerRow = new GenericTable().InjectFrom(row.BOM_FabricType) as GenericTable
                        };

                        newrow.ColorPerRow = new TblColor();
                        newrow.ColorPerRow = row.TblColor1;

                        newrow.InjectFrom(row);
                        newrow.ItemPerRow = sv.itemsList.SingleOrDefault(x => x.Iserial == row.BOM_Fabric);

                        SelectedMainRow.BomList.Add(newrow);
                    }
                    if (SelectedMainRow.BomList.Count == 0)
                    {
                        AddBom(false);
                    }
                };

                Client.UpdateOrInsertTblStandardBOMCompleted += (s, sv) =>
                {
                    Loading = false;
                    if (sv.Error != null)
                    {
                        MessageBox.Show(sv.Error.Message);
                        return;
                    }

                    GetSalesOrderBom();
                };
            }
        }