Beispiel #1
0
        private void btnCompare_Click(object sender, EventArgs e)
        {
            SCompare txtStr = new SCompare(txtStr1.Text);

            if (txtStr == txtStr2.Text)
            {
                MessageBox.Show("El string1 es igual a string2!");
            }
            else
            {
                MessageBox.Show("El string1 no es igual a string2!");
            }
        }
Beispiel #2
0
        public static bool Read(string typeSearch, string txt, int index)
        {
            SCompare        txtEntry = new SCompare(txt);
            OleDbDataReader dr       = null;
            Patient         pt;
            string          cmd = "";
            bool            error;

            if (ConnectionBD.Open())
            {
                return(true);
            }
            cmd = "SELECT * FROM tablePatient WHERE " + typeSearch + " = ?";
            Data.Cmd.Parameters.AddWithValue("?", txt);
            if (!(error = Data.Read(cmd, ref dr)))
            {
                while (dr.Read())
                {
                    if (txtEntry == dr.GetString(index))
                    {
                        pt         = new Patient();
                        pt.Name    = dr.GetString(1);
                        pt.Surname = dr.GetString(2);
                        pt.Idcard  = dr.GetString(3);
                        pt.Age     = dr.GetString(4);
                        ListPatient.Add(pt);
                    }
                }
            }
            if (dr != null)
            {
                dr.Close();
            }
            ConnectionBD.Connection.Close();
            Data.Cmd.Parameters.Clear();
            return(error);
        }
Beispiel #3
0
        public static bool Read()
        {
            SCompare        txt = new SCompare(CardPatient);
            string          cmd;
            Recipe          rp;
            bool            error;
            OleDbDataReader dr = null;

            if (ConnectionBD.Open())
            {
                return(true);
            }
            cmd = "SELECT * FROM tableRecipe WHERE Cedula = ?";
            Data.Cmd.Parameters.AddWithValue("?", CardPatient);
            if (!(error = Data.Read(cmd, ref dr)))
            {
                while (dr.Read())
                {
                    if (txt == dr.GetString(3))
                    {
                        rp              = new Recipe();
                        rp.Drugs        = dr.GetString(1);
                        rp.Prescription = dr.GetString(2);
                        rp.DateBegin    = dr.GetDateTime(4);
                        rp.DateDest     = dr.GetDateTime(5);
                        ListRecipe.Add(rp);
                    }
                }
            }
            if (dr != null)
            {
                dr.Close();
            }
            ConnectionBD.Connection.Close();
            Data.Cmd.Parameters.Clear();
            return(error);
        }