예제 #1
0
 protected void btnOk_Click(object sender, EventArgs e)
 {
     Tz888.BLL.GoodFriend   friendBll = new Tz888.BLL.GoodFriend();
     Tz888.Model.GoodFriend model     = new Tz888.Model.GoodFriend();
     if (this.tboxName.Text.IndexOf(",") > -1)
     {
         string[] names = this.tboxName.Text.Trim().Split(',');
         for (int i = 0; i < names.Length; i++)
         {
             if (names[i].Trim() != "")
             {
                 Tz888.BLL.Conn dal      = new Tz888.BLL.Conn();
                 string         strWhere = "";
                 strWhere = "nickName='" + names[i].Trim() + "'";
                 long      m  = 1;
                 long      j  = 1;
                 long      k  = 1;
                 DataTable dt = dal.GetList("loginInfoTab", "loginName", "loginName", strWhere, "loginName", ref m, k, ref j);
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     model.LoginName = Page.User.Identity.Name;
                     //model.LoginName = "kiki";
                     model.ContactName = dt.Rows[0][0].ToString();
                     model.GroupId     = 3;
                     friendBll.AddFriend(model);
                 }
                 else
                 {
                     Response.Write("<script>alert('用户不存在')</script>");
                 }
             }
         }
     }
     else
     {
         Tz888.BLL.Conn dal      = new Tz888.BLL.Conn();
         string         strWhere = "";
         strWhere = "nickName='" + this.tboxName.Text.Trim() + "'";
         long      i  = 1;
         long      j  = 1;
         long      k  = 1;
         DataTable dt = dal.GetList("loginInfoTab", "loginName", "loginName", strWhere, "loginName", ref i, k, ref j);
         if (dt != null && dt.Rows.Count > 0)
         {
             model.LoginName = Page.User.Identity.Name;
             //model.LoginName = "kiki";
             model.ContactName = dt.Rows[0][0].ToString();
             model.GroupId     = 3;
             friendBll.AddFriend(model);
         }
         else
         {
             Response.Write("<script>alert('用户不存在')</script>");
         }
     }
     getList();
 }
예제 #2
0
    protected void brnFriend_Click(object sender, EventArgs e)
    {
        LinkButton btn = new LinkButton();

        btn       = (LinkButton)sender;
        loginname = btn.CommandName.Trim();

        Tz888.BLL.GoodFriend friendBll = new Tz888.BLL.GoodFriend();

        Tz888.Model.GoodFriend model = new Tz888.Model.GoodFriend();
        model.LoginName   = Page.User.Identity.Name;//"sunray";
        model.ContactName = loginname;
        model.GroupId     = 1;
        friendBll.AddFriend(model);
        //string url="../FriendManager/addsuccess.aspx?name="+loginname;
        Response.Redirect("../FriendManager/addsuccess.aspx?name=" + loginname);
    }
예제 #3
0
    protected void btnAddFriend_Click(object sender, EventArgs e)
    {
        Button btn;

        btn = (Button)sender;
        bool   blSuccess    = false;
        bool   grade        = false;
        bool   type         = false;
        string name         = btn.CommandName.Substring(0, btn.CommandName.IndexOf("_"));
        string memberGrade  = btn.CommandName.Substring(btn.CommandName.IndexOf("_") + 1, btn.CommandName.IndexOf("%") - btn.CommandName.IndexOf("_") - 1);
        string manageType   = btn.CommandName.Substring(btn.CommandName.IndexOf("%") + 1, btn.CommandName.IndexOf("$") - btn.CommandName.IndexOf("%") - 1);
        string memberIntent = btn.CommandName.Substring(btn.CommandName.IndexOf("$") + 1);

        Tz888.BLL.GoodFriend   friendBll = new Tz888.BLL.GoodFriend();
        Tz888.Model.GoodFriend set       = new Tz888.Model.GoodFriend();

        bool IsBlack = friendBll.IsSpecies(name, Page.User.Identity.Name, 3);

        //bool IsBlack = friendBll.IsSpecies("huangleon", "beckycheng", 3);
        if (IsBlack)
        {
            Response.Write("<script>alert('添加好友失败!您被加入黑名单')</script>");
            return;
        }
        bool IsFriend = friendBll.IsSpecies(Page.User.Identity.Name, name, 1);

        //bool IsFriend = friendBll.IsSpecies("huangleon", "beckycheng", 1);
        if (IsFriend)
        {
            Response.Write("<script>alert('添加好友失败!用户已在好友列表中')</script>");
            return;
        }
        if (name.Trim() == Page.User.Identity.Name.Trim())
        {
            Response.Write("<script>alert('添加好友失败!不能添加自己为好友')</script>");
            return;
        }

        set = friendBll.GetFriendSet(name);
        if (set != null)
        {
            if (set.MemberGrade == 2)
            {
                if (memberGrade == "1001")
                {
                    grade = true;
                }
                else if (Page.User.IsInRole("GT1002"))
                {
                    grade = true;
                }
            }
            else if (set.MemberGrade == 0)
            {
                grade = true;
            }
            if (grade)
            {
                if (set.MemberType == 0)
                {
                    type = true;
                }
                else if (set.MemberType == 1)
                {
                    if (manageType.Trim() == "1004")
                    {
                        type = true;
                    }
                }
                else if (set.MemberType == 2)
                {
                    if (manageType.Trim() == "1003")
                    {
                        type = true;
                    }
                }
                else if (set.MemberType == 3)
                {
                    if (manageType.Trim() == "1001")
                    {
                        type = true;
                    }
                }
            }
            if (type)
            {
                //if (set.MemberIntent == 0)
                //{
                //    if (memberIntent == "1001")
                //    {
                //        blSuccess = true;
                //    }
                //}
                //else if (set.MemberIntent == 1)
                //{
                //    if (memberIntent == "1002")
                //    {
                //        blSuccess = true;
                //    }
                //}
                //else
                //{
                blSuccess = true;    //测试用
                //}
            }
        }
        else
        {
            blSuccess = true;
        }

        string nickName = "";

        Tz888.BLL.Conn dal      = new Tz888.BLL.Conn();
        string         strWhere = "";

        strWhere = "loginName='" + name.Trim() + "'";
        long      i  = 1;
        long      j  = 1;
        long      k  = 1;
        DataTable dt = dal.GetList("loginInfoTab", "loginName", "nickName", strWhere, "loginName", ref i, k, ref j);

        if (dt != null && dt.Rows.Count > 0)
        {
            nickName = dt.Rows[0][0].ToString();
        }

        if (blSuccess)
        {
            Tz888.Model.GoodFriend model = new Tz888.Model.GoodFriend();
            model.LoginName = Page.User.Identity.Name;
            //model.LoginName = "sunray";
            model.ContactName = name;
            model.GroupId     = 1;
            friendBll.AddFriend(model);
            Response.Write("<script   language='JavaScript'>window.open('addsuccess.aspx?name=" + Server.UrlEncode(nickName) + "');</script>");
        }
        else
        {
            Response.Write("<script   language='JavaScript'>window.open('adderror.aspx?name=" + Server.UrlEncode(nickName) + "');</script>");
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.User.Identity.Name == null || Page.User.Identity.Name.Trim() == "")
        {
            Response.Redirect("../../Login.aspx?ReturnUrl=" + Server.UrlEncode(Request.RawUrl));
            return;
        }

        if (Request.QueryString["name"] != null && Request.QueryString["name"].ToString() != "")
        {
            long           m           = 1;
            long           j           = 1;
            long           k           = 1;
            string         nickName    = "";
            string         strWhere    = "";
            string         memberGrade = "";
            string         manageType  = "";
            string         intent      = "";
            string         name        = "";
            bool           grade       = false;
            bool           type        = false;
            Tz888.BLL.Conn dal         = new Tz888.BLL.Conn();
            name = Request.QueryString["name"].ToString().Trim();
            //name = "kiki";
            strWhere = "loginName='" + name + "'";
            //strWhere = "nickName='" + name + "'";
            DataTable dt = dal.GetList("loginInfoTab", "loginName", "nickName", strWhere, "loginName", ref m, k, ref j);
            if (dt != null && dt.Rows.Count > 0)
            {
                nickName = dt.Rows[0][0].ToString();
            }
            //strWhere = "loginName= ' " + Page.User.Identity.Name + "'";
            strWhere = "loginName= ' " + name + "'";
            dt       = null;
            dt       = dal.GetList("loginInfoTab", "loginName", "MemberGradeId,ManageTypeId,requirInfo", strWhere, "loginName", ref m, k, ref j);
            if (dt != null && dt.Rows.Count > 0)
            {
                memberGrade = dt.Rows[0][0].ToString();
                manageType  = dt.Rows[0][1].ToString();
                intent      = dt.Rows[0][2].ToString();
            }
            Tz888.BLL.GoodFriend   friendBll = new Tz888.BLL.GoodFriend();
            Tz888.Model.GoodFriend set       = new Tz888.Model.GoodFriend();

            bool IsBlack = friendBll.IsSpecies(name, Page.User.Identity.Name, 3);
            //bool IsBlack = friendBll.IsSpecies("huangleon", "beckycheng", 3);
            if (IsBlack)
            {
                Response.Write("<script>alert('添加好友失败!您被加入黑名单');window.close();</script>");
                return;
            }
            bool IsFriend = friendBll.IsSpecies(Page.User.Identity.Name, name, 1);
            //bool IsFriend = friendBll.IsSpecies("huangleon", "beckycheng", 1);
            if (IsFriend)
            {
                Response.Write("<script>alert('添加好友失败!用户已在好友列表中');window.close();</script>");
                return;
            }

            if (name.Trim() == Page.User.Identity.Name.Trim())
            {
                Response.Write("<script>alert('添加好友失败!不能添加自己为好友');window.close();</script>");
                return;
            }
            //loginName = "kittycat";

            set = friendBll.GetFriendSet(name);
            if (set != null)
            {
                if (set.MemberGrade == 2)
                {
                    if (memberGrade == "1001")
                    {
                        grade = true;
                    }
                }
                else if (set.MemberGrade == 0)
                {
                    grade = true;
                }
                if (grade)
                {
                    if (set.MemberType == 0)
                    {
                        type = true;
                    }
                    else if (set.MemberType == 1)
                    {
                        if (manageType.Trim() == "1004")
                        {
                            type = true;
                        }
                    }
                    else if (set.MemberType == 2)
                    {
                        if (manageType.Trim() == "1003")
                        {
                            type = true;
                        }
                    }
                    else if (set.MemberType == 3)
                    {
                        if (manageType.Trim() == "1001")
                        {
                            type = true;
                        }
                    }
                }
            }
            else
            {
                type = true;
            }
            if (type)
            {
                Tz888.Model.GoodFriend model = new Tz888.Model.GoodFriend();
                model.LoginName   = Page.User.Identity.Name;
                model.ContactName = name;
                model.GroupId     = 1;
                friendBll.AddFriend(model);
                this.hplName.Text            = "恭喜,您已经成功添加" + nickName + "为您的好友了!";
                this.hplList.Text            = "查看您的好友列表";
                this.hplList.NavigateUrl     = "friendList.aspx";
                this.hplSendInfo.Text        = "给" + nickName + "发送站内短信";
                this.hplSendInfo.NavigateUrl = "../../innerinfo/SendView.aspx?Ac=0&name=" + nickName;
            }
            else
            {
                this.hplName.Text            = "对不起," + name + "  设置只有拓富通会员才能将他加为好友!";
                this.hplList.Text            = "了解一下拓富通会员服务";
                this.hplList.NavigateUrl     = "http://www.topfo.com/help/TopfoServer.shtml#a5";
                this.hplSendInfo.Text        = "立即申请拓富通会员服务";
                this.hplSendInfo.NavigateUrl = "http://member.topfo.com/Register/VIPMemberRegister_In.aspx";
            }
        }
    }
예제 #5
0
    public string AddFriend(string ContactName)
    {
        string username = "";
        string grade    = "";
        string type     = "";

        grade = Tz888.BLL.Login.LoginInfoBLL.getCookieNameByCookieType(1);
        type  = Tz888.BLL.Login.LoginInfoBLL.getCookieNameByCookieType(2);
        bool success = false;

        try
        {
            Tz888.Model.GoodFriend friendSet = new Tz888.Model.GoodFriend();
            Tz888.BLL.GoodFriend   friendBll = new Tz888.BLL.GoodFriend();
            friendSet = friendBll.GetFriendSet(ContactName);
            if (friendSet != null)
            {
                bool res = false;
                if (friendSet.MemberGrade == 2)
                {
                    res = (grade == "MG1002");
                }
                if (res)
                {
                    switch (friendSet.MemberType)
                    {
                    case 0:
                        success = true;
                        break;

                    case 1:
                        success = (type == "GT1004");
                        break;

                    case 2:
                        success = (type == "GT1003");
                        break;

                    case 3:
                        success = (type == "GT1001");
                        break;
                    }
                }
            }
            else
            {
                success = true;
            }

            if (success)
            {
                Tz888.Model.GoodFriend model = new Tz888.Model.GoodFriend();
                model.LoginName   = Tz888.BLL.Login.LoginInfoBLL.getCookieNameByCookieType(0);
                model.ContactName = ContactName;
                model.GroupId     = 1;
                friendBll.AddFriend(model);
                return("ok");
            }
            else
            {
                return("failed");
            }
        }
        catch (Exception e)
        {
            string err = e.Message.ToString();
            return(err);
        }
    }