public frmUserProfile(Image image, string role, string name, string email, string mobile, string Surname, tblRegistration modelvd, string oldRole) { InitializeComponent(); lblFirstName.Text = name; lblSurname.Text = Surname; lblrole.Text = role; lblEmail.Text = email; lblMobile.Text = mobile; imgProfile.Image = image; txtFirstName.Text = name; txtSurname.Text = Surname; tblroles.Text = role; txtEmail.Text = email; txtMobile.Text = mobile; model = modelvd; imageVUp = image; roleVUp = role; nameVUp = name; surnameVUp = Surname; emailVUP = email; moboleVUp = mobile; oldRoleVUp = oldRole; }
private void btnHome_Click(object sender, EventArgs e) { tblRegistration registration = new tblRegistration(); frmDashboard frmDash = new frmDashboard(roleVp, imageVp, nameVp, mobileVp, emailVp, surnameVp); frmDash.Show(); this.Close(); }
private void btnUpload_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Please select a picture"; ofd.Filter = "png files(*.png)|*.png|jpg files(*.jpg)|*.jpg|All files(*.*)|*.*"; ofd.Multiselect = false; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { imgProfile.Image = Image.FromFile(ofd.FileName); tblRegistration obj = tblRegistrationBindingSource.Current as tblRegistration; if (obj != null) { this.imgProfile.ImageLocation = ofd.FileName; } } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.CurrentRow.Index != -1) { model.UserID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["UserID"].Value); using (MacrocommEntities db = new MacrocommEntities()) { model = db.tblRegistrations.Where(x => x.UserID == model.UserID).FirstOrDefault(); imageVUp = byteArrayToImage(model.images); roleVUp = model.UserRole; nameVUp = model.FirstName; emailVUp = model.Email; mobileVUp = model.Mobile; surnameVUp = model.Surname; } } frmUserProfile ViewUserProfile = new frmUserProfile(imageVUp, roleVUp, nameVUp, emailVUp, mobileVUp, surnameVUp, model, oldRoleVUP); ViewUserProfile.Show(); }
private void btnDelete_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow.Index != -1) { model.UserID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["UserID"].Value); using (MacrocommEntities db = new MacrocommEntities()) { model = db.tblRegistrations.Where(x => x.UserID == model.UserID).FirstOrDefault(); if (MessageBox.Show("Are you sure to delete this record ?", "EF CRUD Operation", MessageBoxButtons.YesNo) == DialogResult.Yes) { var entry = db.Entry(model); if (entry.State == EntityState.Detached) { db.tblRegistrations.Attach(model); } db.tblRegistrations.Remove(model); db.SaveChanges(); MessageBox.Show("Deleted Successfully"); } } } }