Ejemplo n.º 1
0
        public static Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, MESSAGE_LOG objSave)
        {
            Int32         objReturn = 0;
            MESSAGE_LOGDB objDB     = new MESSAGE_LOGDB();

            objReturn = objDB.Save(CURRENT_USER, CURRENT_REGISTRY_ID, objSave);

            return(objReturn);
        }
Ejemplo n.º 2
0
        public static MESSAGE_LOG GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 CALL_ID)
        {
            MESSAGE_LOG   objReturn = null;
            MESSAGE_LOGDB objDB     = new MESSAGE_LOGDB();

            objReturn = objDB.GetItem(CURRENT_USER, CURRENT_REGISTRY_ID, CALL_ID);

            return(objReturn);
        }
        public MESSAGE_LOG ParseReaderCustom(DataRow row)
        {
            MESSAGE_LOG objReturn = new MESSAGE_LOG
            {
                CALL_ID           = (Int32)GetNullableObject(row.Field <object>("MESSAGE_LOG_CALL_ID")),
                COMMENTS          = (string)GetNullableObject(row.Field <object>("MESSAGE_LOG_COMMENTS")),
                CREATED           = (DateTime)GetNullableObject(row.Field <object>("MESSAGE_LOG_CREATED")),
                CREATEDBY         = (string)GetNullableObject(row.Field <object>("MESSAGE_LOG_CREATEDBY")),
                ERROR_LEVEL       = (Int32?)GetNullableObject(row.Field <object>("MESSAGE_LOG_ERROR_LEVEL")),
                MESSAGE_STATUS_ID = (Int32)GetNullableObject(row.Field <object>("MESSAGE_LOG_MESSAGE_STATUS_ID")),
                MESSAGE_TYPE_ID   = (Int32)GetNullableObject(row.Field <object>("MESSAGE_LOG_MESSAGE_TYPE_ID")),
                PARAMETERS        = (string)GetNullableObject(row.Field <object>("MESSAGE_LOG_PARAMETERS")),
                RETURNED_DATA     = (string)GetNullableObject(row.Field <object>("MESSAGE_LOG_RETURNED_DATA")),
                SENT            = (DateTime)GetNullableObject(row.Field <object>("MESSAGE_LOG_SENT")),
                STD_REGISTRY_ID = (Int32)GetNullableObject(row.Field <object>("MESSAGE_LOG_STD_REGISTRY_ID")),
                UPDATED         = (DateTime)GetNullableObject(row.Field <object>("MESSAGE_LOG_UPDATED")),
                UPDATEDBY       = (string)GetNullableObject(row.Field <object>("MESSAGE_LOG_UPDATEDBY"))
            };

            return(objReturn);
        }
        public MESSAGE_LOG GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 CALL_ID)
        {
            MESSAGE_LOG 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_MESSAGE_LOG_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("@CALL_ID", CALL_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, MESSAGE_LOG 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_MESSAGE_LOG_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("@CALL_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CALL_ID);
                p           = new SqlParameter("@COMMENTS", SqlDbType.VarChar, 1000);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.COMMENTS);
                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("@ERROR_LEVEL", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ERROR_LEVEL);
                p           = new SqlParameter("@MESSAGE_STATUS_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MESSAGE_STATUS_ID);
                p           = new SqlParameter("@MESSAGE_TYPE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MESSAGE_TYPE_ID);
                p           = new SqlParameter("@PARAMETERS", SqlDbType.VarChar, -1);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PARAMETERS);
                p           = new SqlParameter("@RETURNED_DATA", SqlDbType.VarChar, -1);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.RETURNED_DATA);
                p           = new SqlParameter("@SENT", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.SENT);
                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);

                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["@CALL_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);
        }
Ejemplo n.º 6
0
 public static Boolean Delete(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, MESSAGE_LOG objDelete)
 {
     return(Delete(CURRENT_USER, CURRENT_REGISTRY_ID, objDelete.CALL_ID));
 }