예제 #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;
                }
            }
        }
예제 #2
0
 public static T_OE_ANALYZECONFIG GetT_OE_AnalyzeConfig_ByID(int aNALYZECONFIG_IDX)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_OE_ANALYZECONFIG
                     where a.ANALYZECONFIG_IDX == aNALYZECONFIG_IDX
                     select a).FirstOrDefault();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #3
0
 // *************************** Analyze Config *********************************
 // *********************************************************************
 public static List<T_OE_ANALYZECONFIG> GetT_OE_AnalyzeConfig(string OrgID, int UserID)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_OE_ANALYZECONFIG
                     where a.ORG_ID == OrgID
                     && a.USER_IDX == UserID
                     orderby a.ANALYZECONFIG_NAME
                     select a).ToList();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #4
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;
         }
     }
 }
예제 #5
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;
         }
     }
 }
예제 #6
0
 public static int DeleteT_ATTAINS_ASSESS_UNITS(int aSSESS_UNIT_IDX)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             T_ATTAINS_ASSESS_UNITS r = (from c in ctx.T_ATTAINS_ASSESS_UNITS
                                         where c.ATTAINS_ASSESS_UNIT_IDX == aSSESS_UNIT_IDX
                                         select c).FirstOrDefault();
             ctx.DeleteObject(r);
             ctx.SaveChanges();
             return 1;
         }
         catch
         {
             return 0;
         }
     }
 }
예제 #7
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;
         }
     }
 }
예제 #8
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;
         }
     }
 }
예제 #9
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;
                }
            }
        }
예제 #10
0
 public static List<T_WQX_TRANSACTION_LOG> GetWQX_TRANSACTION_LOG(string TableCD, int TableIdx)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from i in ctx.T_WQX_TRANSACTION_LOG
                     where i.TABLE_CD == TableCD
                     && i.TABLE_IDX == TableIdx
                     select i).ToList();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #11
0
 public static List<T_WQX_REF_SAMP_COL_METHOD> GetT_WQX_REF_SAMP_COL_METHOD_ByContext(string Context)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_WQX_REF_SAMP_COL_METHOD
                     where a.SAMP_COLL_METHOD_CTX == Context
                     select a).ToList();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #12
0
 public static T_WQX_IMPORT_LOG GetWQX_IMPORT_LOG_NewActivity()
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from i in ctx.T_WQX_IMPORT_LOG
                     where i.IMPORT_STATUS == "New"
                     && i.TYPE_CD == "Sample"
                     select i).FirstOrDefault();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #13
0
 public static int GetWQX_IMPORT_LOG_ProcessingCount()
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from i in ctx.T_WQX_IMPORT_LOG
                     where i.IMPORT_STATUS == "Processing"
                     && i.TYPE_CD == "Sample"
                     select i).Count();
         }
         catch (Exception ex)
         {
             return 0;
         }
     }
 }
예제 #14
0
        public override string ResetPassword(string username, string answer)
        {
            using (OpenEnvironmentEntities context = new OpenEnvironmentEntities())
            {
                T_OE_USERS u = db_Accounts.GetT_OE_USERSByID(username);
                if (u != null)
                {
                    //generate new password
                    string newPass = RandomString(8);
                    string salt = GenerateSalt();

                    string hashpass = HashPassword(newPass, _PasswordFormat, salt);
                    //save updated information
                    if (db_Accounts.UpdateT_OE_USERS(u.USER_IDX, hashpass, salt, null, null, null, null, true, null, null, null, null, "system") > 0)
                    {
                        //send email
                        string msg = "Your password has been reset. Your new temporary password is: " + "\r\n\r\n";
                        msg += newPass + "\r\n\r\n";
                        msg += "When you login for the first time you will be asked to set a permanent password.";
                        if (u.EMAIL == null)
                            return "User does not have email address.";
                        if (Utils.SendEmail(null, u.EMAIL.Split(';').ToList(), null, null, "Tribal-FERST Mvskoke Open Waters Module Password Reset", msg, null))
                            return "Email has been sent.";
                        else
                            return "Error in sending email";
                    }
                    else
                    {
                        return "Error updating password";
                    }
                }
                else
                    return "Email does not exist in the system.";
            }
        }
예제 #15
0
 //******************REF LAB****************************************
 public static List<T_WQX_REF_LAB> GetT_WQX_REF_LAB(string OrgID)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_WQX_REF_LAB
                     where a.ORG_ID == OrgID
                     orderby a.LAB_NAME descending
                     select a).ToList();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #16
0
 //*****************APP SETTINGS**********************************
 public static string GetT_OE_APP_SETTING(string settingName)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_OE_APP_SETTINGS
                     where a.SETTING_NAME == settingName
                     select a).FirstOrDefault().SETTING_VALUE;
         }
         catch (Exception ex)
         {
             return "";
         }
     }
 }
예제 #17
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;
                }
            }
        }
예제 #18
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;
                }
            }
        }
예제 #19
0
 public static T_WQX_TRANSACTION_LOG GetWQX_TRANSACTION_LOG_ByLogID(int LogID)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from i in ctx.T_WQX_TRANSACTION_LOG
                     where i.LOG_ID == LogID
                     select i).FirstOrDefault();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #20
0
 public static T_WQX_REF_LAB GetT_WQX_REF_LAB_ByIDandContext(string Name, string OrgID)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_WQX_REF_LAB
                     where a.ORG_ID == OrgID
                     && a.LAB_NAME == Name
                     select a).FirstOrDefault();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #21
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;
                }
            }
        }
예제 #22
0
 //***************** REF_SAMP_PREP *********************************************
 public static T_WQX_REF_SAMP_PREP GetT_WQX_REF_SAMP_PREP_ByIDandContext(string ID, string Context)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_WQX_REF_SAMP_PREP
                     where a.SAMP_PREP_METHOD_ID == ID
                     && a.SAMP_PREP_METHOD_CTX == Context
                     select a).FirstOrDefault();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #23
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;
                }
            }
        }
예제 #24
0
 public static List<T_WQX_REF_DATA> GetT_WQX_REF_TAXA_ByOrg(string OrgID)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_WQX_REF_DATA
                     join b in ctx.T_WQX_REF_TAXA_ORG on a.VALUE equals b.BIO_SUBJECT_TAXONOMY
                     where b.ORG_ID == OrgID
                     && a.TABLE == "Taxon"
                     select a).ToList();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #25
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;
                }
            }
        }
예제 #26
0
 //******************REF TAXA_ORG ****************************************
 public static List<T_WQX_REF_TAXA_ORG> GetT_WQX_REF_TAXA_ORG(string orgName)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from a in ctx.T_WQX_REF_TAXA_ORG
                     where a.ORG_ID == orgName
                     select a).ToList();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #27
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;
                }
            }
        }
예제 #28
0
 public static List<V_WQX_TRANSACTION_LOG> GetV_WQX_TRANSACTION_LOG(string TableCD, DateTime? startDt, DateTime? endDt, string OrgID)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from i in ctx.V_WQX_TRANSACTION_LOG
                     where i.ORG_ID == OrgID
                     && (TableCD == null ? true : i.TABLE_CD == TableCD)
                     && (startDt == null ? true : i.SUBMIT_DT >= startDt)
                     && (endDt == null ? true : i.SUBMIT_DT <= endDt)
                     orderby i.SUBMIT_DT descending
                     select i).ToList();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
예제 #29
0
        public override bool ChangePassword(string username, string oldPassword, string newPassword)
        {
            //validate new password length
            if (!Utils.ValidateParameter(ref newPassword, true, true, false, 0, _MinRequiredPasswordLength))
                return false;

            //Validate Non-AlphaNumeric characters
            char[] charpwd = newPassword.ToCharArray();
            int pwdNonNumericCount = 0;
            for (int i = 1; i < newPassword.Length; i++)
            {
                if (!char.IsLetterOrDigit(charpwd[i]))
                    pwdNonNumericCount += 1;
            }

            if (pwdNonNumericCount < _MinRequiredNonalphanumericCharacters)
                return false;

            using (OpenEnvironmentEntities context = new OpenEnvironmentEntities())
            {
                T_OE_USERS u = db_Accounts.GetT_OE_USERSByID(username);
                if (u != null)
                {
                    //first check accuracy of old password
                    if (!CheckPassword(oldPassword, u.PWD_HASH, u.PWD_SALT))
                        return false;

                    //generate new password
                    string salt = GenerateSalt();
                    string hashpass = HashPassword(newPassword, MembershipPasswordFormat.Hashed, salt);
                    //save updated information
                    if (db_Accounts.UpdateT_OE_USERS(u.USER_IDX, hashpass, salt, null, null, null, null, false, null, null, null, null, "system") > 0)
                        return true;
                    else
                        return false;
                }
            }

            return true;
        }
예제 #30
0
 public static List<T_WQX_IMPORT_LOG> GetWQX_IMPORT_LOG(string OrgID)
 {
     using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
     {
         try
         {
             return (from i in ctx.T_WQX_IMPORT_LOG
                     where i.ORG_ID == OrgID
                     select i).ToList();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }