Exemplo n.º 1
0
        public OperationResult <IUsersDTO> CreateUser(IUsersDTO usersDTO)
        {
            OperationResult <IUsersDTO> createUsersRetValue = null;

            try
            {
                IUsersDAC userDAC         = (IUsersDAC)DACFactory.Instance.Create(DACType.UsersDAC);
                IUsersDTO returnedUserDTO = userDAC.CreateUser(usersDTO);
                if (returnedUserDTO != null)
                {
                    createUsersRetValue = OperationResult <IUsersDTO> .CreateSuccessResult(returnedUserDTO, "users created successfully");
                }
                else
                {
                    createUsersRetValue = OperationResult <IUsersDTO> .CreateFailureResult("Insertion failed!");
                }
            }
            catch (DACException dacEx)
            {
                createUsersRetValue = OperationResult <IUsersDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace);
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException(ex);
                createUsersRetValue = OperationResult <IUsersDTO> .CreateErrorResult(ex.Message, ex.StackTrace);
            }

            return(createUsersRetValue);
        }
Exemplo n.º 2
0
        public IUsersDTO CreateUser(IUsersDTO usersDTO)
        {
            IUsersDTO createUserRetval = null;

            try
            {
                using (EmployeePortalEntities context = new EmployeePortalEntities())
                {
                    Employee employee = new Employee();
                    EntityConverter.FillEntityFromDTO(usersDTO.Employee, employee);
                    context.Employees.Add(employee);

                    User user = new User();
                    user.EmployeeId = employee.EmployeeId;
                    EntityConverter.FillEntityFromDTO(usersDTO, user);
                    context.Users.Add(user);


                    // user.UserId = usersDTO.UserId;
                    //employee.EmployeeId = usersDTO.EmployeesDTO.EmployeeId;
                    context.SaveChanges();
                    createUserRetval = usersDTO;
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException(ex);
                throw new DACException(ex.Message);
            }
            return(createUserRetval);
        }
Exemplo n.º 3
0
        public OperationResult <IUsersDTO> CreateUser(IUsersDTO usersDTO)
        {
            IUsersBDC userBDC = (IUsersBDC)BDCFactory.Instance.Create(BDCType.UsersBDC);

            return(userBDC.CreateUser(usersDTO));
        }
Exemplo n.º 4
0
 public IUsersDTO UpdateProfile(IUsersDTO usersDTO)
 {
     throw new NotImplementedException();
 }