public static Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, STD_REGISTRY_COHORT_TYPES objSave) { Int32 objReturn = 0; STD_REGISTRY_COHORT_TYPESDB objDB = new STD_REGISTRY_COHORT_TYPESDB(); objReturn = objDB.Save(CURRENT_USER, CURRENT_REGISTRY_ID, objSave); return(objReturn); }
public static STD_REGISTRY_COHORT_TYPES GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 COHORT_TYPE_ID) { STD_REGISTRY_COHORT_TYPES objReturn = null; STD_REGISTRY_COHORT_TYPESDB objDB = new STD_REGISTRY_COHORT_TYPESDB(); objReturn = objDB.GetItem(CURRENT_USER, CURRENT_REGISTRY_ID, COHORT_TYPE_ID); return(objReturn); }
public static STD_REGISTRY_COHORT_TYPES GetItemByTableCode(string TABLE_NAME, string CODE) { STD_REGISTRY_COHORT_TYPES objReturn = null; STD_REGISTRY_COHORT_TYPESDB objDB = new STD_REGISTRY_COHORT_TYPESDB(); objReturn = objDB.GetItemByTableCode(TABLE_NAME, CODE); return(objReturn); }
public STD_REGISTRY_COHORT_TYPES ParseReaderCustom(DataRow row) { STD_REGISTRY_COHORT_TYPES objReturn = new STD_REGISTRY_COHORT_TYPES { CODE = (string)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_CODE")), COHORT_TYPE_ID = (Int32)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_COHORT_TYPE_ID")), COMMENT = (string)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_COMMENT")), CREATED = (DateTime)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_CREATED")), CREATEDBY = (string)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_CREATEDBY")), DESCRIPTION_TEXT = (string)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_DESCRIPTION_TEXT")), NAME = (string)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_NAME")), TABLE_NAME = (string)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_TABLE_NAME")), TYPE_PK = (Int32?)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_TYPE_PK")), UPDATED = (DateTime)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_UPDATED")), UPDATEDBY = (string)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_UPDATEDBY")), DEFAULT_FLAG = (bool)GetNullableObject(row.Field <object>("STD_REGISTRY_COHORT_TYPES_DEFAULT_FLAG")) }; return(objReturn); }
public STD_REGISTRY_COHORT_TYPES GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 COHORT_TYPE_ID) { STD_REGISTRY_COHORT_TYPES 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_STD_REGISTRY_COHORT_TYPES_getitem", 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("@COHORT_TYPE_ID", 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 Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, STD_REGISTRY_COHORT_TYPES 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_STD_REGISTRY_COHORT_TYPES_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("@CODE", SqlDbType.VarChar, 100); p.Precision = 0; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.CODE); p = new SqlParameter("@COHORT_TYPE_ID", SqlDbType.Int, 4); p.Direction = ParameterDirection.InputOutput; p.Precision = 10; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.COHORT_TYPE_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("@DESCRIPTION_TEXT", SqlDbType.VarChar, -1); p.Precision = 0; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.DESCRIPTION_TEXT); p = new SqlParameter("@NAME", SqlDbType.VarChar, 100); p.Precision = 0; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.NAME); p = new SqlParameter("@TABLE_NAME", SqlDbType.VarChar, 200); p.Precision = 0; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.TABLE_NAME); p = new SqlParameter("@TYPE_PK", SqlDbType.Int, 4); p.Precision = 10; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.TYPE_PK); 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("@DEFAULT_FLAG", SqlDbType.Bit, 1); p.Precision = 1; p.Scale = 0; AddParameter(ref sCmd, ref p, objSave.DEFAULT_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["@COHORT_TYPE_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); }
public static Boolean Delete(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, STD_REGISTRY_COHORT_TYPES objDelete) { return(Delete(CURRENT_USER, CURRENT_REGISTRY_ID, objDelete.COHORT_TYPE_ID)); }
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); }