Exemple #1
0
        private void GetRequestResponse(IAsyncResult result)
        {
            try {
                Result = ((ISampleService)result.AsyncState).EndGetOOS(result);
            }catch (Exception ex) {
                Error = ex;
            }finally {
                service.Close();
                service = null;
            }

            // Execute Last
            Caliburn.Micro.Execute.OnUIThread(() => Completed(this, new ResultCompletionEventArgs()));
        }
Exemple #2
0
 public IAsyncResult BeginSaveOos(Oos oos, Identification identification, AsyncCallback callback, object state)
 {
     logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
     identification.UserId = AppLib.VerifyToken(identification.Token);
     if (identification.UserId <= 0) {
         throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
     }
     var task = Task<int>.Factory.StartNew(process => DoSaveOos(oos, identification), state);
     return task.ContinueWith(res => callback(task));
 }
Exemple #3
0
        public int DoSaveOos(Oos oos, Identification identification)
        {
            logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));

            //Validate Oos Object
            if (!oos.ValidateModel())
                throw new FaultException<ServiceFault>(new ServiceFault(oos.CurrentErrors), new FaultReason(SysVars.InvalidFormat));
            // Save Oos
            using (SampleDAO dao = new SampleDAO()) {
                return dao.SaveOOS(oos, identification);
            }
        }
        public Oos GetOosData(string token, object recordId)
        {
            Oos result = new Oos();
            User user = new User();
            int userId = 0;
            this.Token = token;

            if (AppLib.DesignMode)
            {
                return new Oos();
            }
            else
            {
                try
                {
                    using (SystemDAO systemDao = new SystemDAO())
                    {
                        userId = systemDao.GetToken(new Guid(this.Token));
                    }
                    if (userId > 0)
                    {
                        using (UserDAO userDao = new UserDAO())
                        {
                            user = userDao.GetUser(userId);
                        }
                        using (SampleDAO ordersDao = new SampleDAO())
                        {
                            result = ordersDao.GetOOS(Convert.ToInt32(recordId), new Identification() { Token = new Guid(this.Token), UserId = (int)user.UserId });
                        }
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return result;
        }
Exemple #5
0
        public int SaveOrderSampleTestOos(ref MsSqlPersistence dbConnection, ref SqlCommand dbCommand, Oos oos, Identification identification)
        {
            try
            {
                int returnValue = 0;
                string sql = string.Empty;
                dbCommand.Parameters.Clear();
                if (oos.IsDirty)
                {
                    sql = string.Empty;
                    if (oos.OosId.IsNull() || oos.OosId <= 0)
                    {
                        sql = @"
                        INSERT INTO orders_samples_tests_timepoints_oos
                                   ([parentid]
                                   ,[status]
                                   ,[is_sample_prep_acceptable]
                                   ,[is_raw_data_acceptable]
                                   ,[is_standard_acceptable]
                                   ,[is_method_acceptable]
                                   ,[is_parameters_acceptable]
                                   ,[is_trends_acceptable]
                                   ,[is_analyst_acceptable]
                                   ,[is_retest]
                                   ,[primary_cause]
                                   ,[client_contact_id]
                                   ,[client_contact_phone_id]
                                   ,[is_client_notified]
                                   ,[is_testing_complete]
                                   ,[review_comment]
                                   ,[conclusion_comment]
                                   ,[investigator_id]
                                   ,[investigation_date]
                                   ,[approved_by]
                                   ,[approved_date]
                                   ,[created_by]
                                   )
                             VALUES
                                   (@ParentId
                                   ,@Status
                                   ,@IsSamplePrepAcceptable
                                   ,@IsRawDataAcceptable
                                   ,@IsStandardAcceptable
                                   ,@IsMethodAcceptable
                                   ,@IsParametersAcceptable
                                   ,@IsTrendsAcceptable
                                   ,@IsAnalystAcceptable
                                   ,@IsRetest
                                   ,@PrimaryCause
                                   ,@ClientContactId
                                   ,@ClientContactPhoneId
                                   ,@IsClientNotified
                                   ,@IsTestingComplete
                                   ,@ReviewComment
                                   ,@ConclusionComment
                                   ,@InvestigatorId
                                   ,@InvestigationDate
                                   ,@ApprovedBy
                                   ,@ApprovedDate
                                   ,@CreatedBy
                                   );
                                SELECT id FROM orders_samples_tests_timepoints_oos WHERE (id = SCOPE_IDENTITY());
                                ";

                        dbCommand.Parameters.Add("@ParentId", System.Data.SqlDbType.Int).Value = oos.SampleTestId;
                        dbCommand.Parameters.Add("@CreatedBy", System.Data.SqlDbType.Int).Value = identification.UserId;
                    }
                    else
                    {
                        sql = @"
                                UPDATE orders_samples_tests_timepoints_oos
                                   SET status = @Status
                                      ,is_sample_prep_acceptable = @IsSamplePrepAcceptable
                                      ,is_raw_data_acceptable = @IsRawDataAcceptable
                                      ,is_standard_acceptable = @IsStandardAcceptable
                                      ,is_method_acceptable = @IsMethodAcceptable
                                      ,is_parameters_acceptable = @IsParametersAcceptable
                                      ,is_trends_acceptable = @IsTrendsAcceptable
                                      ,is_analyst_acceptable = @IsAnalystAcceptable
                                      ,is_retest = @IsRetest
                                      ,primary_cause = @PrimaryCause
                                      ,client_contact_id = @ClientContactId
                                      ,client_contact_phone_id = @ClientContactPhoneId
                                      ,is_client_notified = @IsClientNotified
                                      ,is_testing_complete = @IsTestingComplete
                                      ,review_comment = @ReviewComment
                                      ,conclusion_comment = @ConclusionComment
                                      ,investigator_id = @InvestigatorId
                                      ,investigation_date = @InvestigationDate
                                      ,approved_by = @ApprovedBy
                                      ,approved_date = @ApprovedDate
                                      ,modified_by = @ModifiedBy
                                WHERE id = @ID;
                                ";

                        dbCommand.Parameters.Add("@ID", System.Data.SqlDbType.Int).Value = oos.OosId;
                        dbCommand.Parameters.Add("@ModifiedBy", System.Data.SqlDbType.Int).Value = identification.UserId;
                    }
                    dbCommand.CommandText = sql;
                    /*dbCommand.Parameters.Add("@Status", System.Data.SqlDbType.Int).Value = (int)oos.Status;
                    dbCommand.Parameters.Add("@IsSamplePrepAcceptable", System.Data.SqlDbType.Bit).Value = oos.PreparationYN;
                    dbCommand.Parameters.Add("@IsRawDataAcceptable", System.Data.SqlDbType.Bit).Value = oos.RawDataYN;
                    dbCommand.Parameters.Add("@IsStandardAcceptable", System.Data.SqlDbType.Bit).Value = oos.StandardsReagentsYN;
                    dbCommand.Parameters.Add("@IsMethodAcceptable", System.Data.SqlDbType.Bit).Value = oos.MethodologyYN;
                    dbCommand.Parameters.Add("@IsParametersAcceptable", System.Data.SqlDbType.Bit).Value = oos.InstrumentParametersYN;
                    dbCommand.Parameters.Add("@IsTrendsAcceptable", System.Data.SqlDbType.Bit).Value = oos.TrendsYN;
                    dbCommand.Parameters.Add("@IsAnalystAcceptable", System.Data.SqlDbType.Bit).Value = oos.AnalystYN;
                    dbCommand.Parameters.Add("@IsRetest", System.Data.SqlDbType.Bit).Value = oos.IsRetest;
                    dbCommand.Parameters.Add("@PrimaryCause", System.Data.SqlDbType.VarChar, 50).Value = oos.PrimaryCause ?? string.Empty;
                    dbCommand.Parameters.Add("@ClientContactId", System.Data.SqlDbType.Int).Value = oos.ClientContactEmailYN ?? 0;
                    dbCommand.Parameters.Add("@ClientContactPhoneId", System.Data.SqlDbType.Int).Value = oos.ClientContactPhoneYN ?? 0;
                    dbCommand.Parameters.Add("@IsClientNotified", System.Data.SqlDbType.Bit).Value = oos.IsClientNotified;
                    dbCommand.Parameters.Add("@IsTestingComplete", System.Data.SqlDbType.Bit).Value = oos.IsTestingComplete;

                    dbCommand.Parameters.Add("@ReviewComment", System.Data.SqlDbType.NVarChar, -1).Value = oos.AdditionalObservations ?? string.Empty;
                    dbCommand.Parameters.Add("@ConclusionComment", System.Data.SqlDbType.NVarChar, -1).Value = oos.Conclusion ?? string.Empty;

                    dbCommand.Parameters.Add("@InvestigatorId", System.Data.SqlDbType.Int).Value = oos.InvestigatorId ?? 0;
                    dbCommand.Parameters.Add("@InvestigationDate", System.Data.SqlDbType.DateTime).Value = oos.InvestigationDate.HasValue ? oos.InvestigationDate.Value : SqlDateTime.Null;
                    dbCommand.Parameters.Add("@ApprovedBy", System.Data.SqlDbType.Int).Value = oos.ApprovedBy ?? 0;
                    dbCommand.Parameters.Add("@ApprovedDate", System.Data.SqlDbType.DateTime).Value = oos.ApprovedDate.HasValue ? oos.ApprovedDate.Value : SqlDateTime.Null;
                    */
                    if (oos.OosId.IsNotNull() && oos.OosId > 0)
                        returnValue += dbConnection.ExecuteCommand(dbCommand);
                    else
                        returnValue = (int)dbConnection.ExecuteScalar(dbCommand);

                    // Create Timepoint Entry if IsRetest

                    // Calculate SampleTest Status
                    if (oos.SampleTestId.IsNotNull())
                        this.OrderSampleTestsSetStatus(ref dbConnection, ref dbCommand, (int)oos.SampleTestId, identification);

                    // Release Lock
                    using (SystemDAO systemDao = new SystemDAO())
                    {
                        //systemDao.ReleaseLock(ref dbConnection, ref dbCommand, (int)ModelNamesEnum.Order, oos.OrderId.ToString(), identification.Token);
                    }
                }
                return returnValue;
            }
            catch
            {
                throw;
            }
        }
Exemple #6
0
        private SmartCollection<Oos> GetOOSs(bool showAll, ref MsSqlPersistence dbConnection, ref SqlCommand dbCommand, Identification identification)
        {
            try
            {
                SmartCollection<Oos> resultList = new SmartCollection<Oos>();

                using (DbConnection = new MsSqlPersistence(DbConnectionSettings))
                {
                    if (DbConnection.IsConnected())
                    {
                        using (DbCommand)
                        {
                            DbCommand.CommandType = CommandType.StoredProcedure;
                            DbCommand.CommandText = "uspGetOOSs";
                            DbCommand.Parameters.Clear();
                            dbCommand.Parameters.Add("@IncludeAll", System.Data.SqlDbType.Bit).Value = showAll;
                            DataTable returnDT = DbConnection.ExecuteQuery(DbCommand);
                            foreach (DataRow row in returnDT.Rows)
                            {
                                Oos result = new Oos();
                                result.OosId = Convert.ToInt32(row["OOSID"]);
                                if (row["ARLNumber"] != DBNull.Value)
                                    result.ARLNumber = (int)row["ARLNumber"];
                                if (row["SampleTestId"] != DBNull.Value)
                                result.SampleTestId = (int)row["SampleTestId"];
                                result.ClientName = row["ClientName"].ToString();
                                result.Status = row["status"] != DBNull.Value ? (SampleTestStatus)row["status"] : SampleTestStatus.UnderInvestigation;
                                result.TestName = row["TestName"].ToString();
                                result.AnalyteName = row["AnalyteName"].ToString();
                                result.PriorityName = row["PriorityName"].ToString();
                                if (row["DueDate"] != DBNull.Value)
                                    result.DueDate = (DateTime)row["DueDate"];
                                result.DepartmentName = row["DepartmentName"].ToString();
                                if (row["TimepointStudyYN"] != DBNull.Value)
                                    result.TimepointStudyYN = (bool)row["TimepointStudyYN"];
                                if (row["NextTimepoint"] != DBNull.Value)
                                    result.NextTimepoint = (DateTime)row["NextTimepoint"];

                                result.ModifiedUser = row["ModifiedUser"] != DBNull.Value ? row["ModifiedUser"].ToString() : null;
                                result.CreatedUser = row["CreatedUser"] != DBNull.Value ? row["CreatedUser"].ToString() : null;
                                result.CreatedDate = row["CreatedDate"] != DBNull.Value ? (DateTime)row["CreatedDate"] : new DateTime();
                                result.CreatedBy = row["CreatedBy"] != DBNull.Value ? (int)row["CreatedBy"] : new Int32();
                                result.ModifiedDate = row["ModifiedDate"] != DBNull.Value ? (DateTime)row["ModifiedDate"] : new DateTime();
                                result.ModifiedBy = row["ModifiedBy"] != DBNull.Value ? (int)row["ModifiedBy"] : new Int32();

                                // result.Results =

                                resultList.Add(result);
                            }

                            returnDT = null;
                        }
                    }
                    else
                    {
                        throw new Exception("Unable to Connect");
                    }
                }
                return resultList;
            }
            catch
            {
                throw;
            }
        }
Exemple #7
0
 public int SaveOrderSampleTestOos(Oos oos, Identification identification)
 {
     try
     {
         using (DbConnection = new MsSqlPersistence(DbConnectionSettings, true))
         {
             if (DbConnection.IsConnected())
             {
                 using (DbCommand)
                 {
                     return this.SaveOrderSampleTestOos(ref dbConnection, ref dbCommand, oos, identification);
                 }
             }
             else
             {
                 throw new Exception("Unable to Connect");
             }
         }
     }
     catch
     {
         throw;
     }
 }
Exemple #8
0
        public int SaveOOS(Oos Oos, Identification identification)
        {
            try
            {
                int returnValue = 0;

                if (Oos.IsDirty)
                {

                    /*
                    SystemDAO.SaveChangeAudit<SampleTest>(ref dbConnection, ref dbCommand,
                        GetSampleTest(ref dbConnection, ref dbCommand, sampleTest.Pk ?? 0, identification),
                        sampleTest,
                        ModuleNames.Samples,
                        sample.Pk,
                        identification.UserId); */

                    DbCommand.Parameters.Clear();
                    DbCommand.CommandType = CommandType.StoredProcedure;
                    DbCommand.CommandText = "uspUpdateOOS";
                    DbCommand.Parameters.Add("@OOSId", System.Data.SqlDbType.Int).Value = Oos.OosId;
                    if (Oos.PreparationYN.IsNotNull())
                        DbCommand.Parameters.Add("@PreparationYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.PreparationYN;
                    if (Oos.RawDataYN != null)
                        DbCommand.Parameters.Add("@RawDataYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.RawDataYN;
                    if (Oos.StandardsReagentsYN.IsNotNull())
                        DbCommand.Parameters.Add("@StandardsReagentsYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.StandardsReagentsYN;
                    if (Oos.MethodologyYN.IsNotNull())
                        DbCommand.Parameters.Add("@MethodologyYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.MethodologyYN;
                    if (Oos.InstrumentParametersYN.IsNotNull())
                        DbCommand.Parameters.Add("@InstrumentParametersYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.InstrumentParametersYN;
                    if (Oos.TrendsYN.IsNotNull())
                        DbCommand.Parameters.Add("@TrendsYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.TrendsYN;
                    if (Oos.AnalystYN.IsNotNull())
                        DbCommand.Parameters.Add("@AnalystYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.AnalystYN;
                    if (Oos.ClientContactEmailYN.IsNotNull())
                        DbCommand.Parameters.Add("@ClientContactEmailYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.ClientContactEmailYN;
                    if (Oos.ClientContactPhoneYN.IsNotNull())
                        DbCommand.Parameters.Add("@ClientContactPhoneYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.ClientContactPhoneYN;
                    if (Oos.ClientContactName.IsNotNull())
                        DbCommand.Parameters.Add("@ClientContactName", System.Data.SqlDbType.NVarChar, 100).Value = Oos.ClientContactName;
                    if (Oos.ClientContactDate.IsNotNull())
                        DbCommand.Parameters.Add("@ClientContactDate", System.Data.SqlDbType.NVarChar, 100).Value = Oos.ClientContactDate;
                    if (Oos.AdditionalObservations.IsNotNull())
                        DbCommand.Parameters.Add("@AdditionalObservations", System.Data.SqlDbType.NVarChar, 4000).Value = Oos.AdditionalObservations;
                    if (Oos.Conclusion.IsNotNull())
                        DbCommand.Parameters.Add("@Conclusion", System.Data.SqlDbType.NVarChar, 4000).Value = Oos.Conclusion;
                    if (Oos.PrimaryCause.IsNotNull())
                        DbCommand.Parameters.Add("@PrimaryCause", System.Data.SqlDbType.NVarChar, 100).Value = Oos.PrimaryCause;
                    if (Oos.ResultInvalidatedYN.IsNotNull())
                        DbCommand.Parameters.Add("@ResultInvalidatedYN", System.Data.SqlDbType.Bit).Value = (bool)Oos.ResultInvalidatedYN;

                    DbCommand.Parameters.Add("@ModifiedDate", System.Data.SqlDbType.DateTime).Value = DateTime.Now;
                    DbCommand.Parameters.Add("@ModifiedBy", System.Data.SqlDbType.Int).Value = identification.UserId;

                    // returnValue = Primary Key Id
                    DbConnection.ExecuteCommand(DbCommand);

                    // Save OOS Results
                    SaveOOSResults(Oos.Results, identification);
                }

                //Return Total Number of Updated Records or Last Primary ID
                return returnValue;
            }
            catch
            {
                throw;
            }
        }
Exemple #9
0
        public SmartCollection<Oos> GetOrdersSampleTestsOoss(int orderid, Identification identification)
        {
            try
            {
                SmartCollection<Oos> resultList = new SmartCollection<Oos>();
                using (DbConnection = new MsSqlPersistence(DbConnectionSettings))
                {
                    if (DbConnection.IsConnected())
                    {
                        using (DbCommand)
                        {
                            string sql =
                                @"
                                SELECT
                                Oos.id, Oos.parentid, Oos.status, Oos.is_sample_prep_acceptable, Oos.is_raw_data_acceptable, Oos.is_standard_acceptable,
                                Oos.is_method_acceptable, Oos.is_parameters_acceptable, Oos.is_trends_acceptable, Oos.is_analyst_acceptable,
                                Oos.is_retest, Oos.primary_cause, Oos.client_contact_id, Oos.client_contact_phone_id, Oos.is_client_notified,Oos.is_testing_complete,
                                Oos.review_comment, Oos.conclusion_comment, Oos.investigator_id, Oos.investigation_date, Oos.approved_by,
                                Oos.approved_date, Oos.created_by, Oos.created_date, Oos.modified_by, Oos.modified_date,
                                Test.lab_number,Test.id AS SampleTestId, TimepointResult.result_date,
                                (users.firstname + ' ' + users.lastname) as modifieduser, (users4.firstname + ' ' + users4.lastname) as ApprovedUser,
                                (users2.firstname + ' ' + users2.lastname) as createduser, (users3.firstname + ' ' + users3.lastname) as InvestigationUser
                                FROM Orders
                                INNER JOIN orders_samples_tests AS Test ON Test.parentid = Orders.Id
                                INNER JOIN orders_samples_tests_timepoints AS Timepoint ON  Timepoint.parentid = Test.id
                                INNER JOIN orders_samples_tests_timepoints_results AS TimepointResult ON  TimepointResult.parentid = Timepoint.id
                                INNER JOIN orders_samples_tests_timepoints_oos AS Oos ON Oos.parentid = Timepoint.id
                                LEFT JOIN  [User] as users ON Oos.modified_by = users.UserID
                                LEFT JOIN  [User] as users2 ON Oos.created_by = users2.UserID.
                                LEFT JOIN  [User] as users3 ON Oos.investigator_id = users3.UserID
                                LEFT JOIN  [User] as users4 ON Oos.approved_by = users4.UserID
                                WHERE Orders.id = @OrderId
                                ORDER BY Oos.id Desc
                                ";

                            DbCommand.CommandText = sql;
                            DbCommand.Parameters.Add("@OrderId", System.Data.SqlDbType.Int).Value = orderid;
                            DataTable returnDT = DbConnection.ExecuteQuery(DbCommand);
                            foreach (DataRow row in returnDT.Rows)
                            {
                                Oos result = new Oos();
                                result.OosId = Convert.ToInt32(row["Id"]);
                                /*result.ParentId = row["parentid"] != DBNull.Value ? (int)row["parentid"] : 0;
                                result.Status = row["status"] != DBNull.Value ? (EnumOosStatus)row["status"] : EnumOosStatus.Open;
                                result.PreparationYN = row["is_sample_prep_acceptable"] != DBNull.Value ? Convert.ToBoolean(row["is_sample_prep_acceptable"]) : false;
                                result.RawDataYN = row["is_raw_data_acceptable"] != DBNull.Value ? Convert.ToBoolean(row["is_raw_data_acceptable"]) : false;
                                result.StandardsReagentsYN = row["is_standard_acceptable"] != DBNull.Value ? Convert.ToBoolean(row["is_standard_acceptable"]) : false;
                                result.MethodologyYN = row["is_method_acceptable"] != DBNull.Value ? Convert.ToBoolean(row["is_method_acceptable"]) : false;
                                result.InstrumentParametersYN = row["is_parameters_acceptable"] != DBNull.Value ? Convert.ToBoolean(row["is_parameters_acceptable"]) : false;
                                result.TrendsYN = row["is_trends_acceptable"] != DBNull.Value ? Convert.ToBoolean(row["is_trends_acceptable"]) : false;
                                result.AnalystYN = row["is_analyst_acceptable"] != DBNull.Value ? Convert.ToBoolean(row["is_analyst_acceptable"]) : false;
                                result.IsRetest = row["is_retest"] != DBNull.Value ? Convert.ToBoolean(row["is_retest"]) : false;
                                result.PrimaryCause = row["primary_cause"].ToString();
                                result.ClientContactEmailYN = row["client_contact_id"] != DBNull.Value ? (int)row["client_contact_id"] : 0;
                                result.ClientContactPhoneYN = row["client_contact_phone_id"] != DBNull.Value ? (int)row["client_contact_phone_id"] : 0;
                                result.IsClientNotified = row["is_client_notified"] != DBNull.Value ? Convert.ToBoolean(row["is_client_notified"]) : false;
                                result.IsTestingComplete = row["is_testing_complete"] != DBNull.Value ? Convert.ToBoolean(row["is_testing_complete"]) : false;
                                result.AdditionalObservations = row["review_comment"].ToString();
                                result.Conclusion = row["conclusion_comment"].ToString();
                                result.InvestigatorId = row["investigator_id"] != DBNull.Value ? (int)row["investigator_id"] : 0;
                                result.InvestigationDate = row["investigation_date"] != DBNull.Value ? (DateTime?)row["investigation_date"] : null;
                                result.ApprovedBy = row["approved_by"] != DBNull.Value ? (int?)row["approved_by"] : null;
                                result.ApprovedDate = row["approved_date"] != DBNull.Value ? (DateTime?)row["approved_date"] : null;
                                result.ARLNumber = row["lab_number"] != DBNull.Value ? (int)row["lab_number"] : 0;
                                result.SampleTestId = row["SampleTestId"] != DBNull.Value ? (int)row["SampleTestId"] : 0;
                                result.ApprovedUser = row["ApprovedUser"].ToString();
                                result.InvestigationUser = row["InvestigationUser"].ToString();
                                result.CreatedUser = row["createduser"].ToString();
                                result.CreatedBy = row["created_by"] != DBNull.Value ? (int?)row["created_by"] : null;
                                result.CreatedDate = row["created_date"] != DBNull.Value ? (DateTime?)row["created_date"] : null;
                                result.ModifiedBy = row["modified_by"] != DBNull.Value ? (int?)row["modified_by"] : null;
                                result.ModifiedUser = row["modifieduser"].ToString();
                                result.ModifiedDate = row["modified_date"] != DBNull.Value ? (DateTime?)row["modified_date"] : null;
                                result.TimePoints = this.GetSampleTestOosTimePoints(ref dbConnection, ref dbCommand, (int)row["id"]); */
                                //result.TimePoints = this.GetSampleTestTimePoint(ref dbConnection, ref dbCommand, (int)row["parentid"], Convert.ToDateTime(row["result_date"]));
                                resultList.Add(result);
                            }

                            returnDT = null;
                        }
                    }
                    else
                    {
                        throw new Exception("Unable to Connect");
                    }
                }
                return resultList;
            }
            catch
            {
                throw;
            }
        }
Exemple #10
0
        public Oos GetOOS(int OOSId, Identification identification)
        {
            try
            {
                Oos result = new Oos();
                using (DbConnection = new MsSqlPersistence(DbConnectionSettings))
                {
                    if (DbConnection.IsConnected())
                    {
                        using (DbCommand)
                        {
                            DbCommand.CommandType = CommandType.StoredProcedure;
                            DbCommand.CommandText = "uspGetOOS";
                            DbCommand.Parameters.Add("@OOSId", System.Data.SqlDbType.Int).Value = OOSId;
                            DataTable returnDT = DbConnection.ExecuteQuery(DbCommand);
                            if (returnDT.Rows.Count >= 1)
                            {
                                DataRow row = returnDT.Rows[0];
                                result.OosId = Convert.ToInt32(row["OOSID"]);
                                if (row["ARLNumber"] != DBNull.Value)
                                    result.ARLNumber = (int)row["ARLNumber"];
                                if (row["SampleTestId"] != DBNull.Value)
                                    result.SampleTestId = (int)row["SampleTestId"];
                                result.ClientName = row["ClientName"].ToString();
                                result.LabelDescription = row["LabelDescription"].ToString();
                                result.LotNumber = row["LotNumber"].ToString();
                                result.Analyst = row["AnalystName"].ToString();
                                if (row["TestedDate"] != DBNull.Value)
                                    result.TestedDate = (DateTime)row["TestedDate"];
                                result.Status = row["Status"] != DBNull.Value ? (SampleTestStatus)row["Status"] : SampleTestStatus.UnderInvestigation;
                                result.TestName = row["TestName"].ToString();
                                result.AnalyteName = row["AnalyteName"].ToString();
                                result.PriorityName = row["PriorityName"].ToString();
                                if (row["DueDate"] != DBNull.Value)
                                    result.DueDate = (DateTime)row["DueDate"];
                                result.DepartmentName = row["DepartmentName"].ToString();
                                if (row["TimepointStudyYN"] != DBNull.Value)
                                    result.TimepointStudyYN = (bool)row["TimepointStudyYN"];
                                if (row["NextTimepoint"] != DBNull.Value)
                                    result.NextTimepoint = (DateTime)row["NextTimepoint"];
                                if (row["PreparationYN"] != DBNull.Value)
                                    result.PreparationYN = (bool)row["PreparationYN"];
                                if (row["RawDataYN"] != DBNull.Value)
                                    result.RawDataYN = (bool)row["RawDataYN"];
                                if (row["StandardsReagentsYN"] != DBNull.Value)
                                    result.StandardsReagentsYN = (bool)row["StandardsReagentsYN"];
                                if (row["MethodologyYN"] != DBNull.Value)
                                    result.MethodologyYN = (bool)row["MethodologyYN"];
                                if (row["InstrumentParametersYN"] != DBNull.Value)
                                    result.InstrumentParametersYN = (bool)row["InstrumentParametersYN"];
                                if (row["TrendsYN"] != DBNull.Value)
                                    result.TrendsYN = (bool)row["TrendsYN"];
                                if (row["AnalystYN"] != DBNull.Value)
                                    result.AnalystYN = (bool)row["AnalystYN"];
                                if (row["ClientContactEmailYN"] != DBNull.Value)
                                    result.ClientContactEmailYN = (bool)row["ClientContactEmailYN"];
                                if (row["ClientContactPhoneYN"] != DBNull.Value)
                                    result.ClientContactPhoneYN = (bool)row["ClientContactPhoneYN"];
                                if (row["ClientContactName"] != DBNull.Value)
                                    result.ClientContactName = row["ClientContactName"].ToString();
                                if (row["ClientContactDate"] != DBNull.Value)
                                    result.ClientContactDate = (DateTime)row["ClientContactDate"];
                                if (row["AdditionalObservationDiscussion"] != DBNull.Value)
                                    result.AdditionalObservations = row["AdditionalObservationDiscussion"].ToString();
                                if (row["Conclusion"] != DBNull.Value)
                                    result.Conclusion = row["Conclusion"].ToString();
                                if (row["PrimaryCause"] != DBNull.Value)
                                    result.PrimaryCause = row["PrimaryCause"].ToString();
                                if (row["ResultInvalidatedYN"] != DBNull.Value)
                                    result.ResultInvalidatedYN = (bool)row["ResultInvalidatedYN"];
                                else
                                    result.ResultInvalidatedYN = false;

                                result.ModifiedUser = row["ModifiedUser"] != DBNull.Value ? row["ModifiedUser"].ToString() : null;
                                result.CreatedUser = row["CreatedUser"] != DBNull.Value ? row["CreatedUser"].ToString() : null;
                                result.CreatedDate = row["CreatedDate"] != DBNull.Value ? (DateTime)row["CreatedDate"] : new DateTime();
                                result.CreatedBy = row["CreatedBy"] != DBNull.Value ? (int)row["CreatedBy"] : new Int32();
                                result.ModifiedDate = row["ModifiedDate"] != DBNull.Value ? (DateTime)row["ModifiedDate"] : new DateTime();
                                result.ModifiedBy = row["ModifiedBy"] != DBNull.Value ? (int)row["ModifiedBy"] : new Int32();

                                result.Results = this.GetResultsForSampleTest((int)result.SampleTestId, identification);
                            }

                            returnDT = null;
                        }
                    }
                    else
                    {
                        throw new Exception("Unable to Connect");
                    }
                }
                return result;
            }
            catch
            {
                throw;
            }
        }
Exemple #11
0
 public SaveOosRequest(Oos oos)
 {
     this.oos = oos;
 }