/// <summary> /// 按部门与名字查询员工 /// </summary> /// <param name="name"></param> /// <param name="seldetp"></param> /// <returns></returns> public IList GetSelectYuanGong(string name ,WkTDept seldetp) { IList i; string sql = "from WkTUser u where u.KuName like '%" + name + "%' and u.Kdid = " + seldetp.Id; i = loadEntityList(sql); return i; }
private void BusinessChange_Load(object sender, EventArgs e) { beList = (ArrayList)this.Tag; origin=(ArrayList)beList.Clone(); user = ((BusinessEmployee)beList[0]).EmployeeId; dept = user.Kdid; business = ((BusinessEmployee)beList[0]).BusinessId; foreach (BusinessEmployee be in beList) { ListViewItem item = new ListViewItem(); item.Text = be.EmployeeId.KuName; item.Tag = be; listView1.Items.Add(item); } IList udList=getUserByDept(dept); foreach (WkTUser ud in udList) { ListViewItem item = new ListViewItem(); item.Text = ud.KuName; item.Tag = ud; listView2.Items.Add(item); } }
/// <summary> /// 查询部门负责人 /// </summary> /// <param name="seldetp"></param> /// <returns></returns> public IList GetDeptLeader(WkTDept seldetp) { IList i; string sql = "select u from WkTUser u left join u.UserRole r where u.Kdid = " + seldetp.Id + " and r.KrOrder = 2 "; i = loadEntityList(sql); return i; }
//获取登陆人所在部门 private IList getUserByDept(WkTDept dept) { string queryUser = "******" + dept.Id; return baseService.loadEntityList(queryUser); }
private void initTabPage1() { textBox1.Text = User.KuName; string query = "from WkTDept"; IList depList = baseService.loadEntityList(query); WkTDept dep = new WkTDept(); depList.Remove(depList[0]); comboBox1.DataSource = depList; comboBox1.DisplayMember = "KdName"; comboBox1.ValueMember = "Itself"; listView9.Items.Clear(); IList Boss = getBoss(); foreach (WkTUser b in Boss) { ListViewItem item = new ListViewItem(); item.Text = b.KuName; item.Tag = b; listView9.Items.Add(item); } listView9.SelectedItems.Clear(); }
private void upDateListView1(WkTDept dep) { listView1.Items.Clear(); IList subUsers = getUserByDept(dep); DateTime date = dateTimePicker1.Value; foreach (WkTUser u in subUsers) { TimeSpan tOfDay =new TimeSpan ( getOverTimeOfDay(u, date)); TimeSpan tOfMonth =new TimeSpan( getOverTimeOfMonth(u, date)); ListViewItem item = new ListViewItem(); //item.Checked = true; item.SubItems.Add(u.KuName); item.SubItems.Add(tOfDay.Hours.ToString ()+"小时"+tOfDay.Minutes.ToString()+"分"); item.SubItems.Add(tOfMonth.Hours.ToString() + "小时" + tOfMonth.Minutes.ToString() + "分"); item.Tag = u; listView1.Items.Add(item); } }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedTab.Text=="安排概览") { string query = "from WkTDept"; IList depList = baseService.loadEntityList(query); WkTDept dep = new WkTDept(); dep.KdName = "所有部门"; depList.RemoveAt(0); depList.Insert(0, dep); comboBox2.DataSource = depList; comboBox2.DisplayMember = "KdName"; comboBox2.ValueMember = "Itself"; upDateListView2(new DateTime(1900,1,1),new DateTime(2099,1,1),""); } if (tabControl1.SelectedTab.Text == "加班统计") { string query = "from WkTDept"; IList depList = baseService.loadEntityList(query); //WkTDept dep = new WkTDept(); depList.RemoveAt(0); comboBox1.DataSource = depList; comboBox1.DisplayMember = "KdName"; comboBox1.ValueMember = "Itself"; initPage3(); } if (tabControl1.SelectedTab.Text == "加班取消") { initPage4(); } }
private void redoForm_Load(object sender, EventArgs e) { this.MaximizeBox = false; string query = "from WkTDept"; IList depList = baseService.loadEntityList(query); WkTDept dep = new WkTDept(); depList.Remove(depList[0]); comboBox1.DataSource = depList; comboBox1.DisplayMember = "KdName"; comboBox1.ValueMember = "Itself"; empList = new List<WkTUser>(); int i=1; foreach (BusinessEmployee be in business.BusinessEmployee) { ListViewItem item = new ListViewItem(); item.Text =i.ToString(); item.SubItems.Add(be.EmployeeId.KuName); item.SubItems.Add(be.EmployeeId.Kdid.KdName.Trim()); switch (be.PassExam) { case(int) BusinessEmployee.ExamState.redo: item.SubItems.Add("退回"); break; case (int)BusinessEmployee.ExamState.pass: item.SubItems.Add("通过审核"); break; } i++; item.Tag = be; listView3.Items.Add(item); } }
/// <summary> /// 添加新部门 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button15_Click(object sender, EventArgs e) { if(this.textBox4.Text.Trim() != "") { if (MessageBox.Show("确定要添加吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { WkTDept newdept = new WkTDept(); newdept.KdName = this.textBox4.Text.Trim(); baseService.SaveOrUpdateEntity(newdept); MessageBox.Show("添加成功!"); } } }