Ejemplo n.º 1
0
 protected string SetUserGroup(object author)
 {
     string userType = "";
     if (author != null)
     {
         B_User userBll = new B_User();
         M_User userModel = userBll.GetUser(author.ToString());
         B_UserGroup userGroupBll = new B_UserGroup();
         DataTable dt = userGroupBll.ManageList("");
         if (dt.Rows.Count > 0 && userModel != null)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (dt.Rows[i]["UserGroupId"].ToString() == userModel.GroupID.ToString())
                 {
                     userType = dt.Rows[i]["UserGroupName"].ToString();
                     break;
                 }
             }
         }
     }
     else
     {
         userType = "游客";
     }
     return userType;
 }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        InfoTable.Visible = false;
        B_User user = new B_User();
        M_User userModel = user.GetUser(user.GetCookie().UserID);

        B_SiteInfo site = new B_SiteInfo();
        M_Site siteModel = site.GetSiteModel();
        if (userModel != null)
        {
            if (siteModel.IsOpenInvite)
            {
                B_UserGroup groupBll = new B_UserGroup();
                string integral = groupBll.Power_UserGroup("Invite", 0, groupBll.GetModel(userModel.GroupID).GroupPower);
                lbIntegral.Text = integral;
                if (siteModel.Domain.EndsWith("/"))
                {
                    txtUrl.Text = siteModel.Domain + "user/Reg.aspx?TypeId=" + userModel.TypeId + "&recmd_uid=" + userModel.UserID;
                }
                else
                {
                    txtUrl.Text = siteModel.Domain + "/user/Reg.aspx?TypeId=" + userModel.TypeId + "&recmd_uid=" + userModel.UserID;
                }
            }
            else
            {
                InfoTable.Visible = true;
                MainTable.Visible = false;
            }
        }
        else
        {
            Response.Redirect("Login.aspx");
        }
    }
Ejemplo n.º 3
0
 public void AddCmdUserIntegral(int recmd_uid)
 {
     M_User user = new B_User().GetUser(recmd_uid);
     B_Money money = new B_Money();
     if (user != null)
     {
         B_UserGroup group = new B_UserGroup();
         int num = int.Parse(group.Power_UserGroup("Invite", 0, group.GetModel(user.GroupID).GroupPower));
         money.Integral(num, recmd_uid);
     }
 }
Ejemplo n.º 4
0
    public string GetUserGroup(string UserGroupId)
    {
        if (UserGroupId == "0")
        {
            return "<a href='../user/GroupList.aspx' title='点击设置用户组'><font color=red>还未设置用户组</font></a>";
        }
        else
        {
            B_UserGroup bll=new B_UserGroup();
            M_UserGroup model = bll.GetModel(int.Parse(UserGroupId));

            if (model == null)
            {
                return "<font color=green>该用户组不存在或被删除</font>";
            }
            else
            {
                return model.UserGroupName;
            }
        }
    }
Ejemplo n.º 5
0
 public void Auditing(string tableName, string idStr, int status)
 {
     if (idStr != string.Empty)
     {
         B_Admin admin = new B_Admin();
         B_Column column = new B_Column();
         B_Channel channel = new B_Channel();
         string[] strArray = idStr.Split(new char[] { ',' });
         foreach (string str in strArray)
         {
             int id = int.Parse(str);
             DataRow info = this.dal.GetInfo(tableName, id);
             if (info == null)
             {
                 break;
             }
             int columnId = (int) info["colid"];
             M_Column column2 = column.GetColumn(columnId);
             if (column2 == null)
             {
                 break;
             }
             M_Channel channel2 = channel.GetChannel(column2.ChId);
             if (channel2 == null)
             {
                 break;
             }
             int num3 = (int) info["Status"];
             int num4 = (int) info["UserType"];
             int userId = (int) info["UId"];
             string str2 = info["UName"].ToString();
             string newValue = info["Title"].ToString();
             string str4 = channel2.Notice2.Replace("{@标题}", newValue);
             M_LoginAdmin loginModel = admin.GetLoginModel();
             int adiminId = loginModel.UserId;
             string loginName = loginModel.LoginName;
             this.dal.Auditing(tableName, id, status, adiminId, loginName);
             if ((((status == 3) && (num3 != 3)) && (num4 == 0)) && (userId > 0))
             {
                 B_WebMessage message = new B_WebMessage();
                 M_WebMessage message2 = new M_WebMessage();
                 message2.Title = "稿件采纳通知";
                 message2.Content = str4;
                 message2.IsRead = 0;
                 message2.IsSend = 1;
                 message2.ReceiverId = userId;
                 message2.ReceiverName = str2;
                 message2.SendId = 0;
                 message2.SendName = loginName;
                 message2.OverdueDate = DateTime.Now;
                 message2.AddDate = DateTime.Now;
                 message2.ReceiverDel = 0;
                 message2.SendDel = 0;
                 message.Insert(message2);
             }
             M_User user = new B_User().GetUser(userId);
             if (user == null)
             {
                 break;
             }
             B_UserGroup group = new B_UserGroup();
             M_UserGroup model = group.GetModel(user.GroupID);
             if (group == null)
             {
                 break;
             }
             int num7 = int.Parse(group.Power_UserGroup("Contribute", 0, model.GroupPower)) * column2.ScoreReward;
             new B_Money().Integral(num7, userId);
         }
     }
 }
Ejemplo n.º 6
0
    private void BindGroup()
    {
        B_UserGroup groupBll = new B_UserGroup();
        DataTable dt = groupBll.ManageList("");
        chkBoxGroupIdStr.DataTextField = "UserGroupName";
        chkBoxGroupIdStr.DataValueField = "UserGroupId";
        chkBoxGroupIdStr.DataSource = dt;
        chkBoxGroupIdStr.DataBind();

        dt.Clear();
        dt.Dispose();
    }
Ejemplo n.º 7
0
    /// <summary>
    ///绑定专题和用户组
    /// </summary>
    void BindData()
    {
        //绑定专题列表
        B_Special specialBll = new B_Special();
        DataTable dt = specialBll.GetChannelSpecial(ChannelId);
        if (dt != null)
        {
            DataView dvParent = new DataView(dt);
            dvParent.RowFilter = "ParentId=0";
            lBoxTopicIdStr.Items.Clear();
            for (int i = 0; i < dvParent.Count; i++)
            {
                int parentId = Convert.ToInt32(dvParent[i]["Id"]);
                lBoxTopicIdStr.Items.Add(new ListItem(dvParent[i]["SpecialCName"].ToString(), parentId.ToString()));
                DataView dvChild = new DataView(dt);
                dvChild.RowFilter = "ParentId=" + parentId;
                for (int j = 0; j < dvChild.Count; j++)
                {
                    lBoxTopicIdStr.Items.Add(new ListItem("└" + dvChild[j]["SpecialCName"], dvChild[j]["Id"].ToString()));
                }
            }
        }

        //绑定用户组
        B_UserGroup userGroup = new B_UserGroup();
        DataTable g = userGroup.ManageList("");
        if (g != null)
        {
            for (int i = 0; i < g.Rows.Count; i++)
            {
                UserGroup.Items.Add(new ListItem(g.Rows[i]["UserGroupName"].ToString(), g.Rows[i]["UserGroupId"].ToString()));
            }
        }
    }
Ejemplo n.º 8
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        CheckInput();

        //修改用户信息
        if (userId != 0)
        {
            //判断权限
            power.Power_Judge(18);

            if (txtPwd.Text != "")
            {
                userbll.ModifyPwd(userId, Function.MD5Encrypt(txtPwd.Text));

                string logName = userbll.GetUser(userId).LogName;
                bbsUserBll.UpdatePwd(logName, txtPwd.Text);
            }

            if (txtAnswer.Text != "")
            {
                userbll.ModifyQuestion(userId, txtQuestion.Text, Function.MD5Encrypt(txtAnswer.Text));
            }

            userbll.ModifyOtherBasicInfo(userId, txtEmail.Text, int.Parse(ddlistGroup.SelectedItem.Value), int.Parse(txtSecret.SelectedValue));
        }
        else
        {
            model.LogName = txtLogName.Text;
            model.Email = txtEmail.Text;
            model.TypeId = TypeId;
            model.GroupID = int.Parse(ddlistGroup.SelectedItem.Value);
            model.Secret = int.Parse(txtSecret.SelectedValue);
            model.Question = txtQuestion.Text;
            model.Answer = Function.MD5Encrypt(txtAnswer.Text);
            model.UserPwd = Function.MD5Encrypt(txtPwd.Text);
            model.RegTime = DateTime.Now;
            model.ConfirmRegCode = Guid.NewGuid().ToString();
            B_UserGroup userGroupBll = new B_UserGroup();
            M_UserGroup userGroupModel = userGroupBll.GetModel(int.Parse(ddlistGroup.SelectedValue));
            string userStatus = userGroupBll.Power_UserGroup("Status", 0, userGroupModel.GroupPower);
            model.Status = int.Parse(userStatus);
            //判断权限
            power.Power_Judge(16);

            userId = userbll.Reg(model);
        }

        //自定义字段
        //定义DataTable
        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("FieldName", typeof(string)));
        dt.Columns.Add(new DataColumn("FieldValue", typeof(string)));

        #region 系统默认字段
        if (Request.QueryString["uid"] != null && Request.QueryString["uid"] != "")
        {
            DataRow dr0 = dt.NewRow();
            dr0[0] = "Id";
            dr0[1] = BInfoOper.GetUserInfo(MUserGroupModel.TableName, userId)["Id"];
            dt.Rows.Add(dr0);
        }

        DataRow dr1 = dt.NewRow();
        dr1[0] = "UId";
        dr1[1] = userId;
        dt.Rows.Add(dr1);

        DataRow dr2 = dt.NewRow();
        dr2[0] = "AddTime";
        dr2[1] = DateTime.Now.ToString();
        dt.Rows.Add(dr2);

        DataRow dr3 = dt.NewRow();
        dr3[0] = "UpdateTime";
        dr3[1] = DateTime.Now.ToString();
        dt.Rows.Add(dr3);
        #endregion

        //以下是自动添加字段获得值
        for (int i = 0; i < dtIsUser.Rows.Count; i++)
        {
            DataRow dr = dt.NewRow();
            dr[0] = dtIsUser.Rows[i]["Name"].ToString();

            //联动获取数据开始
            //二级联动
            if (dtIsUser.Rows[i]["Type"].ToString() == "ErLinkageType")
            {
                dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString()];
                dt.Rows.Add(dr);

                dr = dt.NewRow();
                dr[0] = dtIsUser.Rows[i]["Name"].ToString() + "_Id";
                dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + "_Id"];
                dt.Rows.Add(dr);

                string SmallName = BModelField.GetFieldContent(dtIsUser.Rows[i]["Content"].ToString(), 2, 1);
                dr = dt.NewRow();
                dr[0] = SmallName;
                dr[1] = Request.Form["txt_" + SmallName];
                dt.Rows.Add(dr);

                dr = dt.NewRow();
                dr[0] = SmallName + "_Id";
                dr[1] = Request.Form["txt_" + SmallName + "_Id"];
                dt.Rows.Add(dr);
            }
            else
            {
                switch (dtIsUser.Rows[i]["Type"].ToString())
                {
                    case "ListBoxType":
                        if (Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""] == "" || Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""] == null)
                        {
                            dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                        }
                        else
                        {
                            dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""].Replace(" ", "").ToString();
                        }
                        break;
                    case "MultipleTextType":
                        dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                        break;
                    default:
                        dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                        break;
                }
                dt.Rows.Add(dr);
            }
        }

        if (Request.QueryString["uid"] != null && Request.QueryString["uid"] != "")
        {
            //修改信息
            BInfoModel.UpdateInfoModel(dt, MUserGroupModel.TableName);

            Function.ShowSysMsg(1, "<li>修改成功</li><li><a href='user/UserList.aspx?TypeId=" + TypeId + "'>返回" + MUserGroupModel.Name + "列表</a></li>");
        }
        else
        {
            //添加
            BInfoModel.AddInfoModel(dt, MUserGroupModel.TableName);
            string bbsCookieStr = string.Empty;
            bbsCookieStr = bbsUserBll.BBS_User_Reg(model.LogName, txtCnfmPwd.Text, model.Email, true);

            Function.ShowSysMsg(1, "<li>添加成功</li><li><a href='user/UserList.aspx?TypeId=" + TypeId + "'>返回" + MUserGroupModel.Name + "列表</a></li>");
        }
    }
Ejemplo n.º 9
0
    /// <summary>
    /// 用户注册
    /// </summary>
    protected void txtSubmit_Click(object sender, EventArgs e)
    {
        if (IsValid && siteModel != null)
        {
            //验证
            CheckInput();

            M_User model = new M_User();
            model.LogName = txtUsername.Text;
            model.Email = txtEmail.Text;
            model.UserPwd = Function.MD5Encrypt(txtCnfmPwd.Text);
            model.Question = txtQuestion.Text;
            model.Answer = Function.MD5Encrypt(txtAnswer.Text);
            model.RegTime = DateTime.Now;
            model.Secret = 1;//部分公开
            model.ErrorTime = DateTime.Parse("2000/01/01");
            model.ErrorNum = 0;
            model.GroupID = MUserGroupModel.UserGroupId;
            model.TypeId = TypeId;

            if (siteModel.IsTestEmail == true)
            {
                model.IsLock = true;
            }
            else
            {
                model.IsLock = false;
            }

            B_UserGroup userGroupBll = new B_UserGroup();
            M_UserGroup userGroupModel = userGroupBll.GetModel(MUserGroupModel.UserGroupId);
            string userStatus = userGroupBll.Power_UserGroup("Status", 0, userGroupModel.GroupPower);
            model.Status = int.Parse(userStatus);

            string confirmCode = Guid.NewGuid().ToString();
            model.ConfirmRegCode = confirmCode;
            model.Integral = siteModel.LoginScore;
            model.LastLoginTime = DateTime.Now;
            int uid = Bll.Reg(model);

            //自定义字段
            //定义DataTable
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("FieldName", typeof(string)));
            dt.Columns.Add(new DataColumn("FieldValue", typeof(string)));

            #region 系统默认字段
            DataRow dr1 = dt.NewRow();
            dr1[0] = "UId";
            dr1[1] = uid;
            dt.Rows.Add(dr1);

            DataRow dr2 = dt.NewRow();
            dr2[0] = "AddTime";
            dr2[1] = DateTime.Now.ToString();
            dt.Rows.Add(dr2);

            DataRow dr3 = dt.NewRow();
            dr3[0] = "UpdateTime";
            dr3[1] = DateTime.Now.ToString();
            dt.Rows.Add(dr3);
            #endregion

            //以下是自动添加字段获得值
            for (int i = 0; i < dtIsUser.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = dtIsUser.Rows[i]["Name"].ToString();

                //联动获取数据开始
                //二级联动
                if (dtIsUser.Rows[i]["Type"].ToString() == "ErLinkageType")
                {
                    dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString()];
                    dt.Rows.Add(dr);

                    dr = dt.NewRow();
                    dr[0] = dtIsUser.Rows[i]["Name"].ToString() + "_Id";
                    dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + "_Id"];
                    dt.Rows.Add(dr);

                    string SmallName = BModelField.GetFieldContent(dtIsUser.Rows[i]["Content"].ToString(), 2, 1);
                    dr = dt.NewRow();
                    dr[0] = SmallName;
                    dr[1] = Request.Form["txt_" + SmallName];
                    dt.Rows.Add(dr);

                    dr = dt.NewRow();
                    dr[0] = SmallName + "_Id";
                    dr[1] = Request.Form["txt_" + SmallName + "_Id"];
                    dt.Rows.Add(dr);
                }
                else
                {
                    switch (dtIsUser.Rows[i]["Type"].ToString())
                    {
                        case "ListBoxType":
                            if (Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""] == "" || Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""] == null)
                            {
                                dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                            }
                            else
                            {
                                dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""].Replace(" ", "").ToString();
                            }
                            break;
                        case "MultipleTextType":
                            dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                            break;
                        default:
                            dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                            break;
                    }
                    dt.Rows.Add(dr);
                }
            }

            //添加信息
            BInfoModel.AddInfoModel(dt, MUserGroupModel.TableName);

            string bbsCookieStr = string.Empty;
            bbsCookieStr = bbsUserBll.BBS_User_Reg(model.LogName, txtCnfmPwd.Text, model.Email, true);

            if (uid > 0)
            {
                //如果是被已注册用户推荐过来的.那么验证推荐用户是否存在
                //如果存在
                //则给推荐者加上系统设置的推广积分
                if (siteModel.IsOpenInvite && Request.QueryString["recmd_uid"] != null && Function.CheckNumberNotZero(Request.QueryString["recmd_uid"]))
                {
                    int recmd_uid = int.Parse(Request.QueryString["recmd_uid"].ToString());
                    Bll.AddCmdUserIntegral(recmd_uid);
                }
                if (siteModel.IsTestEmail == true)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine(txtUsername.Text + ",您好!");
                    sb.AppendLine("感谢您注册为 " + siteModel.SiteName + " 的用户。");
                    sb.AppendLine("您只需点击下面的链接即可激活您的帐号:");
                    sb.Append("<a href='");
                    string url = "";
                    if (siteModel.Domain.EndsWith("/"))
                    {
                        url = siteModel.Domain + "user/activate.aspx?uid=" + uid + "&code=" + confirmCode;
                    }
                    else
                    {
                        url = siteModel.Domain + "/user/activate.aspx?uid=" + uid + "&code=" + confirmCode;
                    }
                    sb.Append(url);
                    sb.Append("'>");
                    sb.Append(url);
                    sb.Append("</a><br />");
                    sb.AppendLine("(如果您无法点击上面的链接,请将链接地址手工粘贴到浏览器地址栏后访问!)<br />");
                    sb.AppendLine("祝您健康愉快!<br />");
                    sb.AppendLine(siteModel.SiteName);
                    sb.AppendLine(DateTime.Now.ToShortDateString());
                    sb.AppendLine("<hr />");
                    sb.AppendLine("此邮件为系统自动发送,请勿回复。");
                    string body = sb.ToString();
                    try
                    {
                        B_SendMail mail = new B_SendMail(siteModel.EmailServerUserName.Trim(), txtEmail.Text, txtUsername.Text + ",您好!请激活您的账户。", body, true, System.Text.Encoding.UTF8);
                        mail.Send();
                        Function.ShowMsg(1, "<li>"+txtUsername.Text+",恭喜,注册成功!一封包含您帐号激活信息的邮件已发送到您的邮箱,请按邮件内的提示激活您的帐号</li><li><a href='main.aspx'>登录用户中心</a></li><li><a href='"+IndexUrl+"'>返回网站首页</a></li>");
                    }
                    catch
                    {
                        Function.ShowMsg(1, "<li>" + txtUsername.Text + ",恭喜,注册成功!点击下面的链接立即激活您的帐号</li><li><a href='"+url+"'>激活帐号</a></li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                    }
                }
                else
                {
                    if (model.Status == 1)
                    {
                        HttpCookie cookie = new HttpCookie("User");
                        cookie["uId"] = uid.ToString();
                        cookie["logN"] = Function.UrlEncode(txtUsername.Text);
                        cookie["pd"] = Function.MD5Encrypt(txtCnfmPwd.Text);
                        Response.Cookies.Add(cookie);
                        if (bbsCookieStr.Length != 0)
                        {
                            bbsUserBll.WriteUserCookie(bbsCookieStr);
                        }
                        if (returnUrl != string.Empty)
                        {
                            returnUrl2 = "<li><a href='" + returnUrl + "'>返回来源页面</a></li>";
                        }
                        Function.ShowMsg(1, "<li>" + txtUsername.Text + ",恭喜,注册成功!请选择您需要的操作</li>" + returnUrl2 + "<li><a href='main.aspx'>登录用户中心</a></li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                    }
                    else
                    {
                        Function.ShowMsg(1, "<li>" + txtUsername.Text + ",恭喜,注册成功!</li><li><a href='main.aspx'>登录用户中心</a></li>");
                    }

                }
            }
            else
            {
                Function.ShowMsg(0, "<li>对不起,注册失败!请稍后再试</li><li><a href='"+IndexUrl+"'>返回网站首页</a></li>");
            }
        }
    }