Esempio n. 1
0
 /// <summary>
 /// Set Last Department Button Click Event.
 /// </summary>
 private void SetLastDeptBtn_Click(object sender, EventArgs e)
 {
     try {
         var Dialog = new DepartmentDialog(false);
         if (Dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             if (Dialog.SelectedItems.Count > 0)
             {
                 var Dept = Dialog.SelectedItems[0];
                 CurDept.LastDepId = Dept.DepId;
                 LastDeptTB.Text   = String.Format("{0} - {1}", Dept.DepId, Dept.DepName);
             }
         }
     } catch (Exception err) {
         Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.SaveDepartmentForm.SetLastDeptBtn.Click", err.Message, err.StackTrace);
         MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Set Deptments Button Click Event.
        /// </summary>
        private void DeptBtn_Click(object sender, EventArgs e)
        {
            try {
                var Dialog = new DepartmentDialog(true);
                if (Dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    if (Dialog.SelectedItems.Count > 0)
                    {
                        var data = new List <IDValuePair <String, String> >();
                        foreach (var dept in Dialog.SelectedItems)
                        {
                            data.Add(new IDValuePair <String, String>(dept.DepId, dept.DepName));
                        }

                        DeptLB.DataSource    = data;
                        DeptLB.ValueMember   = "ID";
                        DeptLB.DisplayMember = "Value";
                    }
                }
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.OrgEmployeeReportForm.DeptBtn.Click", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }