public static string Tags(string tekst, RescueTekniq.BOL.EyeWash item) { string res = ""; StringBuilder sb = new StringBuilder(); sb.Append(tekst); sb.Replace("[VARE.TYPE]", "EyeWash/Hjertestarter"); sb.Replace("[EyeWash.ANSVARLIG]", item.ResponsibleName); sb.Replace("[EyeWash.ANSVARLIG.NAVN]", item.ResponsibleName); sb.Replace("[EyeWash.ANSVARLIG.EMAIL]", item.ResponsibleEmail); sb.Replace("[EyeWash.ANSVARLIG.TELEFON]", item.ResponsiblePhone); sb.Replace("[EyeWash.NOTE]", item.Note); sb.Replace("[EyeWash.TYPE]", "[VARE.NAVN]"); sb.Replace("[EyeWash.SERIALNO]", item.SerialNo); sb.Replace("[EyeWash.LOCATION]", item.Location); sb.Replace("[EyeWash.LOCATIONFULDADR]", item.LocationFuldAdresse); sb.Replace("[EyeWash.VARENR]", "[VARE.VARENR]"); //item.Vare.VareNr) sb.Replace("[EyeWash.MODEL]", "[VARE.NAVN]"); //item.Vare.Navn) sb.Replace("[EyeWash.EXPIREDATE]", item.WarencyExpireDate.ToString("dd MMMM yyyy")); res = sb.ToString(); res = item.KundeGrpPris.Tags(res); res = item.Virksomhed.Tags(res); return(res); }
/// <summary> /// Creates the PDF document. /// </summary> public Document CreateDocument() { if (!_Eyewash.loaded) { if (_eyeID > 0) { _Eyewash = new RescueTekniq.BOL.EyeWash(_eyeID); } } if (!_Eyewash.loaded) { throw (new Exception("Øjenskyl findes ikke, ID ukendt :" + eyeID.ToString())); } // Create a new MigraDoc document this.document = new Document(); var with_1 = this.document.Info; with_1.Title = "Øjenskyl regstering nr. " + System.Convert.ToString(_eyeID); with_1.Subject = "Øjenskyl registering"; with_1.Author = Company.name; with_1.Comment = ""; with_1.Keywords = ""; DefineStyles(); CreatePage(); FillContent(); return(this.document); }
public static System.Collections.Generic.List <EyeWash> GetListSoonExpired(int CompanyID) { System.Collections.Generic.List <EyeWash> result = new System.Collections.Generic.List <EyeWash>(); int ID = -1; DBAccess db = new DBAccess(); db.AddInt("CompanyID", CompanyID); db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent()); db.AddGuid("AgentID", CurrentUserID); SqlDataReader dr = default(SqlDataReader); //Try dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectAllSoonExpired)); if (dr.HasRows) { while (dr.Read()) { ID = System.Convert.ToInt32(dr.DBtoInt("ID")); result.Add(EyeWash.GetEyeWash(ID)); } } dr.Close(); //Catch ex As Exception // Throw ex //End Try return(result); }
public static int MoveToNewOwner(int ID, int NewOwner) { EyeWash a = new EyeWash(ID); a.CompanyID = NewOwner; AddLog(Status: "EyeWash", Logtext: string.Format("Update EyeWash: ID:{0} SNo:{1} New owner: {2}-{3}", a.ID, a.SerialNo, a.CompanyID, a.Firmanavn), Metode: "MoveToNewOwner"); return(Save(a)); }
public static int Update(EyeWash rec) { DBAccess db = new DBAccess(); db.AddInt("ID", rec.ID); AddParms(ref db, rec); int retval = db.ExecuteNonQuery(_SQLUpdate); AddLog(Status: "EyeWash", Logtext: string.Format("Update EyeWash: ID:{0} SNo:{1} ", rec.ID, rec.SerialNo), Metode: "Update"); return(retval); }
public static int Save(EyeWash rec) { int retval = 0; //db.ExecuteNonQuery(_SQLUpdate) if (rec.ID > 0) { retval = Update(rec); } else { retval = Insert(rec); } return(retval); }
public static List <EyeWash> GetEyeWashsByCriteria(string OrderBY, string criteria, params SqlParameter[] @params) { DBAccess db = new DBAccess(); //Dim conn As SqlConnection = DataFunctions.GetConnection() string query = ""; query += "SELECT "; if (OrderBY != "") { query += " TOP (100) PERCENT "; } query += " * FROM vw_Co2Db_EyeWash "; query += " WHERE ( @IsAgent = 0 OR ( @IsAgent = 1 AND [AgentID] = @AgentID ) )"; if (criteria != "") { query += " AND (" + criteria + ")"; } if (OrderBY != "") { query += " ORDER BY " + OrderBY; } //Dim cmd As New SqlCommand(query, conn) db.CommandType = CommandType.Text; db.CommandText = query; db.AddRange(@params); db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent()); db.AddGuid("AgentID", CurrentUserID); db.Open(); SqlDataReader dr = (SqlDataReader)(db.ExecuteReader()); //cmd.ExecuteReader() List <EyeWash> list = new List <EyeWash>(); while (dr.Read()) { EyeWash _EyeWash = new EyeWash(); EyeWash.Populate(dr, _EyeWash); list.Add(_EyeWash); } db.Dispose(); return(list); }
private static void Populate(SqlDataReader dr, EyeWash rec) { var with_1 = rec; with_1.Status = (RescueTekniq.BOL.EyeWash_StatusEnum)(dr.DBtoInt("Status")); with_1.CompanyID = System.Convert.ToInt32(dr.DBtoInt("CompanyID")); with_1.ModelID = System.Convert.ToInt32(dr.DBtoInt("ModelID")); with_1.SerialNo = dr.DBtoString("SerialNo"); with_1.FirmwareVersion = dr.DBtoString("FirmwareVersion"); with_1.FirmwareLanguage = dr.DBtoString("FirmwareLanguage"); with_1.DeleveryDate = System.Convert.ToDateTime(dr.DBtoDate("DeleveryDate")); with_1.WarencyExpireDate = System.Convert.ToDateTime(dr.DBtoDate("WarencyExpireDate")); with_1.EmailSendt = System.Convert.ToDateTime(dr.DBtoDate("EmailSendt")); with_1.BottleActivationDate = System.Convert.ToDateTime(dr.DBtoDate("BottleActivationDate")); with_1.BottleWarencyExpireDate = System.Convert.ToDateTime(dr.DBtoDate("BottleWarencyExpireDate")); with_1.BilagStatus = (RescueTekniq.BOL.EyeWash_BilagStatus)(dr.DBtoInt("BilagStatus")); with_1.BilagSendtDato = System.Convert.ToDateTime(dr.DBtoDate("BilagSendtDato")); with_1.BilagModtagetDato = System.Convert.ToDateTime(dr.DBtoDate("BilagModtagetDato")); with_1.ResponsibleName = dr.DBtoString("ResponsibleName"); with_1.ResponsiblePhone = dr.DBtoString("ResponsiblePhone"); with_1.ResponsibleEmail = dr.DBtoString("ResponsibleEmail"); with_1.LocationAdresse = dr.DBtoString("LocationAdresse"); with_1.LocationPostnr = dr.DBtoString("LocationPostnr"); with_1.LocationBy = dr.DBtoString("LocationBy"); with_1.LocationState = dr.DBtoString("LocationState"); with_1.LocationLandID = System.Convert.ToInt32(dr.DBtoInt("LocationLandID")); with_1.Location = dr.DBtoString("Location"); with_1.LocationBuildingNo = dr.DBtoString("LocationBuildingNo"); with_1.RegisterretCSI = System.Convert.ToDateTime(dr.DBtoDate("RegisterretCSI")); with_1.RegisterretAF = dr.DBtoString("RegisterretAF"); with_1.Note = dr.DBtoString("Note"); PopulateStandard(dr, rec); }
private static void AddParms(ref DBAccess db, EyeWash rec) { var with_1 = rec; db.AddInt("Status", (System.Int32)with_1.Status); db.AddInt("CompanyID", with_1.CompanyID); db.AddInt("ModelID", with_1.ModelID); db.AddNVarChar("SerialNo", with_1.SerialNo, 50); db.AddNVarChar("FirmwareVersion", with_1.FirmwareVersion, 50); db.AddNVarChar("FirmwareLanguage", with_1._FirmwareLanguage, 50); db.AddDateTime("DeleveryDate", with_1.DeleveryDate); db.AddDateTime("WarencyExpireDate", with_1.WarencyExpireDate); db.AddDateTime("EmailSendt", with_1.EmailSendt); db.AddDateTime("BottleActivationDate", with_1.BottleActivationDate); db.AddDateTime("BottleWarencyExpireDate", with_1.BottleWarencyExpireDate); db.AddInt("BilagStatus", (System.Int32)with_1.BilagStatus); db.AddDateTime("BilagSendtDato", with_1.BilagSendtDato); db.AddDateTime("BilagModtagetDato", with_1.BilagModtagetDato); db.AddNVarChar("ResponsibleName", with_1.ResponsibleName, 50); db.AddNVarChar("ResponsiblePhone", with_1.ResponsiblePhone, 16); db.AddNVarChar("ResponsibleEmail", with_1.ResponsibleEmail, 250); db.AddNVarChar("LocationAdresse", with_1.LocationAdresse, 50); db.AddNVarChar("LocationPostnr", with_1.LocationPostnr, 16); db.AddNVarChar("LocationBy", with_1.LocationBy, 50); db.AddNVarChar("LocationState", with_1.LocationState, 50); db.AddInt("LocationLandID", with_1.LocationLandID); db.AddNVarChar("Location", with_1.Location, -1); db.AddNVarChar("LocationBuildingNo", with_1.LocationBuildingNo, 10); db.AddDateTime("RegisterretCSI", with_1.RegisterretCSI); db.AddNVarChar("RegisterretAF", with_1.RegisterretAF, 50); db.AddNVarChar("Note", with_1.Note, -1); AddParmsStandard(db, rec); }
public static int Delete(EyeWash A) { int retval = -1; if (A.ID > 0) { foreach (EyeWash_Bottle B in A.BottleList) { B.Delete(); } DBAccess db = new DBAccess(); db.AddInt("ID", A.ID); retval = db.ExecuteNonQuery(_SQLDelete); AddLog(Status: "EyeWash", Logtext: string.Format("Delete EyeWash: ID:{0} SNo:{1} ", A.ID, A.SerialNo), Metode: "Delete"); } return(retval); }
public static EyeWash GetEyeWashBySerialNo(string SerialNo) { DBAccess db = new DBAccess(); EyeWash c = new EyeWash(); db.AddNVarChar("SerialNo", SerialNo, 50); db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent()); db.AddGuid("AgentID", CurrentUserID); SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectBySerialNo)); if (dr.HasRows) { while (dr.Read()) { Populate(dr, c); } } dr.Close(); return(c); }
public static EyeWash GetEyeWashbyGuid(Guid GuID) { DBAccess db = new DBAccess(); EyeWash c = new EyeWash(); db.AddGuid("Guid", GuID); db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent()); db.AddGuid("AgentID", CurrentUserID); SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByGuid)); if (dr.HasRows) { while (dr.Read()) { Populate(dr, c); } } dr.Close(); return(c); }
public static int Insert(EyeWash rec) { DBAccess db = new DBAccess(); AddParms(ref db, rec); SqlParameter objParam = new SqlParameter("@ID", 0); objParam.Direction = ParameterDirection.Output; db.Parameters.Add(objParam); int retval = db.ExecuteNonQuery(_SQLInsert); if (retval == 1) { rec.ID = Funktioner.ToInt(objParam.Value, -1); //Integer.Parse(objParam.Value.ToString) AddLog(Status: "EyeWash", Logtext: string.Format("Create EyeWash: ID:{0} SNo:{1} ", rec.ID, rec.SerialNo), Metode: "Insert"); return(rec.ID); //Integer.Parse(objParam.Value.ToString) } else { AddLog(Status: "EyeWash", Logtext: string.Format("Failure to Create EyeWash: SNo:{0}", rec.SerialNo), logtype: LogTypeEnum.Error, Metode: "Insert"); return(-1); } }
public static int Delete(int ID) { EyeWash item = new EyeWash(ID); return(Delete(item)); }