Ejemplo n.º 1
0
        private void LoadOfficers()
        {
            try
            {
                //WorkTypeService.WorkTypeServiceClient ser = new WorkTypeService.WorkTypeServiceClient(AppGlobal.CreateHttpBinding(), new EndpointAddress(new Uri(Application.Current.Host.Source, "../SMSWcf/WorkTypeService.svc")));
                OfficerService.OfficerServiceClient ser = new OfficerService.OfficerServiceClient();
                ser.GetListByHQLCompleted += (object sender, OfficerService.GetListByHQLCompletedEventArgs e) =>
                {
                    int total = 0;
                    officers = JsonSerializerHelper.JsonToEntities <Officer>(e.Result, out total);
                    var removeList = officers.Where(c => c.Name == "吴涛" || c.Name == "贾红兵").ToList();
                    for (int i = 0; i < removeList.Count; i++)
                    {
                        officers.Remove(removeList[i]);
                    }
                    cmbWorkOfficer.ItemsSource = officers;
                    // 增加
                    cmbLeader.ItemsSource = officers;
                    // 结束
                };

                int orgId = isEdit ? smsRecord.Organization.Id : (cboxStation.SelectedItem as Organization).Id;
                ser.GetListByHQLAsync(string.Format("from Officer as e where e.Organization.id = {0} order by e.Name", orgId));
            }
            catch (Exception ex)
            {
                Tools.ShowMessage("读取受理人发生错误", ex.Message, false);
            }
        }
Ejemplo n.º 2
0
        private void LoadOfficers()
        {
            try
            {
                if (cboxStation.SelectedItem != null)
                {
                    OfficerService.OfficerServiceClient ser = new OfficerService.OfficerServiceClient();
                    ser.GetListByHQLCompleted += (object sender, OfficerService.GetListByHQLCompletedEventArgs e) =>
                    {
                        int total      = 0;
                        var list       = JsonSerializerHelper.JsonToEntities <Officer>(e.Result, out total);
                        var removeList = list.Where(c => c.Name == "吴涛" || c.Name == "贾红兵").ToList();
                        for (int i = 0; i < removeList.Count; i++)
                        {
                            list.Remove(removeList[i]);
                        }
                        cboxOper.ItemsSource = list;
                    };

                    ser.GetListByHQLAsync(string.Format("from Officer as e where e.Organization.id = {0} order by e.Name", (cboxStation.SelectedItem as Organization).Id));
                }
            }
            catch (Exception ex)
            {
                Tools.ShowMessage("读取民警发生错误", ex.Message, false);
            }
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            string oldtxtPass = this.oldtxtPass.Password.Trim();

            string txtPass = this.txtPass.Password.Trim();

            string checktxtPass = this.checktxtPass.Password.Trim();

            if (txtPass != checktxtPass)
            {
                Tools.ShowMessage("两次密码输入不一致!", string.Empty, false);
            }
            else
            {
                OfficerService.OfficerServiceClient ser1 = new OfficerService.OfficerServiceClient();
                //登录完成的事件
                ser1.LoginCompleted += (object sender1, OfficerService.LoginCompletedEventArgs e1) =>
                {
                    Officer LoginUser = JsonSerializerHelper.JsonToEntity <Officer>(e1.Result);
                    if (LoginUser != null)
                    {
                        ser1.SaveOrUpdateCompleted += (object sender2, OfficerService.SaveOrUpdateCompletedEventArgs e2) =>
                        {
                            CallBack();
                        };
                        LoginUser.Password = txtPass;

                        ser1.SaveOrUpdateAsync(JsonSerializerHelper.EntityToJson <Officer>(LoginUser));
                    }
                    else
                    {
                        Tools.ShowMessage("原始密码输入不正确!", string.Empty, false);
                    }
                };
                ser1.LoginAsync(AppGlobal.CurrentUser.Code, oldtxtPass);
            }
        }
Ejemplo n.º 4
0
        private void LoadOfficers(int orgId)
        {
            try
            {
                OfficerService.OfficerServiceClient ser = new OfficerService.OfficerServiceClient();
                ser.GetListByHQLCompleted += (object sender, OfficerService.GetListByHQLCompletedEventArgs e) =>
                {
                    int total = 0;
                    officers = JsonSerializerHelper.JsonToEntities <Officer>(e.Result, out total);
                    var removeList = officers.Where(c => c.Name == "吴涛" || c.Name == "贾红兵").ToList();
                    for (int i = 0; i < removeList.Count; i++)
                    {
                        officers.Remove(removeList[i]);
                    }
                    cmbWorkOfficer.ItemsSource = cmbLeader.ItemsSource = officers;
                };

                ser.GetListByHQLAsync(string.Format("from Officer as e where e.Organization.id = {0} order by e.Name", orgId));
            }
            catch (Exception ex)
            {
                Tools.ShowMessage("读取受理人发生错误", ex.Message, false);
            }
        }