Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            Action = RequstString("Action");

            if (Action.Length == 0)
            {
                Action = "";
            }


            if (Action == "EditPsw")
            {
                UserInfo userinfo = new UserInfo();
                userinfo.UserID      = RequstString("UserID");
                userinfo.OldPassword = RequstString("OldPsw");
                userinfo.NewPassword = RequstString("NewPsw");
                ResultMsg_User result = new ResultMsg_User();
                result = EditPsw(userinfo, result);
                context.Response.Write(jsc.Serialize(result));
            }
            else if (Action == "DownFlash")
            {
                FlashInfo flashInfo = new FlashInfo();
                flashInfo.FlashVersion = RequstString("CurrentAgent");

                DownLoadFlash(flashInfo, context.Response);
            }
        }
Exemplo n.º 2
0
        public ResultMsg_User EditPsw(UserInfo dataEntity, ResultMsg_User result)
        {
            using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ELCO_ConnectionString"].ToString()))
            {
                SqlCommand     cmd         = new SqlCommand();
                SqlTransaction transaction = null;
                try
                {
                    conn.Open();
                    cmd.Connection = conn;
                    string strSql = " SELECT COUNT(1) AS SM FROM UserM_UserInfo WHERE UserID = '" + dataEntity.UserID.Trim() + "' and Password='******'";
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = strSql;
                    SqlDataAdapter Datapter = new SqlDataAdapter(cmd);
                    DataTable      dt       = new DataTable();
                    Datapter.Fill(dt);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        result.result = "";
                        result.msg    = "";
                    }
                    else
                    {
                        result.result = "failed";
                        result.msg    = "原密码不正确!";
                    }

                    if (result.result == "")
                    {
                        transaction     = conn.BeginTransaction();
                        cmd.Transaction = transaction;
                        strSql          = "update UserM_UserInfo set Password='******' where UserID='" + dataEntity.UserID.Trim() + "'";
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = strSql;
                        cmd.ExecuteNonQuery();
                        transaction.Commit();
                        result.result = "success";
                        result.msg    = "修改密码成功!";
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    result.result = "failed";
                    result.msg    = "保存失败! \n" + ex.Message;
                }
            }
            return(result);
        }