Exemplo n.º 1
0
        private List <BusinessTripEmployeeModel> GetBusinessTripEmployeeByParentId(string parentId, int departmentId)
        {
            List <BusinessTripEmployeeModel> businessTripEmployeeModelCollection = new List <BusinessTripEmployeeModel>();

            int parentIdOut;

            if (!string.IsNullOrEmpty(parentId) && int.TryParse(parentId, out parentIdOut))
            {
                Department currentDept = DepartmentListSingleton.GetDepartmentByID(departmentId, SPContext.Current.Site.Url);
                string     deptName    = CultureInfo.CurrentUICulture.LCID == 1033 ? currentDept.Name : currentDept.VietnameseName;
                List <BusinessTripEmployeeDetail> businessTripEmployeeDetailCollection = _businessTripEmployeeDetailDAL.GetItemsByParentId(parentIdOut);

                if (businessTripEmployeeDetailCollection != null)
                {
                    foreach (BusinessTripEmployeeDetail businessTripEmployeeDetail in businessTripEmployeeDetailCollection)
                    {
                        BusinessTripEmployeeModel businessTripEmployeeModel = ConvertToModel(businessTripEmployeeDetail);
                        businessTripEmployeeModel.DepartmentName = deptName;
                        businessTripEmployeeModelCollection.Add(businessTripEmployeeModel);
                    }
                }
            }

            return(businessTripEmployeeModelCollection);
        }
Exemplo n.º 2
0
        private BusinessTripEmployeeModel ConvertToModel(BusinessTripEmployeeDetail businessTripEmployeeDetail, string departmentName = "")
        {
            BusinessTripEmployeeModel businessTripEmployeeModel = new BusinessTripEmployeeModel()
            {
                Id = businessTripEmployeeDetail.ID,
                BusinessTripManagementID = businessTripEmployeeDetail.BusinessTripManagementID,
                EmployeeId     = businessTripEmployeeDetail.Employee.LookupId,
                EmployeeCode   = businessTripEmployeeDetail.EmployeeID.LookupValue,
                DepartmentName = departmentName,
                FullName       = businessTripEmployeeDetail.Employee.LookupValue
            };

            return(businessTripEmployeeModel);
        }