public void SUREXXFB(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { //更新审核状态 int Id = int.Parse(P1); SZHL_XXFB model = new SZHL_XXFBB().GetEntity(d => d.ID == Id); if (model.SHStatus != 2) { model.SHStatus = 2; new SZHL_XXFBB().Update(model); //给接收人发送消息 SZHL_TXSX tx = new SZHL_TXSX(); tx.ComId = UserInfo.User.ComId; tx.APIName = "XXFB"; tx.TXMode = "XXFB"; tx.MsgID = model.ID.ToString(); tx.CRUser = UserInfo.User.UserName; tx.FunName = "SENDWXMSG"; tx.Date = model.FBTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); TXSX.TXSXAPI.AddALERT(tx); //时间为发送时间 } else { msg.ErrorMsg = "此新闻公告已确认发布,请更新列表"; } }
public void GETXXFBTYPETOP(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { //获取信息发布分类下的第一条公告 string strSql = string.Format(@"SELECT * from ( SELECT xxtype.ID typeId,xxtype.TypeName,xxfb.XXTitle,xxfb.CRDate,xxfb.ID, ROW_NUMBER() OVER (PARTITION BY xxtype.TypeName ORDER BY xxfb.CRDate DESC) NewIndex FROM SZHL_XXFBType xxtype LEFT JOIN SZHL_XXFB xxfb on xxtype.ID=xxfb.XXFBType AND ','+xxfb.JSUser+',' like '%,{0},%' where xxtype.ComId={1} ) newTab where newTab.NewIndex=1 ORDER by newTab.CRDate DESC" , UserInfo.User.UserName, UserInfo.User.ComId); DataTable dt = new SZHL_XXFBB().GetDTByCommand(strSql); dt.Columns.Add("msgcount"); string strSql1 = string.Format(@"SELECT xxfbitem.XXTitle,xxfb.ID,xxfb.XXFBType from SZHL_XXFB xxfb INNER join SZHL_XXFB_ITEM xxfbitem on xxfb.ID=xxfbitem.XXFBId inner join JH_Auth_User_Center center on center.MsgModeID='XXFB' and center.DataId=xxfbitem.ID and center.isRead=0 where xxfb.ComId={0} and center.UserTO='{1}' ", UserInfo.User.ComId, UserInfo.User.UserName); DataTable dtXXFB = new SZHL_XXFBB().GetDTByCommand(strSql1); string strSql2 = string.Format("SELECT * from SZHL_XXFB where ComId={0} and IsSend=1 and ((CRUser='******' and SHStatus=1) or (SHUser='******' and SHStatus=0))", UserInfo.User.ComId, UserInfo.User.UserName); DataTable dtSHXXFB = new SZHL_XXFBB().GetDTByCommand(strSql2); foreach (DataRow row in dt.Rows) { if (!string.IsNullOrEmpty(row["ID"].ToString())) { row["msgcount"] = dtXXFB.Select(" XXFBType=" + row["typeId"]).Count() + dtSHXXFB.Select("XXFBType=" + row["typeId"]).Count(); } } msg.Result = dt; }
//获取需要登录人审核的数据 public void GETXXFBLIST_DSH(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int page = 0; int.TryParse(context.Request["p"] ?? "1", out page); string strWhere = string.Format("SZHL_XXFB.ComId='{0}' and SZHL_XXFB.SHUser='******' and SHStatus=0 and IsSend='1'and SZHL_XXFB.MsgType=1 ", UserInfo.User.ComId, UserInfo.User.UserName); if (P1 != "") { strWhere += string.Format(" And (SZHL_XXFB.XXTitle like '%{0}%')", P1); } if (P2 != "") { if (!P2.Contains('-')) { strWhere += string.Format(" and ( xxtype.Id={0} ) ", P2); } else { strWhere += string.Format(" and ( xxtype.Id={0} or TypePath+'-' like '{1}-%') ", P2.Split('-').LastOrDefault(), P2); } } int recordCount = 0; DataTable dt = new SZHL_XXFBB().GetDataPager("SZHL_XXFB inner join SZHL_XXFBType xxtype on XXFBType=xxtype.ID ", " SZHL_XXFB.*,xxtype.TypeName", 8, page, "IsSend asc, FBTime desc", strWhere, ref recordCount); msg.Result = dt; msg.Result1 = Math.Ceiling(recordCount * 1.0 / 8);; }
//获取接收的发布信息,已审核过的信息 public void GETXXFBLISTWX(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int page = 0; int pagecount = 8; int.TryParse(context.Request["p"] ?? "1", out page); //页码 int.TryParse(context.Request["pagecount"] ?? "8", out pagecount); //页数 string strWhere = string.Format("SZHL_XXFB.ComId='{0}' and IsSend='1' and MsgType=1 and (((SHstatus='2' and (','+SZHL_XXFB.JSUser+',' LIKE '%,{1},%' or SZHL_XXFB.JSUser='')) and FBTime<=getdate()) or (SHStatus=0 and SHUser='******')or (SHStatus=1 and SZHL_XXFB.CRUser='******')) ", UserInfo.User.ComId, UserInfo.User.UserName); if (P1 != "") { strWhere += string.Format(" And (SZHL_XXFB.XXTitle like '%{0}%' )", P1); } if (P2 != "") { strWhere += string.Format(" and ( xxtype.Id={0} or TypePath like '{1}%') ", P2.Split('-').LastOrDefault(), P2); } int recordCount = 0; DataTable dt = new SZHL_XXFBB().GetDataPager("SZHL_XXFB inner join SZHL_XXFBType xxtype on XXFBType=xxtype.ID", " SZHL_XXFB.*,xxtype.TypeName", pagecount, page, "SHstatus asc,IsSend asc, FBTime desc", strWhere, ref recordCount); if (dt.Rows.Count > 0) { dt.Columns.Add("Item", Type.GetType("System.Object")); foreach (DataRow dr in dt.Rows) { int xid = Int32.Parse(dr["ID"].ToString()); var list = new SZHL_XXFB_ITEMB().GetEntities(p => p.XXFBId == xid); dr["Item"] = list; } } msg.Result = dt; msg.Result1 = Math.Ceiling(recordCount * 1.0 / 8); }
//获取需要审核的信息 public void GETXXFBLISTWXSH(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int page = 0; int.TryParse(context.Request["p"] ?? "1", out page); // string strWhere = string.Format("SZHL_XXFB.ComId='{0}' and IsSend=1 and MsgType=1 and FBTime<=getdate() ", UserInfo.User.ComId); if (P1 == "1") //显示待发布列表 { strWhere += string.Format(" and SZHL_XXFB.CRUser='******' ", UserInfo.User.UserName); } else //默认显示待审核列表 { strWhere += string.Format(" and SZHL_XXFB.SHUser='******' ", UserInfo.User.UserName); } int recordCount = 0; DataTable dt = new SZHL_XXFBB().GetDataPager("SZHL_XXFB inner join SZHL_XXFBType xxtype on XXFBType=xxtype.ID", " SZHL_XXFB.*,xxtype.TypeName", 8, page, " FBTime desc", strWhere, ref recordCount); if (dt.Rows.Count > 0) { dt.Columns.Add("Item", Type.GetType("System.Object")); foreach (DataRow dr in dt.Rows) { int xid = Int32.Parse(dr["ID"].ToString()); var list = new SZHL_XXFB_ITEMB().GetEntities(p => p.XXFBId == xid); dr["Item"] = list; } } msg.Result = dt; msg.Result1 = Math.Ceiling(recordCount * 1.0 / 8); }
//获取所有子项列表 public void GETXXFBUSERCHILDREN(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strSql = string.Format(@"SELECT DISTINCT type.* from SZHL_XXFBType type inner join SZHL_XXFB xxfb on type.ID=xxfb.XXFBType where xxfb.ComId={0} and ','+xxfb.JSUser+',' LIKE '%,{1},%'", UserInfo.User.ComId, UserInfo.User.UserName); DataTable dt = new SZHL_XXFBB().GetDTByCommand(strSql); if (dt.Rows.Count > 0) { string pIds = ""; string Ids = ""; foreach (DataRow row in dt.Rows) { pIds += row["PTypeID"] + ","; Ids += row["Id"] + ","; } pIds = pIds.Substring(0, pIds.Length - 1); Ids = Ids.Substring(0, Ids.Length - 1); string strSql1 = string.Format("SELECT * from SZHL_XXFBType where Id in ({0}) and isDel=0 and ComId={1} order by PTypeID", pIds, UserInfo.User.ComId, Ids); DataTable dtParentType = new SZHL_XXFBTypeB().GetDTByCommand(strSql1); foreach (DataRow row in dt.Rows) { string parentTypeName = ""; if (!string.IsNullOrEmpty(row["TypePath"].ToString())) { DataTable parentRow = dtParentType.Where("ID in (" + row["TypePath"].ToString().Replace('-', ',') + ")").OrderBy(" ID asc "); foreach (DataRow prow in parentRow.Rows) { parentTypeName = parentTypeName + (parentTypeName != "" ? "-" : "") + prow["TypeName"]; } row["TypeName"] = parentTypeName + (parentTypeName != "" ? "-" : "") + row["TypeName"]; } } msg.Result = dt; } }
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); var model = new SZHL_XXFBB().GetEntity(p => p.ID == msgid); UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, model.CRUser); if (model != null) { var item = new SZHL_XXFB_ITEMB().GetEntities(d => d.XXFBId == model.ID); if (item.Count() > 0) { List <Article> Msgs = new List <Article>(); foreach (var v in item) { new JH_Auth_User_CenterB().SendMsg(UserInfo, "XXFB", model.CRUserName + "发布了一个企业信息", v.ID.ToString(), model.JSUser); Article ar = new Article(); ar.Title = v.XXTitle; ar.Description = v.XXTitle; ar.PicUrl = v.ImageIds.Split(',')[0]; ar.Url = v.ID.ToString(); Msgs.Add(ar); } WXHelp wx = new WXHelp(UserInfo.QYinfo); wx.SendTH(Msgs, "XXFB", "A", model.JSUser); } } }
//删除素材 public void DELMATTER(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int Id = int.Parse(P1); SZHL_XXFB xxfb = new SZHL_XXFBB().GetEntity(d => d.ID == Id); xxfb.SCUser = ("," + xxfb.SCUser + ",").Replace(UserInfo.User.UserName + ",", "").Trim(','); new SZHL_XXFBB().Update(xxfb); }
public void GETMOBILEINDEX(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strSql = string.Format(@"SELECT top 3 item.* from SZHL_XXFB_ITEM item inner join SZHL_XXFB xxfb on item.XXFBId=xxfb.ID where item.ComId={0} and xxfb.IsSend='1' and SHStatus=2 and (','+xxfb.JSUser+',' LIKE '%,{1},%' or xxfb.JSUser='') order by xxfb.FBTime DESC", UserInfo.User.ComId, UserInfo.User.UserName); DataTable dt = new SZHL_XXFBB().GetDTByCommand(strSql); msg.Result = dt; }
public void DELDRAFTS(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int ID = int.Parse(P1); SZHL_XXFB xxfb = new SZHL_XXFBB().GetEntity(d => d.ID == ID && d.IsSend == "0" && d.ComId == UserInfo.User.ComId); if (xxfb != null) { new SZHL_XXFBB().Delete(xxfb); new SZHL_XXFB_ITEMB().Delete(d => d.XXFBId == xxfb.ID); } }
public void GETSHXXFBLIST(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int page = 0; int.TryParse(context.Request["p"] ?? "1", out page); string strWhere = string.Format(" fgtype.IsCheck='True' and ','+fgtype.CheckUser+',' LIKE '%,{0},%' and fb.ComId={1} and fb.MsgType=1", UserInfo.User.UserName, UserInfo.User.ComId); int recordCount = 0; DataTable dt = new SZHL_XXFBB().GetDataPager("SZHL_XXFB fb inner join SZHL_XXFBType fgtype on fb.TypeID=fgtype.ID", " fb.*,fgtype.TypeName,fgtype.CheckUser", 8, page, " FBTime desc", strWhere, ref recordCount); msg.Result = dt; msg.Result1 = recordCount; }
public void GETXXFBMODEL(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int Id = int.Parse(P1); SZHL_XXFB model = new SZHL_XXFBB().GetEntity(d => d.ID == Id && d.ComId == UserInfo.User.ComId); model.Remark = new SZHL_XXFBTypeB().GetEntity(p => p.ID == model.XXFBType).TypeName; msg.Result = model; msg.Result1 = new SZHL_XXFBB().GetDTByCommand(" SELECT ID,MSGTLYID,MSGType,MSGContent,CRDate,CRUser,CRUserName FROM JH_Auth_TL WHERE MSGType='XXFB' AND MSGTLYID='" + P1 + "'"); if (!string.IsNullOrEmpty(model.Files)) { msg.Result2 = new FT_FileB().GetEntities(" ID in (" + model.Files + ")"); } msg.Result3 = new JH_Auth_User_CenterB().GetEntities(d => d.DataId == P1 && d.MsgModeID == "xxfb" && d.isRead == 0).Select(d => d.UserTO); msg.Result4 = new SZHL_XXFB_ITEMB().GetEntities(d => d.XXFBId == model.ID); }
/// <summary> /// 信息发布审核 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void SHXXFB(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strSql = string.Format("UPDATE SZHL_XXFB set SHStatus={0} ,SHYJ='{1}',SHDate=getdate() where ID in ({2}) and ComId={3}", P2, context.Request["jy"] ?? "", P1, UserInfo.User.ComId); new SZHL_XXFBB().ExsSql(strSql); int[] Ids = P1.SplitTOInt(','); foreach (int ID in Ids) { SZHL_XXFB model = new SZHL_XXFBB().GetEntity(d => d.ID == ID); SZHL_XXFBType type = new SZHL_XXFBTypeB().GetEntity(d => d.ID == model.XXFBType); //判断审核状态为审核通过,给接收人发送消息 if (model.SHStatus == 1) { if (type.ISzjfb.ToLower() == "true") //判断审核通过直接发布 { SUREXXFB(context, msg, ID.ToString(), P2, UserInfo); } else { //给接收人发送消息 SZHL_TXSX tx = new SZHL_TXSX(); tx.ComId = UserInfo.User.ComId; tx.APIName = "XXFB"; tx.TXMode = "XXFB"; tx.MsgID = model.ID.ToString(); tx.CRUser = UserInfo.User.UserName; tx.FunName = "SENDWXMSG_CHECK"; tx.Date = model.FBTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); TXSX.TXSXAPI.AddALERT(tx); //时间为发送时间 } } else if (model.SHStatus == -1) //退回发送PC消息及微信消息 { string strMsg = UserInfo.User.UserRealName + "退回了您发布的企业信息"; new JH_Auth_User_CenterB().SendMsg(UserInfo, "XXFB", strMsg, model.ID.ToString(), model.CRUser); WXHelp wx = new WXHelp(UserInfo.QYinfo); wx.SendWXRText(strMsg, "XXFB", model.CRUser); } } }
/// <summary> /// 获取车辆列表 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETCLLIST_PAGE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strWhere = string.Format(" car.ComId=" + UserInfo.User.ComId); if (P1 != "") //车牌号 { strWhere += string.Format("and car.CarNum like '%{0}%'", P1); } if (P2 != "")//车辆类型 { strWhere += string.Format(" And car.CarType='{0}'", P2);; } int recordCount = 0; int page = 0; int pagecount = 8; int.TryParse(context.Request["p"] ?? "1", out page); int.TryParse(context.Request["pagecount"] ?? "8", out pagecount);//页数 DataTable dt = new SZHL_XXFBB().GetDataPager("SZHL_YCGL_CAR car left join JH_Auth_ZiDian zd on car.CarType=zd.ID and zd.Class=5 ", "car.*,zd.TypeName", pagecount, page, "car.CRDate desc", strWhere, ref recordCount); msg.Result = dt; msg.Result1 = recordCount; }
//发送审核消息 public void SENDWXMSG_CHECK(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { var tx = JsonConvert.DeserializeObject <SZHL_TXSX>(P1); int ID = Int32.Parse(tx.MsgID); var model = new SZHL_XXFBB().GetEntity(p => p.ID == ID); UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, model.CRUser); if (model != null) { if (model.SHStatus == 0 || model.SHStatus == 1) //如果已处理,则不再发消息 { string wxflag = "B"; //审核页面 string JSUser = ""; Article ar0 = new Article(); if (model.SHStatus == 0) { JSUser = model.SHUser; ar0.Title = model.CRUserName + "发布了一个企业信息,请您审核"; } else if (model.SHStatus == 1) { ar0.Title = new JH_Auth_UserB().GetUserRealName(UserInfo.QYinfo.ComId, model.SHUser) + "审核了一个企业信息,请您确认发布"; JSUser = model.CRUser; wxflag = "C"; //发布确认页面 } ar0.Description = ""; ar0.Url = model.XXFBType.ToString(); List <Article> al = new List <Article>(); al.Add(ar0); WXHelp wx = new WXHelp(UserInfo.QYinfo); new JH_Auth_User_CenterB().SendMsg(UserInfo, "XXFB", ar0.Title, model.ID.ToString(), JSUser, wxflag); wx.SendTH(al, "XXFB", wxflag, JSUser); } } }
//保存为自己的素材 public void SETSCUSER(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int ID = int.Parse(P1); SZHL_XXFB xxfb = new SZHL_XXFBB().GetEntity(d => d.ID == ID); if (xxfb.SCUser == null || !xxfb.SCUser.Split(',').Contains(UserInfo.User.UserName)) { if (string.IsNullOrEmpty(xxfb.SCUser)) { xxfb.SCUser = UserInfo.User.UserName; } else { xxfb.SCUser = "******" + UserInfo.User.UserName; } new SZHL_XXFBB().Update(xxfb); //保存素材 SZHL_XXFB_SCK model = JsonConvert.DeserializeObject <SZHL_XXFB_SCK>(P2); model.ComId = UserInfo.User.ComId; model.CRUser = UserInfo.User.UserName; model.CRDate = DateTime.Now; new SZHL_XXFB_SCKB().Insert(model); } }
public void GETDRAFTLIST(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { DataTable dt = new SZHL_XXFBB().GetDTByCommand("SELECT * from SZHL_XXFB where CRUser='******' and IsSend=0 and MsgType=1 and ComId=" + UserInfo.User.ComId + ""); msg.Result = dt; }