Exemplo n.º 1
0
 /// <summary>
 /// 提交按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Save_Click(object sender, ImageClickEventArgs e)
 {
     if (Session["UserInfo"] != null)
     {
         userinfo = (UserManageMOD)Session["UserInfo"];
     }
     int num = 0;
     string strWhere = " and userid=" + userinfo.UserId + " and userpass='******'";
     DataSet ds = UserManageBLL.GetUserAll(strWhere);
     if (ds != null && ds.Tables[0].Rows.Count > 0)
     {
         num = UserManageBLL.UpdateUserPass(txtNewPass.Text.Trim(), userinfo.UserId.ToString());
         if (num > 0)
         {
             ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('密码修改成功');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('密码修改失败!');", true);
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('原密码不正确!');", true);
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, ImageClickEventArgs e)
    {
        int num = 0;

        if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);
            userinfo = UserManageBLL.GetUserByid(id);
            userinfo.UserType = Convert.ToInt32(ddlUserType.SelectedValue);
            userinfo.Phone = txtPhone.Text.Trim();
            num = UserManageBLL.UpdateUser(userinfo);
        }
        else
        {
            userinfo = new UserManageMOD();
            userinfo.UserType = Convert.ToInt32(ddlUserType.SelectedValue);
            userinfo.UserPass = "******";
            userinfo.UserName = txtUserName.Text.Trim();
            userinfo.TrueName = txtTrueName.Text.Trim();
            userinfo.Phone = txtPhone.Text.Trim();
            userinfo.LoginNum = 0;
            num = UserManageBLL.InsertUser(userinfo);
        }
        if (num > 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交成功');DetailsPageControl.ReflushList('UserManage/UserManage.aspx');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('提交失败');", true);
        }
    }
Exemplo n.º 3
0
        public virtual void ProcessRequest(HttpContext context)
        {
            var authCookie = context.Request.Cookies[FormsAuthentication.FormsCookieName];
            var jser = new JavaScriptSerializer();
            UserInfo = jser.Deserialize<UserManageMOD>(FormsAuthentication.Decrypt(authCookie.Value).UserData);

            //实例化数据
            db = new Model.OrderPrintEntities();
        }
Exemplo n.º 4
0
        public void checkUser()
        {
            var jser = new JavaScriptSerializer();

            var authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            if (authCookie == null)
            {
                Response.Redirect("/Error.htm");
                return;
            }
            UserInfo = jser.Deserialize<UserManageMOD>(FormsAuthentication.Decrypt(authCookie.Value).UserData);
        }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserInfo"] != null)
     {
         userinfo = (UserManageMOD)Session["UserInfo"];
         //获取用户登录次数,如是首次登录提示修改密码
         if (userinfo.LoginNum > 1)
         {
             spanTishi.Visible = false;
         }
         else
         {
             spanTishi.Visible = true;
         }
     }
 }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["id"]);
                userinfo = UserManageBLL.GetUserByid(id);
                if (userinfo != null)
                {
                    txtPhone.Text = userinfo.Phone;
                    txtTrueName.Text = userinfo.TrueName;
                    txtUserName.Text = userinfo.UserName;
                    ddlUserType.SelectedValue = userinfo.UserType.ToString();
                }
                txtTrueName.Enabled = false;
                txtUserName.Enabled = false;
            }

        }
    }
Exemplo n.º 7
0
 /// <summary>
 /// 更新用户
 /// </summary>
 /// <param name="dtoUserList">用户数据对象</param>
 /// <returns></returns>
 public static int UpdateUser(UserManageMOD user)
 {
     return UserManageDAO.UpdateUser(user);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 添加用户
 /// </summary>
 /// <param name="dtoUserList">用户对象</param>
 /// <returns></returns>
 public static int InsertUser(UserManageMOD user)
 {
     return UserManageDAO.InsertUser(user);
 }
Exemplo n.º 9
0
        /// <summary>
        /// 根据主键id查询用户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static UserManageMOD GetUserByid(int id)
        {
            UserManageMOD user = new UserManageMOD();
            string sqlcommandString = "select * from UserManage where userId=" + id;

            try
            {
                SqlDataReader reader = SqlHelper.ExecuteReader(sqlcommandString);
                if (reader.Read())
                {
                    user.LoginNum = Convert.ToInt32(reader["LoginNum"].ToString());
                    user.Phone = reader["Phone"].ToString();
                    user.TrueName = reader["TrueName"].ToString();
                    user.UserId = Convert.ToInt32(reader["UserId"].ToString());
                    user.UserName = reader["UserName"].ToString();
                    user.UserPass = reader["UserPass"].ToString();
                    user.UserType = Convert.ToInt32(reader["UserType"].ToString());
                }
                reader.Close();
                return user;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="dtoUserList">用户数据对象</param>
        /// <returns></returns>
        public static int UpdateUser(UserManageMOD user)
        {
            string sqlCommandString = "Update UserManage Set phone=@phone,userType=@userType,userPass=@userPass Where userId=@userId";
            SqlParameter[] arParams = new SqlParameter[4];
            arParams[0] = new SqlParameter("@userId", user.UserId);
            arParams[1] = new SqlParameter("@phone", user.Phone);
            arParams[2] = new SqlParameter("@userType", user.UserType);
            arParams[3] = new SqlParameter("@userPass", user.UserPass);

            return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlCommandString, arParams);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="dtoUserList">用户对象</param>
        /// <returns></returns>
        public static int InsertUser(UserManageMOD user)
        {
            string sqlCommandString = "Insert Into UserManage(userName,trueName,phone,userType,userPass,loginNum)Values(@userName,@trueName,@phone,@userType,@userPass,@loginNum)";
            SqlParameter[] arParams = new SqlParameter[6];
            arParams[0] = new SqlParameter("@userName", user.UserName);
            arParams[1] = new SqlParameter("@trueName", user.TrueName);
            arParams[2] = new SqlParameter("@phone", user.Phone);
            arParams[3] = new SqlParameter("@userType", user.UserType);
            arParams[4] = new SqlParameter("@userPass", user.UserPass);
            arParams[5] = new SqlParameter("@loginNum", user.LoginNum);

            return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlCommandString, arParams);
        }