private void EditMenuItem_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = sender as MenuItem; if (menuItem == null) { return; } StackPanel meeting = menuItem.CommandTarget as StackPanel; if (meeting == null) { return; } MeetingInfo meetingInfo = new MeetingInfo(); meetingInfo.Meeting = App.Repository.GetMeetingsTable().GetMeeting((int)meeting.Tag); meetingInfo.MeetingType = MeetingInfo.TYPE.EDIT_MEETING; if (meetingInfo.ShowDialog() == true) { if (App.Repository.GetMeetingsTable().ChangeMeeting(meetingInfo.Meeting)) { RefillMeetings(); MessageBox.Show(Properties.Resources.SuccessDescription, Properties.Resources.SuccessTitle, MessageBoxButton.OK); } else { MessageBox.Show(Properties.Resources.ErrorDescription, Properties.Resources.ErrorTitle, MessageBoxButton.OK); } } }
private void ContentItem_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { StackPanel item = sender as StackPanel; if (item == null) { return; } int meetingId = (int)item.Tag; MeetingInfo meetingInfo = new MeetingInfo(); meetingInfo.Meeting = App.Repository.GetMeetingsTable().GetMeeting(meetingId); meetingInfo.MeetingType = MeetingInfo.TYPE.VIEW_MEETING; meetingInfo.ShowDialog(); }
/// <summary> /// 开始会议 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void startMeeting_Click(object sender, EventArgs e) { startMeeting.Select(); #region 初始化会议空间 //检查输入是否有误或者为空的情况 if (MeetingTopic.Text.Trim().Equals("")) { MessageBox.Show("会议主题不能为空!"); MeetingTopic.Focus(); return; } if (MeetingDepartment.Text.Trim().Equals("")) { MessageBox.Show("请填写会议组办部门!"); MeetingDepartment.Focus(); return; } if (MeetingCreater.Text.Trim().Equals("")) { MessageBox.Show("请填写会议组办人!"); MeetingCreater.Focus(); return; } //进入会议,新增记录,access数据库 GlobalInfo.MeetingTopic = MeetingTopic.Text.Trim(); GlobalInfo.MeetingDepart = MeetingDepartment.Text.Trim(); GlobalInfo.MeetingCreater = MeetingCreater.Text.Trim(); GlobalInfo.MeetingCreatTime = DateTime.Now; //新数据库 OleDbConnection oc = GlobalInfo.GlobalConnection; oc.Open(); string sql = "insert into meetingtable(topic,department,creater,createtime,uuid) values(@topic,@deparment,@creater,@createtime,@uuid)"; OleDbCommand ocmd = new OleDbCommand(sql, oc); ocmd.Parameters.Add("topic", OleDbType.Char); ocmd.Parameters.Add("department", OleDbType.Char); ocmd.Parameters.Add("creater", OleDbType.Char); ocmd.Parameters.Add("createtime", OleDbType.Date); ocmd.Parameters.Add("uuid", OleDbType.Char); ocmd.Parameters["topic"].Value = GlobalInfo.MeetingTopic; ocmd.Parameters["department"].Value = GlobalInfo.MeetingDepart; ocmd.Parameters["creater"].Value = GlobalInfo.MeetingCreater; ocmd.Parameters["createtime"].Value = GlobalInfo.MeetingCreatTime; ocmd.Parameters["uuid"].Value = DataService.DataService.generateUUID(); try { ocmd.ExecuteNonQuery(); ocmd.Dispose(); oc.Close(); //写日志 string msg = "[" + GlobalInfo.MeetingCreatTime + "]:" + "创建会议成功"; string path = Application.StartupPath + "//log.txt"; if (File.Exists(path)) { File.Delete(path); } DataService.LogManager.logInfo(path, msg); //启动会议 MeetingInfo mi = new MeetingInfo(); this.Visible = false; try { mi.ShowDialog(); } catch (Exception ex) { Console.WriteLine(ex.Message); } this.Visible = true; } catch (Exception ex) { ocmd.Dispose(); oc.Close(); MessageBox.Show("会议创建失败!" + ex.Message); //写日志 string msg = "\r\n" + GlobalInfo.MeetingCreatTime + "创建会议失败"; string path = Application.StartupPath + "//log.txt"; DataService.LogManager.logInfo(path, msg); } #endregion }