Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public NoticeForm(Notice editObj, Action refreshAction)
            : this(refreshAction)
        {
            //复制可能被改变的属性,避免退出修改的刷新
            obj.Id    = editObj.Id;
            obj.Title = editObj.Title;
            obj.Url   = editObj.Url;

            this.IsEnabled = AppGlobal.HasPermission();
        }
Exemplo n.º 3
0
        public WorkTypeForm(WorkType editObj, Action refreshAction)
            : this(refreshAction)
        {
            //复制可能被改变的属性,避免退出修改的刷新
            obj.Id     = editObj.Id;
            obj.Name   = editObj.Name;
            obj.IsUsed = editObj.IsUsed;

            this.IsEnabled = AppGlobal.HasPermission();
        }
Exemplo n.º 4
0
 void NoticeList_Loaded(object sender, RoutedEventArgs e)
 {
     if (AppGlobal.HasPermission())
     {
         btnAdd.Visibility = btnEdit.Visibility = btnDelete.Visibility = Visibility.Visible;
     }
     else
     {
         btnAdd.Visibility = btnEdit.Visibility = btnDelete.Visibility = Visibility.Collapsed;
     }
     getData();
 }
Exemplo n.º 5
0
        void SMSRecordForm_Loaded(object sender, RoutedEventArgs e)
        {
            LoadSexs();
            LoadGradeTypes();
            LoadWorkTypes();
            LoadOfficerTypes();

            LoadStation();

            bool hasPsermission = AppGlobal.HasPermission();

            this.cmbGradeType.IsReadOnly = !hasPsermission;
            this.cmbGradeType.IsEnabled  = hasPsermission;
        }
Exemplo n.º 6
0
        void SMSRecordList_Loaded(object sender, RoutedEventArgs e)
        {
            btnEdit.Visibility   = AppGlobal.HasPermission() ? Visibility.Visible : Visibility.Collapsed;
            btnDelete.Visibility = AppGlobal.HasPermission() ? Visibility.Visible : Visibility.Collapsed;

            if (this.NavigationContext != null)
            {
                DateTime?start = null;
                DateTime?end   = null;
                if (this.NavigationContext.QueryString.Keys.Contains("OfficerId"))
                {
                    int.TryParse(this.NavigationContext.QueryString["OfficerId"], out officerId);
                }
                if (this.NavigationContext.QueryString.Keys.Contains("Start"))
                {
                    DateTime tmp;
                    if (DateTime.TryParse(this.NavigationContext.QueryString["Start"], out tmp))
                    {
                        start = tmp;
                    }
                }
                if (this.NavigationContext.QueryString.Keys.Contains("End"))
                {
                    DateTime tmp;
                    if (DateTime.TryParse(this.NavigationContext.QueryString["End"], out tmp))
                    {
                        end = tmp;
                    }
                }
                if (this.NavigationContext.QueryString.Keys.Contains("OfficerTypeId"))
                {
                    int.TryParse(this.NavigationContext.QueryString["OfficerTypeId"], out officerTypeId);
                }

                mainGrid.RowDefinitions[0].Height = new GridLength(0);
                mainGrid.RowDefinitions[1].Height = new GridLength(0);
                mainGrid.RowDefinitions[2].Height = new GridLength(0);

                dateStart.SelectedDate = start;
                dateEnd.SelectedDate   = end;
            }

            getData();
        }
Exemplo n.º 7
0
 public SMSRecordForm(SMSRecord editObj)
 {
     InitializeComponent();
     isEdit       = true;
     this.editObj = editObj;
     smsRecord    = editObj;
     Loaded      += new RoutedEventHandler(SMSRecordForm_Loaded);
     SMSRecordService.SMSRecordServiceClient ser = new SMSRecordService.SMSRecordServiceClient();
     ser.GetByIdCompleted +=
         (object sender, SMSRecordService.GetByIdCompletedEventArgs e) =>
     {
         SMSRecord obj = JsonSerializerHelper.JsonToEntity <SMSRecord>(e.Result);
         this.smsRecord          = obj;
         DataContext             = smsRecord;
         chkIsResponse.IsChecked = smsRecord.IsResponse;
     };
     this.IsEnabled = AppGlobal.HasPermission();
     //查询一次,避免在form更改了数据点击取消后原list界面数据更改(界面双向绑定,但没有提交到数据库)
     ser.GetByIdAsync(editObj.Id);
 }