Exemple #1
0
        public static List <Hl7Vaccines> GetHl7VaccinesAsList(DataTable dt)
        {
            List <Hl7Vaccines> oList = new List <Hl7Vaccines>();

            foreach (DataRow row in dt.Rows)
            {
                try
                {
                    Hl7Vaccines o = new Hl7Vaccines();
                    o.Id            = Helper.ConvertToInt(row["ID"]);
                    o.CvxCode       = row["CVX_CODE"].ToString();
                    o.Code          = row["CODE"].ToString();
                    o.Fullname      = row["FULLNAME"].ToString();
                    o.Notes         = row["NOTES"].ToString();
                    o.VaccineStatus = Helper.ConvertToBoolean(row["VACCINE_STATUS"]);
                    o.InternalId    = Helper.ConvertToInt(row["INTERNAL_ID"]);
                    o.NonVaccine    = Helper.ConvertToBoolean(row["NON_VACCINE"]);
                    o.UpdateDate    = Helper.ConvertToDate(row["UPDATE_DATE"]);
                    oList.Add(o);
                }
                catch (Exception ex)
                {
                    Log.InsertEntity("Hl7Vaccines", "GetHl7VaccinesAsList", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
                    throw ex;
                }
            }
            return(oList);
        }
Exemple #2
0
 public static int Update(Hl7Vaccines o)
 {
     try
     {
         string query = @"UPDATE ""HL7_VACCINES"" SET ""ID"" = @Id, ""CVX_CODE"" = @CvxCode, ""CODE"" = @Code, ""FULLNAME"" = @Fullname, ""NOTES"" = @Notes, ""VACCINE_STATUS"" = @VaccineStatus, ""INTERNAL_ID"" = @InternalId, ""NON_VACCINE"" = @NonVaccine, ""UPDATE_DATE"" = @UpdateDate WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@CvxCode", DbType.Int32)
             {
                 Value = o.CvxCode
             },
             new NpgsqlParameter("@Code", DbType.String)
             {
                 Value = o.Code
             },
             new NpgsqlParameter("@Fullname", DbType.String)
             {
                 Value = o.Fullname
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@VaccineStatus", DbType.Boolean)
             {
                 Value = o.VaccineStatus
             },
             new NpgsqlParameter("@InternalId", DbType.Int32)
             {
                 Value = o.InternalId
             },
             new NpgsqlParameter("@NonVaccine", DbType.Boolean)
             {
                 Value = o.NonVaccine
             },
             new NpgsqlParameter("@UpdateDate", DbType.Date)
             {
                 Value = o.UpdateDate
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Hl7Vaccines", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Hl7Vaccines", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #3
0
 public static int Insert(Hl7Vaccines o)
 {
     try
     {
         string query = @"INSERT INTO ""HL7_VACCINES"" (""CVX_CODE"", ""CODE"", ""FULLNAME"", ""NOTES"", ""VACCINE_STATUS"", ""INTERNAL_ID"", ""NON_VACCINE"", ""UPDATE_DATE"") VALUES (@CvxCode, @Code, @Fullname, @Notes, @VaccineStatus, @InternalId, @NonVaccine, @UpdateDate) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@CvxCode", DbType.Int32)
             {
                 Value = o.CvxCode
             },
             new NpgsqlParameter("@Code", DbType.String)
             {
                 Value = o.Code
             },
             new NpgsqlParameter("@Fullname", DbType.String)
             {
                 Value = o.Fullname
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@VaccineStatus", DbType.Boolean)
             {
                 Value = o.VaccineStatus
             },
             new NpgsqlParameter("@InternalId", DbType.Int32)
             {
                 Value = o.InternalId
             },
             new NpgsqlParameter("@NonVaccine", DbType.Boolean)
             {
                 Value = o.NonVaccine
             },
             new NpgsqlParameter("@UpdateDate", DbType.Date)
             {
                 Value = o.UpdateDate
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Hl7Vaccines", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Hl7Vaccines", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }