Beispiel #1
0
        public List <Recipe> GetDataCurrentPage()
        {
            var           temp         = ListRecipe.Skip((CurrentPage - 1) * NumPerPage).Take(NumPerPage).Cast <Recipe>();
            List <Recipe> currentItems = new List <Recipe>(temp);

            return(currentItems);
        }
Beispiel #2
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);
        }