public static void ChangeAlertSts(Int64 OID, int Status, int Type) { OrdNotice obj = OrdNotice.GetOne(OID); if (obj != null && obj.ID > 0) { obj.Status = Status; obj.Type = Type; obj.save(); } }
public static List <OrdNotice> GetAll(int Type) { List <OrdNotice> Temp = new List <OrdNotice>(); DBCon con = new DBCon(); SqlCommand cmd = new SqlCommand(); string query = "select * from OrdNotifictin where Type=@Type and Status=0"; try { cmd = new SqlCommand(query, con.Con); cmd.Parameters.AddWithValue("@Type", Type); SqlDataReader sqlDataReader = cmd.ExecuteReader(); while (sqlDataReader.Read()) { int index = -1; OrdNotice hG_Ticket = new OrdNotice(); hG_Ticket.ID = sqlDataReader.GetInt32(++index); hG_Ticket.OID = sqlDataReader.GetInt64(++index); hG_Ticket.Status = sqlDataReader.GetInt32(++index); hG_Ticket.Type = sqlDataReader.GetInt32(++index); hG_Ticket.CID = sqlDataReader.GetInt32(++index); hG_Ticket.Orgid = sqlDataReader.GetInt32(++index); Temp.Add(hG_Ticket); } } catch (Exception e) { e.ToString(); } finally { con.Con.Close(); con.Con.Dispose(); cmd.Dispose(); } return(Temp); }
public static OrdNotice GetOne(Int64 OID) { OrdNotice Temp = new OrdNotice(); DBCon con = new DBCon(); SqlCommand cmd = new SqlCommand(); string query = "select * from OrdNotifictin where OID=@OID"; try { cmd = new SqlCommand(query, con.Con); cmd.Parameters.AddWithValue("@OID", OID); SqlDataReader sqlDataReader = cmd.ExecuteReader(); while (sqlDataReader.Read()) { int index = -1; OrdNotice hG_Ticket = new OrdNotice(); hG_Ticket.ID = sqlDataReader.GetInt32(++index); hG_Ticket.OID = sqlDataReader.GetInt64(++index); hG_Ticket.Status = sqlDataReader.GetInt32(++index); hG_Ticket.Type = sqlDataReader.GetInt32(++index); hG_Ticket.CID = sqlDataReader.GetInt32(++index); hG_Ticket.Orgid = sqlDataReader.GetInt32(++index); Temp = hG_Ticket; } } catch (Exception e) { e.ToString(); } finally { con.Con.Close(); con.Con.Dispose(); cmd.Dispose(); } return(Temp); }