Ejemplo n.º 1
0
        private void dgvShowStudent_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int         index = dgvShoStudent.CurrentCell.RowIndex;
            EditStudent std   = new EditStudent(int.Parse(dgvShoStudent.Rows[index].Cells[0].Value.ToString()));

            AllUser.OpenChildForm(std, panelFormControl);
        }
Ejemplo n.º 2
0
 public static void AffichageListeUser(AllUser Registre)
 {
     foreach (User u in Registre.Lregistre)
     {
         Console.WriteLine(u.Pseudo);
     }
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("id,Email,MobileNo,MobileNo2,Name,LastName,MiddleName,Deparment,Role,Addreaddress,City,PaidLeave")] AllUser allUser)
        {
            if (id != allUser.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(allUser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AllUserExists(allUser.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(allUser));
        }
Ejemplo n.º 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            StudenAccess stdac = new StudenAccess();

            try
            {
                student std = new student
                {
                    C01_id          = int.Parse(txtID.Text),
                    C02_firtsname   = txtFirstName.Text,
                    C03_lastname    = txtLastName.Text,
                    C04_birthday    = timeBirthday.Value,
                    C05_gender      = radMale.Checked,
                    C06_phonenumber = txtPhone.Text,
                    C07_address     = txtAddress.Text,
                    C08_avatar      = new Binary(AllUser.ImageToBinary(picAvatar.Image))
                };
                stdac.Add(std);
                MessageBox.Show("Done");
                this.txtID.Text         = "";
                this.txtFirstName.Text  = "";
                this.txtLastName.Text   = "";
                this.timeBirthday.Value = DateTime.Today;
                this.radMale.Checked    = true;
                this.txtPhone.Text      = "";
                this.txtAddress.Text    = "";
                this.picAvatar.Image    = null;
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 5
0
 private void _Load(int ID)
 {
     try
     {
         StudenAccess acs = new StudenAccess();
         student      std = acs.getStudent(ID);
         txtID.Text        = std.C01_id.ToString().Trim();
         txtFirstName.Text = std.C02_firtsname.ToString().Trim();
         txtLastName.Text  = std.C03_lastname.ToString().Trim();
         timeBirthday.Text = std.C04_birthday.ToString().Trim();
         if (std.C05_gender == true)
         {
             radMale.Checked = true;
         }
         else
         {
             radFemale.Checked = true;
         }
         txtPhone.Text   = std.C06_phonenumber.ToString().Trim();
         txtAddress.Text = std.C07_address.ToString().Trim();
         picAvatar.Image = AllUser.BinaryToImage(std.C08_avatar.ToArray());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 6
0
    public void LogInUser(string userName, string userPassword)
    {
        string  pathToFile  = "Assets/users.json";
        string  readAllFile = File.ReadAllText(pathToFile);
        bool    invalidData = false;
        AllUser activeUser  = JsonUtility.FromJson <AllUser>(readAllFile);

        for (int i = 0; i < activeUser.users.Length; i++)
        {
            if (userName == activeUser.users[i].name && userPassword == activeUser.users[i].password)
            {
                UserData.name = activeUser.users[i].name;
                UserData.role = activeUser.users[i].role;
                invalidData   = false;
                break;
            }
            else
            {
                invalidData = true;
            }
        }

        if (invalidData)
        {
            invalidDataTextField.text = "Неверные данные";
        }
        else
        {
            SceneManager.LoadScene("SampleScene");
        }
    }
 public Accueil(ObservableCollection <Topic> SujetAccueil, Connexion ConnectAccueilAdmin, AllUser Registre)
 {
     InitializeComponent();
     SujetAccueilAdmin = SujetAccueil;
     ConnectAdmin      = ConnectAccueilAdmin;
     RegistreUser      = Registre;
 }
        public SpotsPage()
        {
            InitializeComponent();
            AllUser Registre = new AllUser();

            grid1.DataContext = this;
        }
Ejemplo n.º 9
0
        public int PullInformationForGivenUser(ref AllUser pUser, string xmlLocation)
        {
            int code = 0;



            return(code);
        }
Ejemplo n.º 10
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            int index = dgv_list.CurrentCell.RowIndex;

            edsrc = new EditForm(dgv_list.Rows[index].Cells[0].Value.ToString());
            panel_list.Controls.Clear();
            AllUser.OpenChildForm(edsrc, panel_list);
        }
Ejemplo n.º 11
0
        private void _Load()
        {
            picShowStudent.BackColor   = Color.LightGray;
            picAddNewStudent.BackColor = Color.Gray;
            ShowStudent std = new ShowStudent();

            AllUser.OpenChildForm(std, panelFormControl);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Given a blank user, this will push information from the database to it.
        /// </summary>
        /// <param name="givenUser"></param>
        /// <returns></returns>
        public int PullInformationForGivenUser(ref AllUser givenUser)
        {
            int code = 0;



            return(code);
        }
Ejemplo n.º 13
0
        private void picAddNewStudent_Click(object sender, EventArgs e)
        {
            picAddNewStudent.BackColor = Color.LightGray;
            picShowStudent.BackColor   = Color.Gray;

            panelFormControl.Controls.Clear();
            AllUser.OpenChildForm(addStudent, panelFormControl);
        }
Ejemplo n.º 14
0
 public Add(ObservableCollection <Topic> sujet, Connexion connectAdmin, AllUser RegistreUser)
 {
     InitializeComponent();
     grootAdmin.DataContext = this;
     SujetAdd               = sujet;
     ConnectAdd             = connectAdmin;
     Registre               = RegistreUser;
     comboTopic.ItemsSource = SujetAdd;
 }
Ejemplo n.º 15
0
        private void picAddNewStudent_Click(object sender, EventArgs e)
        {
            picAddNewStudent.BackColor = Color.LightGray;
            picShowStudent.BackColor   = Color.Gray;

            AddStudent std = new AddStudent();

            AllUser.OpenChildForm(std, panelFormControl);
        }
Ejemplo n.º 16
0
        private void picStudentClick_Click(object sender, EventArgs e)
        {
            if (picStudentClick.BackColor == Color.Gray)
            {
                picStudentClick.BackColor = Color.LightGray;

                picLoginClick.BackColor = Color.Gray;
                panelFormControl.Controls.Clear();
                AllUser.OpenChildForm(student, panelFormControl);
            }
        }
Ejemplo n.º 17
0
        public async Task <IActionResult> Create([Bind("id,Email,MobileNo,MobileNo2,Name,LastName,MiddleName,Deparment,Role,Addreaddress,City,PaidLeave")] AllUser allUser)
        {
            if (ModelState.IsValid)
            {
                _context.Add(allUser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(allUser));
        }
Ejemplo n.º 18
0
        private void btn_course_Click(object sender, EventArgs e)
        {
            if (btn_course.BackColor == SystemColors.ControlDarkDark)
            {
                TurnOffAllButton();

                btn_course.BackColor = SystemColors.ControlDark;
                panel_main.Controls.Clear();
                AllUser.OpenChildForm(crs, panel_main);
            }
        }
Ejemplo n.º 19
0
 private void _LoadBack_()
 {
     std.C01_ID        = int.Parse(txt_id.Text);
     std.C02_FirstName = txt_firstname.Text;
     std.C03_LastName  = txt_lastname.Text;
     std.C04_Birthday  = date_birthday.Value;
     std.C05_Male      = rad_male.Checked;
     std.C06_Phone     = txt_phone.Text;
     std.C07_Address   = txt_address.Text;
     std.C08_Avatar    = AllUser.ImageToBinary(btn_avatar.BackgroundImage);
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Index de l'administration
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var all = new AllUser
            {
                ListeAllUser = UserService.GetAllUser().Select(w => new GetUserViewModel {
                    Id  = w.Id,
                    Nom = w.Mail,
                }).ToList(),
            };

            return(View(all));
        }
Ejemplo n.º 21
0
 private void _Load()
 {
     txt_id.Text                = std.C01_ID.ToString();
     txt_firstname.Text         = std.C02_FirstName;
     txt_lastname.Text          = std.C03_LastName;
     date_birthday.Value        = std.C04_Birthday;
     rad_male.Checked           = std.C05_Male;
     rad_female.Checked         = !std.C05_Male;
     txt_phone.Text             = std.C06_Phone;
     txt_address.Text           = std.C07_Address;
     btn_avatar.BackgroundImage = AllUser.BinaryToImage(std.C08_Avatar);
 }
Ejemplo n.º 22
0
        public static Connexion Login(string username, string password, AllUser Registre)
        {
            Connexion test = new Connexion(username, password);
            int       a    = test.SeConnecter(Registre);

            if (a == 0)
            {
                Console.WriteLine("\n~~~~ Vous avez entré un mauvais username/password ~~~~\n");
                return(null);
            }
            else
            {
                Console.WriteLine($"\n~~~~ Vous êtes désormais connecté en temps que {username} ~~~~\n");
                return(test);
            }
        }
Ejemplo n.º 23
0
        public AllUser loadUser()
        {
            AllUser Registre = new AllUser();

            //Test d'ajout d'utilisateurs (User) au Registre
            Registre.AddUser(new User("guillaume", "guigui71", "*****@*****.**"));
            Registre.AddUser(new User("fabien", "fab71", "*****@*****.**"));
            Registre.AddUser(new User("yannis", "yan71", "*****@*****.**"));
            Registre.AddUser(new User("alex", "alex71", "*****@*****.**"));

            //Test d'ajout d'utilisateurs (Admin) au Registre
            Registre.AddAdmin(new Admin("admin", "admin", "*****@*****.**", "Le grand méchant loup"));
            Admin boss = new Admin("boosDuGame", "toto", "*****@*****.**", "Sympa");

            Registre.AddAdmin(boss);

            return(Registre);
        }
Ejemplo n.º 24
0
    protected void Unnamed6_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            FYPDataContext db        = new FYPDataContext();
            User           u         = new User();
            AllUser        all       = new AllUser();
            var            checkuser = (from x in db.AllUsers
                                        where x.Email_ID.Equals(txtEmail.Text)
                                        select x).FirstOrDefault();


            if (checkuser == null)
            {
                u.Name  = txtName.Text;
                u.Phone = txtPhoneNumber.Text;
                u.Email = txtEmail.Text;
                //u.Password = txtPassword.Text;
                all.Password  = txtPassword.Text;
                all.Email_ID  = txtEmail.Text;
                all.User_Role = "User";
                db.AllUsers.InsertOnSubmit(all);

                db.Users.InsertOnSubmit(u);
                db.SubmitChanges();
                Response.Write("Registration Scuessfully Complete");
                txtPhoneNumber.Text = txtEmail.Text = txtName.Text = "";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Registration Completed');", true);

                //User u1 = new User();
                //var checkuser2 = (from x in db.Users
                //                 where x.Email.Equals(txtEmail.Text)
                //                 select x).FirstOrDefault();
                //Session["BookingUser"] = checkuser2.Id;
                Response.Redirect("Lawns.aspx");
            }

            else
            {
                User_Error.Visible  = true;
                txtPhoneNumber.Text = txtEmail.Text = txtName.Text = "";
            }
        }
    }
Ejemplo n.º 25
0
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            FYPDataContext db  = new FYPDataContext();
            LawnOwner      L   = new LawnOwner();
            AllUser        all = new AllUser();


            var checkVendor = (from x in db.AllUsers
                               where x.Email_ID.Equals(txtEmailL.Text)
                               select x).FirstOrDefault();
            if (checkVendor == null)
            {
                L.LawnName        = txtLawnName.Text;
                L.SeatingCapacity = txtSeating.Text;
                L.Address         = txtAddress.Text;
                L.BankAcc         = txtAcc.Text;
                L.Phone           = txtphone.Text;
                //L.Email = txtEmailL.Text;
                all.Email_ID  = txtEmailL.Text;
                all.Password  = txtPass.Text;
                all.User_Role = "Vendor";
                //  L.Password = txtPass.Text;
                //L.ConfirmPassword = txtConfirmPass.Text;
                L.Area = txtArea.Text;
                db.AllUsers.InsertOnSubmit(all);
                db.LawnOwners.InsertOnSubmit(L);
                db.SubmitChanges();
                Session["Address"] = txtAddress.Text;
                Session["Name"]    = txtLawnName.Text;

                Response.Redirect("ImageUpload.aspx");
            }
            else
            {
                Address_Error.Visible = true;
            }
            txtArea.Text = txtEmailL.Text = txtphone.Text = txtAcc.Text = txtAddress.Text = txtSeating.Text = txtLawnName.Text = "";
        }
    }
Ejemplo n.º 26
0
        public void Load()
        {
            DirectoryInfo di = new DirectoryInfo(UserFilePath);
            UserSet       tmp;

            foreach (FileInfo fi in di.GetFiles())
            {
                tmp = UserSet.Read(fi.Name);
                if (AllUser.FindIndex(
                        user => user.UserName == tmp.UserName) < 0)
                {
                    AllUser.Add(tmp);
                }
            }
            if (AllUser.Count <= 0)
            {
                tmp = new UserSet();
                tmp.Save();
                AllUser.Add(tmp);
            }
        }
Ejemplo n.º 27
0
        public async Task <IActionResult> OwnProfile(OwnProfile ownProfile)
        {
            //var userLoginDetail = userManager.Users.Where(x => x.Email == User.Identity.Name).FirstOrDefault();
            //var userdetail = _context.AllUser.Where(x => x.Email == userLoginDetail.Email).FirstOrDefault();
            if (ModelState.IsValid)
            {
                string  uniqueFileName = ProcessUploadedFile(ownProfile);
                AllUser allUser        = new AllUser
                {
                    id           = ownProfile.id,
                    LastName     = ownProfile.LastName,
                    Addreaddress = ownProfile.Addreaddress,
                    Email        = User.Identity.Name,
                    City         = ownProfile.City,
                    MiddleName   = ownProfile.MiddleName,
                    MobileNo     = ownProfile.MobileNo.ToString(),
                    MobileNo2    = ownProfile.MobileNo2.ToString(),
                    Name         = ownProfile.Name,
                    PaidLeave    = ownProfile_transfer.PaidLeave,
                    Deparment    = ownProfile_transfer.Department,
                    Role         = ownProfile_transfer.Role,
                    UserImage    = uniqueFileName
                };

                try
                {
                    _context.Update(allUser);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(controllerName: "common", actionName: "OwnProfile"));
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(View(ownProfile));
                }
            }

            return(View(ownProfile));
        }
Ejemplo n.º 28
0
        public async Task <IActionResult> Register(RegisterViewModel registerViewModel)
        {
            if (ModelState.IsValid)
            {
                var user = new IdentityUser
                {
                    Email    = registerViewModel.Email,
                    UserName = registerViewModel.Email
                };
                var result = await userManager.CreateAsync(user, registerViewModel.Password);

                if (result.Succeeded)
                {
                    AllUser allUser = new AllUser();
                    allUser.Role      = "Pending";
                    allUser.Email     = registerViewModel.Email;
                    allUser.PaidLeave = 20;
                    allUser.Deparment = "Pending";
                    _context.Add(allUser);
                    await _context.SaveChangesAsync();

                    var            s = userManager.Users.Where(a => a.Email == registerViewModel.Email).FirstOrDefault();
                    IdentityResult identityResult = await userManager.AddToRoleAsync(s, "Pending");

                    //IdentityResult identityResult = await userManager.AddToRoleAsync(s, "Admin");
                    await leaveallocationToALL(s.Email);

                    if (identityResult.Succeeded)
                    {
                        return(RedirectToAction("index", "home"));
                    }
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }
            return(View(registerViewModel));
        }
Ejemplo n.º 29
0
 private void btn_add_Click(object sender, EventArgs e)
 {
     try
     {
         Students std = new Students
         {
             C01_ID        = int.Parse(txt_id.Text),
             C02_FirstName = txt_firstname.Text,
             C03_LastName  = txt_lastname.Text,
             C04_Birthday  = date_birthday.Value,
             C05_Male      = rad_male.Checked,
             C06_Phone     = txt_phone.Text,
             C07_Address   = txt_address.Text,
             C08_Avatar    = AllUser.ImageToBinary(btn_avatar.BackgroundImage)
         };
         mySTD.Add(std);
         MessageBox.Show("Done");
         _Close();
     }
     catch (System.Data.SqlClient.SqlException ex)
     {
         MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 30
0
 private void picAddNewStudent_Paint(object sender, PaintEventArgs e)
 {
     AllUser.PanitEvent(e, "Add", "Microsoft Sans Serif", 14, Brushes.Black, new Point(2, 2));
 }