示例#1
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");
            }
        }