private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { UserLibrary u = new UserLibrary(); int Upload = 0; foreach (DataGridViewRow row in dgvUserUpload.Rows) { u.GENID = u.UserID(); for (int i = 0; i < row.Cells.Count; i++) { if (row.Cells[i].Value == null || row.Cells[i].Value == DBNull.Value || String.IsNullOrWhiteSpace(row.Cells[i].Value.ToString())) { } else { if (Convert.ToInt32(row.Cells[5].Value) == 110) { u.ID = "AD-" + (u.UserID() + 1).ToString().PadLeft(5, '0'); } else if (Convert.ToInt32(row.Cells[5].Value) == 111) { u.ID = "TR-" + (u.UserID() + 1).ToString().PadLeft(5, '0'); } else if (Convert.ToInt32(row.Cells[5].Value) == 112) { u.ID = "ST-" + (u.UserID() + 1).ToString().PadLeft(5, '0'); } u.Username = row.Cells[0].Value.ToString(); u.Password = "******"; u.FirstName = row.Cells[1].Value.ToString(); u.MiddleName = row.Cells[2].Value.ToString(); u.LastName = row.Cells[3].Value.ToString(); u.ContactNumber = row.Cells[4].Value.ToString(); u.Usertype = Convert.ToInt32(row.Cells[5].Value); Upload = 1; } } if (Upload == 1) { u.UserInsert(); Upload = 0; } } }
public void Admin() { if (u.UserID() == 1) { txtID.Text = "AD-" + (u.UserID().ToString().PadLeft(5, '0')); } else { txtID.Text = "AD-" + (u.UserID() + 1).ToString().PadLeft(5, '0'); } u.Usertype = 110; }
public void Admin() { if (u.UserID() == 1) { txtID.Text = "AD-" + (u.UserID().ToString().PadLeft(5, '0')); } else { txtID.Text = "AD-" + (u.UserID() + 1).ToString().PadLeft(5, '0'); } u.Usertype = 110; txtUsername.Enabled = true; txtPassword.Enabled = true; txtConfirmPassword.Enabled = true; drpSecurityQuestion.Enabled = true; txtSecurityAnswer.Enabled = true; }