public static OrderStatusEmailCollection LoadForEmailTemplate(Int32 emailTemplateId) { OrderStatusEmailCollection OrderStatusEmails = new OrderStatusEmailCollection(); //CREATE THE DYNAMIC SQL TO LOAD OBJECT StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT OrderStatusId"); selectQuery.Append(" FROM ac_OrderStatusEmails"); selectQuery.Append(" WHERE EmailTemplateId = @emailTemplateId"); Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); database.AddInParameter(selectCommand, "@emailTemplateId", System.Data.DbType.Int32, emailTemplateId); //EXECUTE THE COMMAND using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read()) { OrderStatusEmail orderStatusEmail = new OrderStatusEmail(); orderStatusEmail.EmailTemplateId = emailTemplateId; orderStatusEmail.OrderStatusId = dr.GetInt32(0); OrderStatusEmails.Add(orderStatusEmail); } dr.Close(); } return(OrderStatusEmails); }
/// <summary> /// Loads the given OrderStatusEmail object from the given database data reader. /// </summary> /// <param name="orderStatusEmail">The OrderStatusEmail object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(OrderStatusEmail orderStatusEmail, IDataReader dr) { //SET FIELDS FROM ROW DATA orderStatusEmail.OrderStatusId = dr.GetInt32(0); orderStatusEmail.EmailTemplateId = dr.GetInt32(1); orderStatusEmail.IsDirty = false; }
public static OrderStatusEmail Load(Int32 orderStatusId, Int32 emailTemplateId) { OrderStatusEmail orderStatusEmail = new OrderStatusEmail(); orderStatusEmail.OrderStatusId = orderStatusId; orderStatusEmail.EmailTemplateId = emailTemplateId; orderStatusEmail.IsDirty = false; return(orderStatusEmail); }
public static bool Delete(Int32 orderStatusId, Int32 emailTemplateId) { OrderStatusEmail orderStatusEmail = new OrderStatusEmail(); if (orderStatusEmail.Load(orderStatusId, emailTemplateId)) { return(orderStatusEmail.Delete()); } return(false); }
public static SaveResult Insert(OrderStatusEmail orderStatusEmail) { return(orderStatusEmail.Save()); }
public static bool Delete(OrderStatusEmail orderStatusEmail) { return(orderStatusEmail.Delete()); }
public static SaveResult Update(OrderStatusEmail orderStatusEmail) { return(orderStatusEmail.Save()); }