Exemplo n.º 1
0
Arquivo: Log.cs Projeto: datvp/WpfMVVM
        public void Info(Model.DownHis m)
        {
            var query = "INSERT INTO DownHis(DriverName,TotalSize,Progress,Status,CreatedOn)VALUES(@DriverName,@TotalSize,@Progress,@Status,@CreatedOn)";
            var found = CheckExist("DownHis", "DriverName", m.DriverName);

            if (found)
            {
                query = "UPDATE DownHis SET TotalSize=@TotalSize,Progress=@Progress,Status=@Status,CreatedOn=@CreatedOn WHERE DriverName=@DriverName";
            }
            List <SQLiteParameter> param = new List <SQLiteParameter>();

            param.Add(new SQLiteParameter("@DriverName", m.DriverName));
            param.Add(new SQLiteParameter("@TotalSize", m.TotalSize));
            param.Add(new SQLiteParameter("@Progress", m.Progress));
            param.Add(new SQLiteParameter("@Status", m.Status));
            param.Add(new SQLiteParameter("@CreatedOn", DateTime.Now.ToString("yyyy-MM-dd HH:MM tt")));
            DAL.ExecQuery(query, param);
        }
Exemplo n.º 2
0
Arquivo: Log.cs Projeto: datvp/WpfMVVM
        public ObservableCollection <Model.DownHis> GetListDownHis()
        {
            ObservableCollection <Model.DownHis> collection = new ObservableCollection <Model.DownHis>();
            string query = "Select * from DownHis";
            var    dt    = DAL.GetList(query, null);

            if (dt == null)
            {
                return(collection);
            }
            foreach (DataRow r in dt.Rows)
            {
                Model.DownHis m = new Model.DownHis();
                m.DriverName = r["DriverName"].ToString();
                m.TotalSize  = int.Parse(r["TotalSize"].ToString());
                m.Progress   = int.Parse(r["Progress"].ToString());
                m.Status     = r["Status"].ToString();
                collection.Add(m);
            }
            return(collection);
        }