Пример #1
0
        public static int InsertOrUpdateT_OE_AnalyzeConfig(global::System.Int32? aNALYZECONFIG_IDX, global::System.String oRG_ID, global::System.String aNALYZECONFIG_NAME, 
            global::System.Int32 uSER_IDX, global::System.String sITES, global::System.String cHARACTERISTIC, global::System.DateTime sTART_DATE, 
            global::System.DateTime eND_DATE, global::System.Double uPPER_THRESHOLD, global::System.Double lOWER_THRESHOLD)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    T_OE_ANALYZECONFIG a = new T_OE_ANALYZECONFIG();

                    if (aNALYZECONFIG_IDX != null)
                        a = (from c in ctx.T_OE_ANALYZECONFIG
                             where c.ANALYZECONFIG_IDX == aNALYZECONFIG_IDX
                             select c).FirstOrDefault();

                    if (aNALYZECONFIG_IDX == null) //insert case
                    {
                        a = new T_OE_ANALYZECONFIG();
                        insInd = true;
                    }

                    if (oRG_ID != null) a.ORG_ID = oRG_ID;
                    if (aNALYZECONFIG_NAME != null) a.ANALYZECONFIG_NAME = aNALYZECONFIG_NAME;
                    if (uSER_IDX != null) a.USER_IDX = uSER_IDX;
                    if (sITES != null) a.SITES = sITES;
                    if (cHARACTERISTIC != null) a.CHARACTERISTIC = cHARACTERISTIC;
                    if (sTART_DATE != null) a.START_DATE = sTART_DATE;
                    if (eND_DATE != null) a.END_DATE = eND_DATE;
                    if (uPPER_THRESHOLD != null) a.UPPER_THRESHOLD = uPPER_THRESHOLD;
                    if (lOWER_THRESHOLD != null) a.LOWER_THRESHOLD = lOWER_THRESHOLD;

                    if (insInd) //insert case
                    {
                    //    a.CREATE_USERID = cREATE_USER.ToUpper();
                    //    a.CREATE_DT = System.DateTime.Now;
                        ctx.AddToT_OE_ANALYZECONFIG(a);
                    }
                    else
                    {
                    //    a.UPDATE_USERID = cREATE_USER.ToUpper();
                    //    a.UPDATE_DT = System.DateTime.Now;
                    }

                    ctx.SaveChanges();

                    return a.ANALYZECONFIG_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }