private void mnuDelete_Click(object sender, EventArgs e) { try { String value = ""; if (MyModules.InputBox("Checking Access", "Enter password:"******"admin.") { MessageBox.Show("Invalid Password!!!", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { return; } ListView.SelectedListViewItemCollection SLV = lvList.SelectedItems; foreach (ListViewItem item in SLV) { if (MessageBox.Show("Mandate: " + item.Text + " would be deleted....continue(y/n)?", MyModules.strApptitle, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { return; } SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand(); cmSQL.Connection = cnSQL; cnSQL.Open(); if (item.SubItems[5].Text.ToString().ToUpper() == "MAIN") { cmSQL.Parameters.Clear(); cmSQL.CommandText = "Delete FROM Payment WHERE MandateNo='" + item.Text + "'"; cmSQL.CommandType = CommandType.Text; cmSQL.ExecuteNonQuery(); } else { cmSQL.Parameters.Clear(); cmSQL.CommandText = "Delete FROM PaymentDeductions WHERE MandateNo='" + item.Text + "'"; cmSQL.CommandType = CommandType.Text; cmSQL.ExecuteNonQuery(); } cnSQL.Close(); MessageBox.Show("Delete Successfull!", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); listOfMandates(); } } catch { } }
private void panel3_DoubleClick(object sender, EventArgs e) { string value = ""; if (MyModules.InputBox("Modification Access", "Enter Passcode:", ref value, true) == DialogResult.OK) { if (value == "L/?") { btnAdd.Visible = true; btnUpdate.Visible = true; btnDelete.Visible = true; userDataGridView.ReadOnly = false; } } }
private void mnuDelete_Click(object sender, EventArgs e) { String value = ""; if (MyModules.InputBox("Student Information", "Enter RefNo:", ref value, false) == DialogResult.OK) { if (value == "") { return; } if (Convert.ToInt16(value) != 0) { Action = AppAction.Delete; InitialiseAction(); oLoad(Convert.ToInt16(value)); } } }
private void mnuInsertColumn_Click(object sender, EventArgs e) { try { String value = ""; DataGridViewColumn dtCol = new DataGridViewColumn(); if (MyModules.InputBox("Insert Column", "Enter Column Name:", ref value, false) == DialogResult.OK) { if (value != "") { dtCol.HeaderText = value; } } // dtCol.Name = "ID_New"; dtCol.CellTemplate = new DataGridViewTextBoxCell(); Dgrid.Columns.Insert(Dgrid.Columns[Dgrid.Tag.ToString()].Index, dtCol); } catch { } }
private void FrmSvrInfor_Load(object sender, EventArgs e) { string value = ""; if (MyModules.InputBox("Access", "Enter Password:"******"Admin." || value == "") { MessageBox.Show("Access Denied!"); this.Close(); } } else { this.Close(); } OleDbConnection cnDB = default(OleDbConnection); OleDbCommand cmSQL = default(OleDbCommand); OleDbDataReader drSQL = default(OleDbDataReader); this.Text = "Server Information"; this.Width = 277; try { cnDB = new OleDbConnection(MyModules.MSAccessCn); cnDB.Open(); cmSQL = new OleDbCommand("SELECT * FROM SvrParam", cnDB); drSQL = cmSQL.ExecuteReader(); if (drSQL.HasRows == false) { MessageBox.Show("Invalid Configuration Parameter" + "\r" + "System Halted", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); System.Environment.Exit(0); } if (drSQL.Read()) { cboServerName.Text = drSQL["ServerName"].ToString(); txtUserID.Text = drSQL["UserID"].ToString(); txtPassword.Text = drSQL["Password"].ToString(); txtAttachName.Text = drSQL["AttachName"].ToString(); chkWinAuthen.Checked = Convert.ToBoolean(drSQL["IntegratedSecurity"]); txtOwner.Text = drSQL["Owner"].ToString(); } drSQL.Close(); cmSQL.Dispose(); cnDB.Close(); cnDB.Dispose(); // LoadServer() // AttachDetails() chkWinAuthen_CheckedChanged(sender, e); } catch (Exception er) { MessageBox.Show(er.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }