Exemplo n.º 1
0
 private void BindInfo()
 {
     BLL.user_info   bll   = new BLL.user_info();
     Model.user_info model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtgroup_id.Text    = model.group_id + "";
     txtuser_name.Text   = model.user_name + "";
     txtphone.Text       = model.phone + "";
     txtsalt.Text        = model.salt + "";
     txtuser_pwd.Text    = model.user_pwd + "";
     txtnick_name.Text   = model.nick_name + "";
     txtavatar.Text      = model.avatar + "";
     txtintegral.Text    = model.integral + "";
     txtschool_id.Text   = model.school_id + "";
     txtschool_name.Text = model.school_name + "";
     txtcollege.Text     = model.college + "";
     txtjob.Text         = model.job + "";
     txtcourse.Text      = model.course + "";
     txtline_way.Text    = model.line_way + "";
     txtarea.Text        = model.area + "";
     txtaddress.Text     = model.address + "";
     txtreg_ip.Text      = model.reg_ip + "";
     txtadd_time.Text    = model.add_time + "";
 }
Exemplo n.º 2
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_user_info", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.user_info   bll   = new BLL.user_info();
            Model.user_info model = bll.GetModel(this.id);

            model.group_id    = Convert.ToInt32(txtgroup_id.Text);
            model.user_name   = Convert.ToString(txtuser_name.Text);
            model.phone       = Convert.ToString(txtphone.Text);
            model.salt        = Convert.ToString(txtsalt.Text);
            model.user_pwd    = Convert.ToString(txtuser_pwd.Text);
            model.nick_name   = Convert.ToString(txtnick_name.Text);
            model.avatar      = Convert.ToString(txtavatar.Text);
            model.integral    = Convert.ToInt32(txtintegral.Text);
            model.school_id   = Convert.ToInt32(txtschool_id.Text);
            model.school_name = Convert.ToString(txtschool_name.Text);
            model.college     = Convert.ToString(txtcollege.Text);
            model.job         = Convert.ToString(txtjob.Text);
            model.course      = Convert.ToString(txtcourse.Text);
            model.line_way    = Convert.ToString(txtline_way.Text);
            model.area        = Convert.ToString(txtarea.Text);
            model.address     = Convert.ToString(txtaddress.Text);
            model.reg_ip      = Convert.ToString(txtreg_ip.Text);
            model.add_time    = Convert.ToDateTime(txtadd_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改用户信息信息,主键:" + id); //记录日志
                JscriptMsg("修改用户信息信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获得Model
        /// </summary>
        /// <param name="Top">大于0取前几行数据,否则取全部</param>
        /// <param name="whereStr">where条件</param>
        /// <param name="filedOrder">排序字段Order By + filedOrder (不可为空)</param>
        /// <returns></returns>
        public Model.user_info GetModel(int Top, string whereStr, string filedOrder)
        {
            DataTable dt = dal.GetList(Top, whereStr, filedOrder).Tables[0];

            Model.user_info model = dt.Rows.Count > 0 ? DataRowToModel(dt.Rows[0]) : null;
            return(model);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获得Model
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public Model.user_info GetModel(string whereStr)
        {
            DataTable dt = dal.GetList(whereStr).Tables[0];

            Model.user_info model = dt.Rows.Count > 0 ? DataRowToModel(dt.Rows[0]) : null;
            return(model);
        }
        private void ShowInfo()
        {
            BLL.user_info   bll   = new BLL.user_info();
            Model.user_info model = bll.GetModel(this.id);
            if (model == null)
            {
                JscriptMsg("信息不存在或已被删除!", "back");
                return;
            }

            txtuser_name.Text = model.user_name + "";
            txtphone.Text     = model.phone + "";
            txtuser_pwd.Text  = DESEncrypt.Decrypt(model.user_pwd, model.salt.Trim());
            txtnick_name.Text = model.nick_name + "";
            txtavatar.Text    = model.avatar + "";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string source_url = Request.QueryString["source_url"];
            string code       = Request.QueryString["code"];
            string state      = Request.QueryString["state"];

            if (!string.IsNullOrEmpty(source_url))
            {
                string location = Request.RawUrl;
                int    index    = location.IndexOf('=');
                source_url = location.Substring(index + 1, location.Length - index - 1);
                source_url = source_url.Replace('&', '*');


                Utils.StringToTxt("wxOAuth_WeChat_GetCode————source_url==" + source_url);
                Utils.WriteCookie("wxOAuth_WeChatGrant", "True");
                string url = WeChatContext.GetRedirectCode("/html/wxOAuth.aspx", source_url, true);

                Response.Redirect(url);
            }
            else if (!string.IsNullOrEmpty(code))
            {
                string temp      = Utils.UrlDecode(state);
                string decodeurl = temp.Replace('*', '&');

                Utils.StringToTxt("wxOAuth_wxLogin————code==" + code + ";wxOAuth_state==" + decodeurl);

                WeiXin_Access_token access_token = WeChatContext.GetAccessModel(code);

                if (access_token != null)
                {
                    SnsapiUserInfo userInfo = WeChatContext.GetSnsapiUserInfo(access_token.Access_token, access_token.Openid);//获取用户信息
                    if (userInfo != null)
                    {
                        user_info_entity entity = new user_info_entity();

                        //公众号openid存在
                        Model.user_oauths oaModel = new BLL.user_oauths().GetModel(" appid = '" + access_token.Openid + "'");
                        if (oaModel != null)
                        {
                            try
                            {
                                Utils.StringToTxt("wxOAuth_wxLogin————公众号openid存在,则更新openID=" + access_token.Openid + "和unionID=" + userInfo.unionid);
                                Model.user_info model = new BLL.user_info().GetModel(oaModel.user_id);

                                Utils.StringToTxt("wxOAuth_wxLogin————用户信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(model));
                                Utils.StringToTxt("wxOAuth_wxLogin————认证信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(oaModel));

                                //更新unionid(多应用唯一识别码)
                                oaModel.appid   = userInfo.openid;
                                oaModel.unionid = userInfo.unionid;
                                new BLL.user_oauths().Update(oaModel);

                                if (model.school_id == 0)//没有学校,公共资源
                                {
                                    decodeurl += "&method=scan";
                                    Response.Redirect(decodeurl);
                                }
                                else//有学校,学校资源
                                {
                                    int    idindex = decodeurl.IndexOf('=');
                                    string id      = decodeurl.Substring(idindex + 1, decodeurl.Length - idindex - 1);

                                    BLL.common_resource   resBll = new BLL.common_resource();
                                    Model.common_resource res    = resBll.GetModel(Convert.ToInt32(id));
                                    if (res != null)
                                    {
                                        if (res.from_id == (int)EnumCollection.resource_from.精品微课)       //如果是精品微课的资源
                                        {
                                            if (res.group_id == (int)EnumCollection.resource_group.公共资源) //若此资源是公共资源,查询此章节下的学校资源
                                            {
                                                Model.common_resource newRes = resBll.GetModel(string.Format(" from_id = {0} and group_id = {1} and type = {2} and data_id = {3}",
                                                                                                             res.from_id, (int)EnumCollection.resource_group.学校资源, res.type, res.data_id));
                                                if (newRes != null)
                                                {
                                                    decodeurl = decodeurl.Replace("id=" + id, "id=" + newRes.id);
                                                    Utils.StringToTxt("wxOAuth_wxLogin————学校资源=" + decodeurl);
                                                }

                                                decodeurl += "&method=scan";
                                                Response.Redirect(decodeurl);
                                            }
                                            else if (res.group_id == (int)EnumCollection.resource_group.学校资源)//若此资源是学校资源,判断是否是本学校的
                                            {
                                                if (model.school_id != res.school_id)
                                                {
                                                    Response.Write("您没有权限查看此资源");
                                                }
                                                else
                                                {
                                                    decodeurl += "&method=scan";
                                                    Response.Redirect(decodeurl);
                                                }
                                            }
                                        }
                                        else if (res.from_id == (int)EnumCollection.resource_from.课堂)//如果是课堂的资源
                                        {
                                            decodeurl += "&method=scan";
                                            Response.Redirect(decodeurl);
                                        }
                                    }
                                    else
                                    {
                                        decodeurl += "&method=scan";
                                        Response.Redirect(decodeurl);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Utils.StringToTxt("wxOAuth_wxLogin————获取数据库用户信息出现异常:" + ex.Message);
                                Response.Write("获取数据库用户信息出现异常:" + ex.Message);
                                return;
                            }
                        }
                        else//不存在
                        {
                            if (Utils.GetCookie("wxOAuth_WeChatGrant") == "True")
                            {
                                Utils.WriteCookie("wxOAuth_WeChatGrant", "False");

                                Utils.StringToTxt("wxOAuth_wxLogin————公众号openid不存在,是全新用户");

                                #region 创建用户
                                Model.user_info model = new Model.user_info();
                                model.group_id    = (int)EnumCollection.user_group.普通用户;
                                model.user_name   = "";
                                model.phone       = "";
                                model.salt        = Utils.GetCheckCode(6);
                                model.user_pwd    = "";
                                model.nick_name   = userInfo.nickname;
                                model.avatar      = userInfo.headimgurl;
                                model.integral    = 0;
                                model.school_id   = 0;
                                model.school_name = "";
                                model.college     = "";
                                model.job         = "";
                                model.course      = "";
                                model.line_way    = "";
                                model.area        = userInfo.country + userInfo.province + userInfo.city;
                                model.address     = "";
                                model.reg_ip      = RequestHelper.GetIP();
                                model.add_time    = System.DateTime.Now;

                                BLL.user_info bll = new BLL.user_info();
                                int           row = bll.Add(model);
                                if (row > 0)
                                {
                                    model.id                 = row;
                                    entity.UserInfo          = model;
                                    entity.UserInfo.user_pwd = "";
                                    entity.UserInfo.salt     = "";
                                    entity.UserInfo.reg_ip   = "";

                                    BLL.user_tree tBll = new BLL.user_tree();
                                    //1 创建code
                                    string tree_code = string.Empty;
                                    do
                                    {
                                        tree_code = Utils.Number(6);
                                    } while (tBll.GetModel(" code = '" + tree_code + "'") != null);

                                    //添加关系
                                    #region 添加关系
                                    Model.user_tree tree = new Model.user_tree();
                                    tree.user_id     = row;
                                    tree.code        = tree_code;
                                    tree.parent_code = "0";
                                    tree.grand_code  = "0";

                                    int treeid = tBll.Add(tree);
                                    if (treeid > 0)
                                    {
                                        tree.id         = treeid;
                                        entity.UserTree = tree;
                                    }
                                    #endregion

                                    #region 添加认证信息
                                    Utils.StringToTxt("wxOAuth_wxLogin————用户信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(model));

                                    Model.user_oauths model1 = new Model.user_oauths();
                                    model1.user_id = row;
                                    model1.type    = (int)EnumCollection.user_oauths.公众号微信登录;
                                    model1.name    = EnumCollection.user_oauths.公众号微信登录.ToString();
                                    model1.appid   = userInfo.openid;
                                    model1.unionid = userInfo.unionid;

                                    int oaid = new BLL.user_oauths().Add(model1);
                                    if (row > 0)
                                    {
                                        model1.id         = row;
                                        entity.UserOAuths = model1;

                                        Utils.StringToTxt("wxOAuth_wxLogin————新增的认证信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(model1));
                                    }
                                    #endregion

                                    Response.Redirect(decodeurl);
                                    return;
                                }
                                else
                                {
                                    Utils.WriteCookie("wxOAuth_WeChatGrant", "True");
                                    string url = WeChatContext.GetRedirectCode("/html/wxOAuth.aspx", state, true);
                                    Response.Redirect(url);
                                    return;
                                }
                                #endregion
                            }
                            else
                            {
                                Utils.WriteCookie("wxOAuth_WeChatGrant", "True");
                                string url = WeChatContext.GetRedirectCode("/html/wxOAuth.aspx", state, true);
                                Response.Redirect(url);
                                return;
                            }
                        }
                    }
                    else
                    {
                        Response.Write("微信认证失败,请重试");
                        return;
                    }
                }
                else
                {
                    Response.Write("token获取失败");
                    return;
                }
            }
        }
Exemplo n.º 7
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_user_info", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtgroup_id.Text.Trim() == "" || txtgroup_id.Text.Trim().Length > 4)
            {
                strError += "用户分组为空或超出长度![br]";
            }
            if (txtuser_name.Text.Trim() == "" || txtuser_name.Text.Trim().Length > 50)
            {
                strError += "用户名为空或超出长度![br]";
            }
            if (txtphone.Text.Trim() == "" || txtphone.Text.Trim().Length > 50)
            {
                strError += "手机号为空或超出长度![br]";
            }
            if (txtsalt.Text.Trim() == "" || txtsalt.Text.Trim().Length > 50)
            {
                strError += "随机加密字符串为空或超出长度![br]";
            }
            if (txtuser_pwd.Text.Trim() == "" || txtuser_pwd.Text.Trim().Length > 200)
            {
                strError += "密码为空或超出长度![br]";
            }
            if (txtnick_name.Text.Trim() == "" || txtnick_name.Text.Trim().Length > 50)
            {
                strError += "昵称为空或超出长度![br]";
            }
            if (txtavatar.Text.Trim() == "" || txtavatar.Text.Trim().Length > 255)
            {
                strError += "头像为空或超出长度![br]";
            }
            if (txtintegral.Text.Trim() == "" || txtintegral.Text.Trim().Length > 4)
            {
                strError += "积分为空或超出长度![br]";
            }
            if (txtschool_id.Text.Trim() == "" || txtschool_id.Text.Trim().Length > 4)
            {
                strError += "学校ID为空或超出长度![br]";
            }
            if (txtschool_name.Text.Trim() == "" || txtschool_name.Text.Trim().Length > 50)
            {
                strError += "学校姓名为空或超出长度![br]";
            }
            if (txtcollege.Text.Trim() == "" || txtcollege.Text.Trim().Length > 50)
            {
                strError += "院系为空或超出长度![br]";
            }
            if (txtjob.Text.Trim() == "" || txtjob.Text.Trim().Length > 50)
            {
                strError += "职位为空或超出长度![br]";
            }
            if (txtcourse.Text.Trim() == "" || txtcourse.Text.Trim().Length > 50)
            {
                strError += "所授课程为空或超出长度![br]";
            }
            if (txtline_way.Text.Trim() == "" || txtline_way.Text.Trim().Length > 50)
            {
                strError += "联系方式为空或超出长度![br]";
            }
            if (txtarea.Text.Trim() == "" || txtarea.Text.Trim().Length > 200)
            {
                strError += "区域为空或超出长度![br]";
            }
            if (txtaddress.Text.Trim() == "" || txtaddress.Text.Trim().Length > 200)
            {
                strError += "详细地址为空或超出长度![br]";
            }
            if (txtreg_ip.Text.Trim() == "" || txtreg_ip.Text.Trim().Length > 50)
            {
                strError += "注册IP为空或超出长度![br]";
            }
            if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8)
            {
                strError += "注册时间为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            Model.user_info model = new Model.user_info();
            BLL.user_info   bll   = new BLL.user_info();

            model.group_id    = Convert.ToInt32(txtgroup_id.Text);
            model.user_name   = Convert.ToString(txtuser_name.Text);
            model.phone       = Convert.ToString(txtphone.Text);
            model.salt        = Convert.ToString(txtsalt.Text);
            model.user_pwd    = Convert.ToString(txtuser_pwd.Text);
            model.nick_name   = Convert.ToString(txtnick_name.Text);
            model.avatar      = Convert.ToString(txtavatar.Text);
            model.integral    = Convert.ToInt32(txtintegral.Text);
            model.school_id   = Convert.ToInt32(txtschool_id.Text);
            model.school_name = Convert.ToString(txtschool_name.Text);
            model.college     = Convert.ToString(txtcollege.Text);
            model.job         = Convert.ToString(txtjob.Text);
            model.course      = Convert.ToString(txtcourse.Text);
            model.line_way    = Convert.ToString(txtline_way.Text);
            model.area        = Convert.ToString(txtarea.Text);
            model.address     = Convert.ToString(txtaddress.Text);
            model.reg_ip      = Convert.ToString(txtreg_ip.Text);
            model.add_time    = Convert.ToDateTime(txtadd_time.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加用户信息信息,主键:" + id); //记录日志
                JscriptMsg("添加用户信息信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.user_info model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"Insert Into ybd_user_info(
                group_id            
                            ,user_name            
                            ,phone            
                            ,salt            
                            ,user_pwd            
                            ,nick_name            
                            ,avatar            
                            ,integral            
                            ,school_id            
                            ,school_name            
                            ,college            
                            ,job            
                            ,course            
                            ,line_way            
                            ,area            
                            ,address            
                            ,reg_ip            
                            ,add_time            
             ) Values (
                @group_id               
                            ,@user_name               
                            ,@phone               
                            ,@salt               
                            ,@user_pwd               
                            ,@nick_name               
                            ,@avatar               
                            ,@integral               
                            ,@school_id               
                            ,@school_name               
                            ,@college               
                            ,@job               
                            ,@course               
                            ,@line_way               
                            ,@area               
                            ,@address               
                            ,@reg_ip               
                            ,@add_time               
             );
            SELECT @@IDENTITY;");

            SqlParameter[] parameters =
            {
                new SqlParameter("@group_id", SqlDbType.Int,                             4)
                ,                             new SqlParameter("@user_name",   SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@phone",       SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@salt",        SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@user_pwd",    SqlDbType.NVarChar, 200)
                ,                             new SqlParameter("@nick_name",   SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@avatar",      SqlDbType.NVarChar, 255)
                ,                             new SqlParameter("@integral",    SqlDbType.Int, 4)
                ,                             new SqlParameter("@school_id",   SqlDbType.Int, 4)
                ,                             new SqlParameter("@school_name", SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@college",     SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@job",         SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@course",      SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@line_way",    SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@area",        SqlDbType.NVarChar, 200)
                ,                             new SqlParameter("@address",     SqlDbType.NVarChar, 200)
                ,                             new SqlParameter("@reg_ip",      SqlDbType.NVarChar, 50)
                ,                             new SqlParameter("@add_time",    SqlDbType.DateTime, 8)
            };
            parameters[0].Value  = model.group_id;
            parameters[1].Value  = model.user_name;
            parameters[2].Value  = model.phone;
            parameters[3].Value  = model.salt;
            parameters[4].Value  = model.user_pwd;
            parameters[5].Value  = model.nick_name;
            parameters[6].Value  = model.avatar;
            parameters[7].Value  = model.integral;
            parameters[8].Value  = model.school_id;
            parameters[9].Value  = model.school_name;
            parameters[10].Value = model.college;
            parameters[11].Value = model.job;
            parameters[12].Value = model.course;
            parameters[13].Value = model.line_way;
            parameters[14].Value = model.area;
            parameters[15].Value = model.address;
            parameters[16].Value = model.reg_ip;
            parameters[17].Value = model.add_time;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.user_info model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"UPDATE ybd_user_info SET 
                group_id = @group_id
                ,user_name = @user_name
                ,phone = @phone
                ,salt = @salt
                ,user_pwd = @user_pwd
                ,nick_name = @nick_name
                ,avatar = @avatar
                ,integral = @integral
                ,school_id = @school_id
                ,school_name = @school_name
                ,college = @college
                ,job = @job
                ,course = @course
                ,line_way = @line_way
                ,area = @area
                ,address = @address
                ,reg_ip = @reg_ip
                ,add_time = @add_time
            WHERE id = @id");

            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int,                       4)
                ,                       new SqlParameter("@group_id",    SqlDbType.Int, 4)
                ,                       new SqlParameter("@user_name",   SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@phone",       SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@salt",        SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@user_pwd",    SqlDbType.NVarChar, 200)
                ,                       new SqlParameter("@nick_name",   SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@avatar",      SqlDbType.NVarChar, 255)
                ,                       new SqlParameter("@integral",    SqlDbType.Int, 4)
                ,                       new SqlParameter("@school_id",   SqlDbType.Int, 4)
                ,                       new SqlParameter("@school_name", SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@college",     SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@job",         SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@course",      SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@line_way",    SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@area",        SqlDbType.NVarChar, 200)
                ,                       new SqlParameter("@address",     SqlDbType.NVarChar, 200)
                ,                       new SqlParameter("@reg_ip",      SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@add_time",    SqlDbType.DateTime, 8)
            };
            parameters[0].Value  = model.id;
            parameters[1].Value  = model.group_id;
            parameters[2].Value  = model.user_name;
            parameters[3].Value  = model.phone;
            parameters[4].Value  = model.salt;
            parameters[5].Value  = model.user_pwd;
            parameters[6].Value  = model.nick_name;
            parameters[7].Value  = model.avatar;
            parameters[8].Value  = model.integral;
            parameters[9].Value  = model.school_id;
            parameters[10].Value = model.school_name;
            parameters[11].Value = model.college;
            parameters[12].Value = model.job;
            parameters[13].Value = model.course;
            parameters[14].Value = model.line_way;
            parameters[15].Value = model.area;
            parameters[16].Value = model.address;
            parameters[17].Value = model.reg_ip;
            parameters[18].Value = model.add_time;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BLL.user_info bll = new BLL.user_info();

            if (action == EnumCollection.ActionEnum.Modify.ToString())                          //修改
            {
                ChkAdminLevel("_share_user_list", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
                Model.user_info model = bll.GetModel(this.id);

                model.group_id    = (int)EnumCollection.user_group.资源分享用户;
                model.user_name   = Convert.ToString(txtuser_name.Text);
                model.phone       = Convert.ToString(txtphone.Text);
                model.salt        = Utils.GetCheckCode(6);
                model.user_pwd    = DESEncrypt.Encrypt(txtuser_pwd.Text.Trim().ToUpper(), model.salt.Trim());
                model.nick_name   = Convert.ToString(txtnick_name.Text);
                model.avatar      = Convert.ToString(txtavatar.Text);
                model.school_id   = 0;
                model.school_name = "";
                model.college     = "";
                model.job         = "";
                model.course      = "";
                model.line_way    = "";
                model.area        = "";
                model.address     = "";
                model.reg_ip      = RequestHelper.GetIP();

                if (bll.Update(model))
                {
                    AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改用户信息,主键:" + id); //记录日志
                    JscriptMsg("修改用户信息成功!", "share_user_list.aspx?page=" + this.page);
                }
                else
                {
                    JscriptMsg("保存过程中发生错误!", "");
                }
            }
            else //添加
            {
                ChkAdminLevel("_course_adR", EnumCollection.ActionEnum.Add.ToString()); //检查权限

                Model.user_info model = bll.GetModel(" phone = '" + this.txtphone.Text.Trim() + "'");
                if (model != null)
                {
                    JscriptMsg("此手机号已被注册", "");
                    return;
                }

                model             = new Model.user_info();
                model.group_id    = (int)EnumCollection.user_group.资源分享用户;
                model.user_name   = Convert.ToString(txtuser_name.Text);
                model.phone       = Convert.ToString(txtphone.Text);
                model.salt        = Utils.GetCheckCode(6);
                model.user_pwd    = DESEncrypt.Encrypt(Utils.MD5(txtuser_pwd.Text.Trim()).ToUpper(), model.salt.Trim());
                model.nick_name   = Convert.ToString(txtnick_name.Text);
                model.avatar      = Convert.ToString(txtavatar.Text);
                model.school_id   = 0;
                model.school_name = "";
                model.college     = "";
                model.job         = "";
                model.course      = "";
                model.line_way    = "";
                model.area        = "";
                model.address     = "";
                model.reg_ip      = RequestHelper.GetIP();
                model.add_time    = System.DateTime.Now;

                int id = bll.Add(model);
                if (id > 0)
                {
                    AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加用户信息,主键:" + id); //记录日志
                    JscriptMsg("添加用户信息成功!", "share_user_list.aspx");
                }
                else
                {
                    JscriptMsg("保存过程中发生错误!", "");
                }
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.user_info DataRowToModel(DataRow row)
 {
     Model.user_info model = new Model.user_info();
     if (row != null)
     {
         if (row["id"] != null) //&& row["id"].ToString() != ""
         {
             model.id = Convert.ToInt32(row["id"]);
         }
         if (row["group_id"] != null) //&& row["group_id"].ToString() != ""
         {
             model.group_id = Convert.ToInt32(row["group_id"]);
         }
         if (row["user_name"] != null) //&& row["user_name"].ToString() != ""
         {
             model.user_name = Convert.ToString(row["user_name"]);
         }
         if (row["phone"] != null) //&& row["phone"].ToString() != ""
         {
             model.phone = Convert.ToString(row["phone"]);
         }
         if (row["salt"] != null) //&& row["salt"].ToString() != ""
         {
             model.salt = Convert.ToString(row["salt"]);
         }
         if (row["user_pwd"] != null) //&& row["user_pwd"].ToString() != ""
         {
             model.user_pwd = Convert.ToString(row["user_pwd"]);
         }
         if (row["nick_name"] != null) //&& row["nick_name"].ToString() != ""
         {
             model.nick_name = Convert.ToString(row["nick_name"]);
         }
         if (row["avatar"] != null) //&& row["avatar"].ToString() != ""
         {
             model.avatar = Convert.ToString(row["avatar"]);
         }
         if (row["integral"] != null) //&& row["integral"].ToString() != ""
         {
             model.integral = Convert.ToInt32(row["integral"]);
         }
         if (row["school_id"] != null) //&& row["school_id"].ToString() != ""
         {
             model.school_id = Convert.ToInt32(row["school_id"]);
         }
         if (row["school_name"] != null) //&& row["school_name"].ToString() != ""
         {
             model.school_name = Convert.ToString(row["school_name"]);
         }
         if (row["college"] != null) //&& row["college"].ToString() != ""
         {
             model.college = Convert.ToString(row["college"]);
         }
         if (row["job"] != null) //&& row["job"].ToString() != ""
         {
             model.job = Convert.ToString(row["job"]);
         }
         if (row["course"] != null) //&& row["course"].ToString() != ""
         {
             model.course = Convert.ToString(row["course"]);
         }
         if (row["line_way"] != null) //&& row["line_way"].ToString() != ""
         {
             model.line_way = Convert.ToString(row["line_way"]);
         }
         if (row["area"] != null) //&& row["area"].ToString() != ""
         {
             model.area = Convert.ToString(row["area"]);
         }
         if (row["address"] != null) //&& row["address"].ToString() != ""
         {
             model.address = Convert.ToString(row["address"]);
         }
         if (row["reg_ip"] != null) //&& row["reg_ip"].ToString() != ""
         {
             model.reg_ip = Convert.ToString(row["reg_ip"]);
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             model.add_time = Convert.ToDateTime(row["add_time"]);
         }
         return(model);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.user_info model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 13
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.user_info model)
 {
     return(dal.Add(model));
 }