//public static IDataReader GetAll(Guid languageGuid) //{ // return DBOrderStatus.GetAll(languageGuid); //} public static DataTable GetAll(Guid languageGuid) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("Guid", typeof(Guid)); dataTable.Columns.Add("Sort", typeof(int)); dataTable.Columns.Add("Description", typeof(string)); // dataTable.Columns.Add("TotalPages", typeof(int)); IDataReader reader = DBOrderStatus.GetAll(languageGuid); while (reader.Read()) { DataRow row = dataTable.NewRow(); row["Guid"] = reader["Guid"]; row["Sort"] = reader["Sort"]; row["Description"] = reader["Description"]; //row["TotalPages"] = Convert.ToInt32(reader["TotalPages"]); dataTable.Rows.Add(row); } reader.Close(); return(dataTable); }
public bool Save() { bool result = false; if (this.guid != Guid.Empty) { result = Update(); } else { result = Create(); } if (result) { if (LanguageDescriptionExists()) { DBOrderStatus.UpdateDescription( guid, langGuid, description); } else { DBOrderStatus.AddDescription( guid, langGuid, Description); } } return(result); }
public bool Delete() { // TODO: check if any order have this status first //bool result = DBOrderStatus.DeleteOrderStatusDescription(guid,langGuid); bool result = DBOrderStatus.DeleteDescription(guid); result = DBOrderStatus.Delete(guid); return(result); }
private bool Create() { this.guid = guidToUse; int rowsAffected = DBOrderStatus.Add( this.guid, this.sort); return(rowsAffected > 0); }
private void GetOrderStatus(Guid guid) { IDataReader reader = DBOrderStatus.Get(guid); if (reader.Read()) { this.guid = new Guid(reader["Guid"].ToString()); this.sort = Convert.ToInt32(reader["Sort"]); } reader.Close(); }
private bool LanguageDescriptionExists() { bool result = false; IDataReader reader = DBOrderStatus.GetDescription( guid, langGuid); if (reader.Read()) { result = true; } reader.Close(); return(result); }
private void GetDescription( Guid statusGuid, Guid languageGuid) { IDataReader reader = DBOrderStatus.GetDescription( statusGuid, languageGuid); if (reader.Read()) { this.langGuid = new Guid(reader["LanguageGuid"].ToString()); this.description = reader["Description"].ToString(); } reader.Close(); }
private static OrderStatus DBMapping(DBOrderStatus dbItem) { if (dbItem == null) return null; OrderStatus item = new OrderStatus(); item.OrderStatusID = dbItem.OrderStatusID; item.Name = dbItem.Name; return item; }
private bool Update() { return(DBOrderStatus.Update( this.guid, this.sort)); }