Пример #1
0
        public static List <Hl7Manufacturers> GetHl7ManufacturersAsList(DataTable dt)
        {
            List <Hl7Manufacturers> oList = new List <Hl7Manufacturers>();

            foreach (DataRow row in dt.Rows)
            {
                try
                {
                    Hl7Manufacturers o = new Hl7Manufacturers();
                    o.Id          = Helper.ConvertToInt(row["ID"]);
                    o.MvxCode     = row["MVX_CODE"].ToString();
                    o.Name        = row["NAME"].ToString();
                    o.Notes       = row["NOTES"].ToString();
                    o.IsActive    = Helper.ConvertToBoolean(row["IS_ACTIVE"]);
                    o.LastUpdated = Helper.ConvertToDate(row["LAST_UPDATED"]);
                    o.InternalId  = Helper.ConvertToInt(row["INTERNAL_ID"]);
                    oList.Add(o);
                }
                catch (Exception ex)
                {
                    Log.InsertEntity("Hl7Manufacturers", "GetHl7ManufacturersAsList", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
                    throw ex;
                }
            }
            return(oList);
        }
Пример #2
0
 public static int Update(Hl7Manufacturers o)
 {
     try
     {
         string query = @"UPDATE ""HL7_MANUFACTURERS"" SET ""ID"" = @Id, ""MVX_CODE"" = @MvxCode, ""NAME"" = @Name, ""NOTES"" = @Notes, ""IS_ACTIVE"" = @IsActive, ""LAST_UPDATED"" = @LastUpdated, ""INTERNAL_ID"" = @InternalId WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@MvxCode", DbType.String)
             {
                 Value = o.MvxCode
             },
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@LastUpdated", DbType.Date)
             {
                 Value = o.LastUpdated
             },
             new NpgsqlParameter("@InternalId", DbType.Int32)
             {
                 Value = o.InternalId
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Hl7Manufacturers", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Hl7Manufacturers", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Пример #3
0
 public static int Insert(Hl7Manufacturers o)
 {
     try
     {
         string query = @"INSERT INTO ""HL7_MANUFACTURERS"" (""MVX_CODE"", ""NAME"", ""NOTES"", ""IS_ACTIVE"", ""LAST_UPDATED"", ""INTERNAL_ID"") VALUES (@MvxCode, @Name, @Notes, @IsActive, @LastUpdated, @InternalId) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@MvxCode", DbType.String)
             {
                 Value = o.MvxCode
             },
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@LastUpdated", DbType.Date)
             {
                 Value = o.LastUpdated
             },
             new NpgsqlParameter("@InternalId", DbType.Int32)
             {
                 Value = o.InternalId
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Hl7Manufacturers", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Hl7Manufacturers", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }