Пример #1
0
 public static void Flush()
 {
     if (instance != null)
         instance = null;
 }
Пример #2
0
        /// <summary>
        /// Возвращает цену компонента из БД
        /// </summary>
        /// <param name="model">Модель компонента</param>
        /// <returns>Цена</returns>
        private decimal сalculatePriceForModel(ModelDoc2 model)
        {
            try
            {
                bool isProduct = false;
                string isProductStr = model.GetCustomInfoValue("", "IsProduct");
                if (!string.IsNullOrEmpty(currentState))
                    throw new NullReferenceException("currentState");

                if (string.IsNullOrEmpty(isProductStr))
                    isProduct = false;
                if (isProductStr.ToLower().Contains("yes"))
                    isProduct = true;
                if (!isProduct)
                    return execQueryNonProduct("SELECT SCENTRE.GETSCICOMPPRICE_SWR(:P_NUMAGREE,:P_IDCOMPONENT,:P_SIZE1,:P_SIZE2,:P_SIZE1WORK,:P_SIZE2WORK,:P_IDCOLOR1,:P_IDCOLOR2,:P_IDCOLOR3,:P_IDFANER11,:P_IDFANER12,:P_IDCOLORFANER11,:P_IDCOLORFANER12,:P_IDFANER21,:P_IDFANER22,:P_IDCOLORFANER21,:P_IDCOLORFANER22,:P_ITPRODCALCPARENT) AS PRICE FROM DUAL", model);
                else
                    return execQueryProduct("SELECT SCENTRE.GETSCIPRODPRICE_SWR(:P_NUMAGREE,:P_IDCOMPONENT,:P_SIZE1,:P_SIZE2,:P_SIZE3,:P_SIZE4,:P_SIZE5,:P_SIZE6,:P_SIZE7,:P_SIZE8,:P_IDCOLOR1,:P_IDCOLOR2,:P_IDCOLOR3,:P_IDCOLOR4,:P_IDCOLOR5) AS PRICE FROM DUAL", model);

            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("ORA-01012") || ex.Message.Contains("ORA - 02396"))
                {
                    instance = new Repository();
                }
                throw ex;
            }
        }