protected void iniGride() { try { DataTable dtUser = new clsUsers().GetUsers(); gvUser.DataSource = dtUser; } catch (Exception ex) { MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnPrint_Click(object sender, EventArgs e) { DataTable dtUsers = new clsUsers().GetUsers(); Reports.rptUser rptUser = new Reports.rptUser(); SaveFileDialog saveFileDialog = new SaveFileDialog(); if (dtUsers.Rows.Count > 0 && saveFileDialog.ShowDialog() == DialogResult.OK) { rptUser.SetDataSource(dtUsers); rptUser.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, saveFileDialog.FileName); rptUser.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, saveFileDialog.FileName); MessageBox.Show(" File Download Successfully :) ", "This msg", MessageBoxButtons.OK, MessageBoxIcon.Information); } rptUser.Close(); rptUser.Dispose(); }
private void btnLogin_Click(object sender, EventArgs e) { try { UserId = new clsUsers().CheckUser(txtUserName.Text, txtPassword.Text); if (UserId > 0) { txtPassword.Text = ""; DataTable dtuser = new clsUsers().GetUsers(UserId); FullName = dtuser.Rows[0]["FullName"].ToString(); this.Hide(); new MainForm().ShowDialog(); this.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { epUser.Clear(); if (String.IsNullOrEmpty(txtFullName.Text)) { epUser.SetError(lblFullName, "Please Enter Name "); } if (String.IsNullOrEmpty(txtPassword.Text)) { epUser.SetError(lblPassword, "Please Enter Your Password "); } if (cmbPosition.SelectedIndex == 0) { epUser.SetError(lblPosition, "Please Select Position"); } if (txtPassword.Text == txtRetypePassword.Text) { int addrow = new clsUsers().Adduser(txtFullName.Text, txtUserName.Text, txtEmail.Text, txtPassword.Text, Int32.Parse(cmbPosition.SelectedValue.ToString())); if (addrow > 0) { txtFullName.Text = txtEmail.Text = txtPassword.Text = txtUserName.Text = txtRetypePassword.Text = ""; MessageBox.Show("Successfully Inserted"); } } else { MessageBox.Show("Retype Password Should Equal Password"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void iniUser() { DataTable dtUsers = new clsUsers().GetUsers(); dataGridView1.DataSource = dtUsers; }