public ChatWindows() { InitializeComponent(); initialWindow(); receiveUser = new WkTUser(); sendUser = new WkTUser(); }
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); } }
public ArrangeDuty() { InitializeComponent(); initialWindow(); duser = new WkTUser(); buser = new WkTUser(); yuser = new WkTUser(); }
public NewMessageWindow() { InitializeComponent(); loglist = new List<KjqbService.LogInService>(); schedulelist = new List<KjqbService.ScheduleInService>(); commentList = new List<KjqbService.CommentInService>(); tfmlist = new List<KjqbService.TimeArrangeForManagerInService>(); levlist = new List<KjqbService.LeaveInService>(); buslist = new List<KjqbService.BusinessService>(); user = new WkTUser(); initialWindow(); }
private void button3_Click(object sender, EventArgs e) { if (listView2.Items.Count == 0 && listView2.Items == null) { MessageBox.Show("未作人员修改"); } else { WkTUser user = new WkTUser(); foreach (ListViewItem item in listView2.Items) { user = (WkTUser)item.Tag; BusinessEmployee be = new BusinessEmployee(); be.EmployeeId=user; be.BusinessId = business; be.PassExam = (int)BusinessEmployee.ExamState.pass; business.BusinessEmployee.Add(be); } foreach (ListViewItem item in listView3.Items) { BusinessEmployee be = (BusinessEmployee)item.Tag; ; if (be.PassExam == (int)BusinessEmployee.ExamState.redo) { business.BusinessEmployee.Remove(be); } } business.PassExam = (int)Business.ExamState.pass; baseService.SaveOrUpdateEntity(business); #region 服务器通信 KjqbService.Service1Client ser = new KjqbService.Service1Client(); KjqbService.BusinessService bs = new KjqbService.BusinessService(); bs.BusinessID = business.Id; bs.ReceiveID = business.Boss.Id; bs.Type = 0; bs.TimeStamp = DateTime.Now.Ticks; ser.SaveInBusinessListInService(bs); #endregion MessageBox.Show("成功提交"); this.DialogResult = DialogResult.OK; } }
/// <summary> /// 向flow1中添加message消息 /// </summary> /// <param name="content"></param> public void AddMessageLabelInFlowPanel1(WkTUser user) { Label label = new Label(); label.Font = new Font(new FontFamily("微软雅黑"), 10, FontStyle.Regular); label.ForeColor = Color.DarkRed; label.AutoSize = true; label.Text = user.KuName; label.Margin = new System.Windows.Forms.Padding(0); label.Parent = flowLayoutPanel1; label.Cursor = Cursors.Hand; label.Tag = user; label.Click += label_Click; if (this.flowLayoutPanel1.Controls.Count > 4) { this.linkLabel1.Visible = true; this.flowLayoutPanel1.Controls.RemoveAt(0); } }
private void button1_Click(object sender, EventArgs e) { WkTUser u = new WkTUser(); baseService.loadEntity(u, 90018); List<string> entityName = new List<string>(); entityName.Add("WkTUser"); //ArrayList userList = baseService.loadEntityList(entityName, new string[,] { { "WkTUser", "Id", CommonStaticParameter.IS_NOT_STRING, textBox1.Text.Trim() }, { "WkTUser", "KuPassWD", CommonStaticParameter.IS_NOT_STRING, textBox2.Text.Trim() } }); ISQLQuery query = baseService.loadEntityList( "select * from Wk_T_User where KU_ID=" + textBox1.Text.Trim() + " and KU_PASSWD=" + textBox2.Text.Trim()); ArrayList userList = (ArrayList)query.List(); //List<string> s = new List<string>(); s.Add("Schedule"); //ArrayList userList = baseService.loadEntityList(s, new string[,] { { "Schedule", "Id", CommonStaticParameter.IS_NOT_STRING, "aaa" } }); if (userList == null||userList.Count<=0) { MessageBox.Show("用户名或密码错误!"); } else if (userList.Count > 1) { MessageBox.Show("用户异常,请联系管理员!"); } else { this.User = (WkTUser)userList[0]; this.DialogResult = DialogResult.OK; } }
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e) { this.buser = this.theuserBai[this.comboBox4.SelectedIndex]; }
private void comboBox6_SelectedIndexChanged(object sender, EventArgs e) { this.yuser = this.theuserYe[this.comboBox6.SelectedIndex]; }
private void InstantMessenger_Load(object sender, EventArgs e) { if (this.formLocation != null) { this.Location = formLocation; } createTree(treeView1); if (Chattinguserlist != null && Chattinguserlist.Count >0) { foreach (KjqbService.ChatInService chat in chattinguserlist) { WkTUser ww = new WkTUser(); ww = (WkTUser)baseService.loadEntity(ww, chat.SendUserId); if (!chatwindowsusers.Contains(ww)) { Panel pp = IsInFlowPanel2(ww); if (pp == null) { CreateWktuserInPanel(ww); Panel pp1 = IsInFlowPanel2(ww); Label ll = (Label)pp1.Controls[1]; ll.Text = "1"; } else { Label ll = (Label)pp.Controls[1]; ll.Text = (int.Parse(ll.Text) + 1).ToString(); } } } } }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { this.duser = theuserDai[this.comboBox2.SelectedIndex]; }
private Panel IsInFlowPanel2(WkTUser w) { if (flowLayoutPanel1.Controls != null&&flowLayoutPanel1.Controls.Count >0) { foreach (Control c in flowLayoutPanel1.Controls) { Panel p = (Panel)c; WkTUser t = (WkTUser)c.Tag; if (t.Id == w.Id) { return p; } } return null; } else { return null; } }
/// <summary> /// 不显示的时候则关闭线程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InstantMessenger_VisibleChanged(object sender, EventArgs e) { if (this.Visible == true) { if (this.timerOfreceiveMessageInThisWin.Enabled == false) { if (Chattinguserlist != null && Chattinguserlist.Count > 0) { foreach (KjqbService.ChatInService chat in chattinguserlist) { WkTUser ww = new WkTUser(); ww = (WkTUser)baseService.loadEntity(ww, chat.SendUserId); if (!chatwindowsusers.Contains(ww)) { Panel pp = IsInFlowPanel2(ww); if (pp == null) { CreateWktuserInPanel(ww); Panel pp1 = IsInFlowPanel2(ww); Label ll = (Label)pp1.Controls[1]; ll.Text = "1"; } else { Label ll = (Label)pp.Controls[1]; ll.Text = (int.Parse(ll.Text) + 1).ToString(); } } } } timerOfreceiveMessageInThisWin.Enabled = true; timerofrefreshOnlineTree.Enabled = true; } } else { if (this.timerOfreceiveMessageInThisWin.Enabled == true) { timerOfreceiveMessageInThisWin.Enabled = false; timerofrefreshOnlineTree.Enabled = false; } } }
private void ReceiveChattingMessage() { #region 接受聊天信息 try { KjqbService.ChatInService[] lists7; lists7 = ser.SearchChatInfo((int)this.user.Id); for (int i = 0; i < lists7.Length; i++) { chatinservice.Add(lists7[i]); if (!IsInChatUserlist(lists7[i].SendUserId)) { WkTUser w = new WkTUser(); w = (WkTUser)baseService.loadEntity(w, lists7[i].SendUserId); this.chattinguserlist.Add(w); if (sec == null) { sec = new Secretary(this); sec.Show(); sec.AddMessageLabelInFlowPanel1(w); } else { if (sec.IsDisposed) { sec = new Secretary(this); sec.Show(); } sec.AddMessageLabelInFlowPanel1(w); } this.chattinguserlist.Add(w); } } SetMessageCount(meaaageCountLabelOfXiaoXI, lists7.Length); } catch { } SetthechatingUserIsTwinkle(); #endregion }
/// <summary> /// 轮训数据库的消息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timerOfreceiveMessageInThisWin_Tick(object sender, EventArgs e) { #region 接受聊天信息 try { KjqbService.ChatInService[] lists7; lists7 = ser.SearchChatInfo((int)this.user.Id); for (int i = 0; i < lists7.Length; i++) { WkTUser ww = new WkTUser(); ww = (WkTUser)baseService.loadEntity(ww, lists7[i].SendUserId); if (!chatwindowsusers.Contains(ww)) { Panel pp = IsInFlowPanel2(ww); if (pp == null) { CreateWktuserInPanel(ww); Panel pp1 = IsInFlowPanel2(ww); Label ll = (Label)pp1.Controls[1]; ll.Text = "1"; } else { Label ll = (Label)pp.Controls[1]; ll.Text = (int.Parse(ll.Text) + 1).ToString(); } } } } catch { } #endregion }
/// <summary> ///添加人员确定按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button13_Click(object sender, EventArgs e) { if (MessageBox.Show("确实要这样做吗?", "提示信息", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (this.textBox5.Text.Trim() != "" && this.textBox6.Text.Trim() != "" && this.comboBox13.Text != "") { string sql = "select u from WkTUser u where u.KuLid = '" + this.textBox6.Text.Trim() + "'"; IList ul = baseService.loadEntityList(sql); if (ul.Count > 0) { MessageBox.Show("登录账号已存在!"); this.textBox6.Text = ""; return; } else { this.button13.Cursor = Cursors.WaitCursor; WkTUser newuser = new WkTUser(); newuser.KuName = this.textBox5.Text.Trim(); newuser.KuLid = this.textBox6.Text.Trim(); newuser.Kdid = this.AdddeptsPage6[this.comboBox13.SelectedIndex]; newuser.KuRegDate = DateTime.Now.Ticks.ToString(); IList pwd = baseService.ExecuteSQL("select right(sys.fn_VarBinToHexStr(hashbytes('MD5', '" + "123456" + "')),32)"); // 数据库属性,跟具体表无关 if (pwd == null || pwd.Count <= 0) { MessageBox.Show("登录异常!"); return; } object[] pwdArray = (object[])pwd[0]; newuser.KuPassWD = pwdArray[0].ToString(); baseService.SaveOrUpdateEntity(newuser); this.textBox6.Text = ""; this.button13.Cursor = Cursors.Hand; MessageBox.Show("添加成功,默认密码:123456,请在分配职位栏中为新人员添加职位"); } } else { MessageBox.Show("您有未填写的选项"); return; } } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if(e.ColumnIndex == 1) { userNow = (WkTUser)this.dataGridView1.Rows[e.RowIndex].Tag; string sql = "select u.DeptId from Wktuser_M_Dept u where u.WktuserId = " + ((WkTUser)this.dataGridView1.Rows[e.RowIndex].Tag).Id + " and u.State = " + (int)IEntity.stateEnum.Normal; IList theone = baseService.loadEntityList(sql); //加载数据到表2 this.dataGridView2.Rows.Clear(); if (theone != null && theone.Count > 0) { foreach (WkTDept o in theone) { this.dataGridView2.Rows.Add(o.KdName.ToString().Trim()); } } else { MessageBox.Show("您还未设置!"); } } }
/// <summary> /// 人员管理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBox7_SelectedIndexChanged(object sender, EventArgs e) { WkTUser w = new WkTUser(); //w.UserRole //w.Kdid string sql = "select u from WkTUser u left join u.Kdid dept where u.Kdid.Id = " + this.AdddeptsPage6[this.comboBox7.SelectedIndex].Id; this.comboBox8.Items.Clear(); IList users = baseService.loadEntityList(sql); if(AddUserPage6 == null) { AddUserPage6 = new List<WkTUser>(); } AddUserPage6.Clear(); if(users != null && users.Count > 0) { foreach (WkTUser u in users) { if (IsInRole(u.UserRole)) { this.comboBox8.Items.Add(u.KuName); this.AddUserPage6.Add(u); } } } }
/// <summary> /// 从时间安排表中按时间与负责人查找 /// </summary> /// <param name="user"></param> /// <param name="t1"></param> /// <param name="t2"></param> /// <returns></returns> public IList SelectManagerTime(WkTUser user , long t1, long t2) { IList i; string sql = "from TimeArrangeForManager u.Startime <= " + t1 + " and u.Endtime > " + t2 + " and u.UserId = " + user.Id; i = loadEntityList(sql); return i; }
//获取两段时间内加班时间 private string getOverTime(WkTUser user, DateTime d1,DateTime d2) { //string query3 = "from WorkOverTime w where w.WorkManId =" + user.Id + "and w.Date>" + d1.ToString("yyyyMMdd000000") + "and w.Date<=" + d2.ToString("yyyyMMdd235959"); string query3 = "from WorkOverTime w where w.WorkManId =" + user.Id + "and w.Date>=" + d1.Ticks + "and w.Date<=" + d2.Ticks; IList result3 = baseService.loadEntityList(query3); long sum = 0; if (result3 != null && result3.Count != 0) { foreach (WorkOverTime wkot in result3) { sum += wkot.DayTime; } } TimeSpan tt = new TimeSpan(sum); return (int)tt.TotalHours + "小时 " + tt.Minutes + "分"; }
private void chatListBox1_DoubleClickSubItem(object sender, ChatListEventArgs e) { ChatListSubItem cha = e.SelectSubItem; if (cha.IsTwinkle) { cha.IsTwinkle = !cha.IsTwinkle; RemoveFromChaterList(cha.userid); this.meaaageCountLabelOfXiaoXI.MessageCount = 0; } WkTUser w = new WkTUser(); w = (WkTUser)baseService.loadEntity(w, cha.userid); if (chatwindowsusers == null) { chatwindowsusers = new List<WkTUser>(); } if (!chatwindowsusers.Contains(w)) { ChatWindows chat = new ChatWindows(); chat.ReceiveUser = w; chat.SendUser = this.user; chat.Chatwindwosuser = chatwindowsusers; chat.Show(); } else { } }
//获取当日加班时间 private long getOverTimeOfDay(WkTUser user, DateTime date) { string query1 = "from WorkOverTime w where w.Date like '%" + date.Date.Ticks + "%'" + " and w.State=" + (int)WorkOverTime.stateEnum.Normal; IList result1=baseService.loadEntityList(query1); bool flag = false; long sum = 0; if (result1 != null && result1.Count != 0) { foreach (WorkOverTime wkot in result1) { foreach (WkTUser u in wkot.WorkManId) { if (u.Id == user.Id) { flag = true; } } if (flag) { sum += wkot.DayTime; flag = false; } } } return sum; }
private bool roleInUser(WkTUser u, string roleName) { IList<WkTRole> roleList = u.UserRole; foreach (WkTRole rr in roleList) { if (rr.KrName.Trim() == roleName && rr.KrDESC == "工作小秘书角色") return true; } return false; }
//获取当月加班时间 private long getOverTimeOfMonth(WkTUser user, DateTime date) { DateTime d1 = date.AddDays(-date.Day).Date; DateTime d2 = d1.AddMonths(1); string query2 = "from WorkOverTime w where w.Date>" + d1.Ticks+ "and w.Date<=" + d2.Ticks+" and w.State="+(int)WorkOverTime.stateEnum.Normal; IList result2 = baseService.loadEntityList(query2); long sum=0; bool flag = false; if (result2 != null && result2.Count != 0) { foreach (WorkOverTime wkot in result2) { foreach(WkTUser u in wkot.WorkManId) { if (u.Id == user.Id) { flag = true; } } if (flag) { sum += wkot.DayTime; flag = false; } } } return sum; }
public void PrintDutyPersonName(Panel p, WkTUser DaiBan, WkTUser Baiban, WkTUser Yeban, int Type) { if (DaiBan == null) { DaiBan = new WkTUser(); DaiBan.Id = 0; DaiBan.KuName = ""; } if (Baiban == null) { Baiban = new WkTUser(); Baiban.Id = 0; Baiban.KuName = ""; } if (Yeban == null) { Yeban = new WkTUser(); Yeban.Id = 0; Yeban.KuName = ""; } #region if (Type == 0) //行政班 { Label Duser = GetTheLabelByLocation(p, 51, 29); if (Duser == null) { Duser = new Label(); Duser.Text = DaiBan.KuName; Duser.Location = new Point(51, 29); Duser.Font = new Font("微软雅黑", 9); Duser.Parent = p; Duser.ForeColor = DaiBan.Id == user.Id ? Color.Red : Color.Black; Duser.AutoSize = true; } else { Duser.Text = DaiBan.KuName; Duser.ForeColor = DaiBan.Id == user.Id ? Color.Red : Color.Black; } Label Buser = GetTheLabelByLocation(p, 51, 49); if (Buser == null) { Buser = new Label(); Buser.Text = Baiban.KuName; Buser.Location = new Point(51, 49); Buser.Font = new Font("微软雅黑", 9); Buser.Parent = p; Buser.ForeColor = Baiban.Id == user.Id ? Color.Red : Color.Black; Buser.AutoSize = true; } else { Buser.Text = Baiban.KuName; Buser.ForeColor = Baiban.Id == user.Id ? Color.Red : Color.Black; } Label Yuser = GetTheLabelByLocation(p, 51, 67); if (Yuser == null) { Yuser = new Label(); Yuser.Text = Yeban.KuName; Yuser.Location = new Point(51, 67); Yuser.Font = new Font("微软雅黑", 9); Yuser.Parent = p; Yuser.ForeColor = Yeban.Id == user.Id ? Color.Red : Color.Black; Yuser.AutoSize = true; } else { Yuser.Text = Yeban.KuName; Yuser.ForeColor = Yeban.Id == user.Id ? Color.Red : Color.Black; } } #endregion #region 网络班 else { Label Duser = GetTheLabelByLocation(p, 91, 29); if (Duser == null) { Duser = new Label(); Duser.Text = DaiBan.KuName; Duser.Location = new Point(91, 29); Duser.Font = new Font("微软雅黑", 9); Duser.ForeColor = DaiBan.Id == user.Id ? Color.Red : Color.Black; Duser.Parent = p; Duser.AutoSize = true; } else { Duser.Text = DaiBan.KuName; Duser.ForeColor = DaiBan.Id == user.Id ? Color.Red : Color.Black; } Label Buser = GetTheLabelByLocation(p, 91, 49); if (Buser == null) { Buser = new Label(); Buser.Text = Baiban.KuName; Buser.Location = new Point(91, 49); Buser.Font = new Font("微软雅黑", 9); Buser.Parent = p; Buser.ForeColor = Baiban.Id == user.Id ? Color.Red : Color.Black; Buser.AutoSize = true; } else { Buser.Text = Baiban.KuName; Buser.ForeColor = Baiban.Id == user.Id ? Color.Red : Color.Black; } Label Yuser = GetTheLabelByLocation(p, 91, 67); if (Yuser == null) { Yuser = new Label(); Yuser.Text = Yeban.KuName; Yuser.Location = new Point(91, 67); Yuser.Font = new Font("微软雅黑", 9); Yuser.Parent = p; Yuser.ForeColor = Yeban.Id == user.Id ? Color.Red : Color.Black; Yuser.AutoSize = true; } else { Yuser.ForeColor = Yeban.Id == user.Id ? Color.Red : Color.Black; Yuser.Text = Yeban.KuName; } } #endregion }
private void CreateWktuserInPanel(WkTUser w) { Panel p1 = new Panel(); p1.Width = 123; p1.Height = 42; p1.Parent = flowLayoutPanel1; p1.Tag = w; p1.Cursor = Cursors.Hand; Label l1 = new Label(); l1.Font = new Font("微软雅黑", 13, FontStyle.Bold); l1.Text = w.KuName; l1.AutoSize = true; l1.Location = new Point(1, 11); l1.Parent = p1; Label l2 = new Label(); l2.Font = new Font("微软雅黑", 13, FontStyle.Bold); l2.Text = ""; l2.ForeColor = Color.Red; l2.AutoSize = true ; l2.Location = new Point(l1.Width+5, 11); l2.Parent = p1; l1.DoubleClick += l1_DoubleClick; }