/// <summary> /// 查看可用会议室列表 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETKYHYSLIST(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { //var list = new SZHL_HYGL_ROOMB().GetEntities(p => p.Status == "1" && p.IsDel == 0); DataTable dt = new SZHL_HYGL_ROOMB().GetDTByCommand("select * from dbo.SZHL_HYGL_ROOM where IsDel=0 and Status='1' and ComId=" + UserInfo.User.ComId); dt.Columns.Add("ZT", Type.GetType("System.String")); dt.Columns.Add("ZYSJ", Type.GetType("System.String")); foreach (DataRow dr in dt.Rows) { int rid = Int32.Parse(dr["ID"].ToString()); var st = DateTime.Now; var et = DateTime.Now.AddHours(3); var list = new SZHL_HYGLB().GetEntities(p => p.RoomID == rid && p.IsDel == 0 && ((st >= p.StartTime && st < p.EndTime) || (et > p.StartTime && et <= p.EndTime) || (et > p.StartTime && st <= p.StartTime) || (et >= p.EndTime && st < p.EndTime)) && p.ComId == UserInfo.User.ComId).OrderBy(p => p.StartTime); List <int> li = new List <int>(); foreach (var l in list) { var pi = new Yan_WF_PIB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.ID == l.intProcessStanceid); if (pi != null) { if (pi.IsCanceled == "Y") { li.Add(l.ID); } } } var list1 = list.Where(p => !li.Contains(p.ID)); if (list1.Count() == 0) { dr["ZT"] = "0"; dr["ZYSJ"] = ""; } else { dr["ZT"] = "1"; dr["ZYSJ"] = list1.First().StartTime.Value.ToString("yyyy-MM-dd HH:mm") + "~" + list1.First().EndTime.Value.ToString("yyyy-MM-dd HH:mm"); } } msg.Result = dt; }
/// <summary> /// 添加会议消息 /// </summary> /// <param name="P1"></param> public void COMPLETEWFHYGL(string P1) { int msgid = Int32.Parse(P1); var model = new SZHL_HYGLB().GetEntity(p => p.ID == msgid); if (model != null) { SZHL_TXSX tx1 = new SZHL_TXSX(); tx1.ComId = model.ComId; tx1.APIName = "HYGL"; tx1.MsgID = model.ID.ToString(); tx1.FunName = "SENDWXMSG"; tx1.Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); tx1.CRUser = model.CRUser; tx1.CRDate = DateTime.Now; TXSX.TXSXAPI.AddALERT(tx1); //时间为发送时间 } }
public void SENDMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int Id = int.Parse(P1); var model = new SZHL_HYGLB().GetEntity(d => d.ID == Id && d.ComId == UserInfo.User.ComId); var rm = new SZHL_HYGL_ROOMB().GetEntity(p => p.ID == model.RoomID && p.ComId == UserInfo.User.ComId); Article ar0 = new Article(); ar0.Title = "会议通知"; ar0.Description = "发起人:" + new JH_Auth_UserB().GetUserRealName(UserInfo.User.ComId.Value, model.CRUser) + "\r\n您有新的会议[" + model.Title + "],会议室[" + rm.Name + "],请尽快查看吧"; ar0.Url = model.ID.ToString(); List <Article> al = new List <Article>(); al.Add(ar0); //new JH_Auth_User_CenterB().SendMsg(UserInfo, "HYGL", strContent, model.ID.ToString(), model.JSR, "B", model.intProcessStanceid); WXHelp wx = new WXHelp(UserInfo.QYinfo); wx.SendTH(al, "HYGL", "A", model.CYUser); }
/// <summary> /// 会议发送提醒信息 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void SENDWXMSG_TX(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { var tx = JsonConvert.DeserializeObject <SZHL_TXSX>(P1); int msgid = Int32.Parse(tx.MsgID); UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, tx.CRUser); var model = new SZHL_HYGLB().GetEntity(p => p.ID == msgid && p.ComId == UserInfo.User.ComId); if (model != null) { var rm = new SZHL_HYGL_ROOMB().GetEntity(p => p.ID == model.RoomID && p.ComId == UserInfo.User.ComId); Article ar0 = new Article(); ar0.Title = "会议提醒"; ar0.Description = "发起人:" + UserInfo.User.UserRealName + "\r\n您有会议[" + model.Title + "],会议室[" + rm.Name + "],将于" + model.StartTime.Value.ToString("yyyy-MM-dd HH:mm") + "开始,请及时参加"; ar0.Url = model.ID.ToString(); List <Article> al = new List <Article>(); al.Add(ar0); string jsr = string.Empty; if (!string.IsNullOrEmpty(model.FQUser)) { jsr = model.FQUser; } if (!string.IsNullOrEmpty(model.CYUser)) { if (!string.IsNullOrEmpty(jsr)) { jsr = jsr + "," + model.CYUser; } else { jsr = model.CYUser; } } if (!string.IsNullOrEmpty(model.ZCUser)) { if (!string.IsNullOrEmpty(jsr)) { jsr = jsr + "," + model.ZCUser; } else { jsr = model.ZCUser; } } if (!string.IsNullOrEmpty(model.JLUser)) { if (!string.IsNullOrEmpty(jsr)) { jsr = jsr + "," + model.JLUser; } else { jsr = model.JLUser; } } if (!string.IsNullOrEmpty(model.SXUser)) { if (!string.IsNullOrEmpty(jsr)) { jsr = jsr + "," + model.SXUser; } else { jsr = model.SXUser; } } ////发送消息 string content = ar0.Description; new JH_Auth_User_CenterB().SendMsg(UserInfo, "HYGL", content, model.ID.ToString(), jsr, "B", model.intProcessStanceid, tx.ISCS); if (!string.IsNullOrEmpty(jsr)) { WXHelp wx = new WXHelp(UserInfo.QYinfo); wx.SendTH(al, "HYGL", "A", jsr); } } }
/// <summary> /// 会议管理发送消息 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void SENDWXMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { var tx = JsonConvert.DeserializeObject <SZHL_TXSX>(P1); int msgid = Int32.Parse(tx.MsgID); UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, tx.CRUser); var model = new SZHL_HYGLB().GetEntity(p => p.ID == msgid && p.ComId == UserInfo.User.ComId); if (model != null) { var user = new JH_Auth_UserB().GetUserByUserName(model.ComId.Value, model.CRUser); var rm = new SZHL_HYGL_ROOMB().GetEntity(p => p.ID == model.RoomID && p.ComId == UserInfo.User.ComId); Article ar0 = new Article(); ar0.Title = "会议通知"; ar0.Description = "发起人:" + user.UserRealName + "\r\n您有新的会议[" + model.Title + "],会议室[" + rm.Name + "],请尽快查看吧"; ar0.Url = model.ID.ToString(); List <Article> al = new List <Article>(); al.Add(ar0); string jsr = string.Empty; if (!string.IsNullOrEmpty(model.FQUser)) { jsr = model.FQUser; } if (!string.IsNullOrEmpty(model.CYUser)) { if (!string.IsNullOrEmpty(jsr)) { jsr = jsr + "," + model.CYUser; } else { jsr = model.CYUser; } } if (!string.IsNullOrEmpty(model.ZCUser)) { if (!string.IsNullOrEmpty(jsr)) { jsr = jsr + "," + model.ZCUser; } else { jsr = model.ZCUser; } } if (!string.IsNullOrEmpty(model.JLUser)) { if (!string.IsNullOrEmpty(jsr)) { jsr = jsr + "," + model.JLUser; } else { jsr = model.JLUser; } } if (!string.IsNullOrEmpty(model.SXUser)) { if (!string.IsNullOrEmpty(jsr)) { jsr = jsr + "," + model.SXUser; } else { jsr = model.SXUser; } } UserInfo = new JH_Auth_UserB().GetUserInfo(model.ComId.Value, model.CRUser); if (!string.IsNullOrEmpty(jsr)) { //发送消息 string content = user.UserRealName + "邀请您参加会议:" + model.Title; new JH_Auth_User_CenterB().SendMsg(UserInfo, "HYGL", content, model.ID.ToString(), jsr, "B", model.intProcessStanceid, tx.ISCS); WXHelp wx = new WXHelp(UserInfo.QYinfo); wx.SendTH(al, "HYGL", "A", jsr); } if (model.TXSJ > 0) { DateTime dt = model.StartTime.ToDateTime().AddMinutes(-model.TXSJ.Value); SZHL_TXSX tx1 = new SZHL_TXSX(); tx1.ComId = model.ComId; tx1.APIName = "HYGL"; tx1.MsgID = model.ID.ToString(); tx1.FunName = "SENDWXMSG_TX"; tx1.Date = dt.ToString("yyyy-MM-dd HH:mm:ss"); tx1.CRUser = model.CRUser; tx1.CRDate = DateTime.Now; TXSX.TXSXAPI.AddALERT(tx1); //时间为发送时间 //TXSX.TXSXAPI.AddALERT(UserInfo.User.ComId.Value, "HYGL", "SENDWXMSG_TX", model.ID.ToString(), dt); //时间为发送时间 } } }
/// <summary> /// 会议详细信息 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETHYGLMODEL(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int Id = int.Parse(P1); string strWhere = " 1=1 and hy.ComId=" + UserInfo.User.ComId + " and hy.ID=" + Id; string colNme = @"hy.*,hys.Name ,dbo.fn_PDStatus(hy.intProcessStanceid) AS StateName,case when hy.StartTime>getdate() then '即将开始' when hy.StartTime<=getdate() and hy.EndTime>=getdate() then '正在进行' when hy.EndTime<getdate() then '已结束' end as HLStatus "; string tableName = string.Format(@" SZHL_HYGL hy left join SZHL_HYGL_ROOM hys on hy.RoomID=hys.ID"); string strSql = string.Format("Select {0} From {1} where {2} order by hy.CRDate desc", colNme, tableName, strWhere); DataTable dt = new SZHL_HYGLB().GetDTByCommand(strSql); msg.Result = dt; if (dt.Rows.Count > 0) { if (dt.Rows[0]["Files"] != null) { string strfiles = dt.Rows[0]["Files"].ToString(); if (!string.IsNullOrEmpty(strfiles)) { msg.Result1 = new FT_FileB().GetEntities(" ID in (" + strfiles + ")"); } } //msg.Result2 = new SZHL_HYGL_QRB().GetEntities(p => p.Status == "0" && p.HYID == model.ID && p.IsDel == 0); //msg.Result3 = new SZHL_HYGL_QDB().GetEntities(p => p.IsDel == 0 && p.HYID == model.ID); var strid = dt.Rows[0]["ID"].ToString(); //打开会议即已阅 //Msg_Result msg2 = new Msg_Result(); //UPDATEHYQK(context, msg2, strid, "1", UserInfo); msg.Result2 = new JH_Auth_TLB().GetEntities(p => p.ComId == UserInfo.User.ComId && p.MSGType == "HYGL" && p.MSGTLYID == strid); var hysat = new JH_Auth_TLB().GetEntities(p => p.ComId == UserInfo.User.ComId && p.MSGType == "HYGL" && p.MSGTLYID == strid && p.CRUser == UserInfo.User.UserName && p.MsgISShow != null).OrderByDescending(p => p.CRDate).ToList(); if (hysat.Count() > 0) { string strs = string.Empty; foreach (var l in hysat) { if (string.IsNullOrEmpty(strs)) { strs = l.MsgISShow; } else { strs = strs + "," + l.MsgISShow; } } msg.Result3 = strs; } if (dt.Rows[0]["JLFiles"] != null) { string strjlfiles = dt.Rows[0]["JLFiles"].ToString(); if (!string.IsNullOrEmpty(strjlfiles)) { msg.Result4 = new FT_FileB().GetEntities(" ID in (" + strjlfiles + ")"); } } //更新消息为已读状态 new JH_Auth_User_CenterB().ReadMsg(UserInfo, Int32.Parse(strid), "HYGL"); } }
/// <summary> /// 添加会议 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void ADDHYGL(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { SZHL_HYGL HY = JsonConvert.DeserializeObject <SZHL_HYGL>(P1); if (HY == null) { msg.ErrorMsg = "添加失败"; return; } if (string.IsNullOrWhiteSpace(HY.Title)) { msg.ErrorMsg = "会议主题不能为空"; return; } if (string.IsNullOrWhiteSpace(HY.CYUser)) { msg.ErrorMsg = "参会人不能为空"; return; } if (HY.StartTime >= HY.EndTime) { msg.ErrorMsg = "开始时间必须大于结束时间"; return; } if (HY.ID == 0) { if (HY.RoomID == 0 || HY.RoomID == null) { msg.ErrorMsg = "请选择会议室!"; } else { var list = new SZHL_HYGLB().GetEntities(p => p.ComId == UserInfo.User.ComId && p.RoomID == HY.RoomID && p.IsDel == 0 && ((HY.StartTime >= p.StartTime && HY.StartTime < p.EndTime) || (HY.EndTime > p.StartTime && HY.EndTime <= p.EndTime) || (HY.EndTime > p.StartTime && HY.StartTime <= p.StartTime) || (HY.EndTime >= p.EndTime && HY.StartTime < p.EndTime))).OrderBy(p => p.StartTime); List <int> li = new List <int>(); foreach (var l in list) { var pi = new Yan_WF_PIB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.ID == l.intProcessStanceid); if (pi != null && pi.IsCanceled == "Y") { li.Add(l.ID); } } var list1 = list.Where(p => !li.Contains(p.ID)); if (list1.Count() == 0) { if (P2 != "") // 处理微信上传的图片 { string fids = new FT_FileB().ProcessWxIMG(P2, "HYGL", UserInfo); if (!string.IsNullOrEmpty(HY.Files)) { HY.Files += "," + fids; } else { HY.Files = fids; } } HY.CRDate = DateTime.Now; HY.CRUser = UserInfo.User.UserName; HY.ComId = UserInfo.User.ComId; HY.IsDel = 0; new SZHL_HYGLB().Insert(HY); } else { msg.ErrorMsg = "选择的时间段中,此会议室已经被占用!"; } //可用会议室需要优化,根据时间段来判断会议室是否可用 //List<SZHL_HYGL_ROOM> car1 = new SZHL_HYGL_ROOMB().GetEntities(d => d.ComId == UserInfo.User.ComId && d.ID == HY.RoomID && d.Status == "1" && d.IsDel == 0).ToList(); } } else { new SZHL_HYGLB().Update(HY); } msg.Result = HY; }