private void personal_dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 3) { StaffLog sf = (StaffLog)personal_dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag; writeLog wl = new writeLog(); wl.User = sf.Staff; wl.LogDate = new DateTime(sf.WriteTime); wl.IsComment = true; wl.CommentPersonName = this.User.KuName; wl.ShowDialog(); } else if (e.ColumnIndex == 4 && this.personal_dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "删除") { if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { StaffLog sf = (StaffLog)personal_dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex - 1].Tag; sf.State = (int)IEntity.stateEnum.Deleted; baseService.SaveOrUpdateEntity(sf); this.personal_dataGridView.Rows.RemoveAt(e.RowIndex); } } //else if (e.ColumnIndex == 5 && this.personal_dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "修改") //{ // StaffLog sf = (StaffLog)personal_dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag; // writeLog wl = new writeLog(); // wl.User = sf.Staff; // wl.LogDate = new DateTime(sf.WriteTime); // wl.IsComment = true; // wl.CommentPersonName = this.User.KuName; // wl.ShowDialog(); //} }
private void initData() { if (logDate == null || logDate.Equals(new DateTime(0))) { logDate = DateTime.Now; } IList staffLogList = baseService.loadEntityList("from StaffLog where State=" + (int)IEntity.stateEnum.Normal + " and WriteTime >=" + logDate.Date.Ticks + " and Staff=" + user.Id); if (staffLogList != null && staffLogList.Count > 0) { StaffLog s = (StaffLog)staffLogList[0]; htmlEditor1.BodyInnerHTML = s.Content; htmlEditor1.Tag = staffLogList[0]; SharedUser = new List <WkTUser>(); SharedUser.AddRange(s.SharedStaffs); initCommentList(s.Comments); } if (IsComment != true) { //偏好设置 IList staffHobbyList = baseService.loadEntityList("from Hobby where State=" + (int)IEntity.stateEnum.Normal + " and Staff=" + user.Id + " and TypeFlag=" + (int)Hobby.hobbyTypeEnum.RiZhi); if (staffHobbyList != null && staffHobbyList.Count > 0) { Hobby s = (Hobby)staffHobbyList[0]; SharedUser = new List <WkTUser>(); SharedUser.AddRange(s.SharedStaffs); } //当用于编写日志作用时候加载日程 long nextDay = logDate.Date.Ticks + new DateTime(1, 1, 2).Date.Ticks; IList scheduleList = baseService.loadEntityList("from StaffSchedule where State=" + (int)IEntity.stateEnum.Normal + " and Staff=" + user.Id + " and ScheduleTime>=" + logDate.Date.Ticks + " and ScheduleTime<" + nextDay + " order by ScheduleTime asc"); initScheduleList(scheduleList); } }
private static EmbedBuilder CreateUnbanEmbed(SocketGuildUser discordUser, StaffLog log) { return(new EmbedBuilder() .WithTitle($"Unban") .AddField("User", discordUser.Mention, true) .WithColor(StringToColor(log.Colour))); }
bool IsInLoglist(StaffLog ss) { foreach (KjqbService.LogInService l in loglist) { if (l.LogId == ss.Id) { return(true); } } return(false); }
/// <summary> /// 表二中查看 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 2) { StaffLog sf = (StaffLog)dataGridView2.Rows[e.RowIndex].Tag; writeLog wl = new writeLog(); wl.User = sf.Staff; wl.LogDate = new DateTime(sf.WriteTime); wl.IsComment = true; wl.CommentPersonName = this.User.KuName; wl.ShowDialog(); } }
private void share_dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5) { StaffLog thelog = new StaffLog(); object[] sf = (object[])share_dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag; thelog = (StaffLog)baseService.loadEntity(thelog, Convert.ToInt64(sf[0].ToString())); writeLog wl = new writeLog(); wl.User = thelog.Staff; wl.LogDate = new DateTime(thelog.WriteTime); wl.IsComment = true; wl.CommentPersonName = this.user.KuName; wl.ShowDialog(); } }
private void pictureBox3_Click(object sender, EventArgs e) { if (this.comment_textBox.Text.Trim().Length > 0) { StaffLog staffLog = (StaffLog)htmlEditor1.Tag; Comments comment = new Comments(); comment.Content = comment_textBox.Text.Trim(); comment.CommentPersonName = this.CommentPersonName; comment.State = (int)IEntity.stateEnum.Normal; comment.TimeStamp = DateTime.Now.Ticks; staffLog.Comments.Add(comment); baseService.SaveOrUpdateEntity(staffLog); initCommentList(staffLog.Comments); this.comment_textBox.Text = ""; #region 向服务中发送数据 try { KjqbService.Service1Client ser = new KjqbService.Service1Client(); if (comment.CommentPersonName != "") { KjqbService.CommentInService ll = new KjqbService.CommentInService(); ll.LogId = staffLog.Id; ll.CommentUserName = this.CommentPersonName; ll.LogUserId = staffLog.Staff.Id; ll.TimeStamp = DateTime.Now.Ticks; ser.SaveInCommentListInService(ll); } } catch { } #endregion this.labelMessageBox1.MessageageShow("评论成功!"); } else { this.labelMessageBox1.MessageageShow("您的评论内容为空……"); } }
private static EmbedBuilder CreateBulkDeletedEmbed(IReadOnlyCollection <Cacheable <IMessage, ulong> > messages, SocketTextChannel textChannel, StaffLog log) { return(new EmbedBuilder() .WithTitle("Messages Deleted") .AddField("Count", messages.Count) .AddField("Channel", $"{textChannel.Mention}", true) .WithColor(StringToColor(log.Colour))); }
private static EmbedBuilder CreateTimestampPunishmentEmbed(SocketUser socketUser, Punishment punishment, StaffLog log) { var instigator = log.Channel.Guild.GetUser(punishment.InstigatorID); return(new EmbedBuilder() .WithTitle(punishment.Type.ToString().ToSentenceCase()) .AddField("User", socketUser.Mention, inline: true) .AddField("Reason", punishment.Reason, inline: true) .AddField("By", instigator.Mention, inline: true) .AddField("Start", punishment.Start.ToTimestamp()) .AddField("End", punishment.End.ToTimestamp(), inline: true) .WithColor(StringToColor(log.Colour))); }
void l1_Click(object sender, EventArgs e) { LinkLabel l1 = (LinkLabel)sender; if (l1.Tag.GetType() == typeof(KjqbService.LogInService)) { KjqbService.LogInService ll = (KjqbService.LogInService)l1.Tag; StaffLog ss = new StaffLog(); ss = (StaffLog)baseService.loadEntity(ss, ll.LogId); if (ss.State == 0) { writeLog wl = new writeLog(); wl.User = ss.Staff; wl.LogDate = new DateTime(ss.WriteTime); wl.IsComment = true; wl.CommentPersonName = this.User.KuName; wl.ShowDialog(); } else { MessageBox.Show("该篇日志作者已经删除"); } } else if (l1.Tag.GetType() == typeof(KjqbService.CommentInService)) { KjqbService.CommentInService ll = (KjqbService.CommentInService)l1.Tag; StaffLog ss = new StaffLog(); ss = (StaffLog)baseService.loadEntity(ss, ll.LogId); if (ss.State == 0) { writeLog wl = new writeLog(); wl.User = ss.Staff; wl.LogDate = new DateTime(ss.WriteTime); wl.IsComment = true; wl.CommentPersonName = this.User.KuName; wl.ShowDialog(); } else { MessageBox.Show("该篇日志作者已经删除"); } } else if (l1.Tag.GetType() == typeof(KjqbService.ScheduleInService)) { KjqbService.ScheduleInService ll = (KjqbService.ScheduleInService)l1.Tag; StaffSchedule ss = new StaffSchedule(); ss = (StaffSchedule)baseService.loadEntity(ss, ll.ScheduleId); DateTime dt = new DateTime(ss.ScheduleTime); MessageBox.Show(dt.ToString("yyyy-MM-dd HH:mm:ss") + " :" + ss.Content); } else if (l1.Tag.GetType() == typeof(KjqbService.LeaveInService)) { //KjqbService.LeaveInService ll = (KjqbService.LeaveInService)l1.Tag; //LeaveManage tt = new LeaveManage(); //tt = (LeaveManage)baseService.loadEntity(tt, ll.LeaveId); if (leaveWindow == null || leaveWindow.IsDisposed) { leaveWindow = new Leave(); leaveWindow.Leaveman = this.user; leaveWindow.Role = role; } if (!leaveWindow.Created) { leaveWindow.Show(); } else { leaveWindow.WindowState = FormWindowState.Normal; leaveWindow.Focus(); } } else if (l1.Tag.GetType() == typeof(KjqbService.BusinessService)) { if (businessManagement == null || businessManagement.IsDisposed) { businessManagement = new BusinessManagement(); } if (!businessManagement.Created) { businessManagement.User = this.User; businessManagement.Role = this.Role; businessManagement.Show(); } else { businessManagement.WindowState = FormWindowState.Normal; businessManagement.Focus(); } } }
private void NewMessageWindow_Load(object sender, EventArgs e) { if (this.formLocation != null) { this.Location = formLocation; } if (loglist != null && loglist.Count > 0) { loglist.Reverse(); foreach (KjqbService.LogInService ll in Loglist) { StaffLog ss = new StaffLog(); ss = (StaffLog)baseService.loadEntity(ss, ll.LogId); LinkLabel l1 = new LinkLabel(); l1.Text = ss.Staff.KuName + "分享给您的日志"; l1.Width = this.flowLayoutPanel1.Width - 10; l1.Height = 30; l1.Top = 10; l1.Tag = ll; l1.Click += l1_Click; l1.Parent = flowLayoutPanel1; l1.DoubleClick += l1_DoubleClick; } } if (schedulelist != null && schedulelist.Count > 0) { schedulelist.Reverse(); foreach (KjqbService.ScheduleInService ll in schedulelist) { StaffSchedule ss = new StaffSchedule(); //string sql = "select u from StaffLog u where u.Id = " + ll.LogId; ss = (StaffSchedule)baseService.loadEntity(ss, ll.ScheduleId); LinkLabel l1 = new LinkLabel(); l1.Width = this.flowLayoutPanel1.Width - 10; l1.Height = 30; l1.Top = 10; l1.Tag = ll; l1.Click += l1_Click; l1.Parent = flowLayoutPanel1; l1.DoubleClick += l1_DoubleClick; if (ss.Staff.Id == ss.ArrangeMan.Id) { l1.Text = ss.Staff.KuName + "分享给您的日程"; } else if (ss.Staff.Id != ss.ArrangeMan.Id) { l1.Text = ss.ArrangeMan.KuName + "给您安排的日程"; } } } if (commentList != null && commentList.Count > 0) { commentList.Reverse(); foreach (KjqbService.CommentInService ll in commentList) { StaffLog ss = new StaffLog(); //string sql = "select u from StaffLog u where u.Id = " + ll.LogId; ss = (StaffLog)baseService.loadEntity(ss, ll.LogId); LinkLabel l1 = new LinkLabel(); l1.Text = ll.CommentUserName + "评论了您的日志"; l1.Width = this.flowLayoutPanel1.Width - 10; l1.Height = 30; l1.Top = 10; l1.Tag = ll; l1.Click += l1_Click; l1.DoubleClick += l1_DoubleClick; l1.Parent = flowLayoutPanel1; } } if (tfmlist != null && tfmlist.Count > 0) { tfmlist.Reverse(); foreach (KjqbService.TimeArrangeForManagerInService tfm in tfmlist) { TimeArrangeForManager tt = new TimeArrangeForManager(); tt = (TimeArrangeForManager)baseService.loadEntity(tt, tfm.TimeArrangeForManagerId); LinkLabel l1 = new LinkLabel(); l1.Width = this.flowLayoutPanel1.Width - 10; l1.Height = 30; l1.Top = 10; l1.Tag = tfm; l1.Click += l1_Click; l1.DoubleClick += l1_DoubleClick; l1.Parent = flowLayoutPanel1; DateTime dt = new DateTime(tt.TimeMonth); if (tfm.ExamineOrExamineresult == 0) { l1.Text = dt.ToString("yyyy年MM月") + " " + "排班待您审核"; } if (tfm.ExamineOrExamineresult == 1) { l1.Text = dt.ToString("yyyy年MM月") + " " + "排班审核通过"; } if (tfm.ExamineOrExamineresult == 2) { l1.Text = dt.ToString("yyyy年MM月") + " " + "排班审核未通过"; } if (tfm.ExamineOrExamineresult == 3) { l1.Text = "请您安排" + dt.ToString("yyyy年MM月") + "的值班"; } } } if (levlist != null && levlist.Count > 0) { levlist.Reverse(); foreach (KjqbService.LeaveInService tfm in levlist) { LeaveManage tt = new LeaveManage(); tt = (LeaveManage)baseService.loadEntity(tt, tfm.LeaveId); LinkLabel l1 = new LinkLabel(); l1.Width = this.flowLayoutPanel1.Width - 10; l1.Height = 30; l1.Top = 10; l1.Tag = tfm; l1.Click += l1_Click; l1.DoubleClick += l1_DoubleClick; l1.Parent = flowLayoutPanel1; if (tfm.ExamineOrExamineresult == 0) { l1.Text = tt.Ku_Id.KuName + "请假申请待您审核"; } DateTime dt1 = new DateTime(tt.StartTime); DateTime dt2 = new DateTime(tt.EndTime); if (tfm.ExamineOrExamineresult == 1) { l1.Text = "您提交的" + tt.LeaveType + "申请审核通过"; } if (tfm.ExamineOrExamineresult == 2) { l1.Text = "您提交的" + tt.LeaveType + "申请审核未通过"; } } } if (buslist != null && buslist.Count > 0) { buslist.Reverse(); foreach (KjqbService.BusinessService tfm in buslist) { // tt = new LeaveManage(); //tt = (LeaveManage)baseService.loadEntity(tt, tfm.LeaveId); LinkLabel l1 = new LinkLabel(); l1.Width = this.flowLayoutPanel1.Width - 10; l1.Height = 30; l1.Top = 10; l1.Tag = tfm; l1.Click += l1_Click; l1.DoubleClick += l1_DoubleClick; l1.Parent = flowLayoutPanel1; if (tfm.Type == 0) { l1.Text = "您有一条出差信息待审批"; } else if (tfm.Type == 1) { l1.Text = "您的出差申请被退回"; } else if (tfm.Type == 2) { l1.Text = "您的出差申请被撤销"; } else if (tfm.Type == 3) { l1.Text = "您的出差申请审核通过"; } } } }
private void button1_Click(object sender, EventArgs e) { #region 图片并生成新html Regex r = new Regex("<IMG[\\s\\S]*?>"); MatchCollection mc = r.Matches(htmlEditor1.BodyInnerHTML); ///string[] mc = CommonClass.HtmlUtility.GetElementsByTagName(htmlEditor1.BodyInnerHTML, "IMG"); String html = htmlEditor1.BodyInnerHTML; Uri endpoint = new Uri(Securit.DeDES(IniReadAndWrite.IniReadValue("fileManage", "filePath"))); for (int i = 0; i < mc.Count; i++) { if (mc[i].Value.Contains("src=\"http://")) { continue; } using (WebClient myWebClient = new WebClient()) { myWebClient.UploadFileCompleted += new UploadFileCompletedEventHandler(uploadCompleted); String imgHtml = mc[i].Value; string inPath = HtmlUtility.GetTitleContent(imgHtml, "img", "src"); //imgHtml.Substring(startIndex, imgHtml.LastIndexOf("\"") - startIndex); try { String newName = user.Id + "_" + DateTime.Now.Ticks + inPath.Substring(inPath.LastIndexOf(".")); String tempPath = Application.StartupPath.ToString() + "\\temp\\" + newName; File.Copy(inPath, tempPath, true); myWebClient.UploadFileAsync(endpoint, tempPath); String newString2 = imgHtml.Remove(imgHtml.IndexOf("src"), inPath.Length + 6);//.Remove(imgHtml.LastIndexOf('>'))+" src=\"" + Securit.DeDES(IniReadAndWrite.IniReadValue("fileManage", "savePath")) + newName + "\">"; string newString1 = newString2.Remove(newString2.LastIndexOf('>')); string newString = newString1 + " src=\"" + Securit.DeDES(IniReadAndWrite.IniReadValue("fileManage", "savePath")) + @"LogPic\" + newName + "\">"; //html html = html.Replace(mc[i].Value, newString); } catch (Exception exp) { MessageBox.Show(exp.ToString()); return; } } } #endregion StaffLog staffLog = null; if (htmlEditor1.Tag == null) { staffLog = new StaffLog(); } else if (htmlEditor1.Tag != null) { staffLog = (StaffLog)htmlEditor1.Tag; } staffLog.Content = html; staffLog.State = (int)IEntity.stateEnum.Normal; staffLog.WriteTime = DateTime.Now.Ticks; staffLog.TimeStamp = DateTime.Now.Ticks; staffLog.Staff = user; staffLog.SharedStaffs = sharedUser; try { if (staffLog.Id == 0) { object be = baseService.saveEntity(staffLog); staffLog.Id = int.Parse(be.ToString()); } else if (staffLog.Id != 0) { baseService.SaveOrUpdateEntity(staffLog); } #region 向服务中发送数据 try { KjqbService.Service1Client ser = new KjqbService.Service1Client(); if (sharedUser != null && sharedUser.Count > 0) { foreach (WkTUser u in sharedUser) { KjqbService.LogInService ll = new KjqbService.LogInService(); ll.LogId = staffLog.Id; ll.WriteUserId = this.user.Id; ll.ShareUserId = u.Id; ll.TimeStamp = DateTime.Now.Ticks; ser.SaveInLogListInService(ll); } } } catch { } #endregion } catch { MessageBox.Show("保存失败!"); return; } MessageBox.Show("保存成功!"); this.DialogResult = DialogResult.OK; this.Close(); }