void addRecord_Click(object sender, EventArgs e) { Form f = new Progress(); f.ShowDialog(); Form add = new AddRecord(); add.ShowDialog(); }
void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { Form f = new Progress(); f.ShowDialog(); profile_id = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); Form view = new ViewUpdate(); view.ShowDialog(); }
void FirGridView_CellContentClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) { string a = FirGridView.Rows[e.RowIndex].Cells["complainer_address"].Value.ToString(); string b = FirGridView.Rows[e.RowIndex].Cells["complainer_city"].Value.ToString(); string c = FirGridView.Rows[e.RowIndex].Cells["Complainer_State"].Value.ToString(); Form f = new Progress(); f.ShowDialog(); FIR_ID = FirGridView.Rows[e.RowIndex].Cells["fir_id"].Value.ToString(); complainerName = FirGridView.Rows[e.RowIndex].Cells["complainer_name"].Value.ToString(); complainerAddress = a + ", " + b + ", " + c.ToString(); complain = FirGridView.Rows[e.RowIndex].Cells["fir_summary"].Value.ToString(); complainerMobile = FirGridView.Rows[e.RowIndex].Cells["complainer_mobile"].Value.ToString(); incidentDate = FirGridView.Rows[e.RowIndex].Cells["incident_date"].Value.ToString(); firDate = FirGridView.Rows[e.RowIndex].Cells["fir_date"].Value.ToString(); Accusedname = FirGridView.Rows[e.RowIndex].Cells["Accused_name"].Value.ToString(); stat1 = FirGridView.Rows[e.RowIndex].Cells["recieved"].Value.ToString(); stat2 = FirGridView.Rows[e.RowIndex].Cells["fir_action"].Value.ToString(); Form viewFir = new FIRDetail(); viewFir.ShowDialog(); }
private void buttonSubmit_Click(object sender, EventArgs e) { string param = ""; if (checkManadatory(txtFname.Text)) { DialogResult dr = MessageBox.Show("Name should not contain any special character or blank spaces", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (checkOptional(txtMname.Text)) { DialogResult dr = MessageBox.Show("Name should not contain any special character or blank spaces. Leave blank if there is no Middle name.", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (checkOptional(txtLname.Text)) { DialogResult dr = MessageBox.Show("Name should not contain any special character or blank spaces. Leave blank if there is no Last name.", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (checkOptional(txtNicname.Text)) { DialogResult dr = MessageBox.Show("Name should not contain any special character or blank spaces. Leave blank if there is no Nick Name.", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int rowC = 0; try { using (SqlConnection conn = new SqlConnection("Server=.\\SQLEXPRESS;Database=FIR_db; User Id = sa; Password = 2611798")) { var rowstate = (DataRowView)txtState.SelectedItem; var rowCity = (DataRowView)txtDistrict.SelectedItem; var rowRegion = (DataRowView)txtSubRegion.SelectedItem; conn.Open(); param = "@firstname, @middlename, @lastname, @nickname, @dob, @addresss, @subregion, @city, @states, @profilepic,@stateid,@districtid"; cmd = new SqlCommand("insert into profiles (firstname,middlename, lastname, nickname, dob, addresss, subregion, city, states, profilepic,stateid,districtid)values(" + param + ")", conn); cmd.Parameters.AddWithValue("@firstname", txtFname.Text); cmd.Parameters.AddWithValue("@middlename", txtMname.Text); cmd.Parameters.AddWithValue("@lastname", txtLname.Text); cmd.Parameters.AddWithValue("@nickname", txtNicname.Text); cmd.Parameters.AddWithValue("@dob", txtDob.Text); cmd.Parameters.AddWithValue("@addresss", txtAddress.Text); cmd.Parameters.AddWithValue("@states", rowstate["stateName"].ToString()); cmd.Parameters.AddWithValue("@city", rowCity["districtName"].ToString()); cmd.Parameters.AddWithValue("@subregion", rowRegion["subRegionName"].ToString()); // cmd.Parameters.AddWithValue("@profilepic", SqlDbType.Image).Value = imageUpload(); cmd.Parameters.AddWithValue("@profilepic", imageUpload()); cmd.Parameters.AddWithValue("@stateid", Convert.ToInt16(txtState.SelectedValue.ToString())); cmd.Parameters.AddWithValue("@districtid", Convert.ToInt16(txtDistrict.SelectedValue.ToString())); rowC = (int)cmd.ExecuteNonQuery(); } } catch (SqlException sce) { DialogResult dr = MessageBox.Show("unable to upload. Please check your entries / internet connection", "Upload Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FileLoadException fe) { DialogResult dr = MessageBox.Show("Image file has been deleted or its location has changed. Please select again.", "Image not found", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (InvalidOperationException ie) { DialogResult dr = MessageBox.Show("Connection Error. Check your Internet connection", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Form f = new Progress(); f.ShowDialog(); if (rowC == 2) { nextStep(); } else { DialogResult dr = MessageBox.Show("Not working"); } } } }