Ejemplo n.º 1
0
        public bool Update(Model.AdminAccount model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [admin_account] set ");
            strSql.Append("password=@Password");
            strSql.Append(" where adminno=@AdminNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Password", SqlDbType.VarChar, 50),
                new SqlParameter("@AdminNo",  SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.Password;
            parameters[1].Value = model.AdminNo;
            int rows = SqlDbHelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);

            if (rows == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        //序列化存储文件
        public static void saveDat(Model.AdminAccount model)
        {
            Stream          s  = File.Open("user.dat", FileMode.OpenOrCreate);
            BinaryFormatter bf = new BinaryFormatter();

            bf.Serialize(s, model);
            s.Close();
        }
Ejemplo n.º 3
0
 public bool Add(Model.AdminAccount model)
 {
     //if(model.AdminNo)
     //string strSql = "insert into [admin_account] values(@AdminNo,@Password)";
     //SqlParameter[] parameters = {
     //    new SqlParameter("@AdminNo", SqlDbType.VarChar,50),
     //    new SqlParameter("@Password", SqlDbType.VarChar,50),};
     //parameters[0].Value = model.AdminNo;
     //parameters[1].Value = model.Password;
     //int n = SqlDbHelper.ExecuteNonQuery(strSql, CommandType.Text, parameters);
     //if (n == 1)
     return(true);
     //else
     //    return false;
 }
Ejemplo n.º 4
0
 public bool Login(Model.AdminAccount model)
 {
     //StringBuilder strSql = new StringBuilder();
     //strSql.Append("select count(1) from [admin_account]");
     //strSql.Append(" where adminno=@AdminNo and password=@Password");
     //SqlParameter[] parameters = {
     //    new SqlParameter("@AdminNo", SqlDbType.VarChar,50),
     //    new SqlParameter("@Password", SqlDbType.VarChar,50),};
     //parameters[0].Value = model.AdminNo;
     //parameters[1].Value = model.Password;
     //int n = Convert.ToInt32(SqlDbHelper.ExecuteScalar(strSql.ToString(), CommandType.Text, parameters));
     //if (n == 1)
     return(true);
     //else
     //    return false;
 }
Ejemplo n.º 5
0
        public bool Add(Model.AdminAccount model)
        {
            string strSql = "insert into [admin_account] values(@AdminNo,@Password)";

            SqlParameter[] parameters =
            {
                new SqlParameter("@AdminNo",  SqlDbType.VarChar, 50),
                new SqlParameter("@Password", SqlDbType.VarChar, 50),
            };
            parameters[0].Value = model.AdminNo;
            parameters[1].Value = model.Password;
            int n = SqlDbHelper.ExecuteNonQuery(strSql, CommandType.Text, parameters);

            if (n == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }