Exemplo n.º 1
0
        //*****************USERS **********************************
        public static int CreateT_OE_USERS(global::System.String uSER_ID, global::System.String pWD_HASH, global::System.String pWD_SALT, global::System.String fNAME, global::System.String lNAME, global::System.String eMAIL, global::System.Boolean aCT_IND, global::System.Boolean iNITAL_PWD_FLAG, global::System.DateTime? lASTLOGIN_DT, global::System.String pHONE, global::System.String pHONE_EXT, global::System.String cREATE_USER)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_OE_USERS u = new T_OE_USERS();
                    u.USER_ID = uSER_ID;
                    u.PWD_HASH = pWD_HASH;
                    u.PWD_SALT = pWD_SALT;
                    u.FNAME = fNAME;
                    u.LNAME = lNAME;
                    u.EMAIL = eMAIL;
                    u.ACT_IND = aCT_IND;
                    u.INITAL_PWD_FLAG = iNITAL_PWD_FLAG;
                    u.EFFECTIVE_DT = System.DateTime.Now;
                    u.LASTLOGIN_DT = lASTLOGIN_DT;
                    u.PHONE = pHONE;
                    u.PHONE_EXT = pHONE_EXT;
                    u.CREATE_DT = System.DateTime.Now;
                    u.CREATE_USERID = cREATE_USER;

                    ctx.AddToT_OE_USERS(u);
                    ctx.SaveChanges();
                    return u.USER_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 2
0
 public static int DeleteT_OE_ColumnConfig(int columnConfig_IDX)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             T_OE_COLUMNCONFIG r = new T_OE_COLUMNCONFIG();
             r = (from c in ctx.T_OE_COLUMNCONFIG where c.COLUMNCONFIG_IDX == columnConfig_IDX select c).FirstOrDefault();
             ctx.DeleteObject(r);
             ctx.SaveChanges();
             return 1;
         }
         catch
         {
             return 0;
         }
     }
 }
Exemplo n.º 3
0
 public static int DeleteT_WQX_IMPORT_LOG(int iMPORT_ID)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             T_WQX_IMPORT_LOG r = new T_WQX_IMPORT_LOG();
             r = (from c in ctx.T_WQX_IMPORT_LOG
                  where c.IMPORT_ID == iMPORT_ID select c).FirstOrDefault();
             ctx.DeleteObject(r);
             ctx.SaveChanges();
             return 1;
         }
         catch
         {
             return 0;
         }
     }
 }
Exemplo n.º 4
0
 public static int DeleteT_ATTAINS_ASSESS(int aSSESS_IDX)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             T_ATTAINS_ASSESS r = (from c in ctx.T_ATTAINS_ASSESS
                                         where c.ATTAINS_ASSESS_IDX == aSSESS_IDX
                                         select c).FirstOrDefault();
             ctx.DeleteObject(r);
             ctx.SaveChanges();
             return 1;
         }
         catch
         {
             return 0;
         }
     }
 }
Exemplo n.º 5
0
 public static int DeleteT_WQX_REF_TAXA_ORG(string orgName, string charName)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             T_WQX_REF_TAXA_ORG r = new T_WQX_REF_TAXA_ORG();
             r = (from c in ctx.T_WQX_REF_TAXA_ORG
                  where c.ORG_ID == orgName
                  && c.BIO_SUBJECT_TAXONOMY == charName
                  select c).FirstOrDefault();
             ctx.DeleteObject(r);
             ctx.SaveChanges();
             return 1;
         }
         catch
         {
             return 0;
         }
     }
 }
Exemplo n.º 6
0
 public static int CreateT_VCCB_USER_ROLE(global::System.Int32 rOLE_IDX, global::System.Int32 uSER_IDX, global::System.String cREATE_USER = "******")
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             T_OE_USER_ROLES ur = new T_OE_USER_ROLES();
             ur.ROLE_IDX = rOLE_IDX;
             ur.USER_IDX = uSER_IDX;
             ur.CREATE_DT = System.DateTime.Now;
             ur.CREATE_USERID = cREATE_USER;
             ctx.AddToT_OE_USER_ROLES(ur);
             ctx.SaveChanges();
             return 1;
         }
         catch (Exception ex)
         {
             return 0;
         }
     }
 }
Exemplo n.º 7
0
        //*****************ROLES **********************************
        public static int CreateT_OE_ROLES(global::System.String rOLE_NAME, global::System.String rOLE_DESC, global::System.String cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_OE_ROLES r = new T_OE_ROLES();
                    r.ROLE_NAME = rOLE_NAME;
                    r.ROLE_DESC = rOLE_DESC;
                    r.CREATE_DT = System.DateTime.Now;
                    r.CREATE_USERID = cREATE_USER;

                    ctx.AddToT_OE_ROLES(r);
                    ctx.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 8
0
        public static int UpdateT_WQX_REF_DATAByIDX(global::System.Int32 IDX, global::System.String vALUE, global::System.String tEXT, Boolean ActInd)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_WQX_REF_DATA a = new T_WQX_REF_DATA();
                    a = (from c in ctx.T_WQX_REF_DATA
                            where c.REF_DATA_IDX == IDX
                            select c).FirstOrDefault();

                    if (vALUE != null) a.VALUE = vALUE;
                    if (tEXT != null) a.TEXT = Utils.SubStringPlus(tEXT, 0, 200);
                    a.UPDATE_DT = System.DateTime.Now;
                    a.ACT_IND = ActInd;
                    ctx.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 9
0
        public static int UpdateWQX_IMPORT_LOG_MarkPendingSampImportAsComplete(string oRG_ID)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_WQX_IMPORT_LOG t = new T_WQX_IMPORT_LOG();
                    t = (from c in ctx.T_WQX_IMPORT_LOG
                         where c.IMPORT_PROGRESS == "P"
                         && c.TYPE_CD == "Sample"
                         select c).FirstOrDefault();

                    t.IMPORT_STATUS = "Success";
                    t.IMPORT_PROGRESS = "100";
                    t.IMPORT_PROGRESS_MSG = "Import complete.";

                    ctx.SaveChanges();

                    return t.IMPORT_ID;
                }
                catch
                {
                    return 0;
                }
            }
        }
Exemplo n.º 10
0
        //*********************** WQX TRANSACTION LOG*******************************
        public static int InsertUpdateWQX_TRANSACTION_LOG(int? lOG_ID, string tABLE_CD, int tABLE_IDX, string sUBMIT_TYPE, byte[] rESPONSE_FILE, 
            string rESPONSE_TXT, string cDX_SUBMIT_TRANS_ID, string cDX_SUBMIT_STATUS, string oRG_ID)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                //try
                //{
                    T_WQX_TRANSACTION_LOG t = new T_WQX_TRANSACTION_LOG();
                    if (lOG_ID != null)
                        t = (from c in ctx.T_WQX_TRANSACTION_LOG
                             where c.LOG_ID == lOG_ID
                             select c).First();

                    if (lOG_ID == null)
                        t = new T_WQX_TRANSACTION_LOG();

                    if (tABLE_CD != null) t.TABLE_CD = tABLE_CD;
                    t.TABLE_IDX = tABLE_IDX;
                    if (sUBMIT_TYPE != null) t.SUBMIT_TYPE = sUBMIT_TYPE;
                    if (rESPONSE_FILE != null) t.RESPONSE_FILE = rESPONSE_FILE;
                    if (rESPONSE_TXT != null) t.RESPONSE_TXT = rESPONSE_TXT;
                    if (cDX_SUBMIT_TRANS_ID != null) t.CDX_SUBMIT_TRANSID = cDX_SUBMIT_TRANS_ID;
                    if (cDX_SUBMIT_STATUS != null) t.CDX_SUBMIT_STATUS = cDX_SUBMIT_STATUS;
                    if (oRG_ID != null) t.ORG_ID = oRG_ID;

                    if (lOG_ID == null) //insert case
                    {
                        t.SUBMIT_DT = System.DateTime.Now;
                        ctx.AddToT_WQX_TRANSACTION_LOG(t);
                    }

                    ctx.SaveChanges();

                    return t.LOG_ID;
                //}
                //catch
                //{
                //    return 0;
                //}
            }
        }
Exemplo n.º 11
0
        public static int UpdateT_OE_APP_TASKS(string tASK_NAME, string tASK_STATUS, int? tASK_FREQ_MS, string mODIFY_USERID)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_OE_APP_TASKS t = new T_OE_APP_TASKS();
                        t = (from c in ctx.T_OE_APP_TASKS
                             where c.TASK_NAME == tASK_NAME
                             select c).First();

                    if (tASK_STATUS != null) t.TASK_STATUS = tASK_STATUS;
                    if (tASK_FREQ_MS != null) t.TASK_FREQ_MS = (int)tASK_FREQ_MS;
                    if (mODIFY_USERID != null) t.MODIFY_USERID = mODIFY_USERID;
                    t.MODIFY_DT = System.DateTime.Now;
                    ctx.SaveChanges();

                    return t.TASK_IDX;
                }
                catch
                {
                    return 0;
                }
            }
        }
Exemplo n.º 12
0
        public static int InsertOrUpdateT_WQX_REF_CHAR_ORG(global::System.String cHAR_NAME, global::System.String oRG_NAME, global::System.String cREATE_USER_ID,
            string dEFAULT_DETECT_LIMIT, string dEFAULT_UNIT, int? dEFAULT_ANAL_METHOD_IDX, string dEFAULT_SAMP_FRACTION, string dEFAULT_RESULT_STATUS, string dEFAULT_RESULT_VALUE_TYPE)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_CHAR_ORG a = new T_WQX_REF_CHAR_ORG();

                    if (ctx.T_WQX_REF_CHAR_ORG.Any(o => o.CHAR_NAME == cHAR_NAME && o.ORG_ID == oRG_NAME))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_CHAR_ORG
                             where c.CHAR_NAME == cHAR_NAME
                             && c.ORG_ID == oRG_NAME
                             select c).FirstOrDefault();
                        insInd = false;
                    }

                    a.CHAR_NAME = cHAR_NAME;
                    a.ORG_ID = oRG_NAME;
                    if (dEFAULT_DETECT_LIMIT != null) a.DEFAULT_DETECT_LIMIT = dEFAULT_DETECT_LIMIT;
                    if (dEFAULT_UNIT != null) a.DEFAULT_UNIT = dEFAULT_UNIT;
                    if (dEFAULT_ANAL_METHOD_IDX != null) a.DEFAULT_ANAL_METHOD_IDX = dEFAULT_ANAL_METHOD_IDX;
                    if (dEFAULT_SAMP_FRACTION != null) a.DEFAULT_SAMP_FRACTION = dEFAULT_SAMP_FRACTION;
                    if (dEFAULT_RESULT_STATUS != null) a.DEFAULT_RESULT_STATUS = dEFAULT_RESULT_STATUS;
                    if (dEFAULT_RESULT_VALUE_TYPE != null) a.DEFAULT_RESULT_VALUE_TYPE = dEFAULT_RESULT_VALUE_TYPE;

                    if (insInd) //insert case
                    {
                        a.CREATE_DT = System.DateTime.Now;
                        a.CREATE_USERID = cREATE_USER_ID;
                        ctx.AddToT_WQX_REF_CHAR_ORG(a);
                    }
                    ctx.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 13
0
        public static int DeleteT_ATTAINS_REPORT(int aTTAINS_REPORT_IDX)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_ATTAINS_REPORT r = (from c in ctx.T_ATTAINS_REPORT
                                          where c.ATTAINS_REPORT_IDX == aTTAINS_REPORT_IDX
                                          select c).FirstOrDefault();

                    if (r.ATTAINS_SUBMIT_STATUS == "Y" || r.ATTAINS_SUBMIT_STATUS == "U")
                        return -1;

                    ctx.DeleteObject(r);
                    ctx.SaveChanges();
                    return 1;
                }
                catch
                {
                    return 0;
                }
            }
        }
Exemplo n.º 14
0
        //******************REF DATA****************************************
        public static int InsertOrUpdateT_WQX_REF_DATA(global::System.String tABLE, global::System.String vALUE, global::System.String tEXT, global::System.Boolean? UsedInd)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_DATA a = new T_WQX_REF_DATA();

                    if (ctx.T_WQX_REF_DATA.Any(o => o.VALUE == vALUE && o.TABLE == tABLE))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_DATA
                             where c.VALUE == vALUE
                             && c.TABLE == tABLE
                             select c).FirstOrDefault();
                        insInd = false;
                    }

                    a.TABLE = tABLE;
                    a.VALUE = vALUE;
                    a.TEXT = Utils.SubStringPlus(tEXT, 0,200);
                    if (UsedInd != null) a.USED_IND = UsedInd;

                    a.UPDATE_DT = System.DateTime.Now;
                    a.ACT_IND = true;

                    if (insInd) //insert case
                    {
                        if (UsedInd == null) a.USED_IND = true;
                        ctx.AddToT_WQX_REF_DATA(a);
                    }
                    ctx.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 15
0
        public static int InsertOrUpdateT_WQX_REF_ANAL_METHOD(global::System.Int32? aNALYTIC_METHOD_IDX, global::System.String aNALYTIC_METHOD_ID, string aNALYTIC_METHOD_CTX,
            string aNALYTIC_METHOD_NAME, string aNALYTIC_METHOD_DESC, bool aCT_IND)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_ANAL_METHOD a = new T_WQX_REF_ANAL_METHOD();

                    if (ctx.T_WQX_REF_ANAL_METHOD.Any(o => o.ANALYTIC_METHOD_IDX == aNALYTIC_METHOD_IDX))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_ANAL_METHOD
                             where c.ANALYTIC_METHOD_IDX == aNALYTIC_METHOD_IDX
                             select c).FirstOrDefault();
                        insInd = false;
                    }
                    else
                    {
                        if (ctx.T_WQX_REF_ANAL_METHOD.Any(o => o.ANALYTIC_METHOD_ID == aNALYTIC_METHOD_ID && o.ANALYTIC_METHOD_CTX == aNALYTIC_METHOD_CTX))
                        {
                            //update case
                            a = (from c in ctx.T_WQX_REF_ANAL_METHOD
                                 where c.ANALYTIC_METHOD_ID == aNALYTIC_METHOD_ID
                                 && c.ANALYTIC_METHOD_CTX == aNALYTIC_METHOD_CTX
                                 select c).FirstOrDefault();
                            insInd = false;
                        }
                    }

                    if (aNALYTIC_METHOD_ID != null) a.ANALYTIC_METHOD_ID = aNALYTIC_METHOD_ID;
                    if (aNALYTIC_METHOD_CTX != null) a.ANALYTIC_METHOD_CTX = aNALYTIC_METHOD_CTX;
                    if (aNALYTIC_METHOD_NAME != null) a.ANALYTIC_METHOD_NAME = aNALYTIC_METHOD_NAME;
                    if (aNALYTIC_METHOD_DESC != null) a.ANALYTIC_METHOD_DESC = aNALYTIC_METHOD_DESC;
                    if (aCT_IND != null) a.ACT_IND = aCT_IND;

                    a.UPDATE_DT = System.DateTime.Now;

                    if (insInd) //insert case
                        ctx.AddToT_WQX_REF_ANAL_METHOD(a);

                    ctx.SaveChanges();
                    return a.ANALYTIC_METHOD_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 16
0
        public static int InsertOrUpdateATTAINS_REPORT(int? aTTAINS_REPORT_IDX, string oRG_ID, string rEPORT_NAME, DateTime? dATA_FROM, DateTime? dATA_TO,
            bool? aTTAINS_IND, string aTTAINS_SUBMIT_STATUS, DateTime? aTTAINS_UPDATE_DT, String cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    T_ATTAINS_REPORT a = new T_ATTAINS_REPORT();

                    if (aTTAINS_REPORT_IDX != null)
                        a = (from c in ctx.T_ATTAINS_REPORT
                             where c.ATTAINS_REPORT_IDX == aTTAINS_REPORT_IDX
                             select c).FirstOrDefault();

                    if (aTTAINS_REPORT_IDX == null) //insert case
                    {
                        insInd = true;
                    }

                    if (oRG_ID != null) a.ORG_ID = oRG_ID;
                    if (rEPORT_NAME != null) a.REPORT_NAME = rEPORT_NAME;
                    if (dATA_FROM != null) a.DATA_FROM = dATA_FROM;
                    if (dATA_TO != null) a.DATA_TO = dATA_TO;
                    if (aTTAINS_IND != null) a.ATTAINS_IND = aTTAINS_IND;
                    if (aTTAINS_SUBMIT_STATUS != null) a.ATTAINS_SUBMIT_STATUS = aTTAINS_SUBMIT_STATUS;
                    if (aTTAINS_UPDATE_DT != null) a.ATTAINS_UPDATE_DT = aTTAINS_UPDATE_DT;

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

                    ctx.SaveChanges();

                    return a.ATTAINS_REPORT_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 17
0
        //***************************** ATTAINS_REPORT_LOG **************************************************
        public static int InsertOrUpdateATTAINS_REPORT_LOG(int? aTTAINS_LOG_IDX, int? aTTAINS_REPORT_IDX,  DateTime? sUBMIT_DT, 
            string sUBMIT_FILE, byte[] rESPONSE_FILE, string rESPONSE_TXT, string cDX_SUBMIT_TRANSID, string cDX_SUBMIT_STATUS, string cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    T_ATTAINS_REPORT_LOG a = new T_ATTAINS_REPORT_LOG();

                    if (aTTAINS_LOG_IDX != null)
                        a = (from c in ctx.T_ATTAINS_REPORT_LOG
                             where c.ATTAINS_LOG_IDX == aTTAINS_LOG_IDX
                             select c).FirstOrDefault();

                    if (aTTAINS_REPORT_IDX == null) //insert case
                    {
                        insInd = true;
                    }

                    if (aTTAINS_REPORT_IDX != null) a.ATTAINS_REPORT_IDX = aTTAINS_REPORT_IDX.ConvertOrDefault<int>();
                    if (sUBMIT_DT != null) a.SUBMIT_DT = sUBMIT_DT.ConvertOrDefault<DateTime>();
                    if (sUBMIT_FILE != null) a.SUBMIT_FILE = sUBMIT_FILE;
                    if (rESPONSE_FILE != null) a.RESPONSE_FILE = rESPONSE_FILE;
                    if (rESPONSE_TXT != null) a.RESPONSE_TXT = rESPONSE_TXT;
                    if (cDX_SUBMIT_TRANSID != null) a.CDX_SUBMIT_TRANSID = cDX_SUBMIT_TRANSID;
                    if (cDX_SUBMIT_STATUS != null) a.CDX_SUBMIT_STATUS = cDX_SUBMIT_STATUS;

                    if (insInd) //insert case
                    {
                        ctx.AddToT_ATTAINS_REPORT_LOG(a);
                    }

                    ctx.SaveChanges();

                    return a.ATTAINS_LOG_IDX ;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 18
0
        //***************************** ATTAINS_ASSESS_UNITS_MLOC **************************************
        public static int InsertOrUpdateATTAINS_ASSESS_UNITS_MLOC(int aSSESS_UNIT_IDX, int mONLOC_IDX, String cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    T_ATTAINS_ASSESS_UNITS_MLOC a = (from c in ctx.T_ATTAINS_ASSESS_UNITS_MLOC
                         where c.ATTAINS_ASSESS_UNIT_IDX == aSSESS_UNIT_IDX
                         && c.MONLOC_IDX == mONLOC_IDX
                         select c).FirstOrDefault();

                    if (a == null)
                    {
                        a = new T_ATTAINS_ASSESS_UNITS_MLOC();
                        insInd = true;
                    }

                    a.ATTAINS_ASSESS_UNIT_IDX = aSSESS_UNIT_IDX;
                    a.MONLOC_IDX = mONLOC_IDX;

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

                    ctx.SaveChanges();

                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 19
0
        public static int InsertOrUpdateATTAINS_ASSESS_UNITS(int? aTTAINS_ASSESS_UNIT_IDX, int? aTTAINS_REPORT_IDX, string aSSESS_UNIT_ID, string aSSESS_UNIT_NAME, 
            string lOCATION_DESC, string aGENCY_CODE, string sTATE_CODE, string aCT_IND, string wATER_TYPE_CODE, decimal? wATER_SIZE, string wATER_UNIT_CODE,
            string uSE_CLASS_CODE, string uSE_CLASS_NAME, String cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    if (aTTAINS_ASSESS_UNIT_IDX == -1) aTTAINS_ASSESS_UNIT_IDX = null;

                    T_ATTAINS_ASSESS_UNITS a = null;

                    if (aTTAINS_ASSESS_UNIT_IDX != null)
                        a = (from c in ctx.T_ATTAINS_ASSESS_UNITS
                             where c.ATTAINS_ASSESS_UNIT_IDX == aTTAINS_ASSESS_UNIT_IDX
                             select c).FirstOrDefault();

                    if (a == null)
                    {
                        a = new T_ATTAINS_ASSESS_UNITS();
                        insInd = true;
                    }

                    if (aTTAINS_REPORT_IDX != null) a.ATTAINS_REPORT_IDX = aTTAINS_REPORT_IDX.ConvertOrDefault<int>();
                    if (aSSESS_UNIT_ID != null) a.ASSESS_UNIT_ID = aSSESS_UNIT_ID;
                    if (aSSESS_UNIT_NAME != null) a.ASSESS_UNIT_NAME = aSSESS_UNIT_NAME;
                    if (lOCATION_DESC != null) a.LOCATION_DESC = lOCATION_DESC;
                    if (aGENCY_CODE != null) a.AGENCY_CODE = aGENCY_CODE;
                    if (sTATE_CODE != null) a.STATE_CODE = sTATE_CODE;
                    if (aCT_IND != null) a.ACT_IND = aCT_IND;
                    if (wATER_TYPE_CODE != null) a.WATER_TYPE_CODE = wATER_TYPE_CODE;
                    if (wATER_SIZE != null) a.WATER_SIZE = wATER_SIZE;
                    if (wATER_UNIT_CODE != null) a.WATER_UNIT_CODE = wATER_UNIT_CODE;
                    if (uSE_CLASS_CODE != null) a.USE_CLASS_CODE = uSE_CLASS_CODE;
                    if (uSE_CLASS_NAME != null) a.USE_CLASS_NAME = uSE_CLASS_NAME;

                    if (insInd) //insert case
                    {
                        a.CREATE_USERID = cREATE_USER.ToUpper();
                        a.CREATE_DT = System.DateTime.Now;
                        ctx.AddToT_ATTAINS_ASSESS_UNITS(a);
                    }
                    else
                    {
                        a.MODIFY_USERID = cREATE_USER.ToUpper();
                        a.MODIFY_DT = System.DateTime.Now;
                    }

                    ctx.SaveChanges();

                    return a.ATTAINS_ASSESS_UNIT_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 20
0
        public static int InsertOrUpdateATTAINS_ASSESS(int? aTTAINS_ASSESS_IDX, string rEPORTING_CYCLE, string rEPORT_STATUS, int aTTAINS_ASSESS_UNIT_IDX,
            string aGENCY_CODE, string cYCLE_LAST_ASSESSED, string cYCLE_LAST_MONITORED, string tROPHIC_STATUS_CODE, String cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    if (aTTAINS_ASSESS_IDX == -1) aTTAINS_ASSESS_IDX = null;

                    T_ATTAINS_ASSESS a = null;

                    if (aTTAINS_ASSESS_IDX != null)
                        a = (from c in ctx.T_ATTAINS_ASSESS
                             where c.ATTAINS_ASSESS_IDX == aTTAINS_ASSESS_IDX
                             select c).FirstOrDefault();

                    if (a == null)
                    {
                        a = new T_ATTAINS_ASSESS();
                        insInd = true;
                    }

                    if (rEPORTING_CYCLE != null) a.REPORTING_CYCLE = rEPORTING_CYCLE;
                    if (rEPORT_STATUS != null) a.REPORT_STATUS = rEPORT_STATUS;
                    a.ATTAINS_ASSESS_UNIT_IDX = aTTAINS_ASSESS_UNIT_IDX;
                    if (aGENCY_CODE != null) a.AGENCY_CODE = aGENCY_CODE;
                    if (cYCLE_LAST_ASSESSED != null) a.CYCLE_LAST_ASSESSED = cYCLE_LAST_ASSESSED;
                    if (cYCLE_LAST_MONITORED != null) a.CYCLE_LAST_MONITORED = cYCLE_LAST_MONITORED;
                    if (tROPHIC_STATUS_CODE != null) a.TROPHIC_STATUS_CODE = tROPHIC_STATUS_CODE;

                    if (insInd) //insert case
                    {
                        a.CREATE_USERID = cREATE_USER.ToUpper();
                        a.CREATE_DT = System.DateTime.Now;
                        ctx.AddToT_ATTAINS_ASSESS(a);
                    }
                    else
                    {
                        a.MODIFY_USERID = cREATE_USER.ToUpper();
                        a.MODIFY_DT = System.DateTime.Now;
                    }

                    ctx.SaveChanges();

                    return a.ATTAINS_ASSESS_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 21
0
        public static int UpdateWQX_ACTIVITY_WQXStatus(global::System.Int32? aCTIVITY_IDX, global::System.String wQX_SUBMIT_STATUS, Boolean? aCT_IND, Boolean? wQX_IND, String cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_WQX_ACTIVITY a = (from c in ctx.T_WQX_ACTIVITY
                                        where c.ACTIVITY_IDX == aCTIVITY_IDX
                                        select c).FirstOrDefault();

                    if (wQX_SUBMIT_STATUS != null) a.WQX_SUBMIT_STATUS = wQX_SUBMIT_STATUS;
                    if (aCT_IND != null) a.ACT_IND = aCT_IND;
                    if (wQX_IND != null) a.WQX_IND = wQX_IND;
                    a.UPDATE_USERID = cREATE_USER.ToUpper();
                    a.UPDATE_DT = System.DateTime.Now;

                    ctx.SaveChanges();

                    return a.ACTIVITY_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 22
0
 public static int DeleteT_WQX_RESULT(int ResultIDX)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             T_WQX_RESULT r = new T_WQX_RESULT();
             r = (from c in ctx.T_WQX_RESULT where c.RESULT_IDX == ResultIDX select c).FirstOrDefault();
             ctx.DeleteObject(r);
             ctx.SaveChanges();
             return 1;
         }
         catch
         {
             return 0;
         }
     }
 }
Exemplo n.º 23
0
        public static int UpdateWQX_ACTIVITY_EntryType(global::System.Int32? aCTIVITY_IDX, string eNTRY_TYPE)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_WQX_ACTIVITY a = (from c in ctx.T_WQX_ACTIVITY
                                        where c.ACTIVITY_IDX == aCTIVITY_IDX
                                        select c).FirstOrDefault();

                    if (a != null)
                        if (eNTRY_TYPE != null) a.ENTRY_TYPE = eNTRY_TYPE;

                    ctx.SaveChanges();

                    return a.ACTIVITY_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 24
0
        //***************** REF_SYS_LOG *********************************************
        public static int InsertT_OE_SYS_LOG(string logType, string logMsg)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_OE_SYS_LOG e = new T_OE_SYS_LOG();
                    e.LOG_TYPE = logType;
                    if (logMsg != null)
                        e.LOG_MSG = logMsg.SubStringPlus(0, 1999);
                    e.LOG_DT = System.DateTime.Now;

                    ctx.AddToT_OE_SYS_LOG(e);
                    ctx.SaveChanges();
                    return e.SYS_LOG_ID;
                }
                catch
                {
                    return 0;
                }
            }
        }
Exemplo n.º 25
0
        //******************REF CHARACTERISTIC****************************************
        public static int InsertOrUpdateT_WQX_REF_CHARACTERISTIC(global::System.String cHAR_NAME, global::System.Decimal? dETECT_LIMIT, global::System.String dEFAULT_UNIT, global::System.Boolean? uSED_IND, 
            global::System.Boolean aCT_IND)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_CHARACTERISTIC a = new T_WQX_REF_CHARACTERISTIC();

                    if (ctx.T_WQX_REF_CHARACTERISTIC.Any(o => o.CHAR_NAME == cHAR_NAME))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_CHARACTERISTIC
                             where c.CHAR_NAME == cHAR_NAME
                             select c).FirstOrDefault();
                        insInd = false;
                    }

                    a.CHAR_NAME = cHAR_NAME;
                    if (dETECT_LIMIT != null) a.DEFAULT_DETECT_LIMIT = dETECT_LIMIT;
                    if (dEFAULT_UNIT != null) a.DEFAULT_UNIT = dEFAULT_UNIT;
                    if (uSED_IND != null) a.USED_IND = uSED_IND;

                    a.UPDATE_DT = System.DateTime.Now;
                    a.ACT_IND = true;

                    if (insInd) //insert case
                    {
                        a.USED_IND = false;
                        ctx.AddToT_WQX_REF_CHARACTERISTIC(a);
                    }
                    ctx.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 26
0
        //*********************** IMPORT LOG *******************************
        public static int InsertUpdateWQX_IMPORT_LOG(int? iMPORT_ID, string oRG_ID, string tYPE_CD, string fILE_NAME, int fILE_SIZE, string iMPORT_STATUS, string iMPORT_PROGRESS,
            string iMPORT_PROGRESS_MSG, byte[] iMPORT_FILE, string uSER_ID)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_WQX_IMPORT_LOG t = new T_WQX_IMPORT_LOG();
                    if (iMPORT_ID != null)
                        t = (from c in ctx.T_WQX_IMPORT_LOG
                             where c.IMPORT_ID == iMPORT_ID
                             select c).First();

                    if (iMPORT_ID == null)
                        t = new T_WQX_IMPORT_LOG();

                    if (oRG_ID != null) t.ORG_ID = oRG_ID;
                    if (tYPE_CD != null) t.TYPE_CD = tYPE_CD.Substring(0,5);
                    if (fILE_NAME!= null) t.FILE_NAME = fILE_NAME;
                    t.FILE_SIZE = fILE_SIZE;
                    if (iMPORT_STATUS != null) t.IMPORT_STATUS = iMPORT_STATUS;
                    if (iMPORT_PROGRESS != null) t.IMPORT_PROGRESS = iMPORT_PROGRESS;
                    if (iMPORT_PROGRESS_MSG != null) t.IMPORT_PROGRESS_MSG = iMPORT_PROGRESS_MSG;
                    if (iMPORT_FILE != null) t.IMPORT_FILE = iMPORT_FILE;
                    if (uSER_ID != null) t.CREATE_USERID = uSER_ID;

                    if (iMPORT_ID == null) //insert case
                    {
                        t.CREATE_DT = DateTime.Now;
                        ctx.AddToT_WQX_IMPORT_LOG(t);
                    }
                    else
                    {
                    }

                    ctx.SaveChanges();

                    return t.IMPORT_ID;
                }
                catch
                {
                    return 0;
                }
            }
        }
Exemplo n.º 27
0
        //******************REF COUNTY ****************************************
        public static int InsertOrUpdateT_WQX_REF_COUNTY(global::System.String sTATE_CODE, global::System.String cOUNTY_CODE, global::System.String cOUNTY_NAME, global::System.Boolean? UsedInd)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_COUNTY a = new T_WQX_REF_COUNTY();

                    if (ctx.T_WQX_REF_COUNTY.Any(o => o.STATE_CODE == sTATE_CODE && o.COUNTY_CODE == cOUNTY_CODE))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_COUNTY
                             where c.STATE_CODE == sTATE_CODE
                             && c.COUNTY_CODE == cOUNTY_CODE
                             select c).FirstOrDefault();
                        insInd = false;
                    }

                    a.STATE_CODE = sTATE_CODE;
                    a.COUNTY_CODE = cOUNTY_CODE;
                    a.COUNTY_NAME = cOUNTY_NAME;

                    if (UsedInd != null) a.USED_IND = UsedInd;

                    a.UPDATE_DT = System.DateTime.Now;
                    a.ACT_IND = true;

                    if (insInd) //insert case
                    {
                        if (UsedInd == null) a.USED_IND = true;
                        ctx.AddToT_WQX_REF_COUNTY(a);
                    }
                    ctx.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 28
0
 public static int DeleteT_WQX_USER_ORGS(global::System.String oRG_ID, global::System.Int32 uSER_IDX)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             T_WQX_USER_ORGS r = new T_WQX_USER_ORGS();
             r = (from c in ctx.T_WQX_USER_ORGS where c.USER_IDX == uSER_IDX && c.ORG_ID == oRG_ID  select c).FirstOrDefault();
             ctx.DeleteObject(r);
             ctx.SaveChanges();
             return 1;
         }
         catch
         {
             return 0;
         }
     }
 }
Exemplo n.º 29
0
        public static int InsertOrUpdateT_WQX_REF_LAB(global::System.Int32? lAB_IDX, global::System.String lAB_NAME, string lAB_ACCRED_IND, string lAB_ACCRED_AUTHORITY, string oRG_ID, bool aCT_IND)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_LAB a = new T_WQX_REF_LAB();

                    if (ctx.T_WQX_REF_LAB.Any(o => o.LAB_IDX == lAB_IDX))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_LAB
                             where c.LAB_IDX == lAB_IDX
                             select c).FirstOrDefault();
                        insInd = false;
                    }
                    else
                    {
                        if (ctx.T_WQX_REF_LAB.Any(o => o.LAB_NAME == lAB_NAME && o.ORG_ID == oRG_ID))
                        {
                            //update case
                            a = (from c in ctx.T_WQX_REF_LAB
                                 where c.LAB_NAME == lAB_NAME
                                 && c.ORG_ID == oRG_ID
                                 select c).FirstOrDefault();
                            insInd = false;
                        }
                    }

                    if (lAB_NAME != null) a.LAB_NAME = lAB_NAME;
                    if (lAB_ACCRED_IND != null) a.LAB_ACCRED_IND = lAB_ACCRED_IND;
                    if (lAB_ACCRED_AUTHORITY != null) a.LAB_ACCRED_AUTHORITY = lAB_ACCRED_AUTHORITY;
                    if (oRG_ID != null) a.ORG_ID = oRG_ID;
                    a.ACT_IND = aCT_IND;

                    a.UPDATE_DT = System.DateTime.Now;

                    if (insInd) //insert case
                    {
                        a.CREATE_DT = System.DateTime.Now;
                        ctx.AddToT_WQX_REF_LAB(a);
                    }

                    ctx.SaveChanges();
                    return a.LAB_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
Exemplo n.º 30
0
        public static int InsertOrUpdateT_WQX_REF_TAXA_ORG(global::System.String bIO_SUBJECT_TAXAONOMY, global::System.String oRG_NAME, global::System.String cREATE_USER_ID)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_TAXA_ORG a = new T_WQX_REF_TAXA_ORG();

                    if (ctx.T_WQX_REF_TAXA_ORG.Any(o => o.BIO_SUBJECT_TAXONOMY == bIO_SUBJECT_TAXAONOMY && o.ORG_ID == oRG_NAME))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_TAXA_ORG
                             where c.BIO_SUBJECT_TAXONOMY == bIO_SUBJECT_TAXAONOMY
                             && c.ORG_ID == oRG_NAME
                             select c).FirstOrDefault();
                        insInd = false;
                    }

                    a.BIO_SUBJECT_TAXONOMY = bIO_SUBJECT_TAXAONOMY;
                    a.ORG_ID = oRG_NAME;

                    if (insInd) //insert case
                    {
                        a.CREATE_DT = System.DateTime.Now;
                        a.CREATE_USERID = cREATE_USER_ID;
                        ctx.AddToT_WQX_REF_TAXA_ORG(a);
                    }
                    ctx.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }