Exemplo n.º 1
0
 public IHttpActionResult Register([FromBody] DTO.UserDTO user)
 //לאן חוזר ההחזרה באנגולר ומה עושים עם זה
 {
     if (Bll.UsersBLL.Register(user))
     {
         return(Ok());
     }
     return(BadRequest());
 }
Exemplo n.º 2
0
        public void AddUser(string firstName, string lastName, string email)
        {
            var addUserDto = new UserDTO()
            {
                FirstName = firstName,
                LastName = lastName,
                Email = email
            };

            _user.AddUserDto(addUserDto);
        }
 public IHttpActionResult Post([FromBody] DTO.UserDTO studentsDTO)
 {
     try
     {
         return(Ok(BL.UserBL.Add(studentsDTO)));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Exemplo n.º 4
0
        public IdentityResult RegisterUser(UserDTO userDto)
        {
            var user = new ApplicationUser
            {
                UserName = userDto.Email,
                Email = userDto.Email
            };

            var result = _userManager.CreateAsync(user, userDto.Password).Result;

            return result;
        }
Exemplo n.º 5
0
        public static User GetUser(DTO.UserDTO dtoUser)
        {
            User user = new User()
            {
                Identity = dtoUser.Identity,
                Name     = dtoUser.Name,
                Mail     = dtoUser.Mail,
                Gender   = dtoUser.Gender
            };

            return(user);
        }
Exemplo n.º 6
0
        public void DataReaderReadAdd(List<UserDTO> allUsers, SqlDataReader dr)
        {
            while (dr.Read())
            {
                UserDTO tmpUser = new UserDTO();

                tmpUser.ID = (int)dr[0];
                tmpUser.FirstName = dr[1].ToString();
                tmpUser.LastName = dr[2].ToString();
                tmpUser.Email = dr[3].ToString();

                allUsers.Add(tmpUser);
            }
        }
Exemplo n.º 7
0
        protected void txtDangKy_Click1(object sender, EventArgs e)
        {
            DTO.UserDTO us = new DTO.UserDTO(-1, txtHoten.Text, txtTaikhoan.Text, txtPassWord.Text, 1, false, txtEmail.Text, txtPhone.Text);
            if (userBUS.insert(us))
            {
                CGloble.Alert(this, "Đăng ký thành công!");

                Response.Redirect("~/HomeWeb/Home.aspx");
            }
            else
            {
                CGloble.Alert(this, "Đăng ký thất bại!");
                txtPassWord.Text = "";
            }
        }
Exemplo n.º 8
0
 //פונקציה שמוסיפה משתמש או מוקדן
 public static DTO.UserDTO AddMokdanOrUser(DTO.UserDTO user)
 {
     DAL.User u1 = BLL.Convertions.UserDtoToDAL(user);
     if (Login(u1.UserPhone) == null)
     {
         //u1.RoleId = 3;
         db.Users.Add(u1);
         db.SaveChanges();
         return(BLL.Convertions.UserToDto(u1));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 9
0
        public static User GetUser(DTO.UserDTO UserDto)
        {
            User User = new User();

            User.city      = UserDto.city;
            User.firstName = UserDto.firstName;
            User.lastName  = UserDto.lastName;
            User.email     = UserDto.email;
            User.tz        = UserDto.tz;
            User.userId    = UserDto.userId;
            User.password  = UserDto.password;
            User.phone     = UserDto.phone;
            User.street    = UserDto.street;
            User.numhouse  = UserDto.numhouse;
            return(User);
        }
        //TODO: Change to generic convert
        public static UserDTO ConvertUser(User user)
        {
            UserDTO userDTO = new DTO.UserDTO()
            {
                Uid        = user.Uid,
                Uaddress   = user.Uaddress,
                Uemail     = user.Uemail,
                UfirstName = user.UfirstName,
                UlastName  = user.UlastName,
                Upassword  = user.Upassword,
                Uphone     = user.Uphone,
                UuserName  = user.UuserName
            };

            return(userDTO);
        }
Exemplo n.º 11
0
 //פונקציה ששומרת את השינויים על עריכת משתמש
 public static void UpdateEditUser(DTO.UserDTO user)
 {
     DAL.User u1 = BLL.Convertions.UserDtoToDAL(user);
     DAL.User u2 = db.Users.FirstOrDefault(u => u.UserId == u1.UserId);
     if (u2 != null)
     {
         u2.UserPassword      = u1.UserPassword;
         u2.UserPhone         = u1.UserPhone;
         u2.UserRecognizeName = u1.UserRecognizeName;
         u2.UserFullName      = u1.UserFullName;
         u2.UserEmail         = u1.UserEmail;
         u2.UserAddress       = u1.UserAddress;
         u2.RoleId            = u1.RoleId;
         db.SaveChanges();
     }
 }
Exemplo n.º 12
0
        public static User GetUser(DTO.UserDTO dtoUser)
        {
            User user = new User()
            {
                Identity         = dtoUser.Identity,
                Name             = dtoUser.Name,
                Mail             = dtoUser.Mail,
                Gender           = dtoUser.Gender,
                Cellphone        = dtoUser.Cellphone,
                CreditCardNumber = dtoUser.CreditCardNumber,
                Validity         = dtoUser.Validity,
                Cvv         = dtoUser.Cvv,
                IdCardOwner = dtoUser.IdCardOwner
            };

            return(user);
        }
Exemplo n.º 13
0
        public void AddUserDto(UserDTO addUserDto)
        {
            this.OpenConnection();

            string sql = String.Format("Insert Into Users" +
                                       "(FirstName, LastName, Email) Values('{0}', '{1}', '{2}')",
                                       //"(FirstName, LastName, Email) Values(@FirstNam, @LastName, )",
                                       addUserDto.FirstName, addUserDto.LastName, addUserDto.Email);

            using (SqlCommand cmd = new SqlCommand(sql, this.connect))
            {
                cmd.Parameters.Add(CmdParam("@FirstName",addUserDto.FirstName, SqlDbType.NVarChar));

                cmd.Parameters.Add(CmdParam("@LastName", addUserDto.LastName, SqlDbType.NVarChar));

                cmd.Parameters.Add(CmdParam("@Email", addUserDto.Email, SqlDbType.NVarChar));

                cmd.ExecuteNonQuery();
            }

            this.CloseConnection();
        }
Exemplo n.º 14
0
        public void DataReaderReadAdd(List<UserDTO> allUsers, SqlDataReader dr)
        {
            var columns = Enumerable.Range(0, dr.FieldCount).Select(dr.GetName).ToList();

            var idIndx = columns.FindIndex(x => x == "UserID");
            var firstNameIndx = columns.FindIndex(x => x == "FirstName");
            var lastNameIndx = columns.FindIndex(x => x == "LastName");
            var emailIndx = columns.FindIndex(x => x == "Email");

            while (dr.Read())
            {                
                var tmpUser = new UserDTO
                {                   
                    ID = (int) dr[idIndx],
                    FirstName = dr[firstNameIndx].ToString(),
                    LastName = dr[lastNameIndx].ToString(),
                    Email = dr[emailIndx].ToString()
                };


                allUsers.Add(tmpUser);
            }
        }
Exemplo n.º 15
0
        //------------------------------------------------------------------------------------------------------------------------------------------
        public List <DTO.UserDTO> SelectAllUserByDataReader()
        {
            List <DTO.UserDTO> list   = new List <DTO.UserDTO>();
            string             strCmd = "select_all_user";
            SqlDataReader      rd     = _DataProvicer.ExecuteQueryWithDataReader(strCmd, CommandType.StoredProcedure);

            if (rd.HasRows)
            {
                while (rd.Read())
                {
                    DTO.UserDTO dto = new DTO.UserDTO
                    {
                        UserID   = rd.GetString(0),
                        UserName = rd.GetString(1),
                        Password = rd.GetString(2),
                        Phone    = rd.GetInt32(3),
                        Email    = rd.GetString(4),
                        RoleID   = rd.GetString(5)
                    };
                    list.Add(dto);
                }
            }
            return(list);
        }
Exemplo n.º 16
0
 public void Put(string id, [FromBody] DTO.UserDTO userDTO)
 {
     BL.UserBL.UpdateUser(id, userDTO);
 }
Exemplo n.º 17
0
 public void Put(string id, [FromBody] DTO.UserDTO studentsDTO)
 {
     BL.UserBL.UpdateUser(id, studentsDTO);
 }
Exemplo n.º 18
0
 public userToSuggest(UserDTO user, bool IsActiv)
 {
     this.user    = user;
     this.IsActiv = IsActiv;
 }
Exemplo n.º 19
0
 public static UserDTO AddNewUser(DTO.UserDTO user)
 {
     return(Converts.UserConvert.ConvertUserToDTO(UserDal.AddNewUser(Converts.UserConvert.ConvertUserToDAL(user))));
 }
Exemplo n.º 20
0
        public void AddUserDto(UserDTO addUserDto)
        {
            OpenConnection();

            const string strSql = "Insert Into Users(FirstName, LastName, Email) " +
                               "Values(@FName, @LName, @EMail)";

            using (var cmd = new SqlCommand(strSql, _connect))
            {
                cmd.Parameters.Add(CmdParam("@FName",addUserDto.FirstName, SqlDbType.NVarChar));

                cmd.Parameters.Add(CmdParam("@LName", addUserDto.LastName, SqlDbType.NVarChar));

                cmd.Parameters.Add(CmdParam("@EMail", addUserDto.Email, SqlDbType.NVarChar));

                cmd.ExecuteNonQuery();
            }

            CloseConnection();
        }
Exemplo n.º 21
0
        public UserDTO EditUserQuery(int idParam)
        {
            UserDTO user = new UserDTO();

            this.OpenConnection();

            string strSql = String.Format("Select * From Users Where UserID = {0}", idParam);

            SqlCommand cmd = new SqlCommand(strSql, this.connect);

            SqlParameter param = new SqlParameter();
            param.ParameterName = "@UserID";
            param.Value = idParam;
            param.SqlDbType = SqlDbType.Int;

            cmd.Parameters.Add(param);

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                user.FirstName = dr[1].ToString();
                user.LastName = dr[2].ToString();
                user.Email = dr[3].ToString();
            }

            this.CloseConnection();

            return user;
        }
Exemplo n.º 22
0
 public static bool CreateUser(DTO.UserDTO user)
 {
     return(Dal.Actions.User.CreateUser(Converters.UserConverters.GetUser(user)));
 }
Exemplo n.º 23
0
        public UserDTO EditUserQuery(int idParam)
        {
            var user = new UserDTO();

            OpenConnection();

            var strSql = String.Format("Select * From Users Where UserID = {0}", idParam);

            var cmd = new SqlCommand(strSql, _connect);

            var param = new SqlParameter
            {
                ParameterName = "@UserID",
                Value = idParam,
                SqlDbType = SqlDbType.Int
            };

            cmd.Parameters.Add(param);

            var dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                user.FirstName = dr[1].ToString();
                user.LastName = dr[2].ToString();
                user.Email = dr[3].ToString();
            }

            CloseConnection();

            return user;
        }