public void getData(int i) { this.pointer = i; if (pointer == 1) { hideAll(); this.donorSearchPan.Visible = true; } if (pointer == 2) { hideAll(); this.storageSearchPan.Visible = true; } if (pointer == 3) { hideAll(); this.clientSearchPan.Visible = true; } if (pointer == 4) { hideAll(); } connection con = new connection(); DataSet ds = con.showData(pointer); dataGridView1.DataSource = ds.Tables[0]; }
private void loadInfo(int id) { connection con = new connection(); DataSet ds = con.getData(pointer, id); if (editD.Visible == true) { editD.loadData(ds.Tables[0].Rows[0][0].ToString(), ds.Tables[0].Rows[0][1].ToString(), ds.Tables[0].Rows[0][2].ToString(), ds.Tables[0].Rows[0][3].ToString(), ds.Tables[0].Rows[0][4].ToString(), ds.Tables[0].Rows[0][5].ToString(), ds.Tables[0].Rows[0][6].ToString(), ds.Tables[0].Rows[0][7].ToString(), ds.Tables[0].Rows[0][8].ToString()); } if (deleteD.Visible == true) { deleteD.loadData(ds.Tables[0].Rows[0][0].ToString(), ds.Tables[0].Rows[0][1].ToString(), ds.Tables[0].Rows[0][2].ToString(), ds.Tables[0].Rows[0][3].ToString(), ds.Tables[0].Rows[0][4].ToString(), ds.Tables[0].Rows[0][5].ToString(), ds.Tables[0].Rows[0][6].ToString(), ds.Tables[0].Rows[0][7].ToString(), ds.Tables[0].Rows[0][8].ToString()); } if (editS.Visible == true) { editS.loadData(ds.Tables[0].Rows[0][0].ToString(), ds.Tables[0].Rows[0][1].ToString(), ds.Tables[0].Rows[0][2].ToString(), ds.Tables[0].Rows[0][3].ToString(), ds.Tables[0].Rows[0][4].ToString()); } if (deleteS.Visible == true) { deleteS.loadData(ds.Tables[0].Rows[0][0].ToString(), ds.Tables[0].Rows[0][1].ToString(), ds.Tables[0].Rows[0][2].ToString(), ds.Tables[0].Rows[0][3].ToString(), ds.Tables[0].Rows[0][4].ToString()); } if (editC.Visible == true) { editC.loadData(ds.Tables[0].Rows[0][0].ToString(), ds.Tables[0].Rows[0][1].ToString(), ds.Tables[0].Rows[0][2].ToString(), ds.Tables[0].Rows[0][3].ToString(), ds.Tables[0].Rows[0][4].ToString(), ds.Tables[0].Rows[0][5].ToString(), ds.Tables[0].Rows[0][6].ToString(), ds.Tables[0].Rows[0][7].ToString(), ds.Tables[0].Rows[0][8].ToString(), ds.Tables[0].Rows[0][9].ToString(), ds.Tables[0].Rows[0][10].ToString(), ds.Tables[0].Rows[0][11].ToString(), ds.Tables[0].Rows[0][12].ToString(), ds.Tables[0].Rows[0][13].ToString(), ds.Tables[0].Rows[0][14].ToString()); } if (deleteC.Visible == true) { deleteC.loadData(ds.Tables[0].Rows[0][0].ToString(), ds.Tables[0].Rows[0][1].ToString(), ds.Tables[0].Rows[0][2].ToString(), ds.Tables[0].Rows[0][3].ToString(), ds.Tables[0].Rows[0][4].ToString(), ds.Tables[0].Rows[0][5].ToString(), ds.Tables[0].Rows[0][6].ToString(), ds.Tables[0].Rows[0][7].ToString(), ds.Tables[0].Rows[0][8].ToString(), ds.Tables[0].Rows[0][9].ToString(), ds.Tables[0].Rows[0][10].ToString(), ds.Tables[0].Rows[0][11].ToString(), ds.Tables[0].Rows[0][12].ToString(), ds.Tables[0].Rows[0][13].ToString(), ds.Tables[0].Rows[0][14].ToString()); } }
private void delButton_Click(object sender, EventArgs e) { connection con = new connection(); con.donorDelete(id); clearText(); dd.getData(1); }
private void editButton_Click(object sender, EventArgs e) { connection con = new connection(); con.donorUpdate(id, nameText.Text, proText.Text, dateCombo1.Text + "-" + month[monthCombo1.Text] + "-" + yearCombo1.Text, addText.Text, emText.Text, phText.Text, bgCombo.Text, dateCombo2.Text + "-" + month[monthCombo2.Text] + "-" + yearCombo2.Text); clearText(); dd.getData(1); }
private void editButton_Click(object sender, EventArgs e) { connection con = new connection(); con.clientUpdate(id, nameText.Text, proText.Text, addText.Text, emText.Text, phText.Text, Convert.ToInt32(amountText1.Text), Convert.ToInt32(amountText2.Text), Convert.ToInt32(amountText3.Text), Convert.ToInt32(amountText4.Text), Convert.ToInt32(amountText5.Text), Convert.ToInt32(amountText6.Text), Convert.ToInt32(amountText7.Text), Convert.ToInt32(amountText8.Text), dateCombo1.Text + "-" + month[monthCombo1.Text] + "-" + yearCombo1.Text); clearText(); dd.getData(3); }
private void doneButton_Click(object sender, EventArgs e) { connection con = new connection(); con.storageInsert(bgCombo.Text, roomText.Text, slText.Text, dateCombo1.Text + "-" + month[monthCombo1.Text] + "-" + yearCombo1.Text); clearText(); dd.getData(2); }
private void deleteButton_Click(object sender, EventArgs e) { connection con = new connection(); con.storageDelete(id); clearText(); dd.getData(2); }
private void insButton_Click(object sender, EventArgs e) { connection con = new connection(); con.clientInsert(nameText.Text, proText.Text, addText.Text, emText.Text, phText.Text, bgAmount["AB+"], bgAmount["AB-"], bgAmount["A+"], bgAmount["A-"], bgAmount["B+"], bgAmount["B-"], bgAmount["O+"], bgAmount["O-"], dateCombo1.Text + "-" + month[monthCombo1.Text] + "-" + yearCombo1.Text); clearText(); loadBg(); dd.getData(3); }
private void clientSearchButton_Click(object sender, EventArgs e) { string qer = ""; int cnt = 0; if (nameText2.Text != "") { qer += "name like '%" + nameText2.Text + "%' "; cnt++; } if (addText2.Text != "") { if (cnt > 0) { qer += "and address like '%" + addText2.Text + "%' "; } else { qer += "address like '%" + addText2.Text + "%' "; } cnt++; } if (phText2.Text != "") { if (cnt > 0) { qer += "and phone like '%" + phText2.Text + "%' "; } else { qer += "phone like '%" + phText2.Text + "%' "; } cnt++; } connection con = new connection(); if (qer != "") { qer = "select id as ID, name as Name, pro as Profession, address as Address, em as Email, ph as Phone, ABpos as AB_pos, ABneg as AB_neg, Apos as A_pos, Aneg as A_neg, Bpos as B_pos, Bneg as B_neg, Opos as O_pos, Oneg as O_neg, pd as Purchase_Date from client_info where " + qer; DataSet ds = con.Search(qer); dataGridView1.DataSource = ds.Tables[0]; } else { qer = "select id as ID, name as Name, pro as Profession, address as Address, em as Email, ph as Phone, ABpos as AB_pos, ABneg as AB_neg, Apos as A_pos, Aneg as A_neg, Bpos as B_pos, Bneg as B_neg, Opos as O_pos, Oneg as O_neg, pd as Purchase_Date from client_info"; DataSet ds = con.Search(qer); dataGridView1.DataSource = ds.Tables[0]; } nameText2.Text = ""; addText2.Text = ""; phText2.Text = ""; }
private void bloodCount() { connection con = new connection(); abpCnt.Text = con.bloodCount("AB+").ToString(); abnCnt.Text = con.bloodCount("AB-").ToString(); apCnt.Text = con.bloodCount("A+").ToString(); anCnt.Text = con.bloodCount("A-").ToString(); bpCnt.Text = con.bloodCount("B+").ToString(); bnCnt.Text = con.bloodCount("B-").ToString(); opCnt.Text = con.bloodCount("O+").ToString(); onCnt.Text = con.bloodCount("O-").ToString(); }
private void btnLogin_Click(object sender, EventArgs e) { //disabled for now connection con = new connection(); bool b = con.varifyAdmin(txtUserName.Text, txtPass.Text); if (b) { MessageBox.Show("Logged In!"); this.Hide(); mainForm mf = new mainForm(); mf.Show(); } clearText(); //temporary code //MessageBox.Show("Logged In!"); //this.Hide(); //mainForm mf = new mainForm(); //mf.Show(); }
private void storageSearchButton_Click(object sender, EventArgs e) { string qer = ""; int cnt = 0; if (bgCombo2.Text != "") { qer += "bg = '" + bgCombo2.Text + "' "; cnt++; } if (slText.Text != "") { if (cnt > 0) { qer += "and sl like '%" + slText.Text + "%' "; } else { qer += "sl like '%" + slText.Text + "%' "; } cnt++; } connection con = new connection(); if (qer != "") { qer = "select id as ID, bg as Blood_Group, roomNo as Room_No, sl as Serial_No, dd as Donation_Date from storage_info where " + qer; DataSet ds = con.Search(qer); dataGridView1.DataSource = ds.Tables[0]; } else { qer = "select id as ID, bg as Blood_Group, roomNo as Room_No, sl as Serial_No, dd as Donation_Date from storage_info"; DataSet ds = con.Search(qer); dataGridView1.DataSource = ds.Tables[0]; } bgCombo2.Text = ""; slText.Text = ""; }
private void donorSearchButton_Click(object sender, EventArgs e) { string qer = ""; int cnt = 0; if (nameText1.Text != "") { qer += "name like '%" + nameText1.Text + "%' "; cnt++; } if (addText1.Text != "") { if (cnt > 0) { qer += "and addr like '%" + addText1.Text + "%' "; } else { qer += "addr like '%" + addText1.Text + "%' "; } cnt++; } if (phText1.Text != "") { if (cnt > 0) { qer += "and phone like '%" + phText1.Text + "%' "; } else { qer += "phone like '%" + phText1.Text + "%' "; } cnt++; } if (bgCombo1.Text != "") { if (cnt > 0) { qer += "and bg = '" + bgCombo1.Text + "'"; } else { qer += "bg = '" + bgCombo1.Text + "'"; } cnt++; } connection con = new connection(); if (qer != "") { qer = "select id as ID, name as Name, pro as Profession, dob as Date_of_Birth,addr as Address, email as Email, phone as Phone, bg as Blood_Group, dod as Date_of_Donation from donor_info where " + qer; DataSet ds = con.Search(qer); dataGridView1.DataSource = ds.Tables[0]; } else { qer = "select id as ID, name as Name, pro as Profession, dob as Date_of_Birth,addr as Address, email as Email, phone as Phone, bg as Blood_Group, dod as Date_of_Donation from donor_info"; DataSet ds = con.Search(qer); dataGridView1.DataSource = ds.Tables[0]; } nameText1.Text = ""; addText1.Text = ""; phText1.Text = ""; bgCombo1.Text = ""; }