Exemplo n.º 1
0
 private void InitMe()
 {
     base.StartPosition = FormStartPosition.CenterScreen;
     this.Text = ResourceService.GetString("Dialog.UserLogin.Text");
     base.Icon = ResourceService.GetIcon("Dialog.UserLogin.Icon");
     this.btOk.Text = ResourceService.GetString("Dialog.UserLogin.LoginButtonText");
     this.btCancel.Text = ResourceService.GetString("Global.CancelButtonText");
     this.txtPassword.Properties.PasswordChar = '*';
     this.btOk.Image = ResourceService.GetBitmap("Global.OkButtonImage");
     this.btCancel.Image = ResourceService.GetBitmap("Global.CancelButtonImage");
     this.btOk.DialogResult = DialogResult.OK;
     this.btCancel.DialogResult = DialogResult.Cancel;
     this.txtUser.EditValue = CacheService.Get("LastLoginStaff");
     this.ogmTv = new OGMTreeView();
     this.ogmTv.Dock = DockStyle.Fill;
     this.pcContainer.Size = this.ogmTv.Size;
     this.pcContainer.Controls.Add(this.ogmTv);
     this.ogmTv.HandleCreated += new EventHandler(this.ogmTv_HandleCreated);
     this.ogmTv.DoubleClick += new EventHandler(this.ogmTv_DoubleClick);
     if (this.txtUser.EditValue == null)
     {
         string str = PropertyService.Get<string>("LastLoginDeptId", string.Empty);
         string str2 = PropertyService.Get<string>("LastLoginStaffId", string.Empty);
         if (!(string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str2)))
         {
             this.txtUser.EditValue = OGMService.GetStaffDept(str, str2);
         }
         this.marqueeProgressBarControl1.Hide();
     }
     else
     {
         this.marqueeProgressBarControl1.Hide();
     }
     this.txtUser.Properties.QueryCloseUp += new CancelEventHandler(this.txtUser_QueryCloseUp);
     this.txtUser.Properties.QueryPopUp += new CancelEventHandler(this.txtUser_QueryPopUp);
     LoggingService.Debug("登录窗口初始化完成...");
 }
Exemplo n.º 2
0
 private void cmbActdef_SelectedIndexChanged(object sender, EventArgs e)
 {
     LoggingService.Debug("下一步活动改变了...");
     try
     {
         if ((this.cmbActdef.DataSource != null) && (this.cmbActdef.SelectedItem != null))
         {
             Actdef selectedItem = this.cmbActdef.SelectedItem as Actdef;
             if (!StringHelper.IsNull(selectedItem.ParticipantId))
             {
                 CParticipant part = QueryHelper.Get<CParticipant>(selectedItem.ParticipantId);
                 if (part != null)
                 {
                     IList<CStaff> staffsOfParticipant = WorkflowService.GetStaffsOfParticipant(part);
                     if (staffsOfParticipant.Count <= 0)
                     {
                         throw new WfClientException("没有分配人员行使该活动!");
                     }
                     if (part.AssignRule == AssignRuleType.ANY)
                     {
                         if (this.ogmTv == null)
                         {
                             this.ogmTv = new OGMTreeView();
                             this.ogmTv.Size = new Size(this.cmbStaff.Width, 4 * this.cmbStaff.Height);
                             this.groupBox1.Controls.Add(this.ogmTv);
                             this.ogmTv.Location = this.cmbStaff.Location;
                             this.ogmTv.CheckBoxes = true;
                             this.ogmTv.AfterCheck += new TreeViewEventHandler(this.ogmTv_AfterCheck);
                         }
                         this.cmbStaff.Visible = false;
                         this.ogmTv.InitStaffsTree(part.Name, staffsOfParticipant);
                     }
                     else
                     {
                         int num2;
                         if (this.ogmTv != null)
                         {
                             this.ogmTv.Visible = false;
                             this.cmbStaff.Visible = true;
                         }
                         this.cmbStaff.DataSource = null;
                         Transition transition = this.cmbPoscond.SelectedItem as Transition;
                         foreach (SkyMap.Net.Workflow.XPDL.Condition condition in transition.Conditions)
                         {
                             if (condition.Type == "AUTOSTAFFSQL")
                             {
                                 LoggingService.InfoFormatted("将依据{0}自动选择转出人员。。。", new object[] { condition.Xpression });
                                 if (!string.IsNullOrEmpty(condition.Xpression))
                                 {
                                     DataTable table = QueryHelper.ExecuteSql("Default", string.Empty, this.ReplaceSystemParams(condition.Xpression));
                                     if ((staffsOfParticipant != null) && (table.Rows.Count > 0))
                                     {
                                         int count = table.Rows.Count;
                                         num2 = staffsOfParticipant.Count - 1;
                                         while (num2 > -1)
                                         {
                                             if (table.Select("staff_id='" + staffsOfParticipant[num2].Id + "'").Length == 0)
                                             {
                                                 staffsOfParticipant.RemoveAt(num2);
                                             }
                                             num2--;
                                         }
                                         if (staffsOfParticipant.Count > 0)
                                         {
                                             this.cmbStaff.DataSource = staffsOfParticipant;
                                             this.chkStaff.Checked = true;
                                         }
                                     }
                                 }
                             }
                         }
                         if ((this.cmbStaff.DataSource == null) || (this.cmbStaff.Items.Count == 0))
                         {
                             CStaff current;
                             string str = SecurityUtil.GetSmPrincipal().DeptIds[0];
                             LoggingService.Debug("转出人员太多,看是否需要赐除非本部门人员...");
                             bool flag = false;
                             bool flag2 = true;
                             using (IEnumerator<CStaff> enumerator2 = staffsOfParticipant.GetEnumerator())
                             {
                                 while (enumerator2.MoveNext())
                                 {
                                     current = enumerator2.Current;
                                     foreach (CStaffDept dept in current.StaffDepts)
                                     {
                                         if (str == dept.DeptID)
                                         {
                                             flag = true;
                                         }
                                         else
                                         {
                                             flag2 = true;
                                         }
                                         if (flag2 && flag)
                                         {
                                             goto Label_0411;
                                         }
                                     }
                                 Label_0411:;
                                 }
                             }
                             if (flag && flag2)
                             {
                                 //lhm 原来同部门的情况下默认会自动勾选上选中某人,现修改为false
                                 this.chkStaff.Checked = false;
                                 if (LoggingService.IsInfoEnabled)
                                 {
                                     LoggingService.Info("转出时移除非本部门的人员从列表。。。");
                                 }
                                 for (num2 = staffsOfParticipant.Count - 1; num2 > -1; num2--)
                                 {
                                     current = staffsOfParticipant[num2];
                                     foreach (CStaffDept dept in current.StaffDepts)
                                     {
                                         if (str != dept.DeptID)
                                         {
                                             staffsOfParticipant.RemoveAt(num2);
                                             goto Label_04EF;
                                         }
                                     }
                                 Label_04EF:;
                                 }
                             }
                             else
                             {
                                 this.chkStaff.Checked = false;
                             }
                             this.cmbStaff.DataSource = staffsOfParticipant;
                             string userId = SecurityUtil.GetSmIdentity().UserId;
                             foreach (CStaff staff in staffsOfParticipant)
                             {
                                 if (staff.Id == str)
                                 {
                                     this.cmbStaff.SelectedItem = staff;
                                     return;
                                 }
                             }
                             foreach (CStaff staff in staffsOfParticipant)
                             {
                                 foreach (CStaffDept dept in staff.StaffDepts)
                                 {
                                     if (str == dept.DeptID)
                                     {
                                         this.cmbStaff.SelectedItem = staff;
                                         return;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (CoreException exception)
     {
         MessageHelper.ShowBaseExceptionInfo(exception);
     }
     catch (Exception exception2)
     {
         MessageHelper.ShowError("UnKnown", exception2);
     }
 }