public Boolean SaveAll(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, List <USER_ROLES> USER_ROLES)
        {
            if (USER_ROLES == null)
            {
                return(false);
            }

            Boolean objReturn = false;

            SqlConnection sConn = null;
            SqlCommand    sCmd  = null;
            SqlParameter  p     = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                foreach (USER_ROLES objSave in USER_ROLES)
                {
                    sCmd = new SqlCommand("CRS.usp_USER_ROLES_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("@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("@INACTIVE_DATE", SqlDbType.DateTime, 8);
                    p.Precision = 23;
                    p.Scale     = 3;
                    AddParameter(ref sCmd, ref p, objSave.INACTIVE_DATE);
                    p           = new SqlParameter("@INACTIVE_FLAG", SqlDbType.Bit, 1);
                    p.Precision = 1;
                    p.Scale     = 0;
                    AddParameter(ref sCmd, ref p, objSave.INACTIVE_FLAG);
                    p           = new SqlParameter("@STD_ROLE_ID", SqlDbType.Int, 4);
                    p.Precision = 10;
                    p.Scale     = 0;
                    AddParameter(ref sCmd, ref p, objSave.STD_ROLE_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("@USER_ID", SqlDbType.Int, 4);
                    p.Precision = 10;
                    p.Scale     = 0;
                    AddParameter(ref sCmd, ref p, objSave.USER_ID);
                    p           = new SqlParameter("@USER_ROLE_ID", SqlDbType.Int, 4);
                    p.Direction = ParameterDirection.InputOutput;
                    p.Precision = 10;
                    p.Scale     = 0;
                    AddParameter(ref sCmd, ref p, objSave.USER_ROLE_ID);

                    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 = true;

                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 PRPA_IN201306UV02 PRPA_IN201305UV02(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, PATIENT p)
        {
            PRPA_IN201306UV02 objReturn = null;

            try
            {
                PRPA_MT201306UV02ParameterList patientParameters = GetDemographicParameters(p);
                if (patientParameters == null)
                {
                    return(null);
                }
                QUQI_MT021001UV01DataEnterer[] currentUser = GetDataEnterer(CURRENT_USER, CURRENT_REGISTRY_ID);

                if (rsMain == null)
                {
                    InitProxy();
                }

                string createDateTime = DateTime.Now.ToString("yyyyMMddhhmmss");

                PRPA_IN201305UV02 PRPA_IN201305UV021 = new PRPA_IN201305UV02()
                {
                    id = new II()
                    {
                        root = vaRoot, extension = string.Format("{0}-{1}", "MCID", createDateTime)
                    },
                    creationTime = new TS()
                    {
                        value = createDateTime
                    },
                    versionCode = new CS()
                    {
                        code = verCode
                    },
                    interactionId = new II()
                    {
                        extension = "PRPA_IN201305UV02", root = iiRoot
                    },
                    processingCode = new CS()
                    {
                        code = prcCode
                    },
                    processingModeCode = new CS()
                    {
                        code = "T"
                    },
                    acceptAckCode = new CS()
                    {
                        code = "AL"
                    },

                    receiver = new MCCI_MT000100UV01Receiver[]
                    {
                        new MCCI_MT000100UV01Receiver()
                        {
                            typeCode = CommunicationFunctionType.RCV,
                            device   = new MCCI_MT000100UV01Device()
                            {
                                determinerCode = "INSTANCE",
                                classCode      = EntityClassDevice.DEV,
                                id             = new II[] { new II()
                                                            {
                                                                root = vaRoot
                                                            } }
                            }
                        }
                    },

                    sender = new MCCI_MT000100UV01Sender()
                    {
                        typeCode = CommunicationFunctionType.SND,
                        device   = new MCCI_MT000100UV01Device()
                        {
                            determinerCode = "INSTANCE",
                            classCode      = EntityClassDevice.DEV,
                            id             = new II[] { new II()
                                                        {
                                                            root = vaRoot, extension = "200CRSE"
                                                        } }
                        }
                    },

                    controlActProcess = new PRPA_IN201305UV02QUQI_MT021001UV01ControlActProcess()
                    {
                        dataEnterer = currentUser,
                        classCode   = ActClassControlAct.CACT,
                        moodCode    = x_ActMoodIntentEvent.EVN,
                        code        = new CD()
                        {
                            code = "PRPA_TE201305UV02", codeSystem = iiRoot
                        },

                        queryByParameter = new PRPA_MT201306UV02QueryByParameter()
                        {
                            queryId = new II()
                            {
                                root = vaRoot, extension = createDateTime
                            },
                            statusCode = new CS()
                            {
                                code = "new"
                            },
                            modifyCode = new CS()
                            {
                                code = "MVI.COMP1"
                            },
                            initialQuantity = new INT()
                            {
                                value = "1"
                            },
                            parameterList = patientParameters
                        },
                    }
                };

                ////Used for debugging request
                //SoapEnvelope envelope = new SoapEnvelope();
                //envelope.body = new Body();
                //envelope.body.PRPA_IN201305UV02 = PRPA_IN201305UV021;

                //XmlSerializer ser = new XmlSerializer(typeof(SoapEnvelope));
                //TextWriter writer = new StreamWriter("C:\\temp\\PRPA_IN201305UV02.xml");
                //ser.Serialize(writer, envelope);
                //writer.Close();

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                objReturn = rsMain.PRPA_IN201305UV02(PRPA_IN201305UV021);
                LogManager.LogTiming(logDetails);

                ////Used for debugging response
                //if (objReturn != null)
                //{
                //    envelope = new SoapEnvelope();
                //    envelope.body = new Body();
                //    envelope.body.PRPA_IN201306UV02 = objReturn;

                //    ser = new XmlSerializer(typeof(SoapEnvelope));
                //    writer = new StreamWriter("C:\\temp\\PRPA_IN201306UV02.xml");
                //    ser.Serialize(writer, envelope);
                //    writer.Close();
                //}
            }
            catch (WebException 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;
            }
            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;
            }

            return(objReturn);
        }
Ejemplo n.º 3
0
        public List <DATA_DICTIONARY> GetItems(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID)
        {
            List <DATA_DICTIONARY> 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_DATA_DICTIONARY_getitems", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_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)
                {
                    var myData = objTemp.Tables[0].AsEnumerable().Select(r => ParseReader(r));
                    if (myData != null)
                    {
                        objReturn = myData.ToList <DATA_DICTIONARY>();
                    }
                }

                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);
        }
Ejemplo n.º 4
0
        protected override void Log(string message, BaseLogType logType, LogDetails details, LogLevel loglevel)
        {
            details.Add(nameof(logType), logType?.ToString());

            LogWithDetails(() => global::Serilog.Log.Write(loglevel.ToSerilogLogLevel(), message), details);
        }
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, STD_SURVEY_SECTION 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_SURVEY_SECTION_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("@BRP_FORM_SECTION_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.BRP_FORM_SECTION_ID);
                p           = new SqlParameter("@CONCLUSION", SqlDbType.VarChar, 4000);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CONCLUSION);
                p           = new SqlParameter("@CREATED", SqlDbType.DateTime2, 6);
                p.Precision = 19;
                p.Scale     = 0;
                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", SqlDbType.VarChar, 4000);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.DESCRIPTION);
                p           = new SqlParameter("@INTRODUCTION", SqlDbType.VarChar, 4000);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.INTRODUCTION);
                p           = new SqlParameter("@LINE_NUMBER", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.LINE_NUMBER);
                p           = new SqlParameter("@MENU_ITEM_NAME", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MENU_ITEM_NAME);
                p           = new SqlParameter("@NOTES", SqlDbType.Text, 16);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.NOTES);
                p           = new SqlParameter("@STD_SURVEY_SECTION_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_SURVEY_SECTION_ID);
                p           = new SqlParameter("@STD_SURVEY_TYPE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_SURVEY_TYPE_ID);
                p           = new SqlParameter("@TITLE", SqlDbType.VarChar, 255);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.TITLE);
                p           = new SqlParameter("@TOOL_TIP", SqlDbType.VarChar, 255);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.TOOL_TIP);
                p           = new SqlParameter("@UPDATED", SqlDbType.DateTime2, 6);
                p.Precision = 19;
                p.Scale     = 0;
                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["@STD_SURVEY_SECTION_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 HttpResponseMessage Get(string sessionId, bool detailed)
        {
            SessionDetails retVal = new SessionDetails();

            try
            {
                SessionController sessionController = new SessionController();

                Session session = sessionController.GetSessionWithId(new SessionId(sessionId));

                retVal.Description   = session.Description;
                retVal.SessionId     = session.SessionId.ToString();
                retVal.StartTime     = session.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
                retVal.EndTime       = session.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                retVal.Status        = session.Status;
                retVal.HasBlobSasUri = !string.IsNullOrWhiteSpace(session.BlobSasUri);


                foreach (DiagnoserSession diagSession in session.GetDiagnoserSessions())
                {
                    DiagnoserSessionDetails diagSessionDetails = new DiagnoserSessionDetails
                    {
                        Name                    = diagSession.Diagnoser.Name,
                        CollectorStatus         = diagSession.CollectorStatus,
                        AnalyzerStatus          = diagSession.AnalyzerStatus,
                        CollectorStatusMessages = diagSession.CollectorStatusMessages,
                        AnalyzerStatusMessages  = diagSession.AnalyzerStatusMessages
                    };

                    foreach (String analyzerError in diagSession.GetAnalyzerErrors())
                    {
                        diagSessionDetails.AddAnalyzerError(analyzerError);
                    }

                    foreach (String collectorError in diagSession.GetCollectorErrors())
                    {
                        diagSessionDetails.AddCollectorError(collectorError);
                    }

                    int minLogRelativePathSegments = Int32.MaxValue;

                    double logFileSize = 0;
                    foreach (Log log in diagSession.GetLogs())
                    {
                        logFileSize += log.FileSize;
                        LogDetails logDetails = new LogDetails
                        {
                            FileName                 = log.FileName,
                            RelativePath             = log.RelativePath,
                            FullPermanentStoragePath = log.FullPermanentStoragePath,
                            StartTime                = log.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                            EndTime = log.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
                        };

                        int relativePathSegments = logDetails.RelativePath.Split('\\').Length;

                        if (relativePathSegments == minLogRelativePathSegments)
                        {
                            logDetails.RelativePath = logDetails.RelativePath.Replace('\\', '/');
                            diagSessionDetails.AddLog(logDetails);
                        }
                        else if (relativePathSegments < minLogRelativePathSegments)
                        {
                            minLogRelativePathSegments = relativePathSegments;
                            logDetails.RelativePath    = logDetails.RelativePath.Replace('\\', '/');
                            diagSessionDetails.ClearReports();
                            diagSessionDetails.AddLog(logDetails);
                        }
                    }
                    retVal.LogFilesSize = logFileSize;

                    int minReportRelativePathSegments = Int32.MaxValue;
                    foreach (Report report in diagSession.GetReports())
                    {
                        ReportDetails reportDetails = new ReportDetails
                        {
                            FileName                 = report.FileName,
                            RelativePath             = report.RelativePath,
                            FullPermanentStoragePath = report.FullPermanentStoragePath
                        };

                        int relativePathSegments = reportDetails.RelativePath.Split('\\').Length;

                        if (relativePathSegments == minReportRelativePathSegments)
                        {
                            reportDetails.RelativePath = reportDetails.RelativePath.Replace('\\', '/');
                            diagSessionDetails.AddReport(reportDetails);
                        }
                        else if (relativePathSegments < minReportRelativePathSegments)
                        {
                            minReportRelativePathSegments = relativePathSegments;
                            reportDetails.RelativePath    = reportDetails.RelativePath.Replace('\\', '/');
                            diagSessionDetails.ClearReports();
                            diagSessionDetails.AddReport(reportDetails);
                        }
                    }

                    retVal.AddDiagnoser(diagSessionDetails);
                }
            }
            catch (FileNotFoundException fex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, fex.Message));
            }
            catch (Exception ex)
            {
                Logger.LogSessionErrorEvent("Encountered exception while getting session", ex, sessionId);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, retVal));
        }
Ejemplo n.º 7
0
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, REGISTRY_CORE_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_CORE_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("@CORE_DATA_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CORE_DATA_ID);
                p           = new SqlParameter("@CORE_TYPE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CORE_TYPE_ID);
                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("@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["@CORE_DATA_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 DateTime Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, DIM_TIME objSave)
        {
            DateTime objReturn = DateTime.MinValue;

            SqlConnection sConn = null;
            SqlCommand    sCmd  = null;
            SqlParameter  p     = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_DIM_TIME_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("@Calendar_Year", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Calendar_Year);
                p           = new SqlParameter("@Date_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Date_Name);
                p           = new SqlParameter("@Day_Of_Month", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Day_Of_Month);
                p           = new SqlParameter("@Day_Of_Month_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Day_Of_Month_Name);
                p           = new SqlParameter("@Day_Of_Quarter", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Day_Of_Quarter);
                p           = new SqlParameter("@Day_Of_Quarter_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Day_Of_Quarter_Name);
                p           = new SqlParameter("@Day_Of_Year", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Day_Of_Year);
                p           = new SqlParameter("@Day_Of_Year_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Day_Of_Year_Name);
                p           = new SqlParameter("@EPRPQuarter", SqlDbType.Char, 6);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.EPRPQuarter);
                p           = new SqlParameter("@Fiscal_Day", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Day);
                p           = new SqlParameter("@Fiscal_Day_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Day_Name);
                p           = new SqlParameter("@Fiscal_Day_Of_Month", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Day_Of_Month);
                p           = new SqlParameter("@Fiscal_Day_Of_Month_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Day_Of_Month_Name);
                p           = new SqlParameter("@Fiscal_Day_Of_Quarter", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Day_Of_Quarter);
                p           = new SqlParameter("@Fiscal_Day_Of_Quarter_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Day_Of_Quarter_Name);
                p           = new SqlParameter("@Fiscal_Day_Of_Year", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Day_Of_Year);
                p           = new SqlParameter("@Fiscal_Day_Of_Year_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Day_Of_Year_Name);
                p           = new SqlParameter("@Fiscal_Month", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Month);
                p           = new SqlParameter("@Fiscal_Month_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Month_Name);
                p           = new SqlParameter("@Fiscal_Month_Of_Quarter", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Month_Of_Quarter);
                p           = new SqlParameter("@Fiscal_Month_Of_Quarter_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Month_Of_Quarter_Name);
                p           = new SqlParameter("@Fiscal_Month_Of_Year", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Month_Of_Year);
                p           = new SqlParameter("@Fiscal_Month_Of_Year_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Month_Of_Year_Name);
                p           = new SqlParameter("@Fiscal_Quarter", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Quarter);
                p           = new SqlParameter("@Fiscal_Quarter_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Quarter_Name);
                p           = new SqlParameter("@Fiscal_Quarter_Of_Year", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Quarter_Of_Year);
                p           = new SqlParameter("@Fiscal_Quarter_Of_Year_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Quarter_Of_Year_Name);
                p           = new SqlParameter("@Fiscal_Year", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Year);
                p           = new SqlParameter("@Fiscal_Year_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Fiscal_Year_Name);
                p           = new SqlParameter("@FiscalQuarterID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.FiscalQuarterID);
                p           = new SqlParameter("@FiscalYear", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.FiscalYear);
                p           = new SqlParameter("@FYQuarter", SqlDbType.Char, 6);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.FYQuarter);
                p           = new SqlParameter("@Month", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.Month);
                p           = new SqlParameter("@Month_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Month_ID);
                p           = new SqlParameter("@Month_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Month_Name);
                p           = new SqlParameter("@Month_Of_Quarter", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Month_Of_Quarter);
                p           = new SqlParameter("@Month_Of_Quarter_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Month_Of_Quarter_Name);
                p           = new SqlParameter("@Month_Of_Year", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Month_Of_Year);
                p           = new SqlParameter("@Month_Of_Year_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Month_Of_Year_Name);
                p           = new SqlParameter("@Month_Short_Name", SqlDbType.Char, 3);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Month_Short_Name);
                p           = new SqlParameter("@PK_Date", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.PK_Date);
                p           = new SqlParameter("@Quarter", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.Quarter);
                p           = new SqlParameter("@Quarter_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Quarter_Name);
                p           = new SqlParameter("@Quarter_Of_Year", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Quarter_Of_Year);
                p           = new SqlParameter("@Quarter_Of_Year_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Quarter_Of_Year_Name);
                p           = new SqlParameter("@Year", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.Year);
                p           = new SqlParameter("@Year_Name", SqlDbType.NVarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Year_Name);

                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 = (DateTime)sCmd.Parameters["@PK_Date"].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 Int32 GetPreviewCount(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, RegistryWizard registryWizard)
        {
            Int32 objReturn = 0;

            SqlConnection sConn   = null;
            SqlCommand    sCmd    = null;
            SqlDataReader sReader = null;

            try
            {
                sConn = new SqlConnection(EtlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRSE.CDW_GETData_Wizard", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@StdRegistryId", CURRENT_REGISTRY_ID);
                sCmd.Parameters.AddWithValue("@CombatLocation", registryWizard.CombatLocIds);
                sCmd.Parameters.AddWithValue("@Ethnicity", registryWizard.EthnicityIds);
                sCmd.Parameters.AddWithValue("@Gender", registryWizard.GenderIds);

                if (registryWizard.OEFOIFLocation != null && registryWizard.OEFOIFLocation.Value)
                {
                    sCmd.Parameters.AddWithValue("@OEFOIF", 1);
                }
                else
                {
                    sCmd.Parameters.AddWithValue("@OEFOIF", DBNull.Value);
                }

                sCmd.Parameters.AddWithValue("@Race", registryWizard.RaceIds);
                sCmd.Parameters.AddWithValue("@ServiceBranch", registryWizard.ServiceIds);
                sCmd.Parameters.AddWithValue("@MaritalStatus", registryWizard.MaritalStatusIds);
                sCmd.Parameters.AddWithValue("@DOBMin", registryWizard.DOBMin);
                sCmd.Parameters.AddWithValue("@DOBMax", registryWizard.DOBMax);
                sCmd.Parameters.AddWithValue("@UserName", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@Count", 1);
                sCmd.Parameters.AddWithValue("@ICD9", registryWizard.ICD9);
                sCmd.Parameters.AddWithValue("@ICD10", registryWizard.ICD10);
                sCmd.Parameters.AddWithValue("@HealthFactorType", registryWizard.HealthFactorType);
                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                sReader = sCmd.ExecuteReader();
                LogManager.LogTiming(logDetails);

                if (sReader != null && sReader.HasRows)
                {
                    sReader.Read();
                    objReturn = (Int32)GetNullableObject(sReader["Record_Count"]);
                    sReader.Close();
                }

                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 (sReader != null)
                {
                    if (!sReader.IsClosed)
                    {
                        sReader.Close();
                    }
                    sReader.Dispose();
                    sReader = null;
                }
                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.º 10
0
        public bool AddItemMyReports(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, string username, string itemPath)
        {
            bool objReturn = false;

            try
            {
                if (rsMain == null)
                {
                    rsMain = new ReportingService2010()
                    {
                        Url = ReportServiceUrl, Credentials = System.Net.CredentialCache.DefaultCredentials
                    }
                }
                ;

                if (itemPath == "/" || CheckItemExists("Folder", itemPath))
                {
                    LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);

                    Role[] roles = rsMain.ListRoles("Catalog", string.Empty);
                    if (roles != null)
                    {
                        Role[] updatedRoles  = roles.Where(role => role.Name == "My Reports").ToArray <Role>();
                        bool   foundUser     = false;
                        bool   inheritParent = false;

                        Policy[] policies = rsMain.GetPolicies(itemPath, out inheritParent);
                        if (policies != null)
                        {
                            foreach (Policy policy in policies)
                            {
                                if (policy.GroupUserName.Equals(username, StringComparison.InvariantCultureIgnoreCase))
                                {
                                    foundUser    = true;
                                    policy.Roles = updatedRoles;
                                    break;
                                }
                            }
                        }

                        if (!foundUser)
                        {
                            Policy policy = new Policy();
                            policy.GroupUserName = username;
                            policy.Roles         = updatedRoles;
                            AddToArray(ref policies, policy);
                        }

                        rsMain.SetPolicies(itemPath, policies);
                        objReturn = true;
                    }

                    LogManager.LogTiming(logDetails);
                }
            }
            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;
            }

            return(objReturn);
        }
Ejemplo n.º 11
0
        private bool CheckItemExists(string typeName, string itemName)
        {
            if (string.IsNullOrEmpty(itemName))
            {
                return(false);
            }

            bool objReturn = false;

            try
            {
                string root = "/";

                if (itemName == "/Reports")
                {
                    itemName = itemName.Replace("/", "");
                }
                else if (itemName.Contains("/"))
                {
                    root     = itemName.Substring(0, itemName.LastIndexOf("/"));
                    itemName = itemName.Replace(root, "").Replace("/", "");
                }

                if (rsMain == null)
                {
                    rsMain = new ReportingService2010()
                    {
                        Url = ReportServiceUrl, Credentials = System.Net.CredentialCache.DefaultCredentials
                    }
                }
                ;

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), string.Empty, 0);

                CatalogItem[] items = rsMain.FindItems(root,
                                                       BooleanOperatorEnum.And,
                                                       null,
                                                       new SearchCondition[]
                {
                    new SearchCondition {
                        Name = "Type", Values = new string[] { typeName }, Condition = ConditionEnum.Equals, ConditionSpecified = true
                    },
                    new SearchCondition {
                        Name = "Name", Values = new string[] { itemName }, Condition = ConditionEnum.Equals, ConditionSpecified = true
                    }
                });

                if (items != null && items.Count() > 0)
                {
                    objReturn = true;
                }

                LogManager.LogTiming(logDetails);
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), string.Empty, 0);
                throw ex;
            }

            return(objReturn);
        }
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, STD_REGISTRY objSave)
        {
            Int32 objReturn = 0;

            SqlConnection  sConn    = null;
            SqlCommand     sCmd     = null;
            SqlParameter   p        = null;
            SqlDataAdapter sAdapter = null;
            DataSet        objTemp  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_STD_REGISTRY_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, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CODE);
                p           = new SqlParameter("@COMMENTS", SqlDbType.VarChar, -1);
                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("@DESCRIPTION_TEXT", SqlDbType.VarChar, 500);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.DESCRIPTION_TEXT);
                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("@INACTIVE_DATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.INACTIVE_DATE);
                p           = new SqlParameter("@INACTIVE_FLAG", SqlDbType.Bit, 1);
                p.Precision = 1;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.INACTIVE_FLAG);
                p           = new SqlParameter("@NAME", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.NAME);
                p           = new SqlParameter("@REGISTRY_ADMINISTRATOR", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.REGISTRY_ADMINISTRATOR);
                p           = new SqlParameter("@REGISTRY_OWNER", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.REGISTRY_OWNER);
                p           = new SqlParameter("@REGISTRY_SUPPORT_CONTACT", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.REGISTRY_SUPPORT_CONTACT);
                p           = new SqlParameter("@SORT_ORDER", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.SORT_ORDER);
                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);

                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);
                //int cnt = sCmd.ExecuteNonQuery();
                sAdapter.Fill(objTemp);
                LogManager.LogTiming(logDetails);
                CheckDataSet(objTemp);

                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 (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 USER_ROLES GetItemByUserRole(string Username, string RoleName)
        {
            USER_ROLES 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_USER_ROLES_getitemByUserRole", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@USERNAME", Username);
                sCmd.Parameters.AddWithValue("@ROLENAME", RoleName);

                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), string.Empty, 0);
                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), string.Empty, 0);
                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 List <string> GetRoleByRegistryId(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID)
        {
            List <string> objReturn = new List <string>();

            SqlConnection sConn   = null;
            SqlCommand    sCmd    = null;
            SqlDataReader sReader = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_USER_ROLES_getitemByRegistryIdUsername", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID);
                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                sReader = sCmd.ExecuteReader();
                LogManager.LogTiming(logDetails);

                if (sReader != null && sReader.HasRows)
                {
                    while (sReader.Read())
                    {
                        string item = sReader[0].ToString();
                        objReturn.Add(item);
                    }
                }

                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), string.Empty, 0);
                throw ex;
            }
            finally
            {
                if (sReader != null)
                {
                    if (!sReader.IsClosed)
                    {
                        sReader.Close();
                    }
                    sReader.Dispose();
                    sReader = null;
                }
                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.º 15
0
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, STD_INSTITUTION 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_INSTITUTION_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("@ACTIVATIONDATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.ACTIVATIONDATE);
                p           = new SqlParameter("@AGENCY_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.AGENCY_ID);
                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, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CREATEDBY);
                p           = new SqlParameter("@DEACTIVATIONDATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.DEACTIVATIONDATE);
                p           = new SqlParameter("@ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ID);
                p           = new SqlParameter("@IS_ACTIVE", SqlDbType.VarChar, 1);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.IS_ACTIVE);
                p           = new SqlParameter("@MAILINGADDRESSLINE1", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MAILINGADDRESSLINE1);
                p           = new SqlParameter("@MAILINGADDRESSLINE2", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MAILINGADDRESSLINE2);
                p           = new SqlParameter("@MAILINGADDRESSLINE3", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MAILINGADDRESSLINE3);
                p           = new SqlParameter("@MAILINGCITY", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MAILINGCITY);
                p           = new SqlParameter("@MAILINGCOUNTRY_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MAILINGCOUNTRY_ID);
                p           = new SqlParameter("@MAILINGCOUNTY_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MAILINGCOUNTY_ID);
                p           = new SqlParameter("@MAILINGPOSTALCODE", SqlDbType.VarChar, 15);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MAILINGPOSTALCODE);
                p           = new SqlParameter("@MAILINGSTATE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MAILINGSTATE_ID);
                p           = new SqlParameter("@MFN_ZEG_RECIPIENT", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MFN_ZEG_RECIPIENT);
                p           = new SqlParameter("@NAME", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.NAME);
                p           = new SqlParameter("@PARENT_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PARENT_ID);
                p           = new SqlParameter("@REALIGNEDFROM_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.REALIGNEDFROM_ID);
                p           = new SqlParameter("@REALIGNEDTO_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.REALIGNEDTO_ID);
                p           = new SqlParameter("@STATIONNUMBER", SqlDbType.VarChar, 10);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STATIONNUMBER);
                p           = new SqlParameter("@STD_FACILITYTYPE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_FACILITYTYPE_ID);
                p           = new SqlParameter("@STREETADDRESSLINE1", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREETADDRESSLINE1);
                p           = new SqlParameter("@STREETADDRESSLINE2", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREETADDRESSLINE2);
                p           = new SqlParameter("@STREETADDRESSLINE3", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREETADDRESSLINE3);
                p           = new SqlParameter("@STREETCITY", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREETCITY);
                p           = new SqlParameter("@STREETCOUNTRY_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREETCOUNTRY_ID);
                p           = new SqlParameter("@STREETCOUNTY_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREETCOUNTY_ID);
                p           = new SqlParameter("@STREETPOSTALCODE", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREETPOSTALCODE);
                p           = new SqlParameter("@STREETSTATE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREETSTATE_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, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.UPDATEDBY);
                p           = new SqlParameter("@VISN_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.VISN_ID);
                p           = new SqlParameter("@VISTANAME", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.VISTANAME);

                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);
        }
        public Boolean PopulateRegistry(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, RegistryWizard registryWizard)
        {
            Boolean objReturn = false;

            SqlConnection sConn = null;
            SqlCommand    sCmd  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.RegWiz_PopulateRegistry", 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("@StdRegistryId", registryWizard.StdRegistryId);
                sCmd.Parameters.AddWithValue("@CombatLocIds", registryWizard.CombatLocIds);
                sCmd.Parameters.AddWithValue("@EthnicityIds", registryWizard.EthnicityIds);
                sCmd.Parameters.AddWithValue("@GenderIds", registryWizard.GenderIds);
                sCmd.Parameters.AddWithValue("@OEFOIFLocationIds", DBNull.Value); //registryWizard.OEFOIFLocation);
                sCmd.Parameters.AddWithValue("@RaceIds", registryWizard.RaceIds);
                sCmd.Parameters.AddWithValue("@ServiceIds", registryWizard.ServiceIds);
                sCmd.Parameters.AddWithValue("@DOBMin", registryWizard.DOBMin);
                sCmd.Parameters.AddWithValue("@DOBMax", registryWizard.DOBMax);
                sCmd.Parameters.AddWithValue("@UserName", registryWizard.Username);

                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 = true;

                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.º 17
0
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, INDIVIDUAL 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_INDIVIDUAL_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("@BIRTH_DATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.BIRTH_DATE);
                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("@DEATH_DATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.DEATH_DATE);
                p           = new SqlParameter("@FIRST_NAME", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.FIRST_NAME);
                p           = new SqlParameter("@IND_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.IND_ID);
                p           = new SqlParameter("@LAST_NAME", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.LAST_NAME);
                p           = new SqlParameter("@MIDDLE_NAME", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MIDDLE_NAME);
                p           = new SqlParameter("@PATIENT_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PATIENT_ID);
                p           = new SqlParameter("@PREFIX", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PREFIX);
                p           = new SqlParameter("@SUFFIX", SqlDbType.VarChar, 25);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.SUFFIX);
                p           = new SqlParameter("@TITLE", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.TITLE);
                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["@IND_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.º 18
0
 // GET api/values
 public async Task <IEnumerable <string> > Get()
 {
     LogDetails.WrokFlowLog($" Controller : - In Message Class  Get Messages Method Called ");
     return(await _messages.GetMessages());
 }
Ejemplo n.º 19
0
        public DiagnoserSessionDetails Get(string sessionId, string diagnoser, bool detailed)
        {
            SessionController sessionController = new SessionController();

            Session session = sessionController.GetSessionWithId(new SessionId(sessionId));

            DiagnoserSession diagSession = session.GetDiagnoserSessions().First(p => p.Diagnoser.Name.Equals(diagnoser, StringComparison.OrdinalIgnoreCase));

            DiagnoserSessionDetails retVal = new DiagnoserSessionDetails
            {
                Name                    = diagSession.Diagnoser.Name,
                CollectorStatus         = diagSession.CollectorStatus,
                AnalyzerStatus          = diagSession.AnalyzerStatus,
                CollectorStatusMessages = diagSession.CollectorStatusMessages,
                AnalyzerStatusMessages  = diagSession.AnalyzerStatusMessages
            };

            foreach (String analyzerError in diagSession.GetAnalyzerErrors())
            {
                retVal.AddAnalyzerError(analyzerError);
            }

            foreach (String collectorError in diagSession.GetCollectorErrors())
            {
                retVal.AddCollectorError(collectorError);
            }

            int minLogRelativePathSegments = Int32.MaxValue;

            foreach (Log log in diagSession.GetLogs())
            {
                LogDetails temp = new LogDetails
                {
                    FileName                 = log.FileName,
                    RelativePath             = log.RelativePath,
                    FullPermanentStoragePath = log.FullPermanentStoragePath,
                    StartTime                = log.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    EndTime = log.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
                };

                int relativePathSegments = temp.RelativePath.Split('\\').Length;

                if (relativePathSegments == minLogRelativePathSegments)
                {
                    temp.RelativePath = temp.RelativePath.Replace('\\', '/');
                    retVal.AddLog(temp);
                }
                else if (relativePathSegments < minLogRelativePathSegments)
                {
                    minLogRelativePathSegments = relativePathSegments;
                    temp.RelativePath          = temp.RelativePath.Replace('\\', '/');
                    retVal.ClearReports();
                    retVal.AddLog(temp);
                }
            }

            int minReportRelativePathSegments = Int32.MaxValue;

            foreach (Report report in diagSession.GetReports())
            {
                ReportDetails temp = new ReportDetails
                {
                    FileName                 = report.FileName,
                    RelativePath             = report.RelativePath,
                    FullPermanentStoragePath = report.FullPermanentStoragePath
                };

                int relativePathSegments = temp.RelativePath.Split('\\').Length;

                if (relativePathSegments == minReportRelativePathSegments)
                {
                    temp.RelativePath = temp.RelativePath.Replace('\\', '/');
                    retVal.AddReport(temp);
                }
                else if (relativePathSegments < minReportRelativePathSegments)
                {
                    minReportRelativePathSegments = relativePathSegments;
                    temp.RelativePath             = temp.RelativePath.Replace('\\', '/');
                    retVal.ClearReports();
                    retVal.AddReport(temp);
                }
            }

            return(retVal);
        }
Ejemplo n.º 20
0
 // GET api/values/5
 public async Task <string> Get(int id)
 {
     LogDetails.WrokFlowLog($" Controller : - In Message Class  Get Message Method Called ID: {id}");
     return(await _messages.GetMessage(id));
 }
Ejemplo n.º 21
0
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, WKF_CASE_ACTIVITY objSave)
        {
            Int32 objReturn = 0;

            SqlConnection  sConn    = null;
            SqlCommand     sCmd     = null;
            SqlParameter   p        = null;
            SqlDataAdapter sAdapter = null;
            DataSet        objTemp  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_WKF_CASE_ACTIVITY_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("@ADDRESS_LINE1", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ADDRESS_LINE1);
                p           = new SqlParameter("@ADDRESS_LINE2", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ADDRESS_LINE2);
                p           = new SqlParameter("@ADDRESS_LINE3", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ADDRESS_LINE3);
                p           = new SqlParameter("@BEST_CALL_BACK_TIME", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.BEST_CALL_BACK_TIME);
                p           = new SqlParameter("@CITY", SqlDbType.VarChar, 60);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CITY);
                p           = new SqlParameter("@CONTACT_EMAIL", SqlDbType.VarChar, 255);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CONTACT_EMAIL);
                p           = new SqlParameter("@CONTACT_NAME", SqlDbType.VarChar, 255);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CONTACT_NAME);
                p           = new SqlParameter("@CONTACT_PHONE", SqlDbType.VarChar, 255);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CONTACT_PHONE);
                p           = new SqlParameter("@COUNTRY", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.COUNTRY);
                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("@INFO_CONVEYED_TEXT", SqlDbType.VarChar, -1);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.INFO_CONVEYED_TEXT);
                p           = new SqlParameter("@INFO_RECEIVED_TEXT", SqlDbType.VarChar, -1);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.INFO_RECEIVED_TEXT);
                p           = new SqlParameter("@POSTAL_CODE", SqlDbType.VarChar, 10);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.POSTAL_CODE);
                p           = new SqlParameter("@STATE", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STATE);
                p           = new SqlParameter("@STD_WKFACTIVITYTYPE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_WKFACTIVITYTYPE_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("@WKF_CASE_ACTIVITY_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.WKF_CASE_ACTIVITY_ID);
                p           = new SqlParameter("@WKF_CASE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.WKF_CASE_ID);
                p           = new SqlParameter("@STD_WKFACTIVITYSTS_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_WKFACTIVITYSTS_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);
                //int cnt = sCmd.ExecuteNonQuery();
                sAdapter.Fill(objTemp);
                LogManager.LogTiming(logDetails);
                CheckDataSet(objTemp);

                objReturn = (Int32)sCmd.Parameters["@WKF_CASE_ACTIVITY_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 (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 List <DomainUser> GetActiveDirectory(DomainNames domainNames, string searchString)
        {
            List <DomainUser> objReturn = null;

            DirectoryEntry         rootEntry    = null;
            DirectorySearcher      searcher     = null;
            SearchResultCollection queryResults = null;

            try
            {
                rootEntry = new DirectoryEntry("GC://DC=va,DC=gov");
                searcher  = new DirectorySearcher(rootEntry);

                searcher.PropertiesToLoad.Add("distinguishedName");
                searcher.PropertiesToLoad.Add("sAMAccountName");
                searcher.PropertiesToLoad.Add("givenName");
                //searcher.PropertiesToLoad.Add("middleName");//Property doesn't exist
                searcher.PropertiesToLoad.Add("sn");
                //searcher.PropertiesToLoad.Add("maidenName");//Property doesn't exist
                searcher.PropertiesToLoad.Add("mail");
                //searcher.PropertiesToLoad.Add("employeeNumber");//Property doesn't exist
                searcher.PropertiesToLoad.Add("title");
                searcher.PropertiesToLoad.Add("telephoneNumber");
                searcher.PropertiesToLoad.Add("facsimileTelephoneNumber");

                //searcher.ServerTimeLimit = new TimeSpan(0, 0, 30);
                //searcher.ClientTimeout = new TimeSpan(0, 10, 0);

                //Validate searchString (LDAP Injection )

                string whitelist = "^[a-zA-Z0-9-,. ]+$";
                Regex  pattern   = new Regex(whitelist);

                if (!pattern.IsMatch(searchString))
                {
                    throw new Exception("Invalid Search Criteria");
                }

                //Filter results by last name and/or first name and must have username
                searcher.Filter = "(&(anr=" + searchString + ")(sAMAccountName=*)(objectCategory=person))";

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), string.Empty, 0);
                queryResults = searcher.FindAll();
                LogManager.LogTiming(logDetails);

                //If there is a better way to bind AD Results to a Grid
                //we should implement it.  This loop seems to take up a
                //majority of the time in this process.
                if (queryResults != null && queryResults.Count > 0)
                {
                    objReturn = new List <DomainUser>();

                    foreach (SearchResult searchResult in queryResults)
                    {
                        string username    = string.Empty;
                        string domainName  = string.Empty;
                        string accountName = string.Empty;

                        if (searchResult.Properties.Contains("distinguishedName"))
                        {
                            domainName = domainNames.FindByDistinguishedName(searchResult.Properties["distinguishedName"][0].ToString());
                        }

                        if (searchResult.Properties.Contains("sAMAccountName"))
                        {
                            accountName = searchResult.Properties["sAMAccountName"][0].ToString().ToUpper();
                        }

                        username = domainName + "\\" + accountName;

                        DomainUser user = new DomainUser(searchResult);
                        user.Username = username;
                        objReturn.Add(user);
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), string.Empty, 0);
                throw ex;
            }
            finally
            {
                if (queryResults != null)
                {
                    queryResults.Dispose();
                    queryResults = null;
                }

                if (searcher != null)
                {
                    searcher.Dispose();
                    searcher = null;
                }

                if (rootEntry != null)
                {
                    rootEntry.Close();
                    rootEntry.Dispose();
                    rootEntry = null;
                }
            }

            return(objReturn);
        }
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, WKF_CASE objSave)
        {
            Int32 objReturn = 0;

            SqlConnection  sConn    = null;
            SqlCommand     sCmd     = null;
            SqlParameter   p        = null;
            SqlDataAdapter sAdapter = null;
            DataSet        objTemp  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_WKF_CASE_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("@CASE_DUE_DATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.CASE_DUE_DATE);
                p           = new SqlParameter("@CASE_NUMBER", SqlDbType.VarChar, 30);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CASE_NUMBER);
                p           = new SqlParameter("@CASE_START_DATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.CASE_START_DATE);
                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("@PARENT_CASE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PARENT_CASE_ID);
                p           = new SqlParameter("@PATIENT_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PATIENT_ID);
                p           = new SqlParameter("@REFERRAL_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.REFERRAL_ID);
                p           = new SqlParameter("@STD_WKFCASETYPE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_WKFCASETYPE_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("@WKF_CASE_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.WKF_CASE_ID);
                p           = new SqlParameter("@STD_WKFCASESTS_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_WKFCASESTS_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);
                //int cnt = sCmd.ExecuteNonQuery();
                sAdapter.Fill(objTemp);
                LogManager.LogTiming(logDetails);
                CheckDataSet(objTemp);

                objReturn = (Int32)sCmd.Parameters["@WKF_CASE_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 (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, INDIVIDUAL_ADDRESS 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_INDIVIDUAL_ADDRESS_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("@ACCEPTS_TXT_MSG", SqlDbType.Bit, 1);
                p.Precision = 1;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ACCEPTS_TXT_MSG);
                p           = new SqlParameter("@ADDRESS_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ADDRESS_ID);
                p           = new SqlParameter("@ALT_EMAIL", SqlDbType.VarChar, 128);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ALT_EMAIL);
                p           = new SqlParameter("@CELL_PHONE", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CELL_PHONE);
                p           = new SqlParameter("@CITY", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CITY);
                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("@EMAIL", SqlDbType.VarChar, 128);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.EMAIL);
                p           = new SqlParameter("@FAX", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.FAX);
                p           = new SqlParameter("@IND_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.IND_ID);
                p           = new SqlParameter("@PHONE", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PHONE);
                p           = new SqlParameter("@POSTAL_CODE", SqlDbType.VarChar, 10);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.POSTAL_CODE);
                p           = new SqlParameter("@STD_ADDRESSTYPE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_ADDRESSTYPE_ID);
                p           = new SqlParameter("@STD_COUNTRY_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_COUNTRY_ID);
                p           = new SqlParameter("@STD_STATE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_STATE_ID);
                p           = new SqlParameter("@STREET1", SqlDbType.VarChar, 256);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREET1);
                p           = new SqlParameter("@STREET2", SqlDbType.VarChar, 256);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREET2);
                p           = new SqlParameter("@STREET3", SqlDbType.VarChar, 256);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STREET3);
                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["@ADDRESS_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 STD_WKFACTIVITYSTS GetItemByCode(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, string CODE)
        {
            STD_WKFACTIVITYSTS 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_WKFACTIVITYSTS_getitemByCode", 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("@CODE", CODE);

                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);
        }
Ejemplo n.º 26
0
        public STD_REGISTRY GetSystemRegistry()
        {
            STD_REGISTRY 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_getitemSystem", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;

                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), string.Empty, 0);
                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), string.Empty, 0);
                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);
        }
Ejemplo n.º 27
0
        public string Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, DATA_DICTIONARY objSave)
        {
            string objReturn = string.Empty;

            SqlConnection sConn = null;
            SqlCommand    sCmd  = null;
            SqlParameter  p     = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_DATA_DICTIONARY_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("@AllowsNull", SqlDbType.Float, 8);
                p.Precision = 53;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.AllowsNull);
                p           = new SqlParameter("@ColumnName", SqlDbType.NVarChar, 510);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ColumnName);
                p           = new SqlParameter("@DataType", SqlDbType.NVarChar, 510);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.DataType);
                p           = new SqlParameter("@Description", SqlDbType.NVarChar, 510);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.Description);
                p           = new SqlParameter("@ObjectName", SqlDbType.NVarChar, 510);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ObjectName);

                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 = (string)sCmd.Parameters["@ObjectName"].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.º 28
0
        public HttpResponseMessage Get(string type, bool detailed)
        {
            List <SessionDetails> retVal = new List <SessionDetails>();

            try
            {
                SessionController sessionController = new SessionController();

                IEnumerable <Session> sessions;

                switch (type.ToLowerInvariant())
                {
                case "all":
                    sessions = sessionController.GetAllSessions();
                    break;

                case "pending":
                    sessions = sessionController.GetAllActiveSessions();
                    break;

                case "needanalysis":
                    sessions = sessionController.GetAllUnanalyzedSessions();
                    break;

                case "complete":
                    sessions = sessionController.GetAllCompletedSessions();
                    break;

                default:
                    sessions = sessionController.GetAllSessions();
                    break;
                }

                IEnumerable <Session> sortedSessions = sessions.OrderByDescending(p => p.StartTime);

                foreach (Session session in sortedSessions)
                {
                    SessionDetails sessionDetails = new SessionDetails
                    {
                        Description   = session.Description,
                        SessionId     = session.SessionId.ToString(),
                        StartTime     = session.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        EndTime       = session.EndTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        Status        = session.Status,
                        HasBlobSasUri = !string.IsNullOrWhiteSpace(session.BlobSasUri)
                    };

                    foreach (DiagnoserSession diagSession in session.GetDiagnoserSessions())
                    {
                        DiagnoserSessionDetails diagSessionDetails = new DiagnoserSessionDetails
                        {
                            Name                    = diagSession.Diagnoser.Name,
                            CollectorStatus         = diagSession.CollectorStatus,
                            AnalyzerStatus          = diagSession.AnalyzerStatus,
                            CollectorStatusMessages = diagSession.CollectorStatusMessages,
                            AnalyzerStatusMessages  = diagSession.AnalyzerStatusMessages
                        };

                        foreach (String analyzerError in diagSession.GetAnalyzerErrors())
                        {
                            diagSessionDetails.AddAnalyzerError(analyzerError);
                        }

                        foreach (String collectorError in diagSession.GetCollectorErrors())
                        {
                            diagSessionDetails.AddCollectorError(collectorError);
                        }

                        int minLogRelativePathSegments = Int32.MaxValue;

                        double logFileSize = 0;
                        foreach (Log log in diagSession.GetLogs())
                        {
                            logFileSize += log.FileSize;
                            LogDetails logDetails = new LogDetails
                            {
                                FileName                 = log.FileName,
                                RelativePath             = log.RelativePath,
                                FullPermanentStoragePath = log.FullPermanentStoragePath,
                                StartTime                = log.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                EndTime = log.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
                            };

                            int relativePathSegments = logDetails.RelativePath.Split('\\').Length;

                            if (relativePathSegments == minLogRelativePathSegments)
                            {
                                logDetails.RelativePath = logDetails.RelativePath.Replace('\\', '/');
                                diagSessionDetails.AddLog(logDetails);
                            }
                            else if (relativePathSegments < minLogRelativePathSegments)
                            {
                                minLogRelativePathSegments = relativePathSegments;
                                logDetails.RelativePath    = logDetails.RelativePath.Replace('\\', '/');
                                diagSessionDetails.ClearReports();
                                diagSessionDetails.AddLog(logDetails);
                            }
                        }
                        sessionDetails.LogFilesSize = logFileSize;

                        int minReportRelativePathSegments = Int32.MaxValue;
                        foreach (Report report in diagSession.GetReports())
                        {
                            ReportDetails reportDetails = new ReportDetails
                            {
                                FileName                 = report.FileName,
                                RelativePath             = report.RelativePath,
                                FullPermanentStoragePath = report.FullPermanentStoragePath
                            };

                            int relativePathSegments = reportDetails.RelativePath.Split('\\').Length;

                            if (relativePathSegments == minReportRelativePathSegments)
                            {
                                reportDetails.RelativePath = reportDetails.RelativePath.Replace('\\', '/');
                                diagSessionDetails.AddReport(reportDetails);
                            }
                            else if (relativePathSegments < minReportRelativePathSegments)
                            {
                                minReportRelativePathSegments = relativePathSegments;
                                reportDetails.RelativePath    = reportDetails.RelativePath.Replace('\\', '/');
                                diagSessionDetails.ClearReports();
                                diagSessionDetails.AddReport(reportDetails);
                            }
                        }

                        sessionDetails.AddDiagnoser(diagSessionDetails);
                    }

                    retVal.Add(sessionDetails);
                }
            }
            catch (Exception ex)
            {
                Logger.LogErrorEvent("Encountered exception while getting sessions from file", ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, $"Encountered exception {ex.Message} while getting sessions from file"));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, retVal));
        }
Ejemplo n.º 29
0
 public void DisplayLog(LogDetails detail)
 {
     logBox.gameObject.SetActive(true);
     logDetail = detail;
 }
        public string[] GetRoles(string Username)
        {
            string[] objReturn = null;

            SqlConnection sConn   = null;
            SqlCommand    sCmd    = null;
            SqlDataReader sReader = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_USER_ROLES_getrolesByUser", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@USERNAME", Username);
                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), string.Empty, 0);
                sReader = sCmd.ExecuteReader();
                LogManager.LogTiming(logDetails);

                if (sReader != null && sReader.HasRows)
                {
                    while (sReader.Read())
                    {
                        AddToArray(ref objReturn, sReader.GetString(0));
                    }
                }

                sReader.Close();
                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), string.Empty, 0);
                throw ex;
            }
            finally
            {
                if (sReader != null)
                {
                    if (!sReader.IsClosed)
                    {
                        sReader.Close();
                    }
                    sReader.Dispose();
                    sReader = null;
                }
                if (sCmd != null)
                {
                    sCmd.Dispose();
                    sCmd = null;
                }
                if (sConn != null)
                {
                    if (sConn.State != ConnectionState.Closed)
                    {
                        sConn.Close();
                    }
                    sConn.Dispose();
                    sConn = null;
                }
            }

            return(objReturn);
        }