/// <summary> /// 小区列表 /// </summary> /// <param name="Row"></param> /// <returns></returns> public string GetCommList(DataRow Row) { if (Row.Table.Columns.Contains("City")) { DataTable dTable = new DbHelperSQLP(PubConstant.UnifiedContionString.ToString()).Query( string.Format(@"SELECT Id,Province,Area,City,CorpID,CommID,CorpName,CommName,ModuleRights,isnull(Tel,'') AS Tel FROM Tb_Community WHERE City = '{0}' ORDER BY CommName ASC", AppGlobal.ChkStr(Row["City"].ToString().Trim()))).Tables[0]; if (dTable.Rows.Count > 0) { return(JSONHelper.FromString(dTable)); } else { return(JSONHelper.FromString(false, "暂无数据")); } } else { return(JSONHelper.FromString(false, "缺少参数City!")); } }
/// <summary> /// 社区活动 /// </summary> /// <param name="row"></param> /// <returns></returns> public string CommunityActivitiesList(DataRow Row) { string result = ""; #region 接受参数 string strCommunityId = ""; //项目ID string strCurrPage = "1"; //第几页 string strPageSize = "10"; //分页的大小 if (Row.Table.Columns.Contains("CommunityId")) { strCommunityId = AppGlobal.ChkStr(Row["CommunityId"].ToString()); } else { return(JSONHelper.FromString(false, "缺少参数CommID")); } if (Row.Table.Columns.Contains("CurrPage")) { strCurrPage = AppGlobal.ChkNum(Row["CurrPage"].ToString()); } if (Row.Table.Columns.Contains("PageSize")) { strPageSize = AppGlobal.ChkNum(Row["PageSize"].ToString()); } #endregion #region 变量定义 string strErrMsg = ""; string strCommID = ""; string SQLContionString = ""; int PageCount = 0; int Counts = 0; StringBuilder sListContent = new StringBuilder(""); int iCurrPage = AppGlobal.StrToInt(strCurrPage); int iPageSize = AppGlobal.StrToInt(strPageSize); #endregion SQLContionString = ConnectionDb.GetConnection(Row["CommunityId"].ToString()); MobileSoft.Model.Unified.Tb_Community Community = new MobileSoft.BLL.Unified.Bll_Tb_Community().GetModel(Row["CommunityId"].ToString()); if (Community == null) { return(JSONHelper.FromString(false, "该小区不存在")); } #region 查询社区活动 string strSQLCommAct = "and ActivitiesType<>'0001' and isnull(IsDelete, 0)=0 And isnull(IsRun, 0)=1 AND CommID = " + Community.CommID; DataTable dTableCommAct = null; dTableCommAct = (new Business.TWBusinRule(SQLContionString)).HSPR_CommActivities_CutPage(out PageCount, out Counts, strSQLCommAct, iCurrPage, iPageSize); if (dTableCommAct.Rows.Count > 0) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("InfoID", typeof(string))); dt.Columns.Add(new DataColumn("Heading", typeof(string))); dt.Columns.Add(new DataColumn("IssueDate", typeof(string))); dt.Columns.Add(new DataColumn("ImageUrl", typeof(string))); foreach (DataRow DRow in dTableCommAct.Rows) { DataRow dr = dt.NewRow(); dr["InfoID"] = DRow["ActivitiesID"].ToString(); dr["Heading"] = DRow["ActivitiesTheme"].ToString(); dr["IssueDate"] = DRow["IssueDate"].ToString(); dr["ImageUrl"] = string.IsNullOrEmpty(DRow["ActivitiesImages"].ToString()) ? "" : DRow["ActivitiesImages"].ToString().IndexOf("http") >= 0 ? DRow["ActivitiesImages"].ToString() : DRow["ActivitiesImages"].ToString(); dt.Rows.Add(dr); } result = JSONHelper.FromString(dt); } else { result = JSONHelper.FromString(dTableCommAct); } #endregion dTableCommAct.Dispose(); return(result); }
/// <summary> /// 根据城市获取小区列表html5 GetCommListforH5 /// </summary> /// <param name="Row"></param> /// <returns></returns> public string GetCommListforH5(DataRow Row) { string CorpID = ""; if (Row.Table.Columns.Contains("CorpID") && Row["CorpID"].ToString() != "") { CorpID = Row["CorpID"].ToString(); } if (Row.Table.Columns.Contains("City")) { string sql; if (string.IsNullOrEmpty(CorpID)) { sql = "SELECT c.Id,c.Province,c.Area,c.City,c.CorpID,c.CommID,c.CorpName,c.CommName,c.ModuleRights,c.Tel,h.Appid,h.Secret FROM Tb_Community as c inner join Tb_WeiXinH5_Config as h on c.Id = h.communityId WHERE c.City = '" + AppGlobal.ChkStr(Row["City"].ToString()) + "' ORDER BY CommName ASC"; } else { string[] str = CorpID.Split(','); if (str.Length > 0) { CorpID = ""; for (int i = 0; i < str.Length; i++) { if (i == 0) { CorpID = str[i]; } else { CorpID += "," + str[i]; } } } sql = "SELECT c.Id,c.Province,c.Area,c.City,c.CorpID,c.CommID,c.CorpName,c.CommName,c.ModuleRights,c.Tel,h.Appid,h.Secret FROM Tb_Community as c inner join Tb_WeiXinH5_Config as h on c.Id = h.communityId WHERE c.City = '" + AppGlobal.ChkStr(Row["City"].ToString()) + "' AND c.CorpID IN (" + CorpID + ") ORDER BY CommName ASC"; } DataTable dTable = new DbHelperSQLP(PubConstant.UnifiedContionString.ToString()).Query(sql).Tables[0]; if (dTable.Rows.Count > 0) { return(JSONHelper.FromString(dTable)); } else { return(JSONHelper.FromString(false, "暂无数据")); } } else { return(JSONHelper.FromString(false, "缺少参数City!")); } }
/// <summary> /// 亲情提示、社区资讯 /// </summary> /// <param name="row"></param> /// <returns></returns> public string CommunityNotificationTWList(DataRow Row) { string result = ""; try { #region 接受参数 string strUserId = ""; string strCommunityId = ""; //项目ID string strCurrPage = "1"; //第几页 string strPageSize = "10"; //分页的大小 if (Row.Table.Columns.Contains("CommunityId")) { strCommunityId = AppGlobal.ChkStr(Row["CommunityId"].ToString()); } else { return(JSONHelper.FromString(false, "缺少参数CommID")); } if (Row.Table.Columns.Contains("UserID") && !string.IsNullOrEmpty(Row["UserID"].ToString())) { strUserId = Row["UserID"].ToString(); } if (Row.Table.Columns.Contains("CurrPage")) { strCurrPage = AppGlobal.ChkNum(Row["CurrPage"].ToString()); } if (Row.Table.Columns.Contains("PageSize")) { strPageSize = AppGlobal.ChkNum(Row["PageSize"].ToString()); } #endregion #region 变量定义 string SQLContionString = ""; int PageCount = 0; int Counts = 0; StringBuilder sListContent = new StringBuilder(""); int iCurrPage = AppGlobal.StrToInt(strCurrPage); int iPageSize = AppGlobal.StrToInt(strPageSize); #endregion SQLContionString = ConnectionDb.GetConnection(Row["CommunityId"].ToString()); MobileSoft.Model.Unified.Tb_Community Community = new MobileSoft.BLL.Unified.Bll_Tb_Community().GetModel(Row["CommunityId"].ToString()); if (Community == null) { return(JSONHelper.FromString(false, "该小区不存在")); } #region 查询亲情提示、社区咨询 string strSQLNotiHis; switch (Community.CorpID) { case 1975: // 华南城社区新闻设置了多选小区发放功能 strSQLNotiHis = " and isnull(IsDelete,0)=0 and isnull(IsAudit, 0)=0 AND (CommID=0 OR CommID = " + Community.CommID + " OR CHARINDEX('" + Community.CommID + "',CommIdNvarchar)>0) and (InfoType = 'qqts' or InfoType = 'dtzx') AND (ShowEndDate is null or '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'< ShowEndDate) "; break; //case 1973: // strSQLNotiHis = " and isnull(IsDelete,0)=0 and isnull(IsAudit, 0)=0 AND (CommID=0 OR CommID = " + Community.CommID + ") and InfoType = 'dtzx' AND (ShowEndDate is null or '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'< ShowEndDate) "; // break; default: strSQLNotiHis = " and isnull(IsDelete,0)=0 and isnull(IsAudit, 0)=0 AND (CommID=0 OR CommID = " + Community.CommID + ") and (InfoType = 'qqts' or InfoType = 'dtzx') AND (ShowEndDate is null or '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'< ShowEndDate) "; break; } DataTable dTableNotiHis = null; dTableNotiHis = (new Business.TWBusinRule(SQLContionString)).HSPR_CommunityInfo_CutPage(out PageCount, out Counts, strSQLNotiHis, iCurrPage, iPageSize); if (!pageHasData(iCurrPage, PageCount, Counts)) { dTableNotiHis.Dispose(); dTableNotiHis = new DataTable(); } if (dTableNotiHis.Rows.Count > 0) { using (IDbConnection conn = new SqlConnection(PubConstant.UnifiedContionString)) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("InfoID", typeof(string))); dt.Columns.Add(new DataColumn("Heading", typeof(string))); dt.Columns.Add(new DataColumn("IssueDate", typeof(string))); dt.Columns.Add(new DataColumn("ImageUrl", typeof(string))); dt.Columns.Add(new DataColumn("IsRead", typeof(int))); string sql = @"SELECT count(0) FROM Tb_BBS_ReadRecord WHERE InfoID=@InfoID AND UserID=@UserID"; foreach (DataRow DRow in dTableNotiHis.Rows) { DataRow dr = dt.NewRow(); dr["InfoID"] = DRow["InfoID"].ToString(); dr["Heading"] = DRow["Heading"].ToString(); dr["IssueDate"] = DRow["IssueDate"].ToString(); dr["ImageUrl"] = string.IsNullOrEmpty(DRow["ImageUrl"].AsString()) ? "" : DRow["ImageUrl"].AsString().IndexOf("http") >= 0 ? DRow ["ImageUrl"].AsString() : imageAddr + DRow["ImageUrl"].AsString(); if (!string.IsNullOrEmpty(strUserId)) { dr["IsRead"] = conn.Query <int>(sql, new { InfoID = DRow["InfoID"].ToString(), UserID = strUserId }).FirstOrDefault(); } else { dr["IsRead"] = 0; } dt.Rows.Add(dr); } result += JSONHelper.FromString(dt); } } else { result += JSONHelper.FromString(dTableNotiHis); } #endregion dTableNotiHis.Dispose(); } catch (Exception ex) { result = ex.Message + "\r\n" + ex.StackTrace; } return(result); }
public string GetAll(DataRow Row) { string result = ""; #region 接受参数 string strCommunityId = ""; //项目ID string strCurrPage = "1"; //第几页 string strPageSize = "10"; //分页的大小 if (Row.Table.Columns.Contains("CommunityId")) { strCommunityId = AppGlobal.ChkStr(Row["CommunityId"].ToString()); } else { return(JSONHelper.FromString(false, "缺少参数CommID")); } if (Row.Table.Columns.Contains("CurrPage")) { strCurrPage = AppGlobal.ChkNum(Row["CurrPage"].ToString()); } if (Row.Table.Columns.Contains("PageSize")) { strPageSize = AppGlobal.ChkNum(Row["PageSize"].ToString()); } #endregion #region 变量定义 string strErrMsg = ""; string strCommID = ""; string SQLContionString = ""; int PageCount = 0; int Counts = 0; StringBuilder sListContent = new StringBuilder(""); int iCurrPage = AppGlobal.StrToInt(strCurrPage); int iPageSize = AppGlobal.StrToInt(strPageSize); #endregion SQLContionString = ConnectionDb.GetConnection(Row["CommunityId"].ToString()); MobileSoft.Model.Unified.Tb_Community Community = new MobileSoft.BLL.Unified.Bll_Tb_Community().GetModel(Row["CommunityId"].ToString()); if (Community == null) { return(JSONHelper.FromString(false, "该小区不存在")); } #region string strSQLNotiHis = " and isnull(IsAudit, 0)=0 AND CommID = " + Community.CommID + " AND (ShowEndDate is null or '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'< ShowEndDate) "; DataTable dTableNotiHis = null; dTableNotiHis = (new Business.TWBusinRule(SQLContionString)).HSPR_CommunityInfo_CutPage(out PageCount, out Counts, strSQLNotiHis, iCurrPage, iPageSize); if (!pageHasData(iCurrPage, PageCount, Counts)) { dTableNotiHis.Dispose(); dTableNotiHis = new DataTable(); } if (dTableNotiHis.Rows.Count > 0) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("InfoID", typeof(string))); dt.Columns.Add(new DataColumn("Heading", typeof(string))); dt.Columns.Add(new DataColumn("IssueDate", typeof(string))); dt.Columns.Add(new DataColumn("ImageUrl", typeof(string))); foreach (DataRow DRow in dTableNotiHis.Rows) { DataRow dr = dt.NewRow(); dr["InfoID"] = DRow["InfoID"].ToString(); dr["Heading"] = DRow["Heading"].ToString(); dr["IssueDate"] = DRow["IssueDate"].ToString(); dr["ImageUrl"] = string.IsNullOrEmpty(DRow["ImageUrl"].ToString()) ? "" : DRow["ImageUrl"].ToString().IndexOf("http") >= 0 ? DRow["ImageUrl"].ToString() : imageAddr + DRow["ImageUrl"].ToString(); dt.Rows.Add(dr); } result += JSONHelper.FromString(dt); } else { result += JSONHelper.FromString(dTableNotiHis); } #endregion dTableNotiHis.Dispose(); return(result); }