示例#1
0
        private void LoadStation()
        {
            try
            {
                OrganizationService.OrganizationServiceClient ser = new OrganizationService.OrganizationServiceClient();
                ser.GetListByHQLCompleted += (object sender, OrganizationService.GetListByHQLCompletedEventArgs e) =>
                {
                    int total = 0;
                    IList <Organization> stations = JsonSerializerHelper.JsonToEntities <Organization>(e.Result, out total);

                    cmbWorkOrg.ItemsSource  = stations;
                    cmbWorkOrg.SelectedItem = smsRecord.Organization;
                    if (!isEdit && !AppGlobal.HasPermission())
                    {
                        cmbWorkOrg.SelectedItem = AppGlobal.CurrentUser.Organization;
                        cmbWorkOrg.IsEnabled    = false;
                    }
                };

                //这里没有考虑权限
                ser.GetListByHQLAsync("from Organization where Name like '%青羊%' and SMSUnitType>0 order by OrderIndex ");
            }
            catch (Exception ex)
            {
                Tools.ShowMessage("读取性别发生错误", ex.Message, false);
            }
        }
示例#2
0
        private void LoadStation()
        {
            try
            {
                OrganizationService.OrganizationServiceClient ser = new OrganizationService.OrganizationServiceClient();
                ser.GetListByHQLCompleted += (object sender, OrganizationService.GetListByHQLCompletedEventArgs e) =>
                {
                    int total    = 0;
                    var stations = JsonSerializerHelper.JsonToEntities <Organization>(e.Result, out total);
                    foreach (var station in stations)
                    {
                        if (station.Name.StartsWith("青羊区分局"))
                        {
                            station.Name = station.Name.Replace("青羊区分局", "");
                        }
                        if (station.Name.StartsWith("成都市公安局"))
                        {
                            station.Name = station.Name.Replace("成都市公安局", "");
                        }
                    }

                    List <TreeViewItemModel> list = new List <TreeViewItemModel>();
                    list.Add(new TreeViewItemModel
                    {
                        Id          = 0,
                        SMSUnitType = 1,
                        Name        = "派出所",
                        Childs      = stations.Where(c => c.SMSUnitType == 1).OrderBy(c => c.OrderIndex).ToList(),
                        IsExpanded  = true,
                        IsActive    = true
                    });
                    list.Add(new TreeViewItemModel
                    {
                        Id          = 0,
                        SMSUnitType = 3,
                        Name        = "科队",
                        Childs      = stations.Where(c => c.SMSUnitType == 3).OrderBy(c => c.OrderIndex).ToList(),
                        IsExpanded  = false,
                        IsActive    = false
                    });

                    tree.ItemsSource       = list;
                    this.tree.SelectedItem = this.tree.Items[0];
                };

                //这里没有考虑权限
                ser.GetListByHQLAsync(string.Format(" select distinct  o from SMSRecord r inner join r.Organization as o where o.Name like '%青羊%' and o.SMSUnitType in ({0},{1})  ", 1, 3));
            }
            catch (Exception ex)
            {
                Tools.ShowMessage("读取单位发生错误", ex.Message, false);
            }
        }
示例#3
0
        private void LoadStation()
        {
            try
            {
                OrganizationService.OrganizationServiceClient ser = new OrganizationService.OrganizationServiceClient();
                ser.GetListByHQLCompleted += (object sender, OrganizationService.GetListByHQLCompletedEventArgs e) =>
                {
                    int total = 0;
                    var list  = JsonSerializerHelper.JsonToEntities <Organization>(e.Result, out total);

                    cboxStation.ItemsSource = list;
                };

                //这里没有考虑权限
                ser.GetListByHQLAsync("from Organization where Name like '%青羊%' order by OrderIndex ");
            }
            catch (Exception ex)
            {
                Tools.ShowMessage("读取单位发生错误", ex.Message, false);
            }
        }
示例#4
0
        private void LoadStation(Action action = null)
        {
            try
            {
                OrganizationService.OrganizationServiceClient ser = new OrganizationService.OrganizationServiceClient();
                ser.GetListByHQLCompleted += (object sender, OrganizationService.GetListByHQLCompletedEventArgs e) =>
                {
                    int total = 0;
                    stations = JsonSerializerHelper.JsonToEntities <Organization>(e.Result, out total);

                    Organization orgNull = new Organization {
                        Name = "全部", Id = 0
                    };

                    stations.Insert(0, orgNull);


                    cmbStation.ItemsSource = stations;
                    if (cmbStation.Items.Count > 0)
                    {
                        cmbStation.SelectedIndex = 0;
                    }

                    if (action != null)
                    {
                        action();
                    }
                };

                //这里没有考虑权限
                ser.GetListByHQLAsync("from Organization where Name like '%青羊%' and SMSUnitType>0 order by OrderIndex ");
            }
            catch (Exception ex)
            {
                Tools.ShowMessage("读取单位发生错误", ex.Message, false);
            }
        }