public List <RepairStatusesTbl> GetAll(string SortBy) { List <RepairStatusesTbl> _DataItems = new List <RepairStatusesTbl>(); TrackerDb _TrackerDb = new TrackerDb(); string _sqlCmd = CONST_SQL_SELECT; _sqlCmd += " ORDER BY " + (String.IsNullOrEmpty(SortBy) ? "SortOrder" : SortBy); // params would go here if need IDataReader _DataReader = _TrackerDb.ExecuteSQLGetDataReader(_sqlCmd); if (_DataReader != null) { while (_DataReader.Read()) { RepairStatusesTbl _DataItem = new RepairStatusesTbl(); _DataItem.RepairStatusID = (_DataReader["RepairStatusID"] == DBNull.Value) ? 0 : Convert.ToInt32(_DataReader["RepairStatusID"]); _DataItem.RepairStatusDesc = (_DataReader["RepairStatusDesc"] == DBNull.Value) ? string.Empty : _DataReader["RepairStatusDesc"].ToString(); _DataItem.EmailClient = (_DataReader["EmailClient"] == DBNull.Value) ? false : Convert.ToBoolean(_DataReader["EmailClient"]); _DataItem.SortOrder = (_DataReader["SortOrder"] == DBNull.Value) ? 0 : Convert.ToInt32(_DataReader["SortOrder"]); _DataItem.Notes = (_DataReader["Notes"] == DBNull.Value) ? string.Empty : _DataReader["Notes"].ToString(); _DataItems.Add(_DataItem); } _DataReader.Close(); } _TrackerDb.Close(); return(_DataItems); }
private bool SendStatusChangeEmail(RepairsTbl pRepair) { EmailCls _Email = new EmailCls(); EquipTypeTbl _EquipTypes = new EquipTypeTbl(); RepairStatusesTbl _RepairStatuses = new RepairStatusesTbl(); _Email.SetEmailTo(pRepair.ContactEmail); _Email.SetEmailSubject("Change to repair status - notification."); _Email.AddStrAndNewLineToBody("<b>Repair Status Change Notification</b>"); _Email.AddFormatToBody("Dear {0}, <br /><br />", pRepair.ContactName); _Email.AddFormatToBody("Please note that repair status of the {0}, serial number: {1}, has changed to <b>{2}</b>.<br /><br />", _EquipTypes.GetEquipName(pRepair._MachineTypeID), pRepair.MachineSerialNumber, _RepairStatuses.GetRepairStatusDesc(pRepair.RepairStatusID)); _Email.AddStrAndNewLineToBody("You are receiving this status update since your email address was assigned to the tracking of this repair.<br />"); _Email.AddStrAndNewLineToBody("Please note that Quaffee DOES NOT run a coffee machine repair workshop. As a service to our current coffee " + "purchasing clients we will take the coffee machine to the workshop, give a swop out machine to the client, if available, and " + "charge what we are charged by the workshop plus a small admin fee. Please note: we are not able to quote these repairs, if you would like " + "to contact the workshop directly, please ask us for their details.<br />"); _Email.AddStrAndNewLineToBody("For clients that are not currently using our coffee, or have not used our coffee consistently over" + " the last 3 months, we may at our discretion offer a swop out machine, at a fee, and also change a collection and delivery fee.<br />"); _Email.AddStrAndNewLineToBody("Any warantee on the repairs is carried by the workshop not by Quaffee.<br />"); _Email.AddStrAndNewLineToBody("The Quaffee Team"); _Email.AddStrAndNewLineToBody("web: <a href='http://www.quaffee.co.za'>quaffee.co.za</a>"); return(_Email.SendEmail()); }