Exemple #1
0
 public Users GetMapper(SqlDataReader reader)
 {
     Users UsersObj = new Users();
     if (reader["user_id"] != DBNull.Value) { UsersObj.UserId= (int)reader["user_id"]; }
     if (reader["first_name"] != DBNull.Value) { UsersObj.FirstName = (string)reader["first_name"]; }
     if (reader["last_name"] != DBNull.Value) { UsersObj.LastName = (string)reader["last_name"]; }
     if (reader["email"] != DBNull.Value) { UsersObj.Email = (string)reader["email"]; }
     if (reader["password"] != DBNull.Value) { UsersObj.Password = (string)reader["password"]; }
     if (reader["experience"] != DBNull.Value) { UsersObj.Experience = (string)reader["experience"]; }
     if (reader["postion"] != DBNull.Value) { UsersObj.Postion = (int)reader["postion"]; }
     if (reader["postion_name"] != DBNull.Value) { UsersObj.PostionName = (string)reader["postion_name"]; }
     if (reader["skills"] != DBNull.Value) { UsersObj.Skills = (int)reader["skills"]; }
     if (reader["skills_name"] != DBNull.Value) { UsersObj.SkillsName = (string)reader["skills_name"]; }
     if (reader["education"] != DBNull.Value) { UsersObj.Education = (string)reader["education"]; }
     if (reader["note"] != DBNull.Value) { UsersObj.Note = (string)reader["note"]; }
     if (reader["location"] != DBNull.Value) { UsersObj.Location = (string)reader["location"]; }
     if (reader["image_name"] != DBNull.Value) { UsersObj.ImageName = (string)reader["image_name"]; }
     if (reader["active_status"] != DBNull.Value) { UsersObj.ActiveStatus = (bool)reader["active_status"]; }
     if (reader["role_id"] != DBNull.Value) { UsersObj.RoleId = (int)reader["role_id"]; }
     if (reader["role_name"] != DBNull.Value) { UsersObj.RoleName = (string)reader["role_name"]; }
     if (reader["created_by"] != DBNull.Value) { UsersObj.CreatedBy = (int)reader["created_by"]; }
     if (reader["created_date"] != DBNull.Value) { UsersObj.CreatedDate = (DateTime)reader["created_date"]; }
     if (reader["updated_by"] != DBNull.Value) { UsersObj.UpdatedBy = (int)reader["updated_by"]; }
     if (reader["updated_date"] != DBNull.Value) { UsersObj.UpdatedDate = (DateTime)reader["updated_date"]; }
     if (reader["flag_deleted"] != DBNull.Value) { UsersObj.FlagDeleted = (bool)reader["flag_deleted"]; }
     if (reader["is_system"] != DBNull.Value) { UsersObj.IsSystem = (bool)reader["is_system"]; }
     return UsersObj;
 }
Exemple #2
0
        public void Add(Users users)
        {
            SqlConnection conn = sqlHelper.GetConnection(false);
               sqlHelper.AddOutParameter("@user_id", SqlDbType.Int);
               sqlHelper.AddInParameter("@first_name", SqlDbType.NVarChar, users.FirstName);
               sqlHelper.AddInParameter("@last_name", SqlDbType.NVarChar, users.LastName);
               sqlHelper.AddInParameter("@email", SqlDbType.NVarChar,users.Email);
               sqlHelper.AddInParameter("@password", SqlDbType.NVarChar, users.Password);
               sqlHelper.AddInParameter("@experience", SqlDbType.NVarChar,users.Experience);
               sqlHelper.AddInParameter("@postion", SqlDbType.Int, users.Postion);
               sqlHelper.AddInParameter("@skills", SqlDbType.Int,users.Skills);
               sqlHelper.AddInParameter("@education", SqlDbType.NVarChar, users.Education);
               sqlHelper.AddInParameter("@note", SqlDbType.NVarChar, users.Note);
               sqlHelper.AddInParameter("@location", SqlDbType.NVarChar, users.Location);
               sqlHelper.AddInParameter("@image_name", SqlDbType.NVarChar, users.ImageName);
               sqlHelper.AddInParameter("@active_status", SqlDbType.Bit, users.ActiveStatus);
               sqlHelper.AddInParameter("@role_id", SqlDbType.Int, users.RoleId);
               sqlHelper.AddInParameter("@created_by", SqlDbType.Int, users.CreatedBy);

               sqlHelper.ExecuteNonQuery("dbo.SP_User_Add", conn, false);

               users.UserId = Convert.ToInt32( sqlHelper.GetOutParameterValue("@user_id"));
        }