Beispiel #1
0
        /// <summary>
        /// Inserts or updates IUS into database 
        /// </summary>
        /// <param name="indicatorGId"></param>
        /// <param name="unitGId"></param>
        /// <param name="subgroupGId"></param>
        /// <param name="minValue"></param>
        /// <param name="maxValue"></param>
        /// <returns></returns>
        public int InsertOrUpdateIUSIntoDBByName(string indicatorName, string unitName, string subgroupval, int minValue, int maxValue)
        {
            int RetVal = -1;

            IndicatorBuilder IndicatorBuilderObj = new IndicatorBuilder(this.DBConnection, this.DBQueries);
            UnitBuilder UnitBuilderObj = new UnitBuilder(this.DBConnection, this.DBQueries);
            DI6SubgroupValBuilder SGBuilder = new DI6SubgroupValBuilder(this.DBConnection, this.DBQueries);
            IUSBuilder IUSObj = new IUSBuilder(this.DBConnection, this.DBQueries);
            int IndicatorNID = -1;
            int UnitNID = -1;
            int SubgroupValNID = -1;

            try
            {
                IndicatorNID = IndicatorBuilderObj.GetIndicatorNid(string.Empty, indicatorName);
                UnitNID = UnitBuilderObj.GetUnitNid(string.Empty, unitName);
                SubgroupValNID = SGBuilder.GetSubgroupValNid(string.Empty, subgroupval);

                if (IndicatorNID > 0 & UnitNID > 0 & SubgroupValNID > 0)
                {
                    // check IUS combination already exists or not
                    RetVal = this.GetIUSNid(IndicatorNID, UnitNID, SubgroupValNID);
                    if (RetVal > 0)
                    {
                        //update record
                        this.UpdateIUS(IndicatorNID, UnitNID, SubgroupValNID, maxValue.ToString(), minValue.ToString(), RetVal);
                    }
                    else
                    {
                        // insert record
                        RetVal = IUSObj.InsertIUS(IndicatorNID, UnitNID, SubgroupValNID, minValue, maxValue);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }

            return RetVal;
        }
Beispiel #2
0
        /// <summary>
        /// Inserts IUS into database 
        /// </summary>
        /// <param name="indicatorGId"></param>
        /// <param name="unitGId"></param>
        /// <param name="subgroupGId"></param>
        /// <returns></returns>
        public int InsertIUSIntoDB(string indicatorGId, string unitGId, string subgroupGId)
        {
            int RetVal = -1;

            IndicatorBuilder IndicatorBuilderObj = new IndicatorBuilder(this.DBConnection, this.DBQueries);
            UnitBuilder UnitBuilderObj = new UnitBuilder(this.DBConnection, this.DBQueries);
            DI6SubgroupValBuilder SGBuilder = new DI6SubgroupValBuilder(this.DBConnection, this.DBQueries);
            IUSBuilder IUSObj = new IUSBuilder(this.DBConnection, this.DBQueries);
            int IndicatorNID = -1;
            int UnitNID = -1;
            int SubgroupValNID = -1;

            try
            {
                IndicatorNID = IndicatorBuilderObj.GetIndicatorNid(indicatorGId, string.Empty);
                UnitNID = UnitBuilderObj.GetUnitNid(unitGId, string.Empty);
                SubgroupValNID = SGBuilder.GetSubgroupValNid(subgroupGId, string.Empty);

                if (IndicatorNID > 0 & UnitNID > 0 & SubgroupValNID > 0)
                {
                    RetVal = IUSObj.InsertIUS(IndicatorNID, UnitNID, SubgroupValNID, 0, 0);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }

            return RetVal;
        }