示例#1
0
        /// <summary>
        /// 公司页面,添加或选择公司
        /// </summary>
        /// <param name="session">用户session</param>
        /// <param name="companyName">公司全名称</param>
        /// <returns></returns>
        public string AddOrSelectCompany_EditCompany(string session, string companyName)
        {
            string resultStr = "";

            Common.Logger.Error("AddOrSelectCompany_EditCompany方法获取到的参数session:" + session + "---companyName:" + companyName);
            //公司表查看数据库是否有此公司,1有的话就给session用户绑定上此公司,2没有的话就先给公司表添加公司再给session用户绑定公司
            //获取公司ID (调用AddOrSelectCompany方法即可)
            string companyID = AddOrSelectCompany(companyName);

            Common.Logger.Error("AddOrSelectCompany_EditCompany方法获取公司ID为:" + companyID);
            //通过session修改个人绑定的公司ID
            SB_UserEL userEL = new SB_UserEL();

            userEL.CompanyID    = long.Parse(companyID);
            userEL.Session_True = session;
            int  ra;
            long excuteUpdate = userEL.ExecNonQuery(26, out ra);

            Common.Logger.Error("AddOrSelectCompany_EditCompany方法用户绑定公司结果为(大于0成功):" + excuteUpdate);
            if (ra > 0)
            {
                resultStr = "success";
            }
            else
            {
                resultStr = "error";
            }
            return(resultStr);
        }
示例#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);
        }
示例#3
0
        /// <summary>
        /// 获取个人小程序码图片
        /// </summary>
        /// <param name="path">小程序码跳转的路径</param>
        /// <param name="session">用户session</param>
        /// <returns></returns>
        public string GetUserQRCode(string path, string session)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetUserQRCode方法,参数path:" + path + "------session:" + session);
            string imgPath = "";
            //判断数据库中是否有值
            SB_UserEL userEL = GetUserELBySession(session);

            //如果QRCode有值,则返回数据库中QRCode的值
            if (!string.IsNullOrEmpty(userEL.QRCode) && userEL.QRCode != "")
            {
                //获取图片名称
                string qrCodeImageName = userEL.QRCode;
                //获取图片路径
                string qrCodeImagePath = System.Configuration.ConfigurationManager.AppSettings["QRCodeGet_User"];
                imgPath = qrCodeImagePath + qrCodeImageName;
            }
            //数据库中QRCode没有数据,则需要获取小程序码图片保存图片,并把图片名称保存到数据库中
            else
            {
                //获取token
                WX_TokenBLL tokenBLL = new WX_TokenBLL();
                string      token    = tokenBLL.GetToken();
                //获取小程序码接口
                string url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + token;
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("path", path);
                JavaScriptSerializer js = new JavaScriptSerializer();
                js.MaxJsonLength = int.MaxValue;
                string json = js.Serialize(dic);
                HF.Cloud.BLL.Common.Logger.Error("GetUserQRCode方法,获取小程序码的json:" + json);
                HF.Cloud.BLL.Common.Logger.Error("GetUserQRCode方法,url:" + url + "-----Path:" + path);
                //post返回的小程序码流
                Stream QRCodeStream = WeChatAppDecrypt.Post(url, json);
                //将图片流转换成图片
                Bitmap tp = new Bitmap(QRCodeStream);
                string QRCodeSave_User = System.Configuration.ConfigurationManager.AppSettings["QRCodeSave_User"];
                string image_userName  = Guid.NewGuid().ToString();
                string qrCodeImageName = image_userName + ".jpg";
                HF.Cloud.BLL.Common.Logger.Error("GetUserQRCode方法,保存小程序图片路径名称:" + QRCodeSave_User + qrCodeImageName);
                tp.Save(QRCodeSave_User + qrCodeImageName);
                //把小程序码图片名称保存到数据库中
                userEL.QRCode = qrCodeImageName;
                int  ra;
                long returnValue = userEL.ExecNonQuery(27, out ra);
                HF.Cloud.BLL.Common.Logger.Error("GetUserQRCode方法,保存小程序图片名称结果:" + ra);
                if (ra > 0)
                {
                    string QRCodeGet_User = System.Configuration.ConfigurationManager.AppSettings["QRCodeGet_User"];
                    imgPath = QRCodeGet_User + qrCodeImageName;
                }
                else
                {
                    imgPath = "error";
                }
            }
            HF.Cloud.BLL.Common.Logger.Error("GetUserQRCode方法,返回的结果:" + imgPath);
            return(imgPath);
        }
示例#4
0
        /// <summary>
        /// 通过code获取session
        /// </summary>
        /// <param name="code">小程序login获取的Code</param>
        /// <returns></returns>
        public string GetSessionByCode(string code)
        {
            string strJson = "";

            BLL.Common.Logger.Error("GetSessionByCode方法接受到的参数code:" + code);
            JavaScriptSerializer        js  = new JavaScriptSerializer();
            Dictionary <string, object> dic = new Dictionary <string, object>();
            string str_OpenidAndSessinKey   = "";

            if (!string.IsNullOrEmpty(code))
            {
                //获取openid和Session_Key
                WeChatAppDecrypt Wechat = new WeChatAppDecrypt();
                str_OpenidAndSessinKey = Wechat.GetOpenIdAndSessionKeyString(code);

                BLL.Common.Logger.Error("GetSessionByCode方法获取到openid和Sessionkey:" + str_OpenidAndSessinKey);
                var    openidAndSessionKey = js.Deserialize <Dictionary <string, object> >(str_OpenidAndSessinKey);
                string strOpenID           = openidAndSessionKey["openid"].ToString();
                string strSession_Key      = openidAndSessionKey["session_key"].ToString();
                //通过openID获取用户记录
                SB_UserEL userEL = new SB_UserEL();
                userEL.OpenID = strOpenID;
                DataTable dt            = userEL.ExecDT(43);
                string    sessionResult = "";
                string    isHadRegister = "";
                if (dt != null && dt.Rows.Count > 0)
                {
                    sessionResult = dt.Rows[0]["Session_True"].ToString();
                    isHadRegister = "1";
                }
                else
                {
                    //生成session
                    //生成6位随机数
                    string strRandom = new Random().Next(100000, 1000000).ToString();
                    //session_Key格式:q/jk63En5ojUGqgi6vLHmA==(24个字符)
                    //openID格式:oFQX10O9zkRnsNYefrc48KfQWi9o(28个字符)
                    //strSession_true=strSession_Key+strOpenID+strRandom
                    //session等于sesion_key去掉后两位的“=”号(22位),加openid(28位),加六位随机数(6位)
                    //sessionResult=q/jk63En5ojUGqgi6vLHmAoFQX10O9zkRnsNYefrc48KfQWi9o654321
                    string strSession_true = strSession_Key.Substring(0, strSession_Key.Length - 2) + strOpenID + strRandom;
                    sessionResult = strSession_true;
                    isHadRegister = "0";
                }
                dic.Add("Session", sessionResult);
                dic.Add("IsHadRegister", isHadRegister);

                strJson = js.Serialize(dic);
                HF.Cloud.BLL.Common.Logger.Error("GetSessionByCode方法返回的数据为:" + strJson);
            }
            else
            {
                strJson = "error";
            }

            return(strJson);
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
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);
        }
示例#8
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);
        }
示例#9
0
        protected void LnkBtnDelete_Command(object sender, CommandEventArgs e)
        {
            string     cn     = e.CommandName;
            string     cnArgs = e.CommandArgument.ToString();
            SB_UserMEL userM  = new SB_UserMEL();
            int        flag;

            using (TransactionScope scope = new TransactionScope())
            {
                switch (cn)
                {
                case "Stop":
                    userM.ID = long.Parse(cnArgs);
                    userM.ExecNonQuery(3, out flag);

                    SB_UserEL user = new SB_UserEL()
                    {
                        Valid  = 0,
                        MainID = userM.ID
                    };

                    user.ExecNonQuery(25, out flag);

                    BindDataList();
                    break;

                case "Enable":
                    userM.ID = long.Parse(cnArgs);
                    userM.ExecNonQuery(31, out flag);

                    SB_UserEL userE = new SB_UserEL()
                    {
                        Valid  = 1,
                        MainID = userM.ID
                    };

                    userE.ExecNonQuery(25, out flag);

                    BindDataList();

                    break;
                }

                scope.Complete();
            }
        }
示例#10
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);
        }
示例#11
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lnkBtnSearch_Click(object sender, EventArgs e)
        {
            string tips = ValidateInput();

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    if (tips == string.Empty)
                    {
                        SysBL     bl = new SysBL();
                        SB_UserEL el = new SB_UserEL();

                        BLL.Common.Symmetric sm = new BLL.Common.Symmetric();

                        el = bl.InsertUser(this.txtUserCode.Text.Trim(), sm.Encrypto("123456"), this.txtUserCode.Text.Trim(), this.txtSBName.Text.Trim(), txtUserName.Text.Trim());

                        bl.addQBCodeModel(el.MainID);              //给服务商添加一个默认模板
                        //给服务商添加一个支付账号,开通账户
                        string Cname = this.txtSBName.Text.Trim(); //企业名称
                        bl.addMainAccount(el.MainID, Cname);
                        //给服务商添加短信模板
                        bl.addMessageSet(el.MainID);

                        if (el != null && el.ID > 0)
                        {
                            MessageBox.ShowAndRedirect(this, "服务商保存成功,默认密码为:123456", "/ServiceProvider/index.aspx");
                            scope.Complete();
                        }
                        else
                        {
                            MessageBox.Show(this, "增加用户账户时失败!");
                        }
                    }
                    else
                    {
                        MessageBox.Show(this, tips);
                    }
                }
                catch (Exception er)
                {
                    MessageBox.Show(this, "保存失败," + er.Message + "!");
                }
            }
        }
示例#12
0
        /// <summary>
        /// 给公司递名片
        /// </summary>
        /// <param name="session">session</param>
        /// <param name="companyID">公司ID</param>
        /// <returns></returns>
        public string SendCard(string session, string companyID)
        {
            string resStr = "";

            HF.Cloud.BLL.Common.Logger.Error("SendCard方法接受的参数session:" + session + "---companyID:" + companyID);
            //通过session获取UserID
            UserBLL userBLL = new UserBLL();
            long    userID  = userBLL.GetUserIDBySession(session);
            //通过companyID查询企业的所有员工
            SB_UserEL userEL = new SB_UserEL();

            userEL.CompanyID = long.Parse(companyID);
            DataTable dt = userEL.ExecDT(44);

            HF.Cloud.BLL.Common.Logger.Error("SendCard方法获取到企业员工数为:" + dt.Rows.Count);
            NoticeEL noticeEL = new NoticeEL();
            int      i        = 0;

            foreach (DataRow dr in dt.Rows)
            {
                noticeEL.UserID        = (long)dr["ID"]; //接受通知用户的userID
                noticeEL.UserID_Friend = userID;         //
                noticeEL.NoticeType    = 1;
                noticeEL.NoticeState   = 0;
                noticeEL.IsLook        = 0;
                noticeEL.CreateTime    = DateTime.Now.ToString();
                noticeEL.Valid         = 1;
                int  ra;
                long notiExec = noticeEL.ExecNonQuery(1, out ra);
                if (notiExec > 0)
                {
                    i = i + 1;
                }
            }
            if (dt.Rows.Count == i)
            {
                resStr = "seccess";
            }
            else
            {
                resStr = "error";
            }
            return(resStr);
        }
示例#13
0
        /// <summary>
        /// 红包开关
        /// </summary>
        /// <param name="companyId">公司ID</param>
        /// <returns></returns>
        public string OpenRedBag(string companyID)
        {
            HF.Cloud.BLL.Common.Logger.Error("OpenRedBag 获取到的参数CompanyID:" + companyID);
            //查看时间,过期则不可打开
            //if(DateTime.Now.ToString()<"2018-02-16 23:12:12:123")
            //{
            //}
            string resultStr     = "";
            long   companyIdLong = 0;//公司ID

            if (long.TryParse(companyID, out companyIdLong))
            {
                //1通过公司id在用户表中看当前公司够5个人不够
                SB_UserEL userEL = new SB_UserEL();
                userEL.CompanyID = companyIdLong;
                DataTable dt_User = userEL.ExecDT(44);
                //1.1够5个人则开始在红包表里面添加红包数据
                if (dt_User != null && dt_User.Rows.Count >= 5)
                {
                    //2 查看已经发了多少钱,发过的总数大于1000停止发送
                    DataTable dt_HongBalAllVa = DbHelperSQL.Query("select sum(HongBaoValue) as AllValue from T_HongBao where Valid=1").Tables[0];
                    string    allValueStr     = dt_HongBalAllVa.Rows[0][0].ToString();
                    //2.1已经发送的总金额小于900的话继续发
                    if (string.IsNullOrEmpty(allValueStr) || double.Parse(allValueStr) < 850)
                    {
                        T_HongBaoEL hongBaoEl = new T_HongBaoEL();
                        //查看红包表是否已经存在记录,存在则不添加红包记录
                        hongBaoEl.CompanyID = companyIdLong;
                        DataTable dt_HongBao = hongBaoEl.ExecDT(33);
                        if (dt_HongBao == null || dt_HongBao.Rows.Count < 1)
                        {
                            //3发红包表添加记录
                            //3.1生成公司红包金额10-100随机数,红包个数是金额的0.5-1倍
                            Random ran = new Random();
                            //3.1.1红包金额,取下不取上
                            int comAllValue = ran.Next(10, 100);
                            //3.1.2人数
                            int comNumber = (int)Math.Floor(ran.Next(5, 10) * 0.1 * comAllValue);
                            HF.Cloud.BLL.Common.Logger.Error("OpenRedBag方法红包总金额是:" + comAllValue + "---总人数:" + comNumber);
                            //3.2通过总金额和人数获取评分后的红包值
                            List <Double> listHongV = HongBao.GetRedBagList(double.Parse(comAllValue.ToString()), comNumber, 1.00);
                            //3.3通过获取到的红包值列表,给红包表添加记录
                            for (int i = 0; i < listHongV.Count; i++)
                            {
                                //ID,CompanyID,HongBaoValue,GetUserID,IsGet,
                                //CreateTime,GiveOutTime,Valid
                                //HF.Cloud.BLL.Common.Logger.Error("OpenRedBag方法获得的红包值listHongV是:" + listHongV[i]);
                                hongBaoEl.CompanyID = companyIdLong;
                                //hongBaoEl.HongBaoValue = decimal.Round((decimal)listHongV[i],2);
                                hongBaoEl.HongBaoValue = decimal.Parse(listHongV[i].ToString());
                                hongBaoEl.IsGet        = 1;
                                hongBaoEl.CreateTime   = DateTime.Now.ToString();
                                hongBaoEl.GiveOutTime  = "";
                                hongBaoEl.Valid        = 1;
                                int ra;
                                hongBaoEl.ExecNonQuery(1, out ra);
                            }
                            HF.Cloud.BLL.Common.Logger.Error("OpenRedBag方法生成的红包个数:" + listHongV.Count);
                            resultStr = "success";
                        }
                        else    //已经激活不能再次激活
                        {
                            resultStr = "actived";
                        }
                    }
                    else    //2.2红包奖金池已经用完额度
                    {
                        resultStr = "empty";
                    }
                }
                else//1.2不够5个人则提示人数不够
                {
                    resultStr = "notenough";
                }
            }
            else
            {
                resultStr = "error";
            }
            HF.Cloud.BLL.Common.Logger.Error("OpenRedBag 结果:" + resultStr);
            return(resultStr);
        }
示例#14
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);
        }
示例#15
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);
        }
示例#16
0
        /// <summary>
        /// 群组人员置顶 取消置顶  删除
        /// </summary>
        /// <param name="userID">人员ID</param>
        /// <param name="groupID">群组ID</param>
        /// <param name="cookie">操作的功能(top置顶distop取消置顶delete删除)</param>
        /// <returns></returns>
        public string EditUser(string session, string userID, string groupID, string cookie)
        {
            string retunStr = "";

            HF.Cloud.BLL.Common.Logger.Error("EditUser编辑群组人员方法,获取的参数userID:" + userID + "------groupID:" + groupID + "------cookie:" + cookie);
            UserUniteGroupEL userGroupEL = new UserUniteGroupEL();

            if (!string.IsNullOrEmpty(userID) && !string.IsNullOrEmpty(groupID) && !string.IsNullOrEmpty(cookie))
            {
                userGroupEL.UserID  = long.Parse(userID);
                userGroupEL.GroupID = long.Parse(groupID);
                if (cookie == "top")//置顶
                {
                    //获取当前置顶的istop最大值
                    int       maxIsTop    = 0;
                    DataTable dtUserGroup = userGroupEL.ExecDT(35);
                    if (dtUserGroup != null && dtUserGroup.Rows.Count > 0)
                    {
                        maxIsTop = Int32.Parse(dtUserGroup.Rows[0]["IsTop"].ToString());
                    }
                    userGroupEL.IsTop = maxIsTop + 1;
                    int  ra;
                    long returnVel = userGroupEL.ExecNonQuery(22, out ra);
                    if (ra > 0)
                    {
                        retunStr = GetGroupFriendList(session, groupID);
                    }
                    else
                    {
                        retunStr = "error";
                    }
                }
                if (cookie == "distop")//取消置顶
                {
                    userGroupEL.IsTop = 0;
                    int  ra;
                    long returnVel = userGroupEL.ExecNonQuery(23, out ra);
                    if (ra > 0)
                    {
                        retunStr = GetGroupFriendList(session, groupID);
                    }
                    else
                    {
                        retunStr = "error";
                    }
                }
                if (cookie == "del")//删除
                {
                    //不可删自己
                    //通过groupID获取群信息
                    GroupEL groupEL      = new GroupEL();
                    long    groupID_long = long.Parse(groupID);
                    groupEL.ID = groupID_long;
                    groupEL.ExecuteEL(3);
                    //群主ID
                    string userID_Group = groupEL.OwnerUserID.ToString();
                    //通过sesison 获取userID
                    SB_UserEL userEL = new SB_UserEL();
                    userEL.Session_True = session;
                    DataTable dtUserEl    = userEL.ExecDT(41);
                    string    userID_User = "";
                    if (dtUserEl != null && dtUserEl.Rows.Count > 0)
                    {
                        userID_User = dtUserEl.Rows[0]["ID"].ToString();
                    }
                    //如果不是群主
                    if (userID_Group != userID_User)
                    {
                        int  ra;
                        long returnVel = userGroupEL.ExecNonQuery(2, out ra);
                        if (ra < 0)
                        {
                            retunStr = "error";
                        }
                    }
                    retunStr = GetGroupFriendList(session, groupID);
                }
            }
            return(retunStr);
        }
示例#17
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="strAddUser"></param>
        /// <returns></returns>
        public string InsertUser(string strAddUser)
        {
            BLL.Common.Logger.Error("InsertUser方法新增加用户接受到的参数string:" + strAddUser);
            string InsertUserRes    = "";//返回的数据
            JavaScriptSerializer js = new JavaScriptSerializer();
            var       info          = js.Deserialize <Dictionary <string, object> >(strAddUser);
            SB_UserEL SB_User_el    = new SB_UserEL();

            SB_User_el.UserName  = info["UserName"].ToString();
            SB_User_el.UserTel   = info["UserTel"].ToString();
            SB_User_el.Duty      = info["Duty"].ToString();
            SB_User_el.UserEmail = info["UserEmail"].ToString();
            SB_User_el.Detail    = info["Detail"].ToString();
            SB_User_el.ImgUrl    = info["ImgUrl"].ToString();
            SB_User_el.CompanyID = long.Parse(info["CompanyID"].ToString());

            SB_User_el.Popularity = 0;
            SB_User_el.Thumbs     = 0;
            SB_User_el.CreateTime = DateTime.Now.ToString();
            SB_User_el.Valid      = 1;
            SB_User_el.UnionID    = "";

            //string strOpneID = info["OpenID"].ToString();
            //SB_User_el.OpenID = strOpneID;
            //string strSession_Key= info["Session_Key"].ToString();
            //SB_User_el.Session_Key = strSession_Key;

            //SB_User_el.UnionID = "";

            //string strSession_true = "";
            //string strRandom = new Random().Next(100000, 1000000).ToString();
            //strSession_true = strSession_Key.Substring(0, strSession_Key.Length - 2) + strOpneID + strRandom;
            //SB_User_el.Session_True = strSession_true;
            //----------------------------------------------------------------------------------
            //string code = info["Code"].ToString();
            //string strSession_true = "";
            //string strOpneID = "";
            //if (!string.IsNullOrEmpty(code))
            //{
            //    //获取openid和Session_Key
            //    WeChatAppDecrypt Wechat = new WeChatAppDecrypt();
            //    string str_res = Wechat.GetOpenIdAndSessionKeyString(code);
            //    BLL.Common.Logger.Error("新增加用户获取到openid和Sessionkey:" + str_res);
            //    var openidAndSessionKey = js.Deserialize<Dictionary<string, object>>(str_res);
            //    strOpneID = openidAndSessionKey["openid"].ToString();
            //    SB_User_el.OpenID = strOpneID;
            //    SB_User_el.Session_Key = openidAndSessionKey["session_key"].ToString();
            //    SB_User_el.UnionID = "";
            //    string strRandom = new Random().Next(100000, 1000000).ToString();
            //    strSession_true = openidAndSessionKey["session_key"].ToString() + strRandom;
            //    SB_User_el.Session_True = strSession_true;
            //}


            //string strOpneID = "";
            //string strSession_key = "";
            ////如果传过来OpenID和Session_Key(小程序获取手机号从而得到OpenID和Session_key)
            //if (!string.IsNullOrEmpty(info["OpenID"].ToString()) && !string.IsNullOrEmpty(info["Session_Key"].ToString()))
            //{
            //    strOpneID = info["OpenID"].ToString();
            //    strSession_key = info["Session_Key"].ToString();
            //}
            ////如果没有openID和Session_Key的话就用Code去换取(小程序中直接填写的手机号,没有获取)
            //else if (!string.IsNullOrEmpty(info["Code"].ToString()))
            //{
            //    //获取openid和Session_Key
            //    WeChatAppDecrypt Wechat = new WeChatAppDecrypt();
            //    string str_res = Wechat.GetOpenIdAndSessionKeyString(info["Code"].ToString());
            //    BLL.Common.Logger.Error("InsertUser方法新增加用户获取到openid和Sessionkey:" + str_res);
            //    var openidAndSessionKey = js.Deserialize<Dictionary<string, object>>(str_res);
            //    strOpneID = openidAndSessionKey["openid"].ToString();
            //    strSession_key = openidAndSessionKey["session_key"].ToString();
            //}
            //SB_User_el.OpenID = strOpneID;
            //SB_User_el.Session_Key = strSession_key;


            string session_True = info["Session_True"].ToString();

            //判断Session_True是否为空
            if (!string.IsNullOrEmpty(session_True) && session_True != "")
            {
                //User表中判断Session_True,看是否有Session_True,有的话就是修改,没有的话就是添加
                SB_UserEL SB_User_el_IsHadSession = new SB_UserEL();
                SB_User_el_IsHadSession.Session_True = session_True;
                DataTable dt = SB_User_el_IsHadSession.ExecDT(45);
                BLL.Common.Logger.Error("InsertUser方法用户表中查询用户个数为:" + dt.Rows.Count);

                if (dt != null && dt.Rows.Count > 0)
                {
                    //修改用户记录
                    SB_User_el.Session_True = session_True;
                    int  aff;
                    long executeResul = SB_User_el.ExecNonQuery(24, out aff);
                    BLL.Common.Logger.Error("InsertUser方法修改用户信息结果为:" + aff);
                    if (aff > 0)
                    {
                        //返回数据库中的Session_True
                        InsertUserRes = session_True;
                        BLL.Common.Logger.Error("InsertUser方法这里是修改用户信息成功,返回的session为:" + InsertUserRes);
                    }
                    else
                    {
                        InsertUserRes = "error";
                    }
                }
                else//添加用户
                {
                    SB_User_el.Session_True = session_True;
                    //拆分sesison_True,获取openid和sesison_key
                    string str_session_key = session_True.Substring(0, 22) + "==";
                    string str_openid      = session_True.Substring(22, 28);
                    SB_User_el.Session_Key = str_session_key;
                    SB_User_el.OpenID      = str_openid;
                    //添加
                    int  aff;
                    long executeResul = SB_User_el.ExecNonQuery(1, out aff);
                    BLL.Common.Logger.Error("InsertUser方法添加用户信息结果为:" + executeResul);
                    if (executeResul > 0)
                    {
                        InsertUserRes = session_True;
                        BLL.Common.Logger.Error("InsertUser方法添加用户信息成功!返回的session为:" + InsertUserRes);
                    }
                    else
                    {
                        InsertUserRes = "error";
                    }
                }
            }

            ////User表中判断openid,看是否有openid,有的话就是修改,没有的话就是添加
            //SB_UserEL SB_User_el_IsHaveOpenID = new SB_UserEL();
            //SB_User_el_IsHaveOpenID.OpenID = strOpneID;
            //SB_User_el_IsHaveOpenID.ExecuteEL(43);
            //if (SB_User_el_IsHaveOpenID.ID > 0)
            //{
            //    //修改用户记录
            //    int aff;
            //    long executeResul = SB_User_el.ExecNonQuery(24, out aff);
            //    if (aff > 0)
            //    {
            //        //返回数据库中的Session_True
            //        InsertUserRes = SB_User_el_IsHaveOpenID.Session_True;
            //        BLL.Common.Logger.Error("InsertUser方法这里是修改用户信息成功,返回的session为:" + InsertUserRes);
            //    }
            //    else
            //    {
            //        InsertUserRes = "";
            //    }
            //}
            //else
            //{
            //    //添加用户记录
            //    //生成session
            //    string strSession_true = "";
            //    string strRandom = new Random().Next(100000, 1000000).ToString();
            //    strSession_true = strSession_key.Substring(0, strSession_key.Length - 2) + strOpneID + strRandom;
            //    SB_User_el.Session_True = strSession_true;
            //    //添加
            //    int aff;
            //    long executeResul = SB_User_el.ExecNonQuery(1, out aff);
            //    if (executeResul > 0)
            //    {
            //        InsertUserRes = strSession_true;
            //        BLL.Common.Logger.Error("InsertUser方法添加用户信息成功!返回的session为:" + InsertUserRes);
            //    }
            //    else
            //    {
            //        InsertUserRes = "";
            //    }
            //}

            return(InsertUserRes);
        }
示例#18
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);
        }
示例#19
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);
        }
示例#20
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);
        }
示例#21
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);
        }
示例#22
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);
        }