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

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

            serviceClient.GetGenericCompleted += (s, ev) =>
            {
                var i = 0;
                foreach (var item in ev.Result)
                {
                    objectToFill.Add(new GenericViewModel
                    {
                        Iserial = item.Iserial,
                        Code    = item.Code,
                        Aname   = item.Aname,
                        Ename   = item.Ename
                    });
                    objectToFill[i].Status.IsChanged     = false;
                    objectToFill[i].Status.IsNew         = false;
                    objectToFill[i].Status.IsSavedDBItem = true;
                    i++;
                }
            };
            serviceClient.CloseAsync();
        }
Ejemplo n.º 2
0
        private void FillGenericCollection(string tablEname, ObservableCollection <GenericViewModel> objectToFill)
        {
            objectToFill.Clear();
            var client = new CRUD_ManagerServiceClient();

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

            client.GetGenericCompleted += (s, ev) =>
            {
                foreach (var item in ev.Result)
                {
                    objectToFill.Add(new GenericViewModel
                    {
                        Iserial = item.Iserial,
                        Code    = item.Code,
                        Aname   = item.Aname,
                        Ename   = item.Ename
                    });
                }
            };
            client.CloseAsync();
        }