public static Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, REGISTRY_COHORT_DATA objSave) { Int32 objReturn = 0; REGISTRY_COHORT_DATADB objDB = new REGISTRY_COHORT_DATADB(); objReturn = objDB.Save(CURRENT_USER, CURRENT_REGISTRY_ID, objSave); return(objReturn); }
public static REGISTRY_COHORT_DATA GetItemByRegistryCohort(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 STD_REGISTRY_COHORT_TYPE_ID) { REGISTRY_COHORT_DATA objReturn = null; REGISTRY_COHORT_DATADB objDB = new REGISTRY_COHORT_DATADB(); objReturn = objDB.GetItemByRegistryCohort(CURRENT_USER, CURRENT_REGISTRY_ID, STD_REGISTRY_COHORT_TYPE_ID); return(objReturn); }
public static REGISTRY_COHORT_DATA GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 ID) { REGISTRY_COHORT_DATA objReturn = null; REGISTRY_COHORT_DATADB objDB = new REGISTRY_COHORT_DATADB(); objReturn = objDB.GetItem(CURRENT_USER, CURRENT_REGISTRY_ID, ID); return(objReturn); }
public REGISTRY_COHORT_DATA ParseReaderCdw(DataRow row) { REGISTRY_COHORT_DATA objReturn = new REGISTRY_COHORT_DATA(); objReturn.VALUE = (string)GetNullableObject(row.Field <object>("VALUE")); objReturn.SELECTED_FLAG = (Boolean)GetNullableObject(row.Field <object>("SELECTED_FLAG")); objReturn.STD_REGISTRY_COHORT_TYPES = new STD_REGISTRY_COHORT_TYPES(); objReturn.STD_REGISTRY_COHORT_TYPES.NAME = (string)GetNullableObject(row.Field <object>("NAME")); objReturn.STD_REGISTRY_COHORT_TYPES.TABLE_NAME = (string)GetNullableObject(row.Field <object>("TABLE_NAME")); return(objReturn); }
public REGISTRY_COHORT_DATA ParseReaderComplete(DataRow row) { REGISTRY_COHORT_DATA objReturn = ParseReaderCustom(row); if (objReturn != null) { if (objReturn.STD_REGISTRY_COHORT_TYPE_ID > 0) { STD_REGISTRY_COHORT_TYPESDB sTD_REGISTRY_COHORT_TYPESDB = new STD_REGISTRY_COHORT_TYPESDB(); objReturn.STD_REGISTRY_COHORT_TYPES = sTD_REGISTRY_COHORT_TYPESDB.ParseReaderCustom(row); } } return(objReturn); }
public REGISTRY_COHORT_DATA ParseReaderCustom(DataRow row) { REGISTRY_COHORT_DATA objReturn = new REGISTRY_COHORT_DATA { COMMENT = (string)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_COMMENT")), CREATED = (DateTime)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_CREATED")), CREATEDBY = (string)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_CREATEDBY")), ID = (Int32)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_ID")), STD_REGISTRY_COHORT_TYPE_ID = (Int32)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_STD_REGISTRY_COHORT_TYPE_ID")), STD_REGISTRY_ID = (Int32)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_STD_REGISTRY_ID")), UPDATED = (DateTime)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_UPDATED")), UPDATEDBY = (string)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_UPDATEDBY")), VALUE = (string)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_VALUE")), SELECTED_FLAG = (Boolean)GetNullableObject(row.Field <object>("REGISTRY_COHORT_DATA_SELECTED_FLAG")) }; return(objReturn); }
public REGISTRY_COHORT_DATA GetItemByRegistryCohort(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 STD_REGISTRY_COHORT_TYPE_ID) { REGISTRY_COHORT_DATA objReturn = null; SqlConnection sConn = null; SqlCommand sCmd = null; SqlDataAdapter sAdapter = null; DataSet objTemp = null; try { sConn = new SqlConnection(SqlConnectionString); sConn.Open(); sCmd = new SqlCommand("CRS.usp_REGISTRY_COHORT_DATA_getitemByRegistryCohort", sConn); sCmd.CommandTimeout = SqlCommandTimeout; sCmd.CommandType = CommandType.StoredProcedure; sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER); sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID); sCmd.Parameters.AddWithValue("@STD_REGISTRY_COHORT_TYPE_ID", STD_REGISTRY_COHORT_TYPE_ID); objTemp = new DataSet(); sAdapter = new SqlDataAdapter(sCmd); LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID); sAdapter.Fill(objTemp); LogManager.LogTiming(logDetails); CheckDataSet(objTemp); if (objTemp != null && objTemp.Tables.Count > 0 && objTemp.Tables[0].Rows.Count > 0) { objReturn = ParseReader(objTemp.Tables[0].Rows[0]); } sConn.Close(); } catch (Exception ex) { LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID); throw ex; } finally { if (sAdapter != null) { sAdapter.Dispose(); sAdapter = null; } if (sCmd != null) { sCmd.Dispose(); sCmd = null; } if (sConn != null) { if (sConn.State != ConnectionState.Closed) { sConn.Close(); } sConn.Dispose(); sConn = null; } } return(objReturn); }
public static List <REGISTRY_COHORT_DATA> ConvertToDataList(RegistryWizard wizard) { List <REGISTRY_COHORT_DATA> objReturn = null; REGISTRY_COHORT_DATA cohort = null; STD_REGISTRY_COHORT_TYPES type = null; if (wizard != null) { objReturn = new List <REGISTRY_COHORT_DATA>(); if (wizard.DOBMin != null) { cohort = new REGISTRY_COHORT_DATA(); type = STD_REGISTRY_COHORT_TYPESManager.GetItemByTableCode("CUSTOM", "DOBMIN"); if (type != null) { cohort.STD_REGISTRY_COHORT_TYPE_ID = type.COHORT_TYPE_ID; } cohort.CREATED = cohort.UPDATED = DateTime.Now; cohort.VALUE = wizard.DOBMin.Value.ToString("yyyy-MM-dd"); objReturn.Add(cohort); } if (wizard.DOBMax != null) { cohort = new REGISTRY_COHORT_DATA(); type = STD_REGISTRY_COHORT_TYPESManager.GetItemByTableCode("CUSTOM", "DOBMAX"); if (type != null) { cohort.STD_REGISTRY_COHORT_TYPE_ID = type.COHORT_TYPE_ID; } cohort.CREATED = cohort.UPDATED = DateTime.Now; cohort.VALUE = wizard.DOBMax.Value.ToString("yyyy-MM-dd"); objReturn.Add(cohort); } if (wizard.OEFOIFLocation != null) { cohort = new REGISTRY_COHORT_DATA(); type = STD_REGISTRY_COHORT_TYPESManager.GetItemByTableCode("CUSTOM", "OEFOIF"); if (type != null) { cohort.STD_REGISTRY_COHORT_TYPE_ID = type.COHORT_TYPE_ID; } cohort.CREATED = cohort.UPDATED = DateTime.Now; cohort.SELECTED_FLAG = wizard.OEFOIFLocation.GetValueOrDefault(); objReturn.Add(cohort); } if (!string.IsNullOrEmpty(wizard.CombatLocIds)) { string[] idList = wizard.CombatLocIds.Split(','); if (idList != null) { foreach (string idS in idList) { int id = 0; if (int.TryParse(idS, out id)) { cohort = new REGISTRY_COHORT_DATA(); cohort.STD_REGISTRY_COHORT_TYPE_ID = id; cohort.CREATED = cohort.UPDATED = DateTime.Now; objReturn.Add(cohort); } } } } if (!string.IsNullOrEmpty(wizard.EthnicityIds)) { string[] idList = wizard.EthnicityIds.Split(','); if (idList != null) { foreach (string idS in idList) { int id = 0; if (int.TryParse(idS, out id)) { cohort = new REGISTRY_COHORT_DATA(); cohort.STD_REGISTRY_COHORT_TYPE_ID = id; cohort.CREATED = cohort.UPDATED = DateTime.Now; objReturn.Add(cohort); } } } } if (!string.IsNullOrEmpty(wizard.GenderIds)) { string[] idList = wizard.GenderIds.Split(','); if (idList != null) { foreach (string idS in idList) { int id = 0; if (int.TryParse(idS, out id)) { cohort = new REGISTRY_COHORT_DATA(); cohort.STD_REGISTRY_COHORT_TYPE_ID = id; cohort.CREATED = cohort.UPDATED = DateTime.Now; objReturn.Add(cohort); } } } } if (!string.IsNullOrEmpty(wizard.MaritalStatusIds)) { string[] idList = wizard.MaritalStatusIds.Split(','); if (idList != null) { foreach (string idS in idList) { int id = 0; if (int.TryParse(idS, out id)) { cohort = new REGISTRY_COHORT_DATA(); cohort.STD_REGISTRY_COHORT_TYPE_ID = id; cohort.CREATED = cohort.UPDATED = DateTime.Now; objReturn.Add(cohort); } } } } if (!string.IsNullOrEmpty(wizard.RaceIds)) { string[] idList = wizard.RaceIds.Split(','); if (idList != null) { foreach (string idS in idList) { int id = 0; if (int.TryParse(idS, out id)) { cohort = new REGISTRY_COHORT_DATA(); cohort.STD_REGISTRY_COHORT_TYPE_ID = id; cohort.CREATED = cohort.UPDATED = DateTime.Now; objReturn.Add(cohort); } } } } if (!string.IsNullOrEmpty(wizard.ServiceIds)) { string[] idList = wizard.ServiceIds.Split(','); if (idList != null) { foreach (string idS in idList) { int id = 0; if (int.TryParse(idS, out id)) { cohort = new REGISTRY_COHORT_DATA(); cohort.STD_REGISTRY_COHORT_TYPE_ID = id; cohort.CREATED = cohort.UPDATED = DateTime.Now; objReturn.Add(cohort); } } } } } return(objReturn); }
public static Boolean Delete(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, REGISTRY_COHORT_DATA objDelete) { return(Delete(CURRENT_USER, CURRENT_REGISTRY_ID, objDelete.ID)); }
public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, REGISTRY_COHORT_DATA objSave) { Int32 objReturn = 0; SqlConnection sConn = null; SqlCommand sCmd = null; SqlParameter p = null; try { sConn = new SqlConnection(SqlConnectionString); sConn.Open(); sCmd = new SqlCommand("CRS.usp_REGISTRY_COHORT_DATA_save", sConn); sCmd.CommandTimeout = SqlCommandTimeout; sCmd.CommandType = CommandType.StoredProcedure; sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER); sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID); p = new SqlParameter("@COMMENT", SqlDbType.VarChar, -1); p.Precision = 0; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.COMMENT); p = new SqlParameter("@CREATED", SqlDbType.DateTime, 8); p.Precision = 23; p.Scale = 3; AddParameter(ref sCmd, ref p, objSave.CREATED); p = new SqlParameter("@CREATEDBY", SqlDbType.VarChar, 30); p.Precision = 0; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.CREATEDBY); p = new SqlParameter("@ID", SqlDbType.Int, 4); p.Direction = ParameterDirection.InputOutput; p.Precision = 10; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.ID); p = new SqlParameter("@STD_REGISTRY_COHORT_TYPE_ID", SqlDbType.Int, 4); p.Precision = 10; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.STD_REGISTRY_COHORT_TYPE_ID); p = new SqlParameter("@STD_REGISTRY_ID", SqlDbType.Int, 4); p.Precision = 10; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.STD_REGISTRY_ID); p = new SqlParameter("@UPDATED", SqlDbType.DateTime, 8); p.Precision = 23; p.Scale = 3; AddParameter(ref sCmd, ref p, objSave.UPDATED); p = new SqlParameter("@UPDATEDBY", SqlDbType.VarChar, 30); p.Precision = 0; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.UPDATEDBY); p = new SqlParameter("@VALUE", SqlDbType.VarChar, 1000); p.Precision = 0; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.VALUE); p = new SqlParameter("@SELECTED_FLAG", SqlDbType.Bit, 1); p.Precision = 1; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.SELECTED_FLAG); LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID); int cnt = sCmd.ExecuteNonQuery(); LogManager.LogTiming(logDetails); objReturn = (Int32)sCmd.Parameters["@ID"].Value; sConn.Close(); } catch (Exception ex) { LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID); throw ex; } finally { if (sCmd != null) { sCmd.Dispose(); sCmd = null; } if (sConn != null) { if (sConn.State != ConnectionState.Closed) { sConn.Close(); } sConn.Dispose(); sConn = null; } } return(objReturn); }