Exemplo n.º 1
0
        /// <summary>
        /// 好友列表
        /// </summary>
        /// <param name="session">本人session</param>
        /// <returns></returns>
        public string GetFriendList(string session)
        {
            HF.Cloud.BLL.Common.Logger.Error("FriendList获取到的session为" + session);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //session获取用户UserID
            SB_UserEL userEL = new SB_UserEL();

            userEL.Session_True = session;
            userEL.ExecuteEL(41);
            HF.Cloud.BLL.Common.Logger.Error("userEL.ID:" + userEL.ID);
            if (userEL.ID > 0)
            {
                long userID = userEL.ID;
                //通过userID在好友表中查询好友列表
                FriendsEL frenEL = new FriendsEL();
                frenEL.UserID = userID;
                DataTable dt = frenEL.ExecDT(31);
                HF.Cloud.BLL.Common.Logger.Error("获取到好友列表,好友个数为:" + dt.Rows.Count);

                foreach (DataRow dr in dt.Rows)
                {
                    long userid_Friend = long.Parse(dr["UserID_Friend"].ToString());
                    //通过userid_Friend获取好友信息
                    userEL.ID = userid_Friend;
                    userEL.ExecuteEL(4);
                    string userName       = userEL.UserName;
                    string userTel        = userEL.UserTel;
                    string duty           = userEL.Duty;
                    string imgUrl         = userEL.ImgUrl;
                    string session_Friend = userEL.Session_True;
                    long   companyID      = userEL.CompanyID;
                    //通过companyID获取公司名称
                    CompanysEL compaEL = new CompanysEL();
                    compaEL.ID = companyID;
                    compaEL.ExecuteEL(2);
                    string companyName = compaEL.CompanyName;
                    HF.Cloud.BLL.Common.Logger.Error("好友名称:" + userEL.UserName + "公司名称:" + companyName);
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("UserName", userName);
                    dic.Add("UserTel", userTel);
                    dic.Add("Duty", duty);
                    dic.Add("ImgUrl", imgUrl);
                    dic.Add("Session", session_Friend);
                    dic.Add("CompanyName", companyName);

                    list.Add(dic);
                }
            }
            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("返回的好友列表json数据:" + strJson);
            return(strJson);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取本人公司信息
        /// </summary>
        /// <param name="session">用户session</param>
        /// <returns></returns>
        public string GetMyCompanyInfo(string session)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetMyCompanyInfo方法接受的参数session:" + session);
            JavaScriptSerializer        js  = new JavaScriptSerializer();
            Dictionary <string, object> dic = new Dictionary <string, object>();
            //通过session获取CompanyID
            SB_UserEL userEl = new SB_UserEL();

            userEl.Session_True = session;
            userEl.ExecuteEL(41);
            HF.Cloud.BLL.Common.Logger.Error("GetMyCompanyInfo方法查询用户信息结果(大于0说明正确):" + userEl.ID);
            if (userEl.ID > 0)
            {
                long companyID = userEl.CompanyID;
                //通过公司ID获取公司信息
                CompanysEL companysEL = new CompanysEL();
                companysEL.ID = companyID;
                companysEL.ExecuteEL(2);
                HF.Cloud.BLL.Common.Logger.Error("GetMyCompanyInfo方法查询公司信息结果公司名称:" + companysEL.CompanyName);
                dic.Add("CompanyID", companyID);
                dic.Add("CompanyName", companysEL.CompanyName);
                dic.Add("CompanyIcon", companysEL.CompanyIcon);
                dic.Add("Introduce", companysEL.Introduce);
                //通过companyID获取公司关键字
                string companyTags = GetCompanyTag_String(companyID.ToString());
                dic.Add("Tags", companyTags);
            }

            string strJson = js.Serialize(dic);

            HF.Cloud.BLL.Common.Logger.Error("GetMyCompanyInfo方法返回的用户信息json数据:" + strJson);
            return(strJson);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 搜索好友
        /// </summary>
        /// <param name="friendName">好友名称</param>
        /// <returns></returns>
        public string SearchFriend(string session, string friendName)
        {
            HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法获取的参数session:" + session + "---friendName:" + friendName);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();

            UserBLL userBLL = new UserBLL();
            long    userID  = userBLL.GetUserIDBySession(session);

            FriendsEL friendEL = new FriendsEL();
            DataTable dt       = friendEL.ExecuteSqlString("select * from ViewFriends where UserID=" + userID + " and UserName like '%" + friendName + "%' and Friend_Valid=1");

            SB_UserEL userEL = new SB_UserEL();

            //userEL.UserName = friendName;
            //DataTable dt= userEL.ExecDT(45);
            HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法获取的好友个数为:" + dt.Rows.Count);
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //这里都是用的视图ViewFriends里的字段
                    long userid = long.Parse(dr["SB_User_ID"].ToString());
                    //通过userid_Friend获取好友信息
                    userEL.ID = userid;
                    userEL.ExecuteEL(4);
                    string userName       = userEL.UserName;
                    string userTel        = userEL.UserTel;
                    string duty           = userEL.Duty;
                    string imgUrl         = userEL.ImgUrl;
                    string session_Friend = userEL.Session_True;
                    long   companyID      = userEL.CompanyID;
                    //通过companyID获取公司名称
                    CompanysEL compaEL = new CompanysEL();
                    compaEL.ID = companyID;
                    compaEL.ExecuteEL(2);
                    string companyName = compaEL.CompanyName;
                    HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法好友名称:" + userEL.UserName + "公司名称:" + companyName);
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("UserName", userName);
                    dic.Add("UserTel", userTel);
                    dic.Add("Duty", duty);
                    dic.Add("ImgUrl", imgUrl);
                    dic.Add("Session", session_Friend);
                    dic.Add("CompanyName", companyName);

                    list.Add(dic);
                }
            }
            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法返回的好友列表json数据:" + strJson);
            return(strJson);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 通过session换取UserID主键
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        public long GetUserIDBySession(string session)
        {
            long      userID = 0;
            SB_UserEL userel = new SB_UserEL();

            userel.Session_True = session;
            userel.ExecuteEL(41);
            if (userel.ID > 0)
            {
                userID = userel.ID;
            }
            return(userID);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 通过session获取SB_UserEL实体
        /// </summary>
        /// <param name="session">session</param>
        /// <returns></returns>
        public SB_UserEL GetUserELBySession(string session)
        {
            SB_UserEL userEL_Return = new SB_UserEL();
            SB_UserEL userEL        = new SB_UserEL();

            userEL.Session_True = session;
            userEL.ExecuteEL(41);
            if (userEL.ID > 0)
            {
                userEL_Return = userEL;
            }
            return(userEL_Return);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userID">用户userID</param>
        /// <returns></returns>
        public string GetUserInfoByUserID(string userID)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoByUserID方法接受到的参数userID:" + userID);
            //通过session获取用户
            SB_UserEL userel = new SB_UserEL();

            userel.ID = long.Parse(userID);
            userel.ExecuteEL(4);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoByUserID方法获取用户姓名:" + userel.UserName);
            JavaScriptSerializer        js  = new JavaScriptSerializer();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(userel.UserName))
            {
                dic.Add("UserID", userID);
                dic.Add("UserName", userel.UserName);
                dic.Add("UserTel", userel.UserTel);
                dic.Add("Duty", userel.Duty);
                dic.Add("UserEmail", userel.UserEmail);
                dic.Add("Detail", userel.Detail);
                dic.Add("ImgUrl", userel.ImgUrl);
                dic.Add("Session", userel.Session_True);
                string companyName = "";
                string companyIcon = "";
                string companyID   = "";
                //通过公司ID查询公司名称
                CompanysEL compEL = new CompanysEL();
                compEL.ID = userel.CompanyID;
                compEL.ExecuteEL(2);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoByUserID方法查询公司名称结果公司名称:" + compEL.CompanyName);
                if (!string.IsNullOrEmpty(compEL.CompanyName))
                {
                    companyName = compEL.CompanyName;
                    companyIcon = compEL.CompanyIcon;
                    companyID   = compEL.ID.ToString();
                }
                dic.Add("CompanyName", companyName);
                dic.Add("CompanyIcon", companyIcon);
                dic.Add("CompanyID", companyID);
            }
            string strJson = js.Serialize(dic);

            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoByUserID方法返回的数据为:" + strJson);
            return(strJson);
        }
Exemplo n.º 7
0
        protected string ValidateInput()
        {
            string tips = string.Empty;

            if (this.txtSBName.Text.Trim() == string.Empty)
            {
                tips += "企业名称不能为空!\\n";
            }
            else
            {
                //SB_UserMEL userM = new SB_UserMEL()
                //{
                //    SBName = this.txtSBName.Text.Trim()
                //};

                //userM.ExecuteEL(43);

                //if (!string.IsNullOrEmpty(userM.ApplyIP))
                //{
                //    tips += "企业名称已经注册,不能重复注册!\\n";
                //}
            }

            if (this.txtUserCode.Text.Trim() != string.Empty)
            {
                if (PageValidate.IsPhone(this.txtUserCode.Text.Trim()))
                {
                    SB_UserMEL userM = new SB_UserMEL()
                    {
                        SBMobile = this.txtUserCode.Text.Trim()
                    };

                    userM.ExecuteEL(44);

                    if (!string.IsNullOrEmpty(userM.ApplyIP))
                    {
                        tips += "手机号已在服务商注册,不能重复注册!\\n";
                    }

                    SB_UserEL user = new SB_UserEL()
                    {
                        UserCode = this.txtUserCode.Text.Trim()
                    };

                    user.ExecuteEL(41);

                    if (!string.IsNullOrEmpty(user.UserName))
                    {
                        tips += "手机号已作为账户被注册过,不能重复注册!\\n";
                    }
                }
                else
                {
                    tips += "手机号格式输入不正确,请重新输入!\\n";
                }
            }
            else
            {
                tips += "手机号不能为空!\\n";
            }

            if (this.txtUserName.Text.Trim() == string.Empty)
            {
                tips += "管理员姓名不能为空!";
            }

            return(tips);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取好友公司信息
        /// </summary>
        /// <param name="companyID">companyID</param>
        /// <returns></returns>
        public string GetFriendCompanyInfo(string session, string companyID)
        {
            string strJson = "";

            HF.Cloud.BLL.Common.Logger.Error("GetFriendCompanyInfo方法接受的参数session:" + session + "---companyID:" + companyID);
            if (!string.IsNullOrEmpty(session) && !string.IsNullOrEmpty(companyID))
            {
                JavaScriptSerializer        js  = new JavaScriptSerializer();
                Dictionary <string, object> dic = new Dictionary <string, object>();

                SB_UserEL userEL = new SB_UserEL();
                userEL.Session_True = session;
                userEL.ExecuteEL(41);
                string isMyCompany = "";//是否是自己公司
                if (userEL.CompanyID.ToString() == companyID)
                {
                    isMyCompany = "1";
                }
                else
                {
                    isMyCompany = "0";
                }
                long _companyID = long.Parse(companyID);
                //通过公司ID获取公司信息
                CompanysEL companysEL = new CompanysEL();
                companysEL.ID = _companyID;
                companysEL.ExecuteEL(2);
                HF.Cloud.BLL.Common.Logger.Error("GetFriendCompanyInfo方法查询公司信息结果公司名称:" + companysEL.CompanyName);
                dic.Add("CompanyID", companyID);
                dic.Add("CompanyName", companysEL.CompanyName);
                dic.Add("CompanyIcon", companysEL.CompanyIcon);
                dic.Add("Introduce", companysEL.Introduce);
                dic.Add("IsMyCompany", isMyCompany);
                //通过companyID获取公司关键字
                string companyTags = GetCompanyTag_String(companyID.ToString());
                dic.Add("Tags", companyTags);
                //3判断是否给此公司递过名片
                string userid = userEL.ID.ToString();
                //3.1查找第一个加入当前公司的用户ID
                string userid_Company = "";
                userEL.CompanyID = _companyID;
                DataTable dt_company = userEL.ExecDT(44);
                if (dt_company != null && dt_company.Rows.Count > 0)
                {
                    userid_Company = dt_company.Rows[0]["ID"].ToString();
                }
                //3.2Notice表中查找此人是否给公司提交过名片的记录
                NoticeEL noticeEL = new NoticeEL();
                noticeEL.UserID        = long.Parse(userid_Company); //第一个加入公司的人
                noticeEL.UserID_Friend = long.Parse(userid);         //自己
                noticeEL.NoticeType    = 1;
                DataTable dt_Notice = noticeEL.ExecDT(23);
                string    isSend    = "";//是否递过,0没递过,1递过
                if (dt_Notice != null && dt_Notice.Rows.Count > 0)
                {
                    isSend = "1";
                }
                else
                {
                    isSend = "0";
                }
                dic.Add("IsSend", isSend);

                strJson = js.Serialize(dic);
            }
            else
            {
                strJson = "error";
            }
            HF.Cloud.BLL.Common.Logger.Error("GetFriendCompanyInfo方法返回的用户信息json数据:" + strJson);
            return(strJson);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取通知列表
        /// </summary>
        /// <param name="session">用户session</param>
        /// <param name="noticeType">标志要请求的通知类型,0全部通知,1个人通知,2系统通知</param>
        /// <returns></returns>
        public string GetNotice(string session, string noticeType)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到参数session:" + session);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //通过session获取用户ID
            UserBLL userBLL = new UserBLL();
            long    userID  = userBLL.GetUserIDBySession(session);

            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到userID:" + userID);
            NoticeEL noticeEL = new NoticeEL();

            noticeEL.UserID = userID;
            DataTable dt = new DataTable();

            if (noticeType == "0")//全部通知
            {
                string sqlString = "select* from (" +
                                   "select N.ID as NID, S.ID as SID, N.UserID_Friend,N.GroupID," +
                                   "ISNULL(N.UserID, S.UserID) as UserID," +
                                   "ISNULL(N.NoticeType, S.NoticeType) as NoticeType," +
                                   "N.NoticeState, S.NoticeTitle, S.NoticeContent, s.AddressUrl," +
                                   "ISNULL(N.IsLook, S.IsLook) as IsLook," +
                                   "ISNULL(N.CreateTime, S.CreateTime) as CreateTime," +
                                   "ISNULL(N.Valid, S.Valid) as Valid " +
                                   "from Notice as N full join Notice_System as S  on N.CreateTime = S.CreateTime) as T " +
                                   "WHERE[UserID] = " + userID +
                                   " and[Valid] = 1 order by CreateTime desc";

                HF.Cloud.BLL.Common.Logger.Error("GetNotice方法联表查询语句:" + sqlString);
                dt = noticeEL.ExecuteSqlString(sqlString);
            }
            if (noticeType == "1")//个人通知
            {
                dt = noticeEL.ExecDT(21);
            }
            if (noticeType == "2")//系统通知
            {
                Notice_SystemEL nsEL = new Notice_SystemEL();
                nsEL.UserID = userID;
                dt          = nsEL.ExecDT(21);
            }
            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到通知个数:" + dt.Rows.Count);
            SB_UserEL  userEL    = new SB_UserEL();
            CompanysEL companyEL = new CompanysEL();
            GroupEL    groupEL   = new GroupEL();

            foreach (DataRow dr in dt.Rows)
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                if (noticeType == "0")
                {
                    if (dr["NoticeType"].ToString() == "2")        //如果是系统通知
                    {
                        dic.Add("NoticeID", dr["SID"].ToString()); //联合表里系统通知表的通知ID
                        string noticeTitleStr = dr["NoticeTitle"].ToString();
                        string noticeTitle    = noticeTitleStr.Length > 10 ? noticeTitleStr.Substring(0, 10) + "..." : noticeTitleStr;
                        dic.Add("NoticeTitle", noticeTitle);
                        string noticeContentStr = dr["NoticeContent"].ToString();
                        string noticeContent    = noticeContentStr.Length > 20 ? noticeContentStr.Substring(0, 20) + "..." : noticeContentStr;
                        dic.Add("NoticeContent", noticeContent);
                        dic.Add("AddressUrl", dr["AddressUrl"].ToString());
                        dic.Add("NoticeType", "2");
                        dic.Add("IsLook", dr["IsLook"].ToString());
                        dic.Add("CreateTime", dr["CreateTime"].ToString());
                    }
                    else
                    {
                        long userID_Friend = long.Parse(dr["UserID_Friend"].ToString());
                        //通过UserID_Friend获取用户头像名字公司ID
                        userEL.ID = userID_Friend;
                        userEL.ExecuteEL(4);
                        HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到好友名字:" + userEL.UserName);
                        string friend_Img       = userEL.ImgUrl;
                        string friend_Name      = userEL.UserName;
                        string friend_Session   = userEL.Session_True;
                        long   friend_CompanyID = userEL.CompanyID;

                        companyEL.ID = friend_CompanyID;
                        companyEL.ExecuteEL(2);
                        HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到好友公司名字:" + companyEL.CompanyName);
                        string friend_CompanyName = companyEL.CompanyName;
                        //获取群组相关
                        if (dr["NoticeType"].ToString() == "3")//3为群组审核通知
                        {
                            long groupID = long.Parse(dr["GroupID"].ToString());
                            groupEL.ID = groupID;
                            groupEL.ExecuteEL(3);
                            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到群组名称:" + groupEL.GroupName + "---群组ID:" + groupID);
                            dic.Add("GroupID", groupID.ToString());  //群组ID,入群审核用
                            dic.Add("GroupName", groupEL.GroupName); //群组名称,入群审核用
                        }

                        dic.Add("UserName", friend_Name);
                        dic.Add("Session", friend_Session);
                        dic.Add("ImgUrl", friend_Img);
                        dic.Add("CompanyName", friend_CompanyName);
                        dic.Add("NoticeID", dr["NID"].ToString());//NID这里是用的联表查询里的个人通知的ID
                        dic.Add("CreateTime", dr["CreateTime"].ToString());
                        dic.Add("NoticeType", dr["NoticeType"].ToString());
                        dic.Add("NoticeState", dr["NoticeState"].ToString());
                        dic.Add("IsLook", dr["IsLook"].ToString());
                    }
                }
                if (noticeType == "1")//个人通知
                {
                    long userID_Friend = long.Parse(dr["UserID_Friend"].ToString());
                    //通过UserID_Friend获取用户头像名字公司ID
                    userEL.ID = userID_Friend;
                    userEL.ExecuteEL(4);
                    HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到好友名字:" + userEL.UserName);
                    string friend_Img       = userEL.ImgUrl;
                    string friend_Name      = userEL.UserName;
                    string friend_Session   = userEL.Session_True;
                    long   friend_CompanyID = userEL.CompanyID;

                    companyEL.ID = friend_CompanyID;
                    companyEL.ExecuteEL(2);
                    HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到好友公司名字:" + companyEL.CompanyName);
                    string friend_CompanyName = companyEL.CompanyName;
                    //获取群组相关
                    if (dr["NoticeType"].ToString() == "3")//3为群组审核通知
                    {
                        long groupID = long.Parse(dr["GroupID"].ToString());
                        groupEL.ID = groupID;
                        groupEL.ExecuteEL(3);
                        HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到群组名称:" + groupEL.GroupName + "---群组ID:" + groupID);
                        dic.Add("GroupID", groupID.ToString());  //群组ID,入群审核用
                        dic.Add("GroupName", groupEL.GroupName); //群组名称,入群审核用
                    }
                    dic.Add("UserName", friend_Name);
                    dic.Add("Session", friend_Session);
                    dic.Add("ImgUrl", friend_Img);
                    dic.Add("CompanyName", friend_CompanyName);
                    dic.Add("NoticeID", dr["ID"].ToString());//ID:这里是单个Notice表里的ID
                    dic.Add("CreateTime", dr["CreateTime"].ToString());
                    dic.Add("NoticeType", dr["NoticeType"].ToString());
                    dic.Add("NoticeState", dr["NoticeState"].ToString());
                    dic.Add("IsLook", dr["IsLook"].ToString());
                }
                if (noticeType == "2")                        //系统通知
                {
                    dic.Add("NoticeID", dr["ID"].ToString()); //系统通知表的通知ID
                    string noticeTitleStr = dr["NoticeTitle"].ToString();
                    string noticeTitle    = noticeTitleStr.Length > 10 ? noticeTitleStr.Substring(0, 10) + "..." : noticeTitleStr;
                    dic.Add("NoticeTitle", noticeTitle);
                    string noticeContentStr = dr["NoticeContent"].ToString();
                    string noticeContent    = noticeContentStr.Length > 20 ? noticeContentStr.Substring(0, 20) + "..." : noticeContentStr;
                    dic.Add("NoticeContent", noticeContent);
                    dic.Add("AddressUrl", dr["AddressUrl"].ToString());
                    dic.Add("NoticeType", "2");
                    dic.Add("IsLook", dr["IsLook"].ToString());
                    dic.Add("CreateTime", dr["CreateTime"].ToString());
                }

                list.Add(dic);
            }
            ////调用此接口后默认都查看通知了,把通知都变为已经查看
            //noticeEL.IsLook = 1;
            //int ra;
            //long noticQue = noticeEL.ExecNonQuery(3, out ra);
            //HF.Cloud.BLL.Common.Logger.Error("GetNotice方法更改为已经查看的记录数为:" + ra.ToString());
            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法返回json数据:" + strJson);
            return(strJson);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取用户综合信息
        /// </summary>
        /// <param name="session">本人session</param>
        /// <param name="sessionFriend">需要获取信息的用户session</param>
        /// <returns></returns>
        public string GetUserInfoBySessionAndSessionFriend(string session, string sessionFriend)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取用户信息方法获取到参数session:" + session + "-----sessionFriend:" + sessionFriend);
            JavaScriptSerializer        js  = new JavaScriptSerializer();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            //通过sessionFriend获取用户
            SB_UserEL userel = new SB_UserEL();

            userel.Session_True = sessionFriend;
            userel.ExecuteEL(41);

            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取用户信息结果(大于0说明成功):" + userel.ID);
            if (userel.ID > 0)
            {
                dic.Add("UserName", userel.UserName);
                dic.Add("UserTel", userel.UserTel);
                dic.Add("Duty", userel.Duty);
                dic.Add("UserEmail", userel.UserEmail);
                dic.Add("Detail", userel.Detail);
                dic.Add("ImgUrl", userel.ImgUrl);
                dic.Add("Session", userel.Session_True);
                #region  人气值
                //组合人气值,人气值=好友查看的次数(好友第一次查看有效,一次以上的不记录)+所有群组群友人数和
                int popularityInt = 0; //人气值
                                       //用户查看人气值
                PopularityBLL popularityBLL = new PopularityBLL();
                //通过Session换取UserID
                UserBLL userBLL       = new UserBLL();
                long    userID        = userBLL.GetUserIDBySession(session);
                long    userID_Friend = userBLL.GetUserIDBySession(sessionFriend);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend方法获取到的用户ID  userID:" + userID + "---userID_Friend:" + userID_Friend);
                int friendLookInt = popularityBLL.GetPopularityNumber(userID);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend方法用户查看人气值为:" + friendLookInt);
                popularityInt += friendLookInt;
                //群组群友人数和
                GroupBLL groupBLL    = new GroupBLL();
                int      groupNumber = groupBLL.GetGroupPopularityNumber(userID);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend方法群组人气值为:" + groupNumber);
                popularityInt += groupNumber;
                dic.Add("Popularity", popularityInt);//人气
                #endregion
                string companyName = "";
                //通过公司ID查询公司名称
                CompanysEL compEL = new CompanysEL();
                compEL.ID = userel.CompanyID;
                compEL.ExecuteEL(2);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取公司信息结果(公司名称为):" + compEL.CompanyName);
                if (!string.IsNullOrEmpty(compEL.CompanyName))
                {
                    companyName = compEL.CompanyName;
                }
                dic.Add("CompanyName", companyName);
                dic.Add("CompanyIcon", compEL.CompanyIcon);
                dic.Add("CompanyID", compEL.ID);
                ///公司简介
                string companyIntroduceStr = compEL.Introduce;
                string introduceStr        = companyIntroduceStr.Length < 50 ? companyIntroduceStr : companyIntroduceStr.Substring(0, 50).ToString() + "...";
                dic.Add("CompanyIntroduce", introduceStr);
                //查看是否有查看sessionFriend用户的记录,有就不用管,没有的话就在SB_Popularity添加一个记录
                bool isLook = popularityBLL.IsLooked(userID, userID_Friend);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend方法,此用户是否被查看过:" + isLook);
                if (!isLook) //如果没有记录就添加一个
                {
                    long insertPopularity = popularityBLL.InsertPopularity(userID, userID_Friend);
                    HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend人气值增加结果:" + insertPopularity);
                }
            }
            //获取公司关键字
            CompanysBLL companyBLL = new CompanysBLL();
            string      tags       = companyBLL.GetCompanyTag_String(userel.CompanyID.ToString());
            dic.Add("Tags", tags);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取公司关键字:" + tags);
            //获取点赞个数
            ThumbsBLL thumbsBLL = new ThumbsBLL();
            string    thumbs    = thumbsBLL.GetThumbs(sessionFriend);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取点赞个数:" + thumbs);
            dic.Add("Thumb", thumbs.ToString());//点赞个数
            //这里要注意,第一个参数是好友的sesison,第二个参数是自己的session
            string isHadThumb = thumbsBLL.IsHadThumb(sessionFriend, session);
            dic.Add("IsHadThumb", isHadThumb);//是否被点赞
            //获取保存数
            FriendsBLL friendsBLL = new FriendsBLL();
            int        saves      = friendsBLL.GetSaveNumber(sessionFriend);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取保存个数:" + saves);
            dic.Add("Save", saves.ToString());//保存个数

            //如果session==sessionFriend,说明是自己看自己
            if (session == sessionFriend)
            {
                dic.Add("Who", "0");
            }
            else
            {
                //查看sessionFriend是否是session的好友
                bool isFriend = friendsBLL.IsFriend(session, sessionFriend);
                if (isFriend)
                {
                    //说明是好友
                    dic.Add("Who", "1");
                }
                else
                {
                    //说明不是好友
                    dic.Add("Who", "2");
                }
            }
            //小程序的token
            WX_TokenBLL tokenBLL = new WX_TokenBLL();
            string      token    = tokenBLL.GetToken();
            dic.Add("Token", token);

            string strJson = js.Serialize(dic);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend返回的数据为:" + strJson);
            return(strJson);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 搜索群
        /// </summary>
        /// <param name="session">用户session</param>
        /// <param name="groupName">群名称</param>
        /// <returns></returns>
        public string  SearchGroup(string session, string groupName)
        {
            HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法获取的参数session:" + session + "---groupName:" + groupName);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //通过Session获取UerID
            UserBLL userBLL = new UserBLL();
            long    userID  = userBLL.GetUserIDBySession(session);

            HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法获取到的UserID:" + userID);
            GroupEL groupEL = new GroupEL();
            //获取到userID用户所有群中包含groupName名字的群组
            DataTable        dt          = groupEL.ExecuteSqlString("select * from ViewGroupUnite where UserID=" + userID + " and GroupName like '%" + groupName + "%' and Group_Valid=1 and Unite_Valid=1");
            UserUniteGroupEL userGroupEL = new UserUniteGroupEL();
            SB_UserEL        userEL      = new SB_UserEL();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ////通过群ID获取群信息
                    //long groupID = (long)/*dr["GroupID"]*/;
                    //groupEL.ID = groupID;
                    //groupEL.ExecuteEL(3);
                    //HF.Cloud.BLL.Common.Logger.Error("SearchGroup方法获取到群组名称:" + groupEL.GroupName);
                    string groupName_true = dr["GroupName"].ToString();
                    long   ownerUserID    = (long)dr["OwnerUserID"];
                    string createTime     = dr["Group_CreateTime"].ToString();
                    //if (!string.IsNullOrEmpty(groupEL.GroupName))
                    //{
                    //    groupName_true = groupEL.GroupName;
                    //    ownerUserID = groupEL.OwnerUserID;
                    //    createTime = groupEL.CreateTime;
                    //}
                    //通过ownerUserID获取群主Name
                    userEL.ID = ownerUserID;
                    userEL.ExecuteEL(4);
                    HF.Cloud.BLL.Common.Logger.Error("SearchGroup方法获取到群主姓名:" + userEL.UserName);
                    string ownerUserName = "";
                    if (!string.IsNullOrEmpty(userEL.UserName))
                    {
                        ownerUserName = userEL.UserName;
                    }
                    //通过群ID获取群有多少人
                    userGroupEL.GroupID = (long)dr["Group_ID"];
                    DataTable dt_Count = userGroupEL.ExecDT(31);
                    HF.Cloud.BLL.Common.Logger.Error("SearchGroup方法获取到本群人数:" + dt_Count.Rows.Count);
                    int groupCount = dt_Count.Rows.Count;

                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("GroupName", groupName_true);
                    dic.Add("GroupOwnerName", ownerUserName);
                    dic.Add("CreateTime", createTime);
                    dic.Add("GroupCount", groupCount.ToString());
                    dic.Add("GroupID", dr["Group_ID"].ToString());
                    list.Add(dic);
                }
            }
            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("SearchGroup方法返回的json数据:" + strJson);
            return(strJson);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 群组人员列表
        /// </summary>
        /// <param name="groupID">群组ID</param>
        /// <returns></returns>
        public string GetGroupFriendList(string session, string groupID)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法获取到的参数groupID:" + groupID);
            JavaScriptSerializer                js   = new JavaScriptSerializer();
            Dictionary <string, object>         dic  = new Dictionary <string, object>();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //通过groupID获取群信息
            GroupEL          groupEL      = new GroupEL();
            SB_UserEL        userEL       = new SB_UserEL();
            UserUniteGroupEL userGroupEL  = new UserUniteGroupEL();
            long             groupID_long = long.Parse(groupID);

            groupEL.ID = groupID_long;
            groupEL.ExecuteEL(3);
            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法获取到群组名称:" + groupEL.GroupName);
            string groupName   = ""; //群名称
            long   ownerUserID = 0;  //群主userID
            string introduce   = ""; //群简介
            string isOpen      = ""; //1公开或0私密

            if (!string.IsNullOrEmpty(groupEL.GroupName))
            {
                groupName   = groupEL.GroupName;
                ownerUserID = groupEL.OwnerUserID;
                introduce   = groupEL.Introduce;
                isOpen      = groupEL.IsOpen.ToString();
            }
            //通过ownerUserID获取群主Name
            userEL.ID = ownerUserID;
            userEL.ExecuteEL(4);
            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法获取到群主姓名:" + userEL.UserName);
            string ownerUserName = "";

            if (!string.IsNullOrEmpty(userEL.UserName))
            {
                ownerUserName = userEL.UserName;
            }
            string userSession = userEL.Session_True;

            //通过群ID获取群有多少人
            userGroupEL.GroupID = groupID_long;
            DataTable dt_Count = userGroupEL.ExecDT(31);

            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法获取到本群人数:" + dt_Count.Rows.Count);
            int groupCount = dt_Count.Rows.Count;

            foreach (DataRow dr in dt_Count.Rows)
            {
                //获取到userID
                string  userID   = dr["UserID"].ToString();
                UserBLL userBLL  = new UserBLL();
                string  userInfo = userBLL.GetUserInfoByUserID(userID);
                //把userInfo反序列化出来
                Dictionary <string, object> json_userInfo = new Dictionary <string, object>();
                json_userInfo = js.Deserialize <Dictionary <string, object> >(userInfo);
                //加上置顶字段 IsTop 2018-1-15
                json_userInfo.Add("IsTop", dr["IsTop"].ToString());
                list.Add(json_userInfo);
            }
            dic.Add("GroupName", groupName);
            dic.Add("GroupOwnerName", ownerUserName);
            dic.Add("Introduce", introduce);
            dic.Add("IsOpen", isOpen);
            dic.Add("GroupCount", groupCount.ToString());
            dic.Add("GroupID", groupID.ToString());
            dic.Add("IsGroupOwner", session == userSession?"1":"0");
            dic.Add("User", list);

            string strJson = js.Serialize(dic);

            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法返回的json数据:" + strJson);
            return(strJson);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 我的群组列表
        /// </summary>
        /// <param name="session">session</param>
        /// <returns></returns>
        public string GetMyGroups(string session)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到的参数session:" + session);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //通过Session获取UerID
            UserBLL userBLL = new UserBLL();
            long    userID  = userBLL.GetUserIDBySession(session);

            HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到的UserID:" + userID);
            //通过userID获取GroupID
            UserUniteGroupEL userGroupEL = new UserUniteGroupEL();

            userGroupEL.UserID = userID;
            DataTable dt = userGroupEL.ExecDT(3);

            HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到群组个数为:" + dt.Rows.Count);
            GroupEL   groupEL = new GroupEL();
            SB_UserEL userEL  = new SB_UserEL();

            foreach (DataRow dr in dt.Rows)
            {
                //通过群ID获取群信息
                long groupID = (long)dr["GroupID"];
                groupEL.ID = groupID;
                groupEL.ExecuteEL(3);
                HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到群组名称:" + groupEL.GroupName);
                string groupName   = "";
                long   ownerUserID = 0;
                string createTime  = "";
                if (!string.IsNullOrEmpty(groupEL.GroupName))
                {
                    groupName   = groupEL.GroupName;
                    ownerUserID = groupEL.OwnerUserID;
                    createTime  = groupEL.CreateTime;
                }
                //通过ownerUserID获取群主Name
                userEL.ID = ownerUserID;
                userEL.ExecuteEL(4);
                HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到群主姓名:" + userEL.UserName);
                string ownerUserName = "";
                if (!string.IsNullOrEmpty(userEL.UserName))
                {
                    ownerUserName = userEL.UserName;
                }
                //通过群ID获取群有多少人
                userGroupEL.GroupID = groupID;
                DataTable dt_Count = userGroupEL.ExecDT(31);
                HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到本群人数:" + dt_Count.Rows.Count);
                int groupCount = dt_Count.Rows.Count;

                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("GroupName", groupName);
                dic.Add("GroupOwnerName", ownerUserName);
                dic.Add("CreateTime", createTime);
                dic.Add("GroupCount", groupCount.ToString());
                dic.Add("GroupID", groupID.ToString());
                list.Add(dic);
            }

            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法返回的json数据:" + strJson);
            return(strJson);
        }