예제 #1
0
        public void Sendmassage(string email)
        {

            DataTable tb;
            bool ex;//判断数据库操作是否成功
            string sql;//数据库操作语句
            string str;//数据库连接参数
            str = "Server=YourSQLServer;user id=sa;password=;initial catalog=Northwind;Connect Timeout=30";
            DataBaseAccess st = new DataBaseAccess(str);
            sql = "select * from 视图 where sort=0";
            tb = st.GetDataTable(sql);
            string from = tb.Rows[0][0].ToString();
            string password = tb.Rows[1][0].ToString();

           
            MailAddress MessageFrom = new MailAddress(from);
            string MessageTo = email;
            string MessageSubject = boot.m_massagetitle;
            string MessageBody = boot.m_massage;
            if (Send(MessageFrom, MessageTo, MessageSubject, MessageBody,password))
            {
                //MessageBox.Show("OK");
            }
            else
            {
                //MessageBox.Show("NO");
            } 




            //根据获得邮箱将信息按照固定格式发送
        }
예제 #2
0
  //------------------------------------------------------
 override public bool  IsLegal()
  {
      String sqlstr = "";
      DataSet DataTable;
     if(name == ""|| password == "")
         return false;
      sqlstr = "select Psw from Staff where StaffID="+name;
     DataBaseAccess DAO=new DataBaseAccess();
      DataTable = DAO.GetDataSet(sqlstr);
      if(DataTable.Tables[0].Rows[0].ToString() != password )
          return false;
      return true;
  }
예제 #3
0
        public bool Savemassage(int sort, string massage, string massgetitle)
        {
            bool ex;//判断数据库操作是否成功
            string sql;//数据库操作语句
            string str;//数据库连接参数
            str = "Server=YourSQLServer;user id=sa;password=;initial catalog=Northwind;Connect Timeout=30";
            DataBaseAccess st = new DataBaseAccess(str);
            sql = "insert into 表名() values(massage,sort,massagetitle)";
            ex = st.ExecuteDataBase(sql);
            return ex;


            //将信息保存入数据库
        }
예제 #4
0
   //-----------------------------------------------------
 override  public bool   Record()
   {
       try
       {
           String sqlstr = "";
           sqlstr = "insert into Visitors Values( '" + IP_ + "','" + Time_ + "')";
           DataBaseAccess DAO = new DataBaseAccess();
           DAO.ExecuteDataBase(sqlstr);
       }
       catch (Exception e)
       {
           return false;
       }
       return true;
   }
예제 #5
0
  //------------------------------------------------
 override public bool   IsLegal()
  {
      String sqlstr = "";
      string psw;
     if(id == ""|| password == "")
         return false;
     sqlstr = "select Psw from Administrator where AdminID="+id;
     DataBaseAccess DAO = new DataBaseAccess();
     psw = DAO.GetScalar(sqlstr);
      if(psw!=null)
          if (psw.Equals(password))
          {
              return true;
          }
      return false;
  }
예제 #6
0
 //--------------------------
 override public bool IsLegal()
 {
     String sqlstr = "";
     //DataSet DataTable;
     string psw;
     if (name == "" || password == "")
         return false;
     sqlstr = "select Psw from Staff where name='" + name + "' and Department='信息管理'";
     DataBaseAccess DAO = new DataBaseAccess();
     psw = DAO.GetScalar(sqlstr);
     if (psw != null)
         if (psw.Equals(password))
         {
             return true;
         }
     return false;
 }
예제 #7
0
  //------------------------------------------------------
 override public bool  IsLegal()
  {
      String sqlstr = "";
      //DataSet DataTable;
      string psw;
     if(id == ""|| password == "")
         return false;
      sqlstr = "select Psw from Customers where CustomerID='"+id+"'";
     DataBaseAccess DAO=new DataBaseAccess();
      psw = DAO.GetScalar(sqlstr);
     if (psw!=null)
     {
         if (psw.Equals(password))
         {
             return true;
         }
     }
      //if(DataTable.Tables[0].Rows[0].ToString() != password || psw==null )
      //    return false;
      return false;
  }
예제 #8
0
        //private List<Employee> employee;

        public EmployeesControl()
        {
            ADO = new DataBaseAccess();
        }
예제 #9
0
 public void Getsolution(int sort,string massage,string massagetitle)
 {
     bool exs;
     Cmassageload boot = new Cmassageload(sort, massage, massagetitle);
     exs=boot.Savemassage(sort,massage,massagetitle);
     if (exs)
     {
         //MessageBox.Show("SAVEOK");
     }
     else
     {
         //MessageBox.Show("SAVENO");
     }
     Cmassagesend sd = new Cmassagesend();
     DataTable tb;
     bool ex;//判断数据库操作是否成功
     string sql;//数据库操作语句
     string str;//数据库连接参数
     str = "Server=YourSQLServer;user id=sa;password=;initial catalog=Northwind;Connect Timeout=30";
     DataBaseAccess st = new DataBaseAccess(str);
     sql = "select * from 视图 where sort=boot.sort";
     tb = st.GetDataTable(sql);
     for (int i = 0; i <= tb.Rows.Count; i++)
     {
        // email = tb.Row[0][i];
        // sd.Sendmassage(email);
     }
     
 }