Example #1
0
        public async void View_CustomerGroup()
        {
            if (SelectedCustomerGroup.CUSTOMER_GROUP_ID != null && SelectedCustomerGroup.CUSTOMER_GROUP_ID != 0)
            {
                App.Current.Properties["Action"] = "View";
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(GlobalData.gblApiAdress);
                client.DefaultRequestHeaders.Accept.Add(
                    new MediaTypeWithQualityHeaderValue("application/json"));
                client.Timeout = new TimeSpan(500000000000);
                HttpResponseMessage response = client.GetAsync("api/CustomerGroupAPI/CustomerGroupEdit?id=" + SelectedCustomerGroup.CUSTOMER_GROUP_ID + "").Result;
                if (response.IsSuccessStatusCode)
                {
                    data = JsonConvert.DeserializeObject <CustomerGroupModel[]>(await response.Content.ReadAsStringAsync());
                    if (data.Length > 0)
                    {
                        for (int i = 0; i < data.Length; i++)
                        {
                            SelectedCustomerGroup.CUSTOMER_GROUP_ID = data[i].CUSTOMER_GROUP_ID;
                            SelectedCustomerGroup.COMPANY_ID        = data[i].COMPANY_ID;
                            SelectedCustomerGroup.DESCRIPTION       = data[i].DESCRIPTION;
                            SelectedCustomerGroup.IS_DELETE         = data[i].IS_DELETE;
                            SelectedCustomerGroup.NAME = data[i].NAME;
                        }
                    }
                    App.Current.Properties["CustomerGroupView"] = SelectedCustomerGroup;
                    CustomerGroupView vi = new CustomerGroupView();
                    vi.Show();
                }
            }
            else
            {
                MessageBox.Show("Select Godown");
                //ViewGoDown _AGD = new ViewGoDown();
                //_AGD.Show();
            }

            // ModalService.NavigateTo(new ItemLocationList(), delegate(bool returnValue) { });
        }
Example #2
0
        public void ShowView2CommandExecute()
        {
            var cglTemp = new ObservableCollection<CustomerGroup>();
            foreach (CustomerGroup item in this.CustomerGroupList)
            {
                cglTemp.Add(item);
            }

            var cg = new CustomerGroupView();
            var cgv = new CustomerGroupViewModel();
            cg.DataContext = cgv;
            if (cg.ShowDialog().HasValue)
            {

                this.db.CustomerGroup.ToList().OrderBy(item => item.Name);
                this.CustomerGroupList = this.db.CustomerGroup.Local;
                foreach (CustomerGroup a in this.CustomerGroupList)
                {
                    bool isOld = false;

                    foreach (CustomerGroup b in cglTemp)
                    {
                        if (a.CustomerGroupId == b.CustomerGroupId)
                        {
                            isOld = true;
                        }
                    }
                    if (!isOld)
                    {
                        this.CustomerGroupList.SingleOrDefault(item => item.CustomerGroupId == a.CustomerGroupId).isSelected = true;
                    }
                }
            }
        }