public int Insert(int personID, int customerID, int kinshipID, bool urgentContact, bool alternativeContact, string modifiedBy)
 {
     try
     {
         using (IDataReader reader = this.Gateway.ExecuteQueryReader(SQLProvider.InsertNOKCommand,
                                                                     new StoredProcInParam("PersonID", DbType.Int32, personID),
                                                                     new StoredProcInParam("CustomerID", DbType.Int32, customerID),
                                                                     new StoredProcInParam("KinshipID", DbType.Int32, kinshipID),
                                                                     new StoredProcInParam("UrgentContact", DbType.Boolean, urgentContact),
                                                                     new StoredProcInParam("AlternativeContact", DbType.Boolean, alternativeContact),
                                                                     new StoredProcInParam("ModifiedBy", DbType.String, SIIStrings.Left(modifiedBy, ModifiedByLength))
                                                                     ))
         {
             return((IsEmptyReader(reader)) ? 0 : SIIConvert.ToInteger(reader["ID"].ToString()));
         }
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
         {
             throw;
         }
         return(0);
     }
 }
        //public DataSet GetCustomerPreAssessments()
        //{
        //    try
        //    {
        //        return this.Gateway.ExecuteQueryDataSet(SQLProvider.GetAllCustomerPreAssessmentCommand,
        //            Administrative.Entities.TableNames.CustomerPreAssessmentTable);
        //    }
        //    catch (Exception ex)
        //    {
        //        if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess)) throw;
        //        else return null;
        //    }
        //}

        public Int64 GetDBTimeStamp(int id)
        {
            try
            {
                DataSet result = this.Gateway.ExecuteQueryDataSet(SQLProvider.GetCustomerPreAssessmentDBTimeStampCommand,
                                                                  Administrative.Entities.TableNames.CustomerPreAssessmentTable,
                                                                  new StoredProcInParam("ID", DbType.Int32, id));
                if (result.Tables[Administrative.Entities.TableNames.CustomerPreAssessmentTable].Rows.Count > 0)
                {
                    return(SIIConvert.ToInteger64(result.Tables[Administrative.Entities.TableNames.CustomerPreAssessmentTable].Rows[0]["DBTimeStamp"].ToString()));
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
                {
                    throw;
                }
                return(0);
            }
        }
Beispiel #3
0
 public int Insert(int personID, string fileNumber, bool hasAvailability, bool admitNotification, bool includingEmail, string modifiedBy)
 {
     try
     {
         using (IDataReader reader = this.Gateway.ExecuteQueryReader(SQLProvider.InsertHHRRCommand,
                                                                     new StoredProcInParam("PersonID", DbType.Int32, personID),
                                                                     new StoredProcInParam("FileNumber", DbType.String, SIIStrings.Left(fileNumber, FileNumberLength)),
                                                                     new StoredProcInParam("HasAvailability", DbType.Boolean, hasAvailability),
                                                                     new StoredProcInParam("AdmitNotification", DbType.Boolean, admitNotification),
                                                                     new StoredProcInParam("IncludingEmail", DbType.Boolean, includingEmail),
                                                                     new StoredProcInParam("ModifiedBy", DbType.String, SIIStrings.Left(modifiedBy, ModifiedByLength))
                                                                     ))
         {
             return((IsEmptyReader(reader)) ? 0 : SIIConvert.ToInteger(reader["ID"].ToString()));
         }
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
         {
             throw;
         }
         return(0);
     }
 }
Beispiel #4
0
/*
 *      public CustomerContactOrganizationEntity GetCustomerContactOrganization(int customerContactOrganizationID)
 *      {
 *          try
 *          {
 *              OrganizationBL organizationBL = new OrganizationBL();
 *
 *              DataSet ds = _customerContactOrganizationDA.GetCustomerContactOrganization(customerContactOrganizationID);
 *              if ((ds.Tables != null) && (ds.Tables.Contains(SII.HCD.Administrative.Entities.TableNames.CustomerContactOrganizationTable)) && (ds.Tables[SII.HCD.Administrative.Entities.TableNames.CustomerContactOrganizationTable].Rows.Count > 0))
 *              {
 *                  int organizationID = SIIConvert.ToInteger(ds.Tables[SII.HCD.Administrative.Entities.TableNames.CustomerContactOrganizationTable].Rows[0]["OrganizationID"].ToString(), 0);
 *                  int contactTypeID = SIIConvert.ToInteger(ds.Tables[SII.HCD.Administrative.Entities.TableNames.CustomerContactOrganizationTable].Rows[0]["ContactTypeID"].ToString(), 0);
 *
 *                  DataSet ds2;
 *
 #region Contact Types
 *                  ds2 = _contactTypeDA.GetContactTypeByID(contactTypeID);
 *                  if ((ds2 != null) && (ds2.Tables.Contains(SII.HCD.Administrative.Entities.TableNames.ContactTypeTable)))
 *                  {
 *                      DataTable dt = ds2.Tables[SII.HCD.Administrative.Entities.TableNames.ContactTypeTable].Copy();
 *                      ds.Tables.Add(dt);
 *                  }
 #endregion
 *
 #region Organization
 *                  if (organizationID <= 0)
 *                  {
 *                      throw new Exception(Properties.Resources.ERROR_CustomerContactOrganizationNotFound);
 *                  }
 *                  SII.HCD.BackOffice.Entities.OrganizationEntity myOrganization = organizationBL.GetOrganization(organizationID);
 #endregion
 *
 *                  CustomerContactOrganizationAdvancedAdapter customerContactOrganizationAdapter = new CustomerContactOrganizationAdvancedAdapter();
 *                  CustomerContactOrganizationEntity result = customerContactOrganizationAdapter.GetInfo(ds.Tables[SII.HCD.Administrative.Entities.TableNames.CustomerContactOrganizationTable].Rows[0], ds);
 *                  result.Organization = myOrganization;
 *                  LOPDLogger.Write(EntityNames.CustomerContactOrganizationEntityName, customerContactOrganizationID, ActionType.View);
 *                  return result;
 *              }
 *              else
 *                  return null;
 *          }
 *          catch (Exception ex)
 *          {
 *              if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.Service)) throw;
 *              return null;
 *          }
 *      }
 */
        public CustomerContactOrganizationEntity GetCustomerContactOrganization(int customerContactOrganizationID)
        {
            try
            {
                OrganizationBL organizationBL = new OrganizationBL();
                DataSet        ds             = _customerContactOrganizationDA.GetCustomerContactOrganization(customerContactOrganizationID);

                if ((ds.Tables != null) && (ds.Tables.Contains(Administrative.Entities.TableNames.CustomerContactOrganizationTable)) && (ds.Tables[Administrative.Entities.TableNames.CustomerContactOrganizationTable].Rows.Count > 0))
                {
                    int organizationID = SIIConvert.ToInteger(ds.Tables[Administrative.Entities.TableNames.CustomerContactOrganizationTable].Rows[0]["OrganizationID"].ToString(), 0);

                    #region Organization
                    if (organizationID <= 0)
                    {
                        throw new Exception(Properties.Resources.ERROR_CustomerContactOrganizationNotFound);
                    }

                    SII.HCD.BackOffice.Entities.OrganizationEntity myOrganization = null;
                    var HiloOrganization = System.Threading.Tasks.Task.Factory.StartNew(() => myOrganization = organizationBL.GetOrganization(organizationID));

                    DataSet ds2 = new DataSet();
                    foreach (DataTable oTabla in ds.Tables)
                    {
                        if (oTabla.Rows.Count > 0)
                        {
                            ds2.Tables.Add(oTabla.Copy());
                        }
                    }
                    #endregion

                    CustomerContactOrganizationAdvancedAdapter customerContactOrganizationAdapter = new CustomerContactOrganizationAdvancedAdapter();
                    CustomerContactOrganizationEntity          result = customerContactOrganizationAdapter.GetInfo(ds.Tables[Administrative.Entities.TableNames.CustomerContactOrganizationTable].Rows[0], ds2);
                    HiloOrganization.Wait();
                    result.Organization = myOrganization;

                    LOPDLogger.Write(EntityNames.CustomerContactOrganizationEntityName, customerContactOrganizationID, ActionType.View);
                    ds.Dispose();
                    ds2.Dispose();
                    return(result);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.Service))
                {
                    throw;
                }
                return(null);
            }
        }
 public int CountCustomerPreAssessment()
 {
     try
     {
         using (IDataReader reader = this.Gateway.ExecuteQueryReader(SQLProvider.CountCustomerPreAssessmentCommand))
         {
             return((IsEmptyReader(reader)) ? 0 : SIIConvert.ToInteger(reader["Count"].ToString(), 0));
         }
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
         {
             throw;
         }
         return(0);
     }
 }
 public int Insert(int customerID, int personID, int customerProcessID, int processChartID, DateTime?initDate, DateTime?confirmedDate, int informationProvidedPersonType,
                   int informationProvidedByID, string interviewMadeIn, int interviewMadeByID, int assistanceDegreeRequestedID, int assistanceDegreeRecommendedID,
                   string preAssessmentDocument, string recommendations, string explanations, int ancestorID, int customerADTOrderID, int status, DateTime lastUpdated,
                   string modifiedBy, Int64 dbTimeStamp
                   )
 {
     try
     {
         using (IDataReader reader = this.Gateway.ExecuteQueryReader(SQLProvider.InsertCustomerPreAssessmentCommand,
                                                                     new StoredProcInParam("CustomerID", DbType.Int32, customerID),
                                                                     new StoredProcInParam("PersonID", DbType.Int32, personID),
                                                                     new StoredProcInParam("CustomerProcessID", DbType.Int32, customerProcessID),
                                                                     new StoredProcInParam("ProcessChartID", DbType.Int32, processChartID),
                                                                     new StoredProcInParam("InitDate", DbType.DateTime, initDate),
                                                                     new StoredProcInParam("ConfirmedDate", DbType.DateTime, confirmedDate),
                                                                     new StoredProcInParam("InformationProvidedPersonType", DbType.Int32, informationProvidedPersonType),
                                                                     new StoredProcInParam("InformationProvidedByID", DbType.Int32, informationProvidedByID),
                                                                     new StoredProcInParam("InterviewMadeIn", DbType.String, interviewMadeIn),
                                                                     new StoredProcInParam("InterviewMadeByID", DbType.Int32, interviewMadeByID),
                                                                     new StoredProcInParam("AssistanceDegreeRequestedID", DbType.Int32, assistanceDegreeRequestedID),
                                                                     new StoredProcInParam("AssistanceDegreeRecommendedID", DbType.Int32, assistanceDegreeRecommendedID),
                                                                     new StoredProcInParam("PreAssessmentDocument", DbType.String, preAssessmentDocument),
                                                                     new StoredProcInParam("Recommendations", DbType.String, recommendations),
                                                                     new StoredProcInParam("Explanations", DbType.String, explanations),
                                                                     new StoredProcInParam("AncestorID", DbType.Int32, ancestorID),
                                                                     new StoredProcInParam("CustomerADTOrderID", DbType.Int32, customerADTOrderID),
                                                                     new StoredProcInParam("Status", DbType.Int32, status),
                                                                     new StoredProcInParam("LastUpdated", DbType.DateTime, (lastUpdated != DateTime.MinValue) ? (object)lastUpdated : (object)DBNull.Value),
                                                                     new StoredProcInParam("ModifiedBy", DbType.String, modifiedBy),
                                                                     new StoredProcInParam("DBTimeStamp", DbType.Int64, dbTimeStamp)
                                                                     ))
         {
             return((IsEmptyReader(reader)) ? 0 : SIIConvert.ToInteger(reader["ID"].ToString()));
         }
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
         {
             throw;
         }
         return(0);
     }
 }
Beispiel #7
0
 public int GetDefaultProfileID(int humanResourceID)
 {
     try
     {
         using (IDataReader reader = this.Gateway.ExecuteQueryReader(SQLProvider.GetHumanResourceDefaultProfileID,
                                                                     new StoredProcInParam("HumanResourceID", DbType.Int32, humanResourceID)))
         {
             return((IsEmptyReader(reader)) ? -1 : SIIConvert.ToInteger(reader["ProfileID"].ToString(), -1));
         }
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
         {
             throw;
         }
         return(-1);
     }
 }
Beispiel #8
0
 public int GetIDByFileNumber(string fileNumber)
 {
     try
     {
         using (IDataReader reader = this.Gateway.ExecuteQueryReader(SQLProvider.GetHumanResourceIDByFileNumberCommand,
                                                                     new StoredProcInParam("FileNumber", DbType.String, fileNumber)))
         {
             return((IsEmptyReader(reader)) ? -1 : SIIConvert.ToInteger(reader["ID"].ToString(), -1));
         }
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
         {
             throw;
         }
         return(-1);
     }
 }
 public int GetNOKsFromPerson(int personID)
 {
     try
     {
         DataSet result = this.Gateway.ExecuteQueryDataSet(SQLProvider.GetNOKsFromPersonCommand, TableNames.NOKTable,
                                                           new StoredProcInParam("PersonID", DbType.Int32, personID));
         if (result.Tables[TableNames.NOKTable].Rows.Count > 0)
         {
             return(SIIConvert.ToInteger(result.Tables[TableNames.NOKTable].Rows[0]["Count"].ToString()));
         }
         else
         {
             return(0);
         }
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
         {
             throw;
         }
         return(0);
     }
 }
Beispiel #10
0
 public int FindFileNumber(string fileNumber)
 {
     try
     {
         DataSet result = this.Gateway.ExecuteQueryDataSet(SQLProvider.FindFileNumberCommand, TableNames.HumanResourceTable,
                                                           new StoredProcInParam("FileNumber", DbType.String, fileNumber));
         if (result.Tables[TableNames.HumanResourceTable].Rows.Count > 0)
         {
             return(SIIConvert.ToInteger(result.Tables[TableNames.HumanResourceTable].Rows[0]["ID"].ToString()));
         }
         else
         {
             return(0);
         }
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.DataAccess))
         {
             throw;
         }
         return(0);
     }
 }
        protected override HumanResourceEntity GetRecord(DataRow row, DataSet dataset)
        {
            ResourceDeviceAdapter resourceDeviceAdapter = new ResourceDeviceAdapter();

            ResourceDeviceEntity[] allocatedDevices = null;
            if (dataset.Tables.Contains(SII.HCD.BackOffice.Entities.TableNames.ResourceDeviceRelTable))
            {
                if (dataset.Tables[SII.HCD.BackOffice.Entities.TableNames.ResourceDeviceRelTable].Rows.Count > 0)
                {
                    allocatedDevices = resourceDeviceAdapter.GetData(dataset);
                }
            }

            HHRRProfileRelAdapter hhrrProfileRelAdapter = new HHRRProfileRelAdapter();

            HHRRProfileRelEntity[] profiles = null;
            if (dataset.Tables.Contains(SII.HCD.BackOffice.Entities.TableNames.HHRRProfileRelTable))
            {
                if (dataset.Tables[SII.HCD.BackOffice.Entities.TableNames.HHRRProfileRelTable].Rows.Count > 0)
                {
                    profiles = hhrrProfileRelAdapter.GetData(dataset);
                }
            }

            PersonAvailPatternAdapter hhrrAvailPatternAdapter = new PersonAvailPatternAdapter();

            PersonAvailPatternEntity[] availPatterns = null;
            if (dataset.Tables.Contains(SII.HCD.BackOffice.Entities.TableNames.PersonAvailPatternTable))
            {
                if (dataset.Tables[SII.HCD.BackOffice.Entities.TableNames.PersonAvailPatternTable].Rows.Count > 0)
                {
                    availPatterns = hhrrAvailPatternAdapter.GetData(dataset);
                }
            }

            PersonCareCenterAccessAdapter personCareCenterAccessAdapter = new PersonCareCenterAccessAdapter();

            PersonCareCenterAccessEntity[] careCentersAccess = null;
            if (dataset.Tables.Contains(SII.HCD.BackOffice.Entities.TableNames.PersonCareCenterAccessTable))
            {
                if (dataset.Tables[SII.HCD.BackOffice.Entities.TableNames.PersonCareCenterAccessTable].Rows.Count > 0)
                {
                    careCentersAccess = personCareCenterAccessAdapter.GetData(dataset);
                }
            }

            return(new HumanResourceEntity(SIIConvert.ToInteger(row["ID"].ToString(), 0),
                                           null,
                                           SIIConvert.ToBoolean(row["AdmitNotification"].ToString(), false),
                                           SIIConvert.ToBoolean(row["IncludingEmail"].ToString(), false),
                                           row["FileNumber"].ToString(),
                                           SIIConvert.ToBoolean(row["HasAvailability"].ToString(), false),
                                           profiles,
                                           availPatterns,
                                           allocatedDevices,
                                           careCentersAccess,
                                           SIIConvert.ToDateTime(row["LastUpdated"].ToString(), DateTime.MinValue),
                                           row["ModifiedBy"].ToString(),
                                           false,
                                           SIIConvert.ToInteger64(row["DBTimeStamp"].ToString(), 0)));
        }