Пример #1
0
        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   = "";
        }
Пример #2
0
        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   = "";
        }
Пример #3
0
        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  = "";
        }