Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
 public static int Delete(string orderNum, int orderDetailNum)
 {
     try
     {
         string query = @"DELETE FROM ""TRANSFER_ORDER_DETAIL"" WHERE ""ID"" = @Id";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@OrderNum", DbType.Int32)
             {
                 Value = orderNum
             },
             new NpgsqlParameter("@OrderDetailNum", DbType.Int32)
             {
                 Value = orderDetailNum
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         // AuditTable.InsertEntity("TransferOrderDetail", string.Format("RecordId: {0}", orderNum + orderDetailNum), 3, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("TransferOrderDetail", "Delete", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
         throw ex;
     }
 }
Ejemplo n.º 4
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);
 }
 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;
     }
 }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
        public static int Delete(string healthFacilityCode, string gtin)
        {
            try
            {
                string query = @"DELETE FROM ""GTIN_HF_STOCK_POLICY"" WHERE ""HEALTH_FACILITY_CODE"" = @HealthFacilityCode AND  ""GTIN"" = @Gtin";
                List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
                {
                    new NpgsqlParameter("@HealthFacilityCode", DbType.String)
                    {
                        Value = healthFacilityCode
                    },
                    new NpgsqlParameter("@Gtin", DbType.String)
                    {
                        Value = gtin
                    }
                };

                int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
                // AuditTable.InsertEntity("GtinHfStockPolicy", string.Format("RecordId: {0}", healthFacilityCode + gtin), 3, DateTime.Now, 1);
                return(rowAffected);
            }
            catch (Exception ex)
            {
                Log.InsertEntity("GtinHfStockPolicy", "Delete", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
                throw ex;
            }
        }
Ejemplo n.º 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);
 }
 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);
 }
Ejemplo n.º 10
0
        public static int Update(GtinHfStockPolicy o)
        {
            try
            {
                string query = @"UPDATE ""GTIN_HF_STOCK_POLICY"" SET ""REORDER_QTY"" = @ReorderQty, ""SAFETY_STOCK"" = @SafetyStock, ""AVG_DAILY_DEMAND_RATE"" = @AvgDailyDemandRate, ""CONSUMPTION_LOGIC"" = @ConsumptionLogic, ""LEAD_TIME"" = @LeadTime, ""FORECAST_PERIOD_DEMAND"" = @ForecastPeriodDemand, ""NOTES"" = @Notes WHERE ""HEALTH_FACILITY_CODE"" = @HealthFacilityCode and ""GTIN"" = @Gtin ";
                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("@ReorderQty", DbType.Double)
                    {
                        Value = (object)o.ReorderQty ?? DBNull.Value
                    },
                    new NpgsqlParameter("@SafetyStock", DbType.Double)
                    {
                        Value = (object)o.SafetyStock ?? DBNull.Value
                    },
                    new NpgsqlParameter("@AvgDailyDemandRate", DbType.Double)
                    {
                        Value = (object)o.AvgDailyDemandRate ?? DBNull.Value
                    },
                    new NpgsqlParameter("@ConsumptionLogic", DbType.String)
                    {
                        Value = (object)o.ConsumptionLogic ?? DBNull.Value
                    },
                    new NpgsqlParameter("@LeadTime", DbType.Int32)
                    {
                        Value = (object)o.LeadTime ?? DBNull.Value
                    },
                    new NpgsqlParameter("@ForecastPeriodDemand", DbType.Double)
                    {
                        Value = (object)o.ForecastPeriodDemand ?? DBNull.Value
                    },
                    new NpgsqlParameter("@Notes", DbType.String)
                    {
                        Value = (object)o.Notes ?? DBNull.Value
                    },
                    new NpgsqlParameter("@Gtin", DbType.String)
                    {
                        Value = o.Gtin
                    }
                };

                int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
                // AuditTable.InsertEntity("GtinHfStockPolicy", string.Format("RecordId: {0}", o.Gtin), 2, DateTime.Now, 1);
                return(rowAffected);
            }
            catch (Exception ex)
            {
                Log.InsertEntity("GtinHfStockPolicy", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
            }
            return(-1);
        }
Ejemplo n.º 11
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);
 }
Ejemplo n.º 13
0
 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);
 }
Ejemplo n.º 14
0
 public static int Update(Language o)
 {
     try
     {
         string query = @"UPDATE ""LANGUAGE"" SET ""ID"" = @Id, ""NAME"" = @Name, ""ABBREVATION"" = @Abbrevation, ""NOTES"" = @Notes, ""IS_ACTIVE"" = @IsActive, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy, ""WRITING_DIRECTION"" = @WritingDirection, ""NAME_ENGLISH"" = @NameEnglish WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@Abbrevation", DbType.String)
             {
                 Value = o.Abbrevation
             },
             new NpgsqlParameter("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@IsActive", DbType.Boolean)
             {
                 Value = (object)o.IsActive ?? DBNull.Value
             },
             new NpgsqlParameter("@ModifiedOn", DbType.DateTime)
             {
                 Value = o.ModifiedOn
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = o.ModifiedBy
             },
             new NpgsqlParameter("@WritingDirection", DbType.String)
             {
                 Value = o.WritingDirection
             },
             new NpgsqlParameter("@NameEnglish", DbType.String)
             {
                 Value = (object)o.NameEnglish ?? DBNull.Value
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Language", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Language", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Update(TransferOrderHeader o)
 {
     try
     {
         string query = @"UPDATE ""TRANSFER_ORDER_HEADER"" SET ""ORDER_SCHED_REPLENISH_DATE"" = @OrderSchedReplenishDate, ""ORDER_FACILITY_FROM"" = @OrderFacilityFrom, ""ORDER_FACILITY_TO"" = @OrderFacilityTo, ""ORDER_CARRIER"" = @OrderCarrier, ""ORDER_STATUS"" = @OrderStatus, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy, ""REV_NUM"" = @RevNum WHERE ""ORDER_NUM"" = @OrderNum ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@OrderNum", DbType.Int32)
             {
                 Value = o.OrderNum
             },
             new NpgsqlParameter("@OrderSchedReplenishDate", DbType.Date)
             {
                 Value = o.OrderSchedReplenishDate
             },
             new NpgsqlParameter("@OrderFacilityFrom", DbType.String)
             {
                 Value = o.OrderFacilityFrom
             },
             new NpgsqlParameter("@OrderFacilityTo", DbType.String)
             {
                 Value = o.OrderFacilityTo
             },
             new NpgsqlParameter("@OrderCarrier", DbType.String)
             {
                 Value = (object)o.OrderCarrier ?? DBNull.Value
             },
             new NpgsqlParameter("@OrderStatus", DbType.Int32)
             {
                 Value = o.OrderStatus
             },
             new NpgsqlParameter("@ModifiedOn", DbType.Date)
             {
                 Value = o.ModifiedOn
             },
             new NpgsqlParameter("@ModifiedBy", DbType.Int32)
             {
                 Value = o.ModifiedBy
             },
             new NpgsqlParameter("@RevNum", DbType.Int32)
             {
                 Value = o.RevNum
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("TransferOrderHeader", o.OrderNum.ToString(), 2, DateTime.Now, o.ModifiedBy);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("TransferOrderHeader", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Ejemplo n.º 16
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);
 }
Ejemplo n.º 17
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);
 }
Ejemplo n.º 18
0
 public static int DeleteByTransactionId(int id, int lotid)
 {
     try
     {
         string query       = @"DELETE FROM ""TRANSACTION_LINES"" WHERE ""TRANSACTION_ID"" = " + id + @" AND ""ITEM_LOT_ID"" = " + lotid;
         int    rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, null);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("TransactionLines", "Delete", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
         throw ex;
     }
 }
Ejemplo n.º 19
0
 public static int DeleteByUserAndRole(int userId, int roleId)
 {
     try
     {
         string query       = @"DELETE FROM ""USER_ROLE"" WHERE ""ROLE_ID"" = " + roleId + @" AND ""USER_ID"" = " + userId;
         int    rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, null);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("UserRole", "DeleteByUserAndRole", 3, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
         throw ex;
     }
 }
Ejemplo n.º 20
0
 public static int Update(Manufacturer o)
 {
     try
     {
         string query = @"UPDATE ""MANUFACTURER"" SET ""ID"" = @Id, ""NAME"" = @Name, ""CODE"" = @Code, ""HL7_MANUFACTURER_ID"" = @Hl7ManufacturerId, ""IS_ACTIVE"" = @IsActive, ""NOTES"" = @Notes, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy WHERE ""ID"" = @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("@Hl7ManufacturerId", DbType.Int32)
             {
                 Value = (object)o.Hl7ManufacturerId ?? DBNull.Value
             },
             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("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Manufacturer", o.Id.ToString(), 2, DateTime.Now, o.ModifiedBy);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Manufacturer", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Delete(int id)
 {
     try
     {
         string query       = @"DELETE FROM ""VACCINATION_QUEUE"" WHERE ""ID"" = " + id;
         int    rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, null);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("VaccinationQueue", "Delete", 1, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
         throw ex;
     }
 }
 public static int Update(NonvaccinationReason o)
 {
     try
     {
         string query = @"UPDATE ""NONVACCINATION_REASON"" SET ""ID"" = @Id, ""NAME"" = @Name, ""CODE"" = @Code, ""IS_ACTIVE"" = @IsActive, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy, ""NOTES"" = @Notes, ""KEEP_CHILD_DUE"" = @KeepChildDue WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@Name", DbType.String)
             {
                 Value = o.Name
             },
             new NpgsqlParameter("@Code", DbType.String)
             {
                 Value = (object)o.Code ?? 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("@Notes", DbType.String)
             {
                 Value = (object)o.Notes ?? DBNull.Value
             },
             new NpgsqlParameter("@KeepChildDue", DbType.Boolean)
             {
                 Value = o.KeepChildDue
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("NonvaccinationReason", o.Id.ToString(), 2, DateTime.Now, o.ModifiedBy);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("NonvaccinationReason", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int UpdateValues(Configuration o)
 {
     try
     {
         string query       = @"UPDATE ""CONFIGURATION"" SET ""VALUE"" = '" + o.Value + @"' WHERE ""NAME"" = '" + o.Name + "'";
         int    rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, null);
         Log.InsertEntity(2, "Success", o.Id.ToString(), "Configuration", "Update");
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Configuration", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Update(VaccinationQueue o, int id)
 {
     try
     {
         string query       = @"UPDATE ""VACCINATION_QUEUE"" SET ""ID"" = " + o.Id + @", ""BARCODE_ID"" = '" + o.BarcodeId + @"', ""HEALTH_FACILITY_ID"" = " + o.HealthFacilityId + @", ""DATE"" = " + o.Date + @", ""USER_ID"" = " + o.UserId + @"WHERE ""ID"" = " + id;
         int    rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, null);
         Log.InsertEntity(2, "Success", id.ToString(), "VaccinationQueue", "Update");
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("VaccinationQueue", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Update(bool status, int id)
 {
     try
     {
         string query       = @"UPDATE ""VACCINATION_APPOINTMENT"" SET ""IS_ACTIVE"" = '" + status + @"' WHERE ""ID"" = " + id;
         int    rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, null);
         Log.InsertEntity(2, "Success", id.ToString(), "VaccinationAppointment", "Update");
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("VaccinationAppointment", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Ejemplo n.º 26
0
 public static int Update(ChildSupplements o)
 {
     try
     {
         string query = @"UPDATE ""CHILD_SUPPLEMENTS"" SET ""ID"" = @Id, ""CHILD_ID"" = @ChildId, ""VitA"" = @Vita, ""Mebendezol"" = @Mebendezol, ""DATE"" = @Date, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@ChildId", DbType.Int32)
             {
                 Value = o.ChildId
             },
             new NpgsqlParameter("@Vita", DbType.Boolean)
             {
                 Value = o.Vita
             },
             new NpgsqlParameter("@Mebendezol", DbType.Boolean)
             {
                 Value = o.Mebendezol
             },
             new NpgsqlParameter("@Date", DbType.Date)
             {
                 Value = o.Date
             },
             new NpgsqlParameter("@ModifiedOn", DbType.DateTime)
             {
                 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("ChildSupplements", o.Id.ToString(), 2, DateTime.Now, o.ModifiedBy);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("ChildSupplements", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Ejemplo n.º 27
0
 public static int Update(Log o)
 {
     try
     {
         string query = @"UPDATE ""LOG"" SET ""ID"" = @Id, ""LOG_CATEGORY_ID"" = @LogCategoryId, ""CREATED"" = @Created, ""TITLE"" = @Title, ""MESSAGE"" = @Message, ""CLASS"" = @Class, ""METHOD"" = @Method WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@LogCategoryId", DbType.Int32)
             {
                 Value = o.LogCategoryId
             },
             new NpgsqlParameter("@Created", DbType.Date)
             {
                 Value = (object)o.Created ?? DBNull.Value
             },
             new NpgsqlParameter("@Title", DbType.String)
             {
                 Value = (object)o.Title ?? DBNull.Value
             },
             new NpgsqlParameter("@Message", DbType.String)
             {
                 Value = (object)o.Message ?? DBNull.Value
             },
             new NpgsqlParameter("@Class", DbType.String)
             {
                 Value = (object)o.Class ?? DBNull.Value
             },
             new NpgsqlParameter("@Method", DbType.String)
             {
                 Value = (object)o.Method ?? DBNull.Value
             },
             new NpgsqlParameter("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("Log", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("Log", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
 public static int Update(HealthFacilityCohortData o)
 {
     try
     {
         string query = @"UPDATE ""HEALTH_FACILITY_COHORT_DATA"" SET ""ID"" = @Id, ""HEALTH_FACILITY_ID"" = @HealthFacilityId, ""YEAR"" = @Year, ""COHORT"" = @Cohort, ""NOTES"" = @Notes, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@HealthFacilityId", DbType.Int32)
             {
                 Value = o.HealthFacilityId
             },
             new NpgsqlParameter("@Year", DbType.Int32)
             {
                 Value = o.Year
             },
             new NpgsqlParameter("@Cohort", DbType.Int32)
             {
                 Value = o.Cohort
             },
             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("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("HealthFacilityCohortData", o.Id.ToString(), 2, DateTime.Now, 1);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("HealthFacilityCohortData", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Ejemplo n.º 29
0
 public static int Update(ChildWeight o)
 {
     try
     {
         string query = @"UPDATE ""CHILD_WEIGHT"" SET ""ID"" = @Id, ""CHILD_ID"" = @ChildId, ""WEIGHT"" = @Weight, ""DATE"" = @Date, ""NOTES"" = @Notes, ""MODIFIED_ON"" = @ModifiedOn, ""MODIFIED_BY"" = @ModifiedBy WHERE ""ID"" = @Id ";
         List <Npgsql.NpgsqlParameter> parameters = new List <NpgsqlParameter>()
         {
             new NpgsqlParameter("@ChildId", DbType.Int32)
             {
                 Value = o.ChildId
             },
             new NpgsqlParameter("@Weight", DbType.Double)
             {
                 Value = o.Weight
             },
             new NpgsqlParameter("@Date", DbType.Date)
             {
                 Value = o.Date
             },
             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("@Id", DbType.Int32)
             {
                 Value = o.Id
             }
         };
         int rowAffected = DBManager.ExecuteNonQueryCommand(query, CommandType.Text, parameters);
         AuditTable.InsertEntity("ChildWeight", o.Id.ToString(), 2, DateTime.Now, o.ModifiedBy);
         return(rowAffected);
     }
     catch (Exception ex)
     {
         Log.InsertEntity("ChildWeight", "Update", 2, ex.StackTrace.Replace("'", ""), ex.Message.Replace("'", ""));
     }
     return(-1);
 }
Ejemplo n.º 30
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);
 }