private void button2_Click(object sender, EventArgs e) { Crpform cp = new Crpform(); passdata pd = new passdata(cp.person); pd(this.textBox1); this.Hide(); cp.Show(); }
private void button1_Click(object sender, EventArgs e) { Dev_Form dv = new Dev_Form(); passdata pd1 = new passdata(dv.person); pd1(this.textBox1); this.Hide(); dv.Show(); }
private void button6_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure ??", "Confirm Exit!!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { passdata pd = new passdata(qp.person); pd(this.textBox1); this.Hide(); qp.Show(); } else { return; } }
private void button3_Click(object sender, EventArgs e) { {/* foreach (DataGridViewRow rw in this.dataGrid_Dev.Rows) { for (int i = 0; i < rw.Cells.Count; i++) { if (rw.Cells[i].Value == null || rw.Cells[i].Value == DBNull.Value) { // here is your message box... MessageBox.Show(" Developments Table is empty"); button6.Visible = true; return; } } }*/ var confirmResult = MessageBox.Show("Are you sure ??", "Confirm Save!!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { cn.Open(); foreach (DataGridViewRow Datarow in dataGrid_Dev.Rows) { if (Datarow.Cells[0].Value != null && Datarow.Cells[1].Value != null) { long sid = Int64.Parse(strid[Structure.IndexOf(Datarow.Cells[0].Value.ToString())]); decimal aid = Decimal.Parse(Datarow.Cells[1].Value.ToString()); { String pap = (textBox1.Text).Split('-')[0]; using (cmd = new OdbcCommand("INSERT INTO `pap`.`pap_str_area` (`psaid`, `papid`, `struid`, `Area`) VALUES (NULL, '" + pap + "', '" + sid + "', '" + aid + "')", cn)) cmd.ExecuteNonQuery(); } } } cn.Close(); passdata pd = new passdata(qp.person); pd(this.textBox1); this.Hide(); qp.Show(); } else { return; } } // } }
private void button2_Click(object sender, EventArgs e) { /* foreach (DataGridViewRow rw in this.dataGrid_crop.Rows) { for (int i = 0; i < rw.Cells.Count; i++) { if (rw.Cells[i].Value == null || rw.Cells[i].Value == DBNull.Value) { // here is your message box... MessageBox.Show(" Crop Table is empty"); button6.Visible = true; return; } } }*/ var confirmResult = MessageBox.Show("Are you sure ??", "Confirm Save!!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { foreach (DataGridViewRow Datarow in dataGrid_crop.Rows) { if (Datarow.Cells[0].Value != null && Datarow.Cells[1].Value != null && Datarow.Cells[2].Value!= null) { long crpid = Int64.Parse(croptypeid[crop.IndexOf(Datarow.Cells[0].Value.ToString())]); long agid = Int64.Parse(Ageid[Age.IndexOf(Datarow.Cells[1].Value.ToString())]); { cn.Open(); // long rate = Int64.Parse(Datarow.Cells[2].Value.ToString()); using (cmd = new OdbcCommand("INSERT INTO `crop_age` (`C_Aid`, `croptype`,`Age`, `Rate`)" + "VALUES (NULL, '" + crpid + "','" + agid + "','0')", cn)) cmd.ExecuteNonQuery(); // MessageBox.Show(agid.ToString()); cn.Close(); } cn.Open(); String cid = null; using (cmd = new OdbcCommand("SELECT C_Aid FROM `crop_age`", cn)) { using (OdbcDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { cid = reader.GetString(0); } reader.Close(); } } MessageBox.Show(cid); cn.Close(); cn.Open(); long nid = Int64.Parse(Datarow.Cells[2].Value.ToString()); String pap = (textBox1.Text).Split('-')[0]; using (cmd3 = new OdbcCommand("INSERT INTO `pap_crtyp_age_rate` (`PCAid`, `pap`, `crop_age`, `Crop Number`) VALUES (NULL,'" + pap + "','" + cid + "','"+ nid + "')", cn)) cmd3.ExecuteNonQuery(); cn.Close(); } } } else { return; } /* cn.Open(); for (int x = 0; x < dataGrid_crop.ColumnCount; x++) { long agid = Int64.Parse(Ageid[Age.IndexOf(Convert.ToString((dataGrid_crop.items.[x].ToString())))]); long crpid = Int64.Parse(croptypeid[crop.IndexOf(Convert.ToString(listBox1.Items[x].ToString()))]); { using (cmd = new OdbcCommand("INSERT INTO `crop_age` (`C_Aid`, `croptype`,`Age`, `Rate`)" + "VALUES (NULL, '" + crpid + "','" + agid + "',NULL)", cn)) cmd.ExecuteNonQuery(); } String cid = Convert.ToString(1); using (cmd = new OdbcCommand("SELECT C_Aid FROM `crop_age`", cn)) { using (OdbcDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { cid = reader.GetString(0); } reader.Close(); } } String pap = (textBox1.Text).Split('-')[0]; cmd = new OdbcCommand("INSERT INTO `pap_crtyp_age_rate` (`PCAid`, `pap`, `crop_age`, `Crop Number`) VALUES (NULL,'" + pap + "','" + cid + "','" + textBox2.Text + "')", cn); cmd.ExecuteNonQuery(); } cn.Close(); for (int rows = 0; rows < dataGrid_crop.Rows.Count; rows++) { for (int col = 0; col < dataGrid_crop.Rows[rows].Cells.Count; col++) { string value = dataGrid_crop.Rows[0].Cells[0].Value.ToString(); textBox2.Text = textBox2.Text + " " + value; } }*/ passdata pd = new passdata(sf.person); pd(this.textBox1); this.Hide(); sf.Show(); }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(FName.Text)) { MessageBox.Show("Enter a Person's Name"); return; } if (string.IsNullOrEmpty(TenurecomboBox.Text)) { MessageBox.Show("Select Appropriate Tenure"); return; } if (string.IsNullOrEmpty(landsize_textBox.Text)) { MessageBox.Show("Enter land Size"); return; } cn.Open(); String pidd = null; using (cmd = new OdbcCommand("Select PAPid from pap where (FName='" + FName.Text + "' AND LName='" + LName.Text + "');", cn)) { using (OdbcDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { pidd = reader.GetString(0); } reader.Close(); } if (pidd != null) { MessageBox.Show("The Name already Exists"); return; } } using (cmd = new OdbcCommand("INSERT INTO `pap`.`pap` (`PAPid`, `FName`, `LName`) VALUES (NULL, '" + FName.Text + "', '" + LName.Text + "');", cn)) cmd.ExecuteNonQuery(); using (cmd = new OdbcCommand("select PAPid,FName,LName from pap", cn)) { using (OdbcDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { pid = reader.GetString(0); pfname = reader.GetString(1); plname = reader.GetString(2); } reader.Close(); } textBox1.Text = pid + "-" + pfname + "-" + plname; passdata pd = new passdata(cf.person); pd(this.textBox1); this.Hide(); cf.Show(); } { long tid = Int64.Parse(Tenid[Ten.IndexOf(Convert.ToString((TenurecomboBox.SelectedItem.ToString())))]); { using (cmd = new OdbcCommand("INSERT INTO `pap`.`land` (`Lid`, `Tenure`, `size`, `Rate`, `papid`) VALUES (NULL, '" + tid + "', '" + landsize_textBox.Text + "', 'NULL','" + pid + "');", cn)) cmd.ExecuteNonQuery(); } cn.Close(); } }