/// <summary> /// 获取信息分类, /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1">0:获取初始类别,1:获取子类别,2:获取全部类别</param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETXXFBTYPELISTWX(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strSql = string.Format("SELECT Id,PTypeID pId,TypeName name,TypePath from SZHL_XXFBType where comId='{0}' and PTypeID='{1}' and isDel=0", UserInfo.User.ComId, P1); DataTable dt = new SZHL_XXFBTypeB().GetDTByCommand(strSql); msg.Result = dt; }
//获取所有子项列表 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 GETXXFBUSERLIST(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int id = 0; int.TryParse(P1, out id); SZHL_XXFBType xxfbType = new SZHL_XXFBTypeB().GetEntity(d => d.ID == id && d.ComId == UserInfo.User.ComId); msg.Result = new JH_Auth_UserB().GetEntities(d => xxfbType.SeeUser.Contains(d.UserName) && d.ComId == UserInfo.User.ComId); }
public void GETXXFBTYPELISTALL(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strSql = string.Format("SELECT ID,PTypeID,TypeName,TypePath from SZHL_XXFBType where comId='{0}' and PTypeID='0' and isDel=0 ", UserInfo.User.ComId); DataTable dt = new SZHL_XXFBTypeB().GetDTByCommand(strSql); dt.Columns.Add("SubItem", typeof(DataTable)); foreach (DataRow dr in dt.Rows) { string topid = dr["ID"].ToString(); strSql = string.Format("SELECT SZHL_XXFBType.ID,PTypeID,TypeName,TypePath,COUNT(SZHL_XXFB.ID) as datacount from SZHL_XXFBType INNER JOIN SZHL_XXFB on SZHL_XXFBType.ID=SZHL_XXFB.XXFBType where SZHL_XXFBType.comId='{0}' and PTypeID='{1}' and isDel=0 AND (','+SZHL_XXFB.JSUser+',' LIKE '%,{2},%' or SZHL_XXFB.JSUser='') GROUP by SZHL_XXFBType.ID,PTypeID,TypeName,TypePath", UserInfo.User.ComId, topid, UserInfo.User.UserName); dr["SubItem"] = new SZHL_XXFBTypeB().GetDTByCommand(strSql); } msg.Result = dt; }
public void DELXXFBTYPE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int ID = int.Parse(P1); SZHL_XXFBType type = new SZHL_XXFBTypeB().GetEntity(d => d.ID == ID && d.ComId == UserInfo.User.ComId); string typepath = type.TypePath == "" ? type.ID + "-" : type.TypePath + "-" + type.ID; if (new SZHL_XXFBTypeB().GetEntities(d => d.ComId == UserInfo.User.ComId).ToList().Where(d => (d.TypePath + "-").IndexOf(typepath) > -1 && d.IsDel == 0).Count() > 0) { msg.ErrorMsg = "请先删除子分类"; } else { type.IsDel = 1; new SZHL_XXFBTypeB().Update(type); } }
public void ADDXXFBTYPE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { SZHL_XXFBType type = JsonConvert.DeserializeObject <SZHL_XXFBType>(P1); if (type != null) { if (type.IsCheck == "True" && type.CheckUser == "") { msg.Result = "请选择审核人"; return; } if (type.ID == 0) { DataTable dt = new SZHL_XXFBTypeB().GetDTByCommand("select ID,TypeName,PTypeID from SZHL_XXFBType where ComId=" + UserInfo.User.ComId + " and IsDel=0 "); if (type.PTypeID == null || type.PTypeID <= 0) { DataTable dtpid = dt.FilterTable(" PTypeID =0 "); if (dt != null && dt.Rows.Count > 0) { type.PTypeID = (int)(dt.Rows[0]["ID"] ?? 0); type.TypePath = dt.Rows[0]["ID"].ToString(); } } DataTable dtcunzai = dt.FilterTable("PTypeID ='" + type.PTypeID + "' and TypeName='" + type.TypeName + "'"); if (dtcunzai != null && dtcunzai.Rows.Count > 0) { msg.ErrorMsg = "分类已存在"; } else { type.CRDate = DateTime.Now; type.CRUser = UserInfo.User.UserName; type.ComId = UserInfo.User.ComId; type.IsDel = 0; new SZHL_XXFBTypeB().Insert(type); } } else { new SZHL_XXFBTypeB().Update(type); } } }
//获取管理员所管理的类型列表 public void GETXXFBCHILDRENMANAGE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { List <SZHL_XXFBType> allTypeList = new SZHL_XXFBTypeB().GetEntities(d => d.ComId == UserInfo.User.ComId && d.IsDel == 0).ToList(); if (allTypeList.Count > 0) { string pIds = allTypeList.Select(d => d.PTypeID.Value).Distinct().ToList().ListTOString(','); string strSql = string.Format("SELECT * from SZHL_XXFBType where ','+TypeManager+',' like '%,{0},%'and Id not in ({1}) and ComId={2} and isDel=0 order by PTypeID", UserInfo.User.UserName, pIds, UserInfo.User.ComId); DataTable dtType = new SZHL_XXFBTypeB().GetDTByCommand(strSql); foreach (DataRow row in dtType.Rows) { string parentTypeName = allTypeList.Where(d => row["TypePath"].ToString().Split('-').Contains(d.ID.ToString())).OrderBy(d => d.ID).Select(d => d.TypeName).ToList <string>().ListTOString('-'); row["TypeName"] = parentTypeName + "-" + row["TypeName"]; } msg.Result = dtType; } }
/// <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); } } }
public void ADDXXFB(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { SZHL_XXFB xxmodel = JsonConvert.DeserializeObject <SZHL_XXFB>(P1); string JsUser = xxmodel.JSUser; if (xxmodel.ID == 0) //企业信息添加 { List <SZHL_XXFB_ITEM> xxfbList = JsonConvert.DeserializeObject <List <SZHL_XXFB_ITEM> >(P2); //企业信息发布多图文信息列表 //企业信息基础赋值 xxmodel.CRDate = DateTime.Now; xxmodel.CRUser = UserInfo.User.UserName; xxmodel.CRUserName = UserInfo.User.UserRealName; xxmodel.ComId = UserInfo.User.ComId; if (xxmodel.FBTime == null || xxmodel.FBTime < DateTime.Now) { xxmodel.FBTime = DateTime.Now; } //如果是草稿不添加发送日期 if (xxmodel.IsSend == "0") { xxmodel.FBTime = null; } xxmodel.Remark = P2; xxmodel.XXTitle = xxfbList[0].XXTitle; //判断神皖是否需要审核 // xxmodel.SHStatus = xxmodel.IsSH.ToLower() == "true" ? 0 : 1; //是否需要审核 //Saas判断是否需要审核 SZHL_XXFBType type = new SZHL_XXFBTypeB().GetEntity(d => d.ID == xxmodel.XXFBType); xxmodel.SHStatus = type.IsCheck.ToLower() == "true" ? 0 : 2; //是否需要审核 //添加企业信息 new SZHL_XXFBB().Insert(xxmodel); //循环多图文信息列表添加表,并判断是否发送消息 foreach (SZHL_XXFB_ITEM xxfb in xxfbList) { if (!string.IsNullOrEmpty(xxfb.XXTitle) || !string.IsNullOrEmpty(xxfb.XXContent)) { xxfb.XXFBId = xxmodel.ID; xxfb.ComId = UserInfo.User.ComId; xxfb.FBTime = xxmodel.FBTime; new SZHL_XXFB_ITEMB().Insert(xxfb); } } //判断发布信息操作的微信消息 0为草稿 1为发布 if (xxmodel.IsSend == "1") { SZHL_TXSX tx = new SZHL_TXSX(); tx.ComId = UserInfo.User.ComId; tx.APIName = "XXFB"; tx.TXMode = "XXFB"; tx.MsgID = xxmodel.ID.ToString(); tx.CRUser = UserInfo.User.UserName; if (xxmodel.SHStatus == 2) //无须审核 { tx.FunName = "SENDWXMSG"; tx.Date = xxmodel.FBTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); TXSX.TXSXAPI.AddALERT(tx); //时间为发送时间 } else //需要审核 { tx.FunName = "SENDWXMSG_CHECK"; tx.Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); TXSX.TXSXAPI.AddALERT(tx); } } } else { List <SZHL_XXFB_ITEM> xxfbList = JsonConvert.DeserializeObject <List <SZHL_XXFB_ITEM> >(P2); xxmodel.Remark = P2; xxmodel.FBTime = xxmodel.FBTime < DateTime.Now ? DateTime.Now : xxmodel.FBTime; xxmodel.XXTitle = xxfbList[0].XXTitle; if (xxmodel.FBTime == null || xxmodel.FBTime < DateTime.Now) { xxmodel.FBTime = DateTime.Now; } //如果是草稿不添加发送日期 if (xxmodel.IsSend == "0") { xxmodel.FBTime = null; } new SZHL_XXFBB().Update(xxmodel); //更新企业信息 new SZHL_XXFB_ITEMB().Delete(d => d.XXFBId == xxmodel.ID); //删除企业信息的多图文 //循环多图文信息列表添加表,并判断是否发送消息 foreach (SZHL_XXFB_ITEM xxfb in xxfbList) { if (!string.IsNullOrEmpty(xxfb.XXTitle) || !string.IsNullOrEmpty(xxfb.XXContent)) { xxfb.XXFBId = xxmodel.ID; xxfb.ComId = UserInfo.User.ComId; xxfb.FBTime = xxmodel.FBTime; new SZHL_XXFB_ITEMB().Insert(xxfb); } } //判断发布信息操作的微信消息 0为草稿,1为发布 if (xxmodel.IsSend == "1") { SZHL_TXSX tx = new SZHL_TXSX(); tx.ComId = UserInfo.User.ComId; tx.APIName = "XXFB"; tx.TXMode = "XXFB"; tx.MsgID = xxmodel.ID.ToString(); tx.CRUser = UserInfo.User.UserName; if (xxmodel.SHStatus == 2) //无须审核 { tx.FunName = "SENDWXMSG"; tx.Date = xxmodel.FBTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); TXSX.TXSXAPI.AddALERT(tx); //时间为发送时间 } else //需要审核 { tx.FunName = "SENDWXMSG_CHECK"; tx.Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); TXSX.TXSXAPI.AddALERT(tx); } } } }
/// <summary> /// 信息发布类别获取 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETXXFBTYPELISTPAGE(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);//页数 int recordCount = 0; string strWhere = string.Format(" comId='{0}' and isDel!=1 and PTypeID!=0 ", UserInfo.User.ComId); string strContent = context.Request["Content"] ?? ""; strContent = strContent.TrimEnd(); if (strContent != "") { strWhere += string.Format(" And TypeName like '%{0}%' ", strContent); } DataTable dt = new SZHL_XXFBTypeB().GetDataPager("SZHL_XXFBType", " ID,TypeName,TypeDec,TypeManager,ISzjfb,CheckUser,SeeUser,IsCheck,IsSee,PTypeID ", pagecount, page, " CRDate desc", strWhere, ref recordCount); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { if (dr["ISzjfb"].ToString() == "True") { dr["ISzjfb"] = "是"; } else { dr["ISzjfb"] = "否"; } if (dr["PTypeID"] != null && dr["PTypeID"].ToString() == "0") { dr["ISzjfb"] = ""; dr["CheckUser"] = ""; dr["SeeUser"] = ""; dr["IsCheck"] = ""; dr["IsSee"] = ""; } else { if (dr["IsCheck"] != null && dr["IsCheck"].ToString() == "False") { dr["ISzjfb"] = ""; dr["CheckUser"] = ""; } if (dr["IsSee"] != null && dr["IsSee"].ToString() == "False") { dr["SeeUser"] = ""; } if (dr["IsCheck"].ToString() == "True") { dr["IsCheck"] = "是"; } else { dr["IsCheck"] = "否"; } if (dr["IsSee"].ToString() == "True") { dr["IsSee"] = "是"; } else { dr["IsSee"] = "否"; } } } } msg.Result = dt; msg.Result1 = recordCount; }