Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        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);
        }