public List <EquipTypeTbl> GetAll(string SortBy) { List <EquipTypeTbl> _DataItems = new List <EquipTypeTbl>(); string _connectionStr = ConfigurationManager.ConnectionStrings[QOnT.classes.TrackerDb.CONST_CONSTRING].ConnectionString; using (OleDbConnection _conn = new OleDbConnection(_connectionStr)) { string _sqlCmd = CONST_SQL_SELECT; _sqlCmd += (!String.IsNullOrEmpty(SortBy)) ? " ORDER BY " + SortBy : " ORDER BY EquipTypeName"; // add default order OleDbCommand _cmd = new OleDbCommand(_sqlCmd, _conn); // run the qurey we have built _conn.Open(); OleDbDataReader _DataReader = _cmd.ExecuteReader(); while (_DataReader.Read()) { EquipTypeTbl _DataItem = new EquipTypeTbl(); _DataItem.EquipTypeId = (_DataReader["EquipTypeId"] == DBNull.Value) ? 0 : Convert.ToInt32(_DataReader["EquipTypeId"]); _DataItem.EquipTypeName = (_DataReader["EquipTypeName"] == DBNull.Value) ? string.Empty : _DataReader["EquipTypeName"].ToString(); _DataItem.EquipTypeDesc = (_DataReader["EquipTypeDesc"] == DBNull.Value) ? string.Empty : _DataReader["EquipTypeDesc"].ToString(); _DataItems.Add(_DataItem); } } return(_DataItems); }
public static void UpdateEquipItem(EquipTypeTbl objEquipType) { string _connectionStr = ConfigurationManager.ConnectionStrings[QOnT.classes.TrackerDb.CONST_CONSTRING].ConnectionString;; using (OleDbConnection _conn = new OleDbConnection(_connectionStr)) { string _sqlCmd = CONST_SQL_UPDATE; OleDbCommand _cmd = new OleDbCommand(_sqlCmd, _conn); // prepare the qurey we have built #region Parameters // objEquipType.EquipTypeName = (objEquipType.EquipTypeName == null) ? string.Empty : objEquipType.EquipTypeName; // objEquipType.EquipTypeDesc = (objEquipType.EquipTypeDesc == null) ? string.Empty : objEquipType.EquipTypeDesc; _cmd.Parameters.Add(new OleDbParameter { Value = objEquipType.EquipTypeName }); _cmd.Parameters.Add(new OleDbParameter { Value = objEquipType.EquipTypeDesc }); // Where clause _cmd.Parameters.Add(new OleDbParameter { Value = objEquipType.EquipTypeId }); #endregion _conn.Open(); _cmd.ExecuteNonQuery(); _conn.Close(); } }
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()); }