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"); } //根据获得邮箱将信息按照固定格式发送 }
//------------------------------------------------------ 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; }
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; //将信息保存入数据库 }
//----------------------------------------------------- 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; }
//------------------------------------------------ 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; }
//-------------------------- 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; }
//------------------------------------------------------ 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; }
//private List<Employee> employee; public EmployeesControl() { ADO = new DataBaseAccess(); }
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); } }