Beispiel #1
0
        public bool UpdateUserMstr(USER_MSTR_DTO dto)
        {
            try
            {
                if (ReferenceEquals(context, null))
                {
                    context = new CalfuEntities();
                }

                USER_MSTR userMstr = context.USER_MSTR.Where(x => x.USER_ID.Equals(dto.USER_ID)).SingleOrDefault();

                if (!ReferenceEquals(null, userMstr))
                {
                    userMstr.USER_NAME = dto.USER_NAME;
                    userMstr.USER_PASS = dto.USER_PASS;
                    userMstr.USER_NICK = dto.USER_NICK;

                    context.SaveChanges();
                }
                context.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #2
0
        public bool DeleteUserMstrRepository(int id)
        {
            try
            {
                if (ReferenceEquals(context, null))
                {
                    context = new CalfuEntities();
                }


                USER_MSTR userMstr = context.USER_MSTR.Where(x => x.USER_ID.Equals(id)).SingleOrDefault();

                if (!ReferenceEquals(userMstr, null))
                {
                    context.USER_MSTR.Remove(userMstr);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #3
0
        public bool LoginByName(string nick, string pass)
        {
            try
            {
                if (ReferenceEquals(context, null))
                {
                    context = new CalfuEntities();
                }


                USER_MSTR userMstr = context.USER_MSTR.Where(x => x.USER_NICK.Equals(nick) && x.USER_PASS.Equals(pass)).FirstOrDefault();

                if (ReferenceEquals(userMstr, null))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #4
0
 public bool CreateUserMstr(USER_MSTR_DTO dto)
 {
     try
     {
         var _userMstr = new USER_MSTR();
         _userMstr.USER_NAME = dto.USER_NAME;
         _userMstr.USER_PASS = dto.USER_PASS;
         _userMstr.USER_NICK = dto.USER_NICK;
         context.USER_MSTR.Add(_userMstr);
         context.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Beispiel #5
0
        public bool ExistUserMstrRepository(int id)
        {
            if (ReferenceEquals(context, null))
            {
                context = new CalfuEntities();
            }


            USER_MSTR userMstr = context.USER_MSTR.Where(x => x.USER_ID.Equals(id)).SingleOrDefault();

            if (!ReferenceEquals(userMstr, null))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        public USER_MSTR_DTO GetUserMstrRepository(int id)
        {
            try
            {
                USER_MSTR_DTO getUserMstrDto = new USER_MSTR_DTO();
                _userMstr = context.USER_MSTR.Where(x => x.USER_ID.Equals(id)).FirstOrDefault();

                getUserMstrDto.USER_ID   = _userMstr.USER_ID;
                getUserMstrDto.USER_NAME = _userMstr.USER_NAME;
                getUserMstrDto.USER_PASS = _userMstr.USER_PASS;
                getUserMstrDto.USER_NICK = _userMstr.USER_NICK;

                //OBRA_MSTR_DTO getObraMstrDto = context.OBRA_MSTR.Where(x => x.OBRA_ID.Equals(id)).ProjectTo<OBRA_MSTR_DTO>().FirstOrDefault();

                return(getUserMstrDto);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }