Exemplo n.º 1
0
 public Organizations GetByID(int _organizationId)
 {
     OrganizationsDAC _organizationsComponent = new OrganizationsDAC();
      IDataReader reader = _organizationsComponent.GetByIDOrganizations(_organizationId);
      Organizations _organizations = null;
      while(reader.Read())
      {
          _organizations = new Organizations();
          if(reader["OrganizationId"] != DBNull.Value)
              _organizations.OrganizationId = Convert.ToInt32(reader["OrganizationId"]);
          if(reader["OrganizationName"] != DBNull.Value)
              _organizations.OrganizationName = Convert.ToString(reader["OrganizationName"]);
          if(reader["OrganizationDescription"] != DBNull.Value)
              _organizations.OrganizationDescription = Convert.ToString(reader["OrganizationDescription"]);
          if(reader["Phone1"] != DBNull.Value)
              _organizations.Phone1 = Convert.ToString(reader["Phone1"]);
          if(reader["Phone2"] != DBNull.Value)
              _organizations.Phone2 = Convert.ToString(reader["Phone2"]);
          if(reader["Phone3"] != DBNull.Value)
              _organizations.Phone3 = Convert.ToString(reader["Phone3"]);
          if(reader["Fax1"] != DBNull.Value)
              _organizations.Fax1 = Convert.ToString(reader["Fax1"]);
          if(reader["Fax2"] != DBNull.Value)
              _organizations.Fax2 = Convert.ToString(reader["Fax2"]);
          if(reader["AddressLine1"] != DBNull.Value)
              _organizations.AddressLine1 = Convert.ToString(reader["AddressLine1"]);
          if(reader["AddressLine2"] != DBNull.Value)
              _organizations.AddressLine2 = Convert.ToString(reader["AddressLine2"]);
      _organizations.NewRecord = false;             }             reader.Close();
      return _organizations;
 }
Exemplo n.º 2
0
 public List<Organizations> GetAll()
 {
     OrganizationsDAC _organizationsComponent = new OrganizationsDAC();
      IDataReader reader =  _organizationsComponent.GetAllOrganizations().CreateDataReader();
      List<Organizations> _organizationsList = new List<Organizations>();
      while(reader.Read())
      {
      if(_organizationsList == null)
          _organizationsList = new List<Organizations>();
          Organizations _organizations = new Organizations();
          if(reader["OrganizationId"] != DBNull.Value)
              _organizations.OrganizationId = Convert.ToInt32(reader["OrganizationId"]);
          if(reader["OrganizationName"] != DBNull.Value)
              _organizations.OrganizationName = Convert.ToString(reader["OrganizationName"]);
          if(reader["OrganizationDescription"] != DBNull.Value)
              _organizations.OrganizationDescription = Convert.ToString(reader["OrganizationDescription"]);
          if(reader["Phone1"] != DBNull.Value)
              _organizations.Phone1 = Convert.ToString(reader["Phone1"]);
          if(reader["Phone2"] != DBNull.Value)
              _organizations.Phone2 = Convert.ToString(reader["Phone2"]);
          if(reader["Phone3"] != DBNull.Value)
              _organizations.Phone3 = Convert.ToString(reader["Phone3"]);
          if(reader["Fax1"] != DBNull.Value)
              _organizations.Fax1 = Convert.ToString(reader["Fax1"]);
          if(reader["Fax2"] != DBNull.Value)
              _organizations.Fax2 = Convert.ToString(reader["Fax2"]);
          if(reader["AddressLine1"] != DBNull.Value)
              _organizations.AddressLine1 = Convert.ToString(reader["AddressLine1"]);
          if(reader["AddressLine2"] != DBNull.Value)
              _organizations.AddressLine2 = Convert.ToString(reader["AddressLine2"]);
      _organizations.NewRecord = false;
      _organizationsList.Add(_organizations);
      }             reader.Close();
      return _organizationsList;
 }
Exemplo n.º 3
0
 public bool Insert(Organizations organizations)
 {
     int autonumber = 0;
     OrganizationsDAC organizationsComponent = new OrganizationsDAC();
     bool endedSuccessfuly = organizationsComponent.InsertNewOrganizations( ref autonumber,  organizations.OrganizationName,  organizations.OrganizationDescription,  organizations.Phone1,  organizations.Phone2,  organizations.Phone3,  organizations.Fax1,  organizations.Fax2,  organizations.AddressLine1,  organizations.AddressLine2);
     if(endedSuccessfuly)
     {
         organizations.OrganizationId = autonumber;
     }
     return endedSuccessfuly;
 }
Exemplo n.º 4
0
 public bool Update(Organizations organizations ,int old_organizationId)
 {
     OrganizationsDAC organizationsComponent = new OrganizationsDAC();
     return organizationsComponent.UpdateOrganizations( organizations.OrganizationName,  organizations.OrganizationDescription,  organizations.Phone1,  organizations.Phone2,  organizations.Phone3,  organizations.Fax1,  organizations.Fax2,  organizations.AddressLine1,  organizations.AddressLine2,  old_organizationId);
 }
Exemplo n.º 5
0
        public List<Employees> GetAllView(int LanguageID)
        {
            EmployeesDAC _employeesComponent = new EmployeesDAC();
            IDataReader reader = _employeesComponent.GetAllEmployeesView("LanguageID = " + LanguageID).CreateDataReader();
            List<Employees> _employeesList = new List<Employees>();
            while (reader.Read())
            {
                if (_employeesList == null)
                    _employeesList = new List<Employees>();
                Employees _employees = new Employees();
                #region Employee Info
                if (reader["EmployeeId"] != DBNull.Value)
                    _employees.EmployeeId = Convert.ToInt32(reader["EmployeeId"]);
                if (reader["EmployeeNumber"] != DBNull.Value)
                    _employees.EmployeeNumber = Convert.ToString(reader["EmployeeNumber"]);
                if (reader["DepartmentId"] != DBNull.Value)
                    _employees.DepartmentId = Convert.ToInt32(reader["DepartmentId"]);
                if (reader["DivisionId"] != DBNull.Value)
                    _employees.DivisionId = Convert.ToInt32(reader["DivisionId"]);
                if (reader["FormalSiteUrl"] != DBNull.Value)
                    _employees.FormalSiteUrl = Convert.ToString(reader["FormalSiteUrl"]);
                if (reader["NationalIdNumber"] != DBNull.Value)
                    _employees.NationalIdNumber = Convert.ToString(reader["NationalIdNumber"]);
                if (reader["NationalIdType"] != DBNull.Value)
                    _employees.NationalIdType = Convert.ToString(reader["NationalIdType"]);
                if (reader["ManagerId"] != DBNull.Value)
                    _employees.ManagerId = Convert.ToInt32(reader["ManagerId"]);
                if (reader["BirthDate"] != DBNull.Value)
                    _employees.BirthDate = Convert.ToDateTime(reader["BirthDate"]);
                if (reader["MaritalStatus"] != DBNull.Value)
                    _employees.MaritalStatus = Convert.ToString(reader["MaritalStatus"]);
                if (reader["Gender"] != DBNull.Value)
                    _employees.Gender = Convert.ToString(reader["Gender"]);
                if (reader["HireDate"] != DBNull.Value)
                    _employees.HireDate = Convert.ToDateTime(reader["HireDate"]);
                if (reader["SalariedFlag"] != DBNull.Value)
                    _employees.SalariedFlag = Convert.ToBoolean(reader["SalariedFlag"]);
                if (reader["VacationHours"] != DBNull.Value)
                    _employees.VacationHours = Convert.ToInt16(reader["VacationHours"]);
                if (reader["SickLeaveHours"] != DBNull.Value)
                    _employees.SickLeaveHours = Convert.ToInt16(reader["SickLeaveHours"]);
                if (reader["CurrentFlag"] != DBNull.Value)
                    _employees.CurrentFlag = Convert.ToBoolean(reader["CurrentFlag"]);
                if (reader["EmployeeRowGuid"] != DBNull.Value)
                    _employees.RowGuid = new Guid(reader["RowGuid"].ToString());
                if (reader["EmployeeModifiedDate"] != DBNull.Value)
                    _employees.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
                if (reader["Position"] != DBNull.Value)
                    _employees.Position = Convert.ToString(reader["Position"]);
                _employees.NewRecord = false;
                #endregion

                #region Person Info
                BusinessLogicLayer.Entities.Persons.Person _person = new BusinessLogicLayer.Entities.Persons.Person();
                #region Main Info
                if (reader["EmployeeId"] != DBNull.Value)
                    _person.BusinessEntityId = Convert.ToInt32(reader["EmployeeId"]);
                if (reader["NameStyle"] != DBNull.Value)
                    _person.NameStyle = Convert.ToBoolean(reader["NameStyle"]);
                if (reader["EmailPromotion"] != DBNull.Value)
                    _person.EmailPromotion = Convert.ToInt32(reader["EmailPromotion"]);
                if (reader["RowGuid"] != DBNull.Value)
                    _person.RowGuid = new Guid(reader["RowGuid"].ToString());
                if (reader["ModifiedDate"] != DBNull.Value)
                    _person.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
                if (reader["CreatedDate"] != DBNull.Value)
                    _person.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
                if (reader["NationalityCode"] != DBNull.Value)
                    _person.NationalityCode = Convert.ToString(reader["NationalityCode"]);
                if (reader["Gender"] != DBNull.Value)
                    _person.Gender = Convert.ToString(reader["Gender"]);
                if (reader["DateofBirth"] != DBNull.Value)
                    _person.DateofBirth = Convert.ToDateTime(reader["DateofBirth"]);
                if (reader["PersonImage"] != DBNull.Value)
                    _person.PersonImage = Convert.ToString(reader["PersonImage"]);
                #endregion

                #region Person Languages
                BusinessLogicLayer.Entities.Persons.PersonLanguages _personLanguages = new BusinessLogicLayer.Entities.Persons.PersonLanguages();
                if (reader["PersonLanguageId"] != DBNull.Value)
                    _personLanguages.PersonLanguageId = Convert.ToInt32(reader["PersonLanguageId"]);
                if (reader["EmployeeId"] != DBNull.Value)
                    _personLanguages.PersonId = Convert.ToInt32(reader["EmployeeId"]);
                if (reader["LanguageId"] != DBNull.Value)
                    _personLanguages.LanguageId = Convert.ToInt32(reader["LanguageId"]);
                if (reader["Title"] != DBNull.Value)
                    _personLanguages.Title = Convert.ToString(reader["Title"]);
                if (reader["FirstName"] != DBNull.Value)
                    _personLanguages.FirstName = Convert.ToString(reader["FirstName"]);
                if (reader["MiddleName"] != DBNull.Value)
                    _personLanguages.MiddleName = Convert.ToString(reader["MiddleName"]);
                if (reader["LastName"] != DBNull.Value)
                    _personLanguages.LastName = Convert.ToString(reader["LastName"]);
                if (reader["Suffix"] != DBNull.Value)
                    _personLanguages.Suffix = Convert.ToString(reader["Suffix"]);
                if (reader["DisplayName"] != DBNull.Value)
                    _personLanguages.DisplayName = Convert.ToString(reader["DisplayName"]);
                _person.PersonLanguages.Add(_personLanguages);
                #endregion

                #region Credentials
                BusinessLogicLayer.Entities.Persons.Credential _credential = new BusinessLogicLayer.Entities.Persons.Credential();
                if (reader["EmployeeId"] != DBNull.Value)
                    _credential.BusinessEntityId = Convert.ToInt32(reader["EmployeeId"]);
                if (reader["Username"] != DBNull.Value)
                    _credential.Username = Convert.ToString(reader["Username"]);

                if (reader["IsActivated"] != DBNull.Value)
                    _credential.IsActivated = Convert.ToBoolean(reader["IsActivated"]);
                if (reader["IsActive"] != DBNull.Value)
                    _credential.IsActive = Convert.ToBoolean(reader["IsActive"]);
                _person.Credentials = _credential;
                #endregion
                _employees.EmployeePerson = _person;
                #endregion

                #region Departments
                Departments _departments = new Departments();
                #region Department Info
                if (reader["DepartmentId"] != DBNull.Value)
                    _departments.DepartmentId = Convert.ToInt32(reader["DepartmentId"]);
                if (reader["OrganizationId"] != DBNull.Value)
                    _departments.OrganizationId = Convert.ToInt32(reader["OrganizationId"]);
                if (reader["DepartmentName"] != DBNull.Value)
                    _departments.DepartmentName = Convert.ToString(reader["DepartmentName"]);
                if (reader["DepartmentDescription"] != DBNull.Value)
                    _departments.DepartmentDescription = Convert.ToString(reader["DepartmentDescription"]);

                #endregion
                #region Organization
                Organizations _organizations = new Organizations();
                if (reader["OrganizationId"] != DBNull.Value)
                    _organizations.OrganizationId = Convert.ToInt32(reader["OrganizationId"]);
                if (reader["OrganizationName"] != DBNull.Value)
                    _organizations.OrganizationName = Convert.ToString(reader["OrganizationName"]);
                if (reader["OrganizationDescription"] != DBNull.Value)
                    _organizations.OrganizationDescription = Convert.ToString(reader["OrganizationDescription"]);
                _departments.Organization = _organizations;
                #endregion
                _employees.Department = _departments;
                #endregion

                #region Division
                Divisions _divisions = new Divisions();
                if (reader["DivisionId"] != DBNull.Value)
                    _divisions.DivisionId = Convert.ToInt32(reader["DivisionId"]);
                if (reader["DepartmentId"] != DBNull.Value)
                    _divisions.DepartmentId = Convert.ToInt32(reader["DepartmentId"]);
                if (reader["DivisionName"] != DBNull.Value)
                    _divisions.DivisionName = Convert.ToString(reader["DivisionName"]);
                if (reader["DivisionDescription"] != DBNull.Value)
                    _divisions.DivisionDescription = Convert.ToString(reader["DivisionDescription"]);
                _employees.Division = _divisions;
                #endregion

                _employeesList.Add(_employees);
            } reader.Close();
            return _employeesList;
        }