コード例 #1
0
        private void btSearchStaff_Click(object sender, EventArgs e)
        {
            string information = "";

            switch (combStaff.Text.Trim())
            {
            case "工号":
                information = "staID";
                break;

            case "姓名":
                information = "staName";
                break;

            case "性别":
                information = "staSex";
                break;

            case "年龄":
                information = "staAge";
                break;

            default:
                break;
            }

            Maticsoft.BLL.Staff sta = new BLL.Staff();
            string string1          = string.Format("{0} = '{1}'", information, tbStaff.Text.Trim());

            if (information == "staID")
            {
                Model.Staff smodel = new Model.Staff();
                smodel = sta.GetModel1(string1);
                if (smodel.staID == "" || smodel.staID == null)
                {
                    MessageBox.Show("查无此人");
                }
                else
                {
                    SeekStaff see = new Hotel.SeekStaff(smodel);
                    see.ShowDialog(this);
                }
            }
            else
            {
                DataSet ds = new DataSet();
                ds = sta.GetList(string1);
                dgvManager.DataSource = ds.Tables[0];
                ds.Tables[0].Columns["staID"].ColumnName   = "员工工号";
                ds.Tables[0].Columns["staName"].ColumnName = "姓名";
                ds.Tables[0].Columns["staSex"].ColumnName  = "性别";
                ds.Tables[0].Columns["staAge"].ColumnName  = "年龄";
                dgvStaff.AllowUserToAddRows = false;
                dgvStaff.SelectionMode      = DataGridViewSelectionMode.FullRowSelect;
            }
        }
コード例 #2
0
        public void StaffLoad()
        {
            Maticsoft.BLL.Staff sta = new BLL.Staff();
            DataSet             ds  = new DataSet();

            ds = sta.GetList("");
            dgvStaff.DataSource = ds.Tables[0];
            ds.Tables[0].Columns["staId"].ColumnName   = "员工工号";
            ds.Tables[0].Columns["staName"].ColumnName = "姓名";
            ds.Tables[0].Columns["staSex"].ColumnName  = "性别";
            ds.Tables[0].Columns["staAge"].ColumnName  = "年龄";
            dgvStaff.AllowUserToAddRows = false;
            dgvStaff.SelectionMode      = DataGridViewSelectionMode.FullRowSelect;
        }
コード例 #3
0
        private void tbID_TextChanged(object sender, EventArgs e)
        {
            Maticsoft.BLL.Staff sta = new BLL.Staff();
            string string1          = string.Format("staID = '{0}'", tbID.Text.Trim());

            if (sta.GetRecordCount(string1) == 1)
            {
                Model.Staff stamodel = new Model.Staff();
                nudAge.Value = sta.GetModel1(string1).staAge;
            }
            else
            {
                nudAge.Value = 18;
            }
        }
コード例 #4
0
ファイル: frmStaff.xaml.cs プロジェクト: bizsoftsolution/FMCG
        private void onClientEvents()
        {
            BLL.FMCGHubClient.FMCGHub.On <BLL.Staff>("Staff_Save", (prod) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    prod.Save(true);
                });
            });

            BLL.FMCGHubClient.FMCGHub.On("Staff_Delete", (Action <int>)((pk) =>
            {
                this.Dispatcher.Invoke((Action)(() =>
                {
                    BLL.Staff prod = new BLL.Staff();
                    prod.Find((int)pk);
                    prod.Delete((bool)true);
                }));
            }));
        }
コード例 #5
0
 private void btConfirm_Click(object sender, EventArgs e)
 {
     if (tbStaffID.Text.Trim() == "")
     {
         MessageBox.Show("输入信息不完整!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         if (tbStaffID.Text.Trim() != "离职")
         {
             Maticsoft.BLL.Staff sta = new BLL.Staff();
             string str1             = string.Format("staID = '{0}'", tbStaffID.Text.Trim());
             string string1          = string.Format("{0}", tbStaffID.Text.Trim());
             if (sta.GetRecordCount(str1) > 0)
             {
                 if (sta.Delete(string1) == true)
                 {
                     MessageBox.Show("删除成功!");
                     ((Main_Admin)this.Owner).StaffLoad();
                     this.DialogResult = DialogResult.OK;
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("删除失败!");
                 }
             }
             else
             {
                 MessageBox.Show("不存在此员工!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("离职备份不可删除!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
コード例 #6
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (txtSID.Text.Trim() == "")
            {
                new FailureWindows("请输入员工编号!").ShowDialog();
                return;
            }
            if (txtSName.Text.Trim() == "")
            {
                new FailureWindows("请输入员工姓名!").ShowDialog();
                return;
            }
            int age = 0;

            if (txtAge.Text.Trim() == "")
            {
                age = 0;
            }
            else
            {
                age = Convert.ToInt32(txtAge.Text);
            }
            string retStr = new BLL.Staff().Add(new T_Staff
            {
                F_staffID   = txtSID.Text,
                F_staffName = txtSName.Text,
                F_sex       = txtGender.Text,
                F_age       = age
            });

            if (retStr.Equals(Common.SystemVar.SystemVar.Success))
            {
                MessageBox.Show("添加成功");
            }
            else
            {
                new WarningWindows("添加失败").Show();
            }
        }
コード例 #7
0
 private void btConfirm_Click(object sender, EventArgs e)
 {
     if (tbStaffID.Text.Trim() == "" || tbStaffName.Text.Trim() == "" || cbStaffSex.Text == "" || nupStaffAge.Value.ToString() == "" || pbPhoto.Image == null)
     {
         MessageBox.Show("输入信息不完整!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         Maticsoft.BLL.Staff sta      = new BLL.Staff();
         Model.Staff         stamodel = new Model.Staff();
         string str1 = string.Format("staID = '{0}'", tbStaffID.Text.Trim());
         if (sta.GetRecordCount(str1) > 0)
         {
             MessageBox.Show("当前工号已存在!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             stamodel.staID    = tbStaffID.Text.Trim();
             stamodel.staName  = tbStaffName.Text.Trim();
             stamodel.staSex   = cbStaffSex.Text.Trim();
             stamodel.staAge   = Convert.ToInt32(nupStaffAge.Value);
             stamodel.staPhoto = mybyte;
             if (sta.Add(stamodel) == true)
             {
                 MessageBox.Show("添加成功!");
                 ((Main_Admin)this.Owner).StaffLoad();
                 this.Close();
             }
             else
             {
                 MessageBox.Show("添加失败!");
             }
         }
     }
 }
コード例 #8
0
 private void btConfirm_Click(object sender, EventArgs e)
 {
     if (tbID.Text.Trim() == "")
     {
         MessageBox.Show("输入信息不完整!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         Maticsoft.BLL.Staff sta = new BLL.Staff();
         string string1          = string.Format("staID = '{0}'", tbID.Text.Trim());
         if (sta.GetRecordCount(string1) == 1)
         {
             Model.Staff stamodel = new Model.Staff();
             stamodel.staID    = tbID.Text.Trim();
             stamodel.staName  = tbName.Text.Trim();
             stamodel.staSex   = cbSex.Text.Trim();
             stamodel.staAge   = Convert.ToInt32(nudAge.Value);
             stamodel.staPhoto = mybyte;
             if (sta.Update(stamodel) == true)
             {
                 MessageBox.Show("修改成功!");
                 ((Main_Admin)this.Owner).StaffLoad();
                 this.Close();
             }
             else
             {
                 MessageBox.Show("修改失败!");
             }
         }
         else
         {
             MessageBox.Show("不存在此员工!", "修改出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }