public static int Update(ChildMerges o)
 {
     try
     {
         string query = @"UPDATE ""CHILD_MERGES"" SET ""ID"" = @Id, ""EFFECTIVE_DATE"" = @EffectiveDate, ""CHILD_ID"" = @ChildId, ""SUBSUMED_ID"" = @SubsumedId WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@EffectiveDate", DbType.Date)
             {
                 Value = o.EffectiveDate
             },
             new NpgsqlParameter("@ChildId", DbType.Int32)
             {
                 Value = o.ChildId
             },
             new NpgsqlParameter("@SubsumedId", DbType.Int32)
             {
                 Value = o.SubsumedId
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("ChildMerges", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("ChildMerges", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Insert(ChildMerges o)
 {
     try
     {
         string query = @"INSERT INTO ""CHILD_MERGES"" (""EFFECTIVE_DATE"", ""CHILD_ID"", ""SUBSUMED_ID"") VALUES (@EffectiveDate, @ChildId, @SubsumedId) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@EffectiveDate", DbType.Date)
             {
                 Value = o.EffectiveDate
             },
             new NpgsqlParameter("@ChildId", DbType.Int32)
             {
                 Value = o.ChildId
             },
             new NpgsqlParameter("@SubsumedId", DbType.Int32)
             {
                 Value = o.SubsumedId
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("ChildMerges", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("ChildMerges", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #3
0
 public static int Insert(SystemModule o)
 {
     try
     {
         string query = @"INSERT INTO ""SYSTEM_MODULE"" (""NAME"", ""CODE"", ""IS_USED"", ""NOTES"") VALUES (@Name, @Code, @IsUsed, @Notes) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@Code", DbType.String)
             {
                 Value = o.Code
             },
             new NpgsqlParameter("@IsUsed", DbType.Boolean)
             {
                 Value = (object)o.IsUsed ?? DBNull.Value
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("SystemModule", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("SystemModule", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
        public static List <AuditTable> GetAuditTableAsList(DataTable dt)
        {
            List <AuditTable> oList = new List <AuditTable>();

            foreach (DataRow row in dt.Rows)
            {
                try
                {
                    AuditTable o = new AuditTable();
                    o.Id              = Helper.ConvertToInt(row["ID"]);
                    o.DbTable         = row["DB_TABLE"].ToString();
                    o.RecordIdOnTable = row["RECORD_ID_ON_TABLE"].ToString();
                    o.UserId          = Helper.ConvertToInt(row["USER_ID"]);
                    o.ActivityId      = Helper.ConvertToInt(row["ACTIVITY_ID"]);
                    o.Date            = Helper.ConvertToDate(row["DATE"]);
                    oList.Add(o);
                }
                catch (Exception ex)
                {
                    Log.InsertEntity("AuditTable", "GetAuditTableAsList", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
                    throw ex;
                }
            }
            return(oList);
        }
Exemple #5
0
 public static int Insert(Configuration o)
 {
     try
     {
         string query = @"INSERT INTO ""CONFIGURATION"" (""NAME"", ""VALUE"", ""NOTES"") VALUES (@Name, @Value, @Notes) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@Value", DbType.String)
             {
                 Value = o.Value
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Configuration", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Configuration", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Update(ConfigurationDate o)
 {
     try
     {
         string query = @"UPDATE ""CONFIGURATION_DATE"" SET ""ID"" = @Id, ""DATE_FORMAT"" = @DateFormat, ""DATE_EXPRESION"" = @DateExpresion WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@DateFormat", DbType.String)
             {
                 Value = o.DateFormat
             },
             new NpgsqlParameter("@DateExpresion", DbType.String)
             {
                 Value = o.DateExpresion
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("ConfigurationDate", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("ConfigurationDate", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Delete(string healthFacilityCode, string gtin, string lotNumber)
 {
     try
     {
         string query = @"DELETE FROM ""HEALTH_FACILITY_BALANCE"" WHERE ""HEALTH_FACILITY_CODE"" = @HealthFacilityCode AND ""GTIN"" = @Gtin AND ""LOT_NUMBER"" = @LotNumber";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@HealthFacilityCode", DbType.String)
             {
                 Value = healthFacilityCode
             },
             new NpgsqlParameter("@Gtin", DbType.String)
             {
                 Value = gtin
             },
             new NpgsqlParameter("@LotNumber", DbType.String)
             {
                 Value = lotNumber
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("HealthFacilityBalance", string.Format("RecordId: {0}", healthFacilityCode + gtin + lotNumber), 3, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("HealthFacilityBalance", "Delete", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
         throw ex;
     }
 }
Exemple #8
0
 public static int Update(UserRole o)
 {
     try
     {
         string query = @"UPDATE ""USER_ROLE"" SET ""ID"" = @Id, ""USER_ID"" = @UserId, ""ROLE_ID"" = @RoleId, ""IS_ACTIVE"" = @IsActive WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@UserId", DbType.Int32)
             {
                 Value = o.UserId
             },
             new NpgsqlParameter("@RoleId", DbType.Int32)
             {
                 Value = o.RoleId
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("UserRole", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("UserRole", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
        //Item Lot New
        public static ItemLot GetItemLotByGtinAndLotNo(string gtin, string lotNumber)
        {
            try
            {
                string query = @"SELECT * FROM ""ITEM_LOT"" WHERE ""GTIN"" = @ParamValue1 AND ""LOT_NUMBER"" = @ParamValue2 ";

                List <NpgsqlParameter> parameters = new List <NpgsqlParameter>()
                {
                    new NpgsqlParameter("@ParamValue1", DbType.String)
                    {
                        Value = gtin
                    },
                    new NpgsqlParameter("@ParamValue2", DbType.String)
                    {
                        Value = lotNumber
                    }
                };

                DataTable dt = DBManager.ExecuteReaderCommand(query, CommandType.Text, parameters);
                AuditTable.InsertEntity("ItemLot", string.Format("RecordId: {0}", gtin + lotNumber), 4, DateTime.Now, 1);
                return(GetItemLotAsObject(dt));
            }
            catch (Exception ex)
            {
                Log.InsertEntity("ItemLot", "GetItemLotByGtinAndLotNo", 4, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
                throw ex;
            }
        }
Exemple #10
0
 public static int Update(Configuration o)
 {
     try
     {
         string query = @"UPDATE ""CONFIGURATION"" SET ""ID"" = @Id, ""NAME"" = @Name, ""VALUE"" = @Value, ""NOTES"" = @Notes WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@Value", DbType.String)
             {
                 Value = o.Value
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Configuration", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Configuration", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #11
0
 public static int Update(PersonConfiguration o)
 {
     try
     {
         string query = @"UPDATE ""PERSON_CONFIGURATION"" SET ""ID"" = @Id, ""COLUMN_NAME"" = @ColumnName, ""IS_VISIBLE"" = @IsVisible, ""IS_MANDATORY"" = @IsMandatory WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@ColumnName", DbType.String)
             {
                 Value = o.ColumnName
             },
             new NpgsqlParameter("@IsVisible", DbType.Boolean)
             {
                 Value = o.IsVisible
             },
             new NpgsqlParameter("@IsMandatory", DbType.Boolean)
             {
                 Value = o.IsMandatory
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("PersonConfiguration", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("PersonConfiguration", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #12
0
 public static int Insert(AgeDefinitions o)
 {
     try
     {
         string query = @"INSERT INTO ""AGE_DEFINITIONS"" (""NAME"", ""IS_ACTIVE"", ""NOTES"", ""DAYS"") VALUES (@Name, @IsActive, @Notes, @Days) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@Days", DbType.Int32)
             {
                 Value = o.Days
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("AgeDefinitions", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("AgeDefinitions", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #13
0
 public static int Insert(UserRole o)
 {
     try
     {
         string query = @"INSERT INTO ""USER_ROLE"" (""USER_ID"", ""ROLE_ID"", ""IS_ACTIVE"") VALUES (@UserId, @RoleId, @IsActive) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@UserId", DbType.Int32)
             {
                 Value = o.UserId
             },
             new NpgsqlParameter("@RoleId", DbType.Int32)
             {
                 Value = o.RoleId
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("UserRole", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("UserRole", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #14
0
 public static int Insert(PersonConfiguration o)
 {
     try
     {
         string query = @"INSERT INTO ""PERSON_CONFIGURATION"" (""COLUMN_NAME"", ""IS_VISIBLE"", ""IS_MANDATORY"") VALUES (@ColumnName, @IsVisible, @IsMandatory) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@ColumnName", DbType.String)
             {
                 Value = o.ColumnName
             },
             new NpgsqlParameter("@IsVisible", DbType.Boolean)
             {
                 Value = o.IsVisible
             },
             new NpgsqlParameter("@IsMandatory", DbType.Boolean)
             {
                 Value = o.IsMandatory
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("PersonConfiguration", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("PersonConfiguration", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #15
0
 public static int Insert(WordTranslate o)
 {
     try
     {
         string query = @"INSERT INTO ""WORD_TRANSLATE"" (""LANGUAGE_ID"", ""CODE"", ""NAME"", ""PAGE_NAME"") VALUES (@LanguageId, @Code, @Name, @PageName) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@LanguageId", DbType.Int32)
             {
                 Value = (object)o.LanguageId ?? DBNull.Value
             },
             new NpgsqlParameter("@Code", DbType.String)
             {
                 Value = (object)o.Code ?? DBNull.Value
             },
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = (object)o.Name ?? DBNull.Value
             },
             new NpgsqlParameter("@PageName", DbType.String)
             {
                 Value = (object)o.PageName ?? DBNull.Value
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("WordTranslate", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("WordTranslate", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #16
0
        public static GtinHfStockPolicy GetGtinHfStockPolicyByHealthFacilityCodeAndGtin(string hfId, string gtin)
        {
            try
            {
                string query = @"SELECT * FROM ""GTIN_HF_STOCK_POLICY"" WHERE ""HEALTH_FACILITY_CODE"" = @ParamValue1 AND ""GTIN"" like @ParamValue2 ";

                List <NpgsqlParameter> parameters = new List <NpgsqlParameter>()
                {
                    new NpgsqlParameter("@ParamValue1", DbType.String)
                    {
                        Value = hfId
                    },
                    new NpgsqlParameter("@ParamValue2", DbType.String)
                    {
                        Value = gtin + "%"
                    }
                };

                DataTable dt = DBManager.ExecuteReaderCommand(query, CommandType.Text, parameters);
                AuditTable.InsertEntity("GtinHfStockPolicy", string.Format("RecordId: {0}", hfId + gtin), 4, DateTime.Now, 1);
                return(GetGtinHfStockPolicyAsObject(dt));
            }
            catch (Exception ex)
            {
                Log.InsertEntity("GtinHfStockPolicy", "GetGtinHfStockPolicyByHealthFacilityCodeAndGtin", 4, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
                throw ex;
            }
        }
 public static int Insert(ConfigurationDate o)
 {
     try
     {
         string query = @"INSERT INTO ""CONFIGURATION_DATE"" (""DATE_FORMAT"", ""DATE_EXPRESION"") VALUES (@DateFormat, @DateExpresion) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@DateFormat", DbType.String)
             {
                 Value = o.DateFormat
             },
             new NpgsqlParameter("@DateExpresion", DbType.String)
             {
                 Value = o.DateExpresion
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("ConfigurationDate", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("ConfigurationDate", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Update(OrderLines o)
 {
     try
     {
         string query = @"UPDATE ""ORDER_LINES"" SET ""ID"" = @Id, ""ORDER_ID"" = @OrderId, ""ITEM_ID"" = @ItemId, ""QUANTITY"" = @Quantity WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@OrderId", DbType.Int32)
             {
                 Value = o.OrderId
             },
             new NpgsqlParameter("@ItemId", DbType.Int32)
             {
                 Value = o.ItemId
             },
             new NpgsqlParameter("@Quantity", DbType.Int32)
             {
                 Value = o.Quantity
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("OrderLines", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("OrderLines", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Insert(OrderLines o)
 {
     try
     {
         string query = @"INSERT INTO ""ORDER_LINES"" (""ORDER_ID"", ""ITEM_ID"", ""QUANTITY"") VALUES (@OrderId, @ItemId, @Quantity) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@OrderId", DbType.Int32)
             {
                 Value = o.OrderId
             },
             new NpgsqlParameter("@ItemId", DbType.Int32)
             {
                 Value = o.ItemId
             },
             new NpgsqlParameter("@Quantity", DbType.Int32)
             {
                 Value = o.Quantity
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("OrderLines", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("OrderLines", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #20
0
 public static int Update(Place o)
 {
     try
     {
         string query = @"UPDATE ""PLACE"" SET ""ID"" = @Id, ""NAME"" = @Name, ""PARENT_ID"" = @ParentId, ""LEAF"" = @Leaf, ""NOTES"" = @Notes, ""IS_ACTIVE"" = @IsActive, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy, ""HEALTH_FACILITY_ID"" = @HealthFacilityId, ""CODE"" = @Code WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@ParentId", DbType.Int32)
             {
                 Value = o.ParentId
             },
             new NpgsqlParameter("@Leaf", DbType.Boolean)
             {
                 Value = o.Leaf
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@ModifiedOn", DbType.DateTime)
             {
                 Value = o.ModifiedOn
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = o.ModifiedBy
             },
             new NpgsqlParameter("@HealthFacilityId", DbType.Int32)
             {
                 Value = (object)o.HealthFacilityId ?? DBNull.Value
             },
             new NpgsqlParameter("@Code", DbType.String)
             {
                 Value = (object)o.Code ?? DBNull.Value
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Place", o.Id.ToString(), 2, DateTime.Now, o.ModifiedBy);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Place", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Update(HealthFacilityBalance o)
 {
     try
     {
         string query = @"UPDATE ""HEALTH_FACILITY_BALANCE"" SET ""RECEIVED"" = @Received, ""DISTRIBUTED"" = @Distributed, ""USED"" = @Used, ""WASTED"" = @Wasted, ""STOCK_COUNT"" = @StockCount, ""BALANCE"" = @Balance, ""ALLOCATED"" = @Allocated WHERE ""HEALTH_FACILITY_CODE"" = @HealthFacilityCode AND ""GTIN"" = @Gtin AND ""LOT_NUMBER"" = @LotNumber  ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@HealthFacilityCode", DbType.String)
             {
                 Value = o.HealthFacilityCode
             },
             new NpgsqlParameter("@Gtin", DbType.String)
             {
                 Value = o.Gtin
             },
             new NpgsqlParameter("@LotNumber", DbType.String)
             {
                 Value = o.LotNumber
             },
             new NpgsqlParameter("@Received", DbType.Double)
             {
                 Value = (object)o.Received ?? DBNull.Value
             },
             new NpgsqlParameter("@Distributed", DbType.Double)
             {
                 Value = (object)o.Distributed ?? DBNull.Value
             },
             new NpgsqlParameter("@Used", DbType.Double)
             {
                 Value = (object)o.Used ?? DBNull.Value
             },
             new NpgsqlParameter("@Wasted", DbType.Double)
             {
                 Value = (object)o.Wasted ?? DBNull.Value
             },
             new NpgsqlParameter("@StockCount", DbType.Double)
             {
                 Value = (object)o.StockCount ?? DBNull.Value
             },
             new NpgsqlParameter("@Balance", DbType.Double)
             {
                 Value = (object)o.Balance ?? DBNull.Value
             },
             new NpgsqlParameter("@Allocated", DbType.Double)
             {
                 Value = (object)o.Allocated ?? DBNull.Value
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("HealthFacilityBalance", string.Format("RecordId: {0}", o.HealthFacilityCode + o.Gtin + o.LotNumber), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("HealthFacilityBalance", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Insert(HealthFacilityBalance o)
 {
     try
     {
         string query = @"INSERT INTO ""HEALTH_FACILITY_BALANCE"" (""HEALTH_FACILITY_CODE"", ""GTIN"", ""LOT_NUMBER"", ""RECEIVED"", ""DISTRIBUTED"", ""USED"", ""WASTED"", ""STOCK_COUNT"", ""BALANCE"", ""ALLOCATED"") VALUES (@HealthFacilityCode, @Gtin, @LotNumber, @Received, @Distributed, @Used, @Wasted, @StockCount, @Balance, @Allocated) returning ""HEALTH_FACILITY_CODE"" || ""GTIN"" || ""LOT_NUMBER"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@HealthFacilityCode", DbType.String)
             {
                 Value = o.HealthFacilityCode
             },
             new NpgsqlParameter("@Gtin", DbType.String)
             {
                 Value = o.Gtin
             },
             new NpgsqlParameter("@LotNumber", DbType.String)
             {
                 Value = o.LotNumber
             },
             new NpgsqlParameter("@Received", DbType.Double)
             {
                 Value = (object)o.Received ?? DBNull.Value
             },
             new NpgsqlParameter("@Distributed", DbType.Double)
             {
                 Value = (object)o.Distributed ?? DBNull.Value
             },
             new NpgsqlParameter("@Used", DbType.Double)
             {
                 Value = (object)o.Used ?? DBNull.Value
             },
             new NpgsqlParameter("@Wasted", DbType.Double)
             {
                 Value = (object)o.Wasted ?? DBNull.Value
             },
             new NpgsqlParameter("@StockCount", DbType.Double)
             {
                 Value = (object)o.StockCount ?? DBNull.Value
             },
             new NpgsqlParameter("@Balance", DbType.Double)
             {
                 Value = (object)o.Balance ?? DBNull.Value
             },
             new NpgsqlParameter("@Allocated", DbType.Double)
             {
                 Value = (object)o.Allocated ?? DBNull.Value
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("HealthFacilityBalance", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("HealthFacilityBalance", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #23
0
 public static int Insert(Item o)
 {
     try
     {
         string query = @"INSERT INTO ""ITEM"" (""ITEM_CATEGORY_ID"", ""NAME"", ""CODE"", ""ENTRY_DATE"", ""IS_ACTIVE"", ""NOTES"", ""MODIFIED_ON"", ""MODIFIED_BY"", ""HL7_VACCINE_ID"", ""EXIT_DATE"") VALUES (@ItemCategoryId, @Name, @Code, @EntryDate, @IsActive, @Notes, @ModifiedOn, @ModifiedBy, @Hl7VaccineId, @ExitDate) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@ItemCategoryId", DbType.Int32)
             {
                 Value = o.ItemCategoryId
             },
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@Code", DbType.String)
             {
                 Value = (object)o.Code ?? DBNull.Value
             },
             new NpgsqlParameter("@EntryDate", DbType.Date)
             {
                 Value = o.EntryDate
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@ModifiedOn", DbType.DateTime)
             {
                 Value = o.ModifiedOn
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = o.ModifiedBy
             },
             new NpgsqlParameter("@Hl7VaccineId", DbType.Int32)
             {
                 Value = (object)o.Hl7VaccineId ?? DBNull.Value
             },
             new NpgsqlParameter("@ExitDate", DbType.Date)
             {
                 Value = (object)o.ExitDate ?? DBNull.Value
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Item", id.ToString(), 1, DateTime.Now, o.ModifiedBy);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Item", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #24
0
 public static int Insert(Order o)
 {
     try
     {
         string query = @"INSERT INTO ""ORDER"" (""ORDER_NUMBER"", ""ORDER_DATE"", ""SENDER_ID"", ""CONFIRMATION_DATE"", ""STATUS"", ""PROCESSED"", ""NOTES"", ""MODIFIED_BY"", ""MODIFIED_ON"", ""IS_ACTIVE"") VALUES (@OrderNumber, @OrderDate, @SenderId, @ConfirmationDate, @Status, @Processed, @Notes, @ModifiedBy, @ModifiedOn, @IsActive) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@OrderNumber", DbType.Int32)
             {
                 Value = o.OrderNumber
             },
             new NpgsqlParameter("@OrderDate", DbType.Date)
             {
                 Value = o.OrderDate
             },
             new NpgsqlParameter("@SenderId", DbType.Int32)
             {
                 Value = o.SenderId
             },
             new NpgsqlParameter("@ConfirmationDate", DbType.Date)
             {
                 Value = (object)o.ConfirmationDate ?? DBNull.Value
             },
             new NpgsqlParameter("@Status", DbType.Int32)
             {
                 Value = o.Status
             },
             new NpgsqlParameter("@Processed", DbType.Boolean)
             {
                 Value = o.Processed
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = o.ModifiedBy
             },
             new NpgsqlParameter("@ModifiedOn", DbType.Date)
             {
                 Value = o.ModifiedOn
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Order", id.ToString(), 1, DateTime.Now, 1);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Order", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Insert(VaccinationAppointment o)
 {
     try
     {
         string query = @"INSERT INTO ""VACCINATION_APPOINTMENT"" (""CHILD_ID"", ""SCHEDULED_FACILITY_ID"", ""SCHEDULED_DATE"", ""NOTES"", ""IS_ACTIVE"", ""MODIFIED_ON"", ""MODIFIED_BY"", ""AEFI"", ""AEFI_DATE"", ""OUTREACH"") VALUES (@ChildId, @ScheduledFacilityId, @ScheduledDate, @Notes, @IsActive, @ModifiedOn, @ModifiedBy, @Aefi, @AefiDate, @Outreach) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@ChildId", DbType.Int32)
             {
                 Value = o.ChildId
             },
             new NpgsqlParameter("@ScheduledFacilityId", DbType.Int32)
             {
                 Value = o.ScheduledFacilityId
             },
             new NpgsqlParameter("@ScheduledDate", DbType.Date)
             {
                 Value = o.ScheduledDate
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@ModifiedOn", DbType.DateTime)
             {
                 Value = o.ModifiedOn
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = o.ModifiedBy
             },
             new NpgsqlParameter("@Aefi", DbType.Boolean)
             {
                 Value = (object)o.Aefi ?? DBNull.Value
             },
             new NpgsqlParameter("@AefiDate", DbType.Date)
             {
                 Value = (object)o.AefiDate ?? DBNull.Value
             },
             new NpgsqlParameter("@Outreach", DbType.Boolean)
             {
                 Value = o.Outreach
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("VaccinationAppointment", id.ToString(), 1, DateTime.Now, o.ModifiedBy);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("VaccinationAppointment", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #26
0
 public static int Insert(Dose o)
 {
     try
     {
         string query = @"INSERT INTO ""DOSE"" (""SCHEDULED_VACCINATION_ID"", ""DOSE_NUMBER"", ""AGE_DEFINITION_ID"", ""FULLNAME"", ""NOTES"", ""IS_ACTIVE"", ""MODIFIED_ON"", ""MODIFIED_BY"", ""FROM_AGE_DEFINITION_ID"", ""TO_AGE_DEFINITION_ID"") VALUES (@ScheduledVaccinationId, @DoseNumber, @AgeDefinitionId, @Fullname, @Notes, @IsActive, @ModifiedOn, @ModifiedBy, @FromAgeDefinitionId, @ToAgeDefinitionId) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@ScheduledVaccinationId", DbType.Int32)
             {
                 Value = o.ScheduledVaccinationId
             },
             new NpgsqlParameter("@DoseNumber", DbType.Int32)
             {
                 Value = o.DoseNumber
             },
             new NpgsqlParameter("@AgeDefinitionId", DbType.Int32)
             {
                 Value = o.AgeDefinitionId
             },
             new NpgsqlParameter("@Fullname", DbType.String)
             {
                 Value = o.Fullname
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@ModifiedOn", DbType.DateTime)
             {
                 Value = (object)o.ModifiedOn ?? DBNull.Value
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = (object)o.ModifiedBy ?? DBNull.Value
             },
             new NpgsqlParameter("@FromAgeDefinitionId", DbType.Int32)
             {
                 Value = (object)o.FromAgeDefinitionId ?? DBNull.Value
             },
             new NpgsqlParameter("@ToAgeDefinitionId", DbType.Int32)
             {
                 Value = (object)o.ToAgeDefinitionId ?? DBNull.Value
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Dose", id.ToString(), 1, DateTime.Now, o.ModifiedBy);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Dose", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #27
0
 public static int Insert(Place o)
 {
     try
     {
         string query = @"INSERT INTO ""PLACE"" (""NAME"", ""PARENT_ID"", ""LEAF"", ""NOTES"", ""IS_ACTIVE"", ""MODIFIED_ON"", ""MODIFIED_BY"", ""HEALTH_FACILITY_ID"", ""CODE"") VALUES (@Name, @ParentId, @Leaf, @Notes, @IsActive, @ModifiedOn, @ModifiedBy, @HealthFacilityId, @Code) returning ""ID"" ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@ParentId", DbType.Int32)
             {
                 Value = o.ParentId
             },
             new NpgsqlParameter("@Leaf", DbType.Boolean)
             {
                 Value = o.Leaf
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@ModifiedOn", DbType.DateTime)
             {
                 Value = o.ModifiedOn
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = o.ModifiedBy
             },
             new NpgsqlParameter("@HealthFacilityId", DbType.Int32)
             {
                 Value = (object)o.HealthFacilityId ?? DBNull.Value
             },
             new NpgsqlParameter("@Code", DbType.String)
             {
                 Value = (object)o.Code ?? DBNull.Value
             }
         };
         object id = DBManager.ExecuteScalarCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Place", id.ToString(), 1, DateTime.Now, o.ModifiedBy);
         return(int.Parse(id.ToString()));
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Place", "Insert", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Exemple #28
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 #29
0
 public static int Update(TransactionLines o)
 {
     try
     {
         string query = @"UPDATE ""TRANSACTION_LINES"" SET ""ID"" = @Id, ""TRANSACTION_ID"" = @TransactionId, ""ITEM_LOT_ID"" = @ItemLotId, ""QUANTITY"" = @Quantity, ""IS_ACTIVE"" = @IsActive, ""ADJUSTMENT_ID"" = @AdjustmentId, ""NOTES"" = @Notes, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@TransactionId", DbType.Int32)
             {
                 Value = o.TransactionId
             },
             new NpgsqlParameter("@ItemLotId", DbType.Int32)
             {
                 Value = o.ItemLotId
             },
             new NpgsqlParameter("@Quantity", DbType.Int32)
             {
                 Value = o.Quantity
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = o.IsActive
             },
             new NpgsqlParameter("@AdjustmentId", DbType.Int32)
             {
                 Value = (object)o.AdjustmentId ?? DBNull.Value
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@ModifiedOn", DbType.Date)
             {
                 Value = o.ModifiedOn
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = o.ModifiedBy
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("TransactionLines", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("TransactionLines", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Update(Picture o)
 {
     try
     {
         string query = @"UPDATE ""PICTURE"" SET ""ID"" = @Id, ""NAME"" = @Name, ""URL"" = @Url, ""STORAGE"" = @Storage, ""WIDTH"" = @Width, ""HEIGHT"" = @Height, ""DISPLAY_ORDER"" = @DisplayOrder, ""NOTES"" = @Notes, ""CREATED_BY"" = @CreatedBy, ""CREATED_ON"" = @CreatedOn WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = (object)o.Name ?? DBNull.Value
             },
             new NpgsqlParameter("@Url", DbType.String)
             {
                 Value = (object)o.Url ?? DBNull.Value
             },
             new NpgsqlParameter("@Width", DbType.Int32)
             {
                 Value = (object)o.Width ?? DBNull.Value
             },
             new NpgsqlParameter("@Height", DbType.Int32)
             {
                 Value = (object)o.Height ?? DBNull.Value
             },
             new NpgsqlParameter("@DisplayOrder", DbType.Int32)
             {
                 Value = (object)o.DisplayOrder ?? DBNull.Value
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@CreatedBy", DbType.Int32)
             {
                 Value = (object)o.CreatedBy ?? DBNull.Value
             },
             new NpgsqlParameter("@CreatedOn", DbType.Date)
             {
                 Value = (object)o.CreatedOn ?? DBNull.Value
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Picture", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Picture", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }