示例#1
0
        public MatchesBase(IInternalService internalService, IWebsiteService website, IMatchesTabService matchesTab, GameMode matchGameMode, MatchesTab currentTab)
            : base(internalService)
        {
            Website           = website;
            MatchesTabService = matchesTab;
            MatchGameMode     = matchGameMode;
            CurrentTab        = currentTab;

            ShowMatchSummaryButtonEnabled = true;

            SeasonList.Add("Lifetime");
            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeasonOption = SeasonList[0];

            GameTimeList           = HeroesHelpers.GameDates.GameTimeList;
            SelectedGameTimeOption = GameTimeList[0];

            GameDateList           = HeroesHelpers.GameDates.GameDateList;
            SelectedGameDateOption = GameDateList[0];

            MapsList.Add("Any");
            MapsList.AddRange(HeroesIcons.MapBackgrounds().GetMapsList());
            SelectedMapOption = MapsList[0];

            ReplayBuildsList.Add("Any");
            ReplayBuildsList.AddRange(HeroesHelpers.Builds.GetBuildsList(HeroesIcons));
            SelectedBuildOption = ReplayBuildsList[0];

            HeroesList.Add("Any");
            HeroesList.AddRange(HeroesIcons.Heroes().GetListOfHeroes(HeroesIcons.GetLatestHeroesBuild()));
            SelectedCharacter = HeroesList[0];

            Messenger.Default.Register <MatchesDataMessage>(this, (message) => ReceivedMatchSearchData(message));
            Messenger.Default.Register <NotificationMessage>(this, async(message) => await ReceivedMessageAsync(message));
        }
示例#2
0
        void Load(MiniNetwork n)
        {
            foreach (ToolbarItem t in new Toolbar(this, ref Predictions).ToolBarItems)
            {
                ToolbarItems.Add(t);
            }

            FilteredYearList = NetworkDatabase.YearList.Where(x => NetworkDatabase.NetworkList.AsParallel().SelectMany(y => y.shows).Where(y => y.year == x).Where(y => y.FinalPrediction > 0 && (y.Renewed || y.Canceled)).Count() > 0).ToList();
            foreach (Year y in FilteredYearList)
            {
                SeasonList.Add(y);
            }

            network = n;

            InitializeComponent();

            BindingContext = this;

            YearList      = FindTemplateElementByName <Picker>(this, "YearList");
            Activity      = FindTemplateElementByName <ActivityIndicator>(this, "Activity");
            SearchResults = FindTemplateElementByName <ResultsList>(this, "SearchResults");
            SearchResults.NavigationParent = this;

            YearList.BindingContext = this;
            //YearList.ItemsSource = FilteredYearList;
            YearList.IsVisible = true;
            //YearList.Position = FilteredYearList.Count - 1;

            //YearList.PositionSelected += YearList_PositionSelected;
            //YearList.PositionChanged += YearList_PositionChanged;
            NetworkDatabase.CurrentYearUpdated += NetworkDatabase_CurrentYearUpdated;


            NetworkDatabase_CurrentYearUpdated(this, new EventArgs());
            //NetworkDatabase.CurrentYear = NetworkDatabase.YearList.IndexOf(SeasonList[SeasonList.Count-1]);

            Activity.IsRunning = false;
            Activity.IsVisible = false;

            SideColumn.SizeChanged += SideColumn_SizeChanged;
            SidePanel.PanelOpened  += SidePanel_PanelOpened;

            var tapped = new TapGestureRecognizer();

            tapped.Tapped += Network_Tapped;
            NetworkLayout.GestureRecognizers.Add(tapped);

            tapped         = new TapGestureRecognizer();
            tapped.Tapped += Year_Tapped;
            YearLayout.GestureRecognizers.Add(tapped);

            tapped         = new TapGestureRecognizer();
            tapped.Tapped += Model_Tapped;
            ModelLayout.GestureRecognizers.Add(tapped);

            Appearing    += ScoreBoard_Appearing;
            Disappearing += ScoreBoard_Disappearing;
        }
示例#3
0
        public async void CompletedSettings()
        {
            PredictionWeek.Text = CurrentWeek();

            YearList      = FindTemplateElementByName <Picker>(this, "YearList");
            Activity      = FindTemplateElementByName <ActivityIndicator>(this, "Activity");
            SearchResults = FindTemplateElementByName <ResultsList>(this, "SearchResults");
            SearchResults.NavigationParent = this;

            SeasonList.Clear();
            Highlights.Clear();
            foreach (Year y in NetworkDatabase.YearList)
            {
                SeasonList.Add(y);
            }


            YearList.BindingContext = this;
            if (YearList.SelectedIndex == -1)
            {
                YearList.BindingContext = null;
                YearList.BindingContext = this;
            }

            YearList.IsVisible = true;
            //YearList.SelectedIndexChanged += YearList_SelectedIndexChanged;
            NetworkDatabase.CurrentYearUpdated += NetworkDatabase_CurrentYearUpdated;



            PredictionYear.Text = NetworkDatabase.YearList[NetworkDatabase.YearList.Count - 1].Season + " Predictions";

            CurrentStatus.IsVisible = false;

            LoadHighlights();

            Activity.IsRunning = false;
            Activity.IsVisible = false;
            UseMenu.IsVisible  = true;

            CurrentStatus.FormattedText = await FetchLabels();

            //if (Highlights.Count > 0)
            //{
            //    HighlightsTitle.IsVisible = true;
            //    ViewPost.IsVisible = true;
            //    TMDBNotice.IsVisible = true;
            //}
            //else
            //    CurrentStatus.IsVisible = true;

            Completed = true;
        }
        public StatsOverviewViewModel(IInternalService internalService, ILoadingOverlayWindowService loadingOverlayWindow)
            : base(internalService)
        {
            LoadingOverlayWindow = loadingOverlayWindow;

            SeasonList.Add(InitialSeasonListOption);
            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeason = SeasonList[0];

            HeroStatsList.AddRange(HeroesHelpers.OverviewHeroStatOptions.GetOverviewHeroStatOptionList());
            SelectedHeroStat = HeroStatsList[0];

            IsHeroStatPercentageDataGridVisible = true;
            IsHeroStatDataGridVisible           = false;
        }
        public StatsAllHeroesViewModel(IInternalService internalService, ILoadingOverlayWindowService loadingOverlayWindow)
            : base(internalService)
        {
            LoadingOverlayWindow = loadingOverlayWindow;

            IsQuickMatchSelected    = false;
            IsUnrankedDraftSelected = false;
            IsHeroLeagueSelected    = false;
            IsTeamLeagueSelected    = false;
            IsCustomGameSelected    = false;
            IsBrawlSelected         = false;

            SeasonList.Add(InitialSeasonListOption);
            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeason = SeasonList[0];
        }
示例#6
0
        public StatsPartiesViewModel(IInternalService internalService, ILoadingOverlayWindowService loadingOverlayWindow)
            : base(internalService)
        {
            LoadingOverlayWindow = loadingOverlayWindow;

            SeasonList.Add(InitialSeasonListOption);
            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeason = SeasonList[0];

            HeroesList.Add(InitialHeroListOption);
            HeroesList.AddRange(HeroesIcons.HeroesData().HeroNames().OrderBy(x => x).ToList());

            SelectedCharacter = Enumerable.Repeat(InitialHeroListOption, SelectedCharacter.Length).ToArray();

            ClearOptions();
        }
示例#7
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();
        }
示例#8
0
        public StatsHeroesViewModel(IInternalService internalService, ILoadingOverlayWindowService loadingOverlayWindow)
            : base(internalService)
        {
            LoadingOverlayWindow = loadingOverlayWindow;

            IsTotalsAveragesChecked = true;
            IsTalentsChecked        = true;
            IsAwardsChecked         = true;

            SeasonList.Add(InitialSeasonListOption);
            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeason = SeasonList[0];

            HeroesList.Add(InitialHeroListOption);
            HeroesList.AddRange(HeroesIcons.HeroesData().HeroNames().OrderBy(x => x).ToList());
            SelectedHero = HeroesList[0];

            GameModeList.AddRange(HeroesHelpers.GameModes.GetAllGameModesList());
            MapList.AddRange(HeroesIcons.Battlegrounds().Battlegrounds(true).Select(x => x.Name).ToList());

            StatsHeroesDataViewModel = new StatsHeroesDataViewModel(internalService, MapList);
        }
        public StatsHeroesViewModel(IInternalService internalService, ILoadingOverlayWindowService loadingOverlayWindow)
            : base(internalService)
        {
            LoadingOverlayWindow = loadingOverlayWindow;

            IsTotalsAveragesChecked = true;
            IsTalentsChecked        = true;
            IsAwardsChecked         = true;

            SeasonList.Add(InitialSeasonListOption);
            SeasonList.Add("Lifetime");
            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeason = SeasonList[0];

            HeroesList.Add(InitialHeroListOption);
            HeroesList.AddRange(HeroesIcons.Heroes().GetListOfHeroes(HeroesIcons.GetLatestHeroesBuild()));
            SelectedHero = HeroesList[0];

            GameModeList.AddRange(HeroesHelpers.GameModes.GetAllGameModeList());
            MapList.AddRange(HeroesIcons.MapBackgrounds().GetMapsList());

            StatsHeroesDataViewModel = new StatsHeroesDataViewModel(internalService, MapList);
        }
示例#10
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);
                    }
                };
            }
        }
示例#11
0
        public PurchaseBudgetViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                MainRowList       = new SortableCollectionView <TblPurchaseBudgetHeaderViewModel>();
                SelectedMainRow   = new TblPurchaseBudgetHeaderViewModel();
                SelectedDetailRow = new TblPurchaseBudgetDetailViewModel();

                Client.GetTblPurchaseBudgetHeaderCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblPurchaseBudgetHeaderViewModel();
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };
                Client.GetTblPurchaseBudgetDetailCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblPurchaseBudgetDetailViewModel();
                        newrow.InjectFrom(row);
                        newrow.SectionPerRow = row.TblLkpBrandSection1;
                        newrow.SeasonPerRow  = row.TblLkpSeason1;

                        SelectedMainRow.DetailsList.Add(newrow);
                    }
                    if (sv.Result.Count == 0)
                    {
                        AddNewDetailRow(false);
                    }
                    Loading = false;
                };
                Client.UpdateOrInsertTblPurchaseBudgetHeaderCompleted += (s, x) =>
                {
                    var savedRow = MainRowList.ElementAt(x.outindex);

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

                Client.UpdateOrInsertTblPurchaseBudgetDetailCompleted += (s, x) =>
                {
                    var savedRow = (TblPurchaseBudgetDetailViewModel)SelectedMainRow.DetailsList.GetItemAt(x.outindex);
                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                };


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

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

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

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


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

                Client.GetAllSeasonsCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result.Where(w => w.IsMaster == true))
                    {
                        if (SeasonList.All(x => x.Iserial != row.Iserial))
                        {
                            SeasonList.Add(new TblLkpSeason().InjectFrom(row) as TblLkpSeason);
                        }
                    }
                };
                Client.GetAllSeasonsAsync();
                Client.GetAllBrandsAsync(LoggedUserInfo.Iserial);

                GetMaindata();
            }
        }
示例#12
0
        public TradeAgreementViewModel() : base(PermissionItemName.TradeAgreementFabricView)
        {
            // ده هيحتاج تعديل
            productionServiceClient.GetTblTradeAgreementDetailListFabricViewCompleted += (s, sv) =>
            {
                foreach (var row in sv.Result)
                {
                    var newrow = new TradeAgreementDetailModel();
                    newrow.TradeAgreementTransactionIserial = SelectedMainRow.Iserial;
                    newrow.HeaderIserial = row.TblTradeAgreementHeader;
                    newrow.ColorPerRow   = new CRUDManagerService.TblColor();
                    if (row.TblColor1 != null)
                    {
                        newrow.ColorPerRow.InjectFrom(row.TblColor1);
                    }
                    newrow.ItemPerRow = new CRUDManagerService.ItemsDto();
                    newrow.ItemPerRow.InjectFrom(sv.itemsList.SingleOrDefault(x => x.Iserial == row.ItemCode && x.ItemGroup == row.ItemType));
                    newrow.ItemType     = row.ItemType;
                    newrow.VendorPerRow = new CRUDManagerService.Vendor {
                        vendor_code = row.TblTradeAgreementHeader1.Vendor
                    };
                    newrow.VendorPurchaseGroupPerRow = new CRUDManagerService.GenericTable();
                    newrow.VendorPerRow.InjectFrom(sv.VendorList.FirstOrDefault(x => x.vendor_code == row.TblTradeAgreementHeader1.Vendor));
                    if (row.TblVendorPurchaseGroup1 != null)
                    {
                        newrow.VendorPurchaseGroupPerRow.InjectFrom(row.TblVendorPurchaseGroup1);
                    }
                    newrow.TradeAgreementTransactionIserial = row.TblTradeAgreementHeader1.TblTradeAgreementTransaction.Value;
                    newrow.HeaderIserial = row.TblTradeAgreementHeader;
                    newrow.InjectFrom(row);
                    SelectedMainRow.DetailsList.Insert(0, newrow);
                }

                Loading = false;

                if (DetailFullCount == 0 && SelectedMainRow.DetailsList.Count == 0)
                {
                    AddNewDetailRow(false);
                }
                if (Export)
                {
                    Export = false;
                    ExportGrid.ExportExcel("TradeAgreement");
                }
            }
            ;
            calculationClient.GetGenericCompleted += (s, sv) =>
            {
                VendorPurchaseGroupList = sv.Result;
            };

            Client.GetAxCurrencyAsync("CCM");
            Client.GetAxCurrencyCompleted += (s, sv) =>
            {
                AxCurrencyList = sv.Result;
            };
            Client.SearchForColorCompleted += (s, sv) =>
            {
                if (sv.Error != null)
                {
                    return;
                }

                SelectedDetailRow.Colors = sv.Result;
            };

            var currentUi = Thread.CurrentThread.CurrentUICulture;

            productionServiceClient.GetTblTradeAgreementDetailListCompleted += (d, sv) =>
            {
                foreach (var row in sv.Result)
                {
                    var newrow = new TradeAgreementDetailModel();
                    newrow.InjectFrom(row);
                    newrow.HeaderIserial = row.TblTradeAgreementHeader;
                    newrow.TradeAgreementTransactionIserial = SelectedMainRow.Iserial;
                    newrow.ColorPerRow = new CRUDManagerService.TblColor();
                    if (row.TblColor1 != null)
                    {
                        newrow.ColorPerRow.InjectFrom(row.TblColor1);
                    }
                    newrow.TblColor   = row.TblColor;
                    newrow.ItemPerRow = new CRUDManagerService.ItemsDto();
                    var itemsDto = sv.itemsList.SingleOrDefault(x => x.Iserial == row.ItemCode && x.ItemGroup == row.ItemType);
                    if (itemsDto != null)
                    {
                        newrow.ItemPerRow.InjectFrom(itemsDto);
                    }
                    newrow.ItemCode = row.ItemCode;
                    newrow.ItemType = row.ItemType;
                    newrow.FromDate = row.TblTradeAgreementHeader1.FromDate;
                    newrow.ToDate   = row.TblTradeAgreementHeader1.ToDate;
                    newrow.VendorPurchaseGroupPerRow = VendorPurchaseGroupList.FirstOrDefault(vpg => vpg.Iserial == newrow.TblVendorPurchaseGroup);
                    newrow.VendorPerRow = new CRUDManagerService.Vendor();
                    newrow.VendorPerRow.InjectFrom(sv.vendorsList.FirstOrDefault(v => v.vendor_code == row.TblTradeAgreementHeader1.Vendor));
                    newrow.Vendor = row.TblTradeAgreementHeader1.Vendor;
                    SelectedMainRow.DetailsList.Add(newrow);
                }

                Loading         = false;
                DetailFullCount = sv.fullCount;
                if (DetailFullCount == 0 && SelectedMainRow.DetailsList.Count == 0)
                {
                    AddNewDetailRow(false);
                }
            };

            productionServiceClient.UpdateOrInsertTblTradeAgreementDetailCompleted += (s, x) =>
            {
                var savedRow = SelectedMainRow.DetailsList.ElementAtOrDefault(x.outindex);

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

            productionServiceClient.GetTblTradeAgreementTransactionCompleted += (d, s) =>
            {
                foreach (var variable in s.Result)
                {
                    var newrow = new TradeAgreementTransaction();
                    newrow.InjectFrom(variable);
                    MainRowList.Add(newrow);
                }
                Loading   = false;
                FullCount = s.fullCount;
                if (SearchWindow != null)
                {
                    SearchWindow.FullCount = s.fullCount;
                    SearchWindow.Loading   = false;
                }
                if (FullCount == 0 && MainRowList.Count == 0)
                {
                    AddNewMainRow(true);
                }
            };

            productionServiceClient.DeleteTblTradeAgreementDetailCompleted += (s, ev) =>
            {
                Loading = false;
                if (ev.Error != null)
                {
                    throw ev.Error;
                }

                var oldrow = SelectedMainRow.DetailsList.FirstOrDefault(x => x.Iserial == ev.Result);

                if (oldrow != null)
                {
                    SelectedMainRow.DetailsList.Remove(oldrow);
                }
            };

            productionServiceClient.SaveTradeAgreementCompleted += (s, sv) =>
            {
                if (SelectedMainRow == null)
                {
                    SelectedMainRow = new TradeAgreementTransaction();
                }
                SelectedMainRow.InjectFrom(sv.savedHeader);
                SelectedMainRow.TblLkpSeason  = sv.savedHeader.TblLkpSeason;
                SelectedMainRow.TblLkpSeason1 = SeasonList.FirstOrDefault(r => r.Iserial == SelectedMainRow.TblLkpSeason);
                //SelectedMainRow.DetailsList.Clear();
                foreach (var item in SelectedMainRow.DetailsList)
                {
                    var newRow = sv.Result.FirstOrDefault(d => d.ItemCode == item.ItemCode && d.TblColor == item.TblColor &&
                                                          d.TblTradeAgreementHeader == item.HeaderIserial && d.AccSize == item.AccSize);
                    if (newRow != null)
                    {
                        item.Iserial       = newRow.Iserial;
                        item.HeaderIserial = newRow.TblTradeAgreementHeader;
                        item.TradeAgreementTransactionIserial = newRow.TblTradeAgreementHeader1.TblTradeAgreementTransaction.Value;
                    }
                }
                RaisePropertyChanged(nameof(IsHeaderSaved));
                MessageBox.Show(strings.Saved);
                Loading = true;
            };
            productionServiceClient.DeleteTradeAgreementHeaderCompleted += (d, s) =>
            {
                SelectedMainRow = new TradeAgreementTransaction();

                if (currentUi.DisplayName == "العربية")
                {
                    MessageBox.Show("Deleted");
                }
                else
                {
                    MessageBox.Show("Deleted");
                }
            };
            // ده هيحتاج تعديل
            LoadingDetail = new RelayCommand <DataGridRowEventArgs>((e) =>
            {
                if (SelectedMainRow.DetailsList.Count < PageSize)
                {
                    return;
                }
                if (SelectedMainRow.DetailsList.Count - 2 < e.Row.GetIndex() && SelectedMainRow.DetailsList.Count < DetailFullCount &&
                    !Loading)
                {
                    string size = null, vendor = null, color = null, ItemType = null, ItemCode = null;
                    string key  = "AccSize";
                    if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                    {
                        size = (string)valueObjecttemp.First(w => w.Key.StartsWith(key)).Value;
                    }
                    key = "Vendor";
                    if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                    {
                        vendor = (string)valueObjecttemp.First(w => w.Key.StartsWith(key)).Value;
                    }

                    key = "Color";
                    if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                    {
                        color = (string)valueObjecttemp.First(w => w.Key.StartsWith(key)).Value;
                    }
                    key = "ItemType";
                    if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                    {
                        ItemType = (string)valueObjecttemp.First(w => w.Key.StartsWith(key)).Value;
                    }
                    key = "ItemCode";
                    if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                    {
                        ItemCode = Convert.ToString(valueObjecttemp.First(w => w.Key.StartsWith(key)).Value);
                    }
                    productionServiceClient.GetTblTradeAgreementDetailListFabricViewAsync(
                        SelectedMainRow.DetailsList.Count, PageSize, SelectedMainRow.Iserial, ItemCode,
                        color, size, vendor, ItemType);
                }
            });
            // ده هيحتاج تعديل
            FilterCommand = new RelayCommand <FilterEvent>((e) =>
            {
                SelectedMainRow.DetailsList.Clear();

                valueObjecttemp.Clear();

                foreach (var f in e.FiltersPredicate)
                {
                    valueObjecttemp.Add(f.FilterColumnInfo.PropertyPath, f.FilterText);
                }

                string size = null, vendor = null, color = null, ItemType = null, ItemCode = null;
                string key  = "AccSize";
                if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                {
                    size = (string)valueObjecttemp.First(w => w.Key.StartsWith(key)).Value;
                }
                key = "Vendor";
                if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                {
                    vendor = (string)valueObjecttemp.First(w => w.Key.StartsWith(key)).Value;
                }

                key = "Color";
                if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                {
                    color = (string)valueObjecttemp.First(w => w.Key.StartsWith(key)).Value;
                }
                key = "ItemType";
                if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                {
                    ItemType = (string)valueObjecttemp.First(w => w.Key.StartsWith(key)).Value;
                }
                key = "ItemCode";
                if (valueObjecttemp.Any(w => w.Key.StartsWith(key)))
                {
                    ItemCode = Convert.ToString(valueObjecttemp.First(w => w.Key.StartsWith(key)).Value);
                }
                productionServiceClient.GetTblTradeAgreementDetailListFabricViewAsync(
                    0, PageSize, SelectedMainRow.Iserial, ItemCode, color, size, vendor, ItemType);
            });
            NewDetail = new RelayCommand <KeyEventArgs>((e) =>
            {
                if (e.Key == Key.Down)
                {
                    //var currentRowIndex = (SelectedMainRow.DetailsList.IndexOf(SelectedDetailRow));
                    //if (currentRowIndex == (SelectedMainRow.DetailsList.Count - 1))
                    //{
                    //    AddNewDetailRow(true);
                    //}
                }
            });
            DeleteDetail = new RelayCommand <KeyEventArgs>((e) =>
            {
                if (e.Key == Key.Delete)
                {
                    var DetailGrid = e.OriginalSource as OsGrid;
                    SelectedDetailRows.Clear();
                    foreach (var row in DetailGrid.SelectedItems)
                    {
                        SelectedDetailRows.Add(row as TradeAgreementDetailModel);
                    }
                    DeleteDetailRow();
                }
            });
            SaveDetail = new RelayCommand <DataGridRowEditEndedEventArgs>((e) => { SaveDetailRow(); });
            Client.GetAllSeasonsCompleted += (s, e) =>
            {
                SeasonList.Clear();
                foreach (var row in e.Result)
                {
                    TblLkpSeason temp = new TblLkpSeason();
                    temp.InjectFrom(row);
                    SeasonList.Add(temp);
                }
            };

            AddNewMainRow(false);
            GetComboData();
            GetMaindata();
        }
示例#13
0
        public SeasonCurrenciesViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                GetItemPermissions(PermissionItemName.SeasonCurrenciesForm.ToString());
                MainRowList     = new SortableCollectionView <TblSeasonCurrenciesViewModel>();
                SelectedMainRow = new TblSeasonCurrenciesViewModel();
                Client.GetTblCurrencyCompleted += (s, sv) =>
                {
                    CurrencyList = sv.Result;
                };
                Client.GetTblCurrencyAsync(0, int.MaxValue, "it.Iserial", null, null);
                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);
                        }
                    }
                    GetMaindata();
                };
                seasonClient.GetAllSeasonsAsync();

                Client.GetTblSeasonCurrencyCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblSeasonCurrenciesViewModel();
                        newrow.SeasonPerRow = new TblLkpSeason();
                        newrow.SeasonPerRow = SeasonList.FirstOrDefault(x => x.Iserial == row.TblLkpSeason);
                        newrow.InjectFrom(row);
                        MainRowList.Add(newrow);
                    }
                    Loading   = false;
                    FullCount = sv.fullCount;
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };

                Client.UpdateOrInsertTblSeasonCurrencyCompleted += (s, x) =>
                {
                    var savedRow = (TblSeasonCurrenciesViewModel)MainRowList.GetItemAt(x.outindex);
                    Loading = false;
                    if (savedRow != null)
                    {
                        savedRow.InjectFrom(x.Result);
                    }
                };
                Client.DeleteTblSeasonCurrencyCompleted += (s, ev) =>
                {
                    if (ev.Error != null)
                    {
                        throw ev.Error;
                    }
                    Loading = false;
                    var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result);
                    if (oldrow != null)
                    {
                        MainRowList.Remove(oldrow);
                    }
                };
            }
        }
 /// <summary>
 ///     Adds season s to the SeasonList
 /// </summary>
 /// <param name="s">Season to add</param>
 public void Add(Season s)
 {
     SeasonList.Add(s);
 }
示例#15
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();
                };
            }
        }