Esempio n. 1
0
        public void Update(LicenseRow row)
        {
            using (var cmd = new SQLiteCommand(conn))
            {
                cmd.CommandText = SqlUpdate;
                cmd.Parameters.Add("@IssueDate", System.Data.DbType.Date)
                .Value = row.IssueDate;
                cmd.Parameters.Add("@ExpireDate", System.Data.DbType.Date)
                .Value = row.ExpireDate;
                cmd.Parameters.Add("@HardwareInfo", System.Data.DbType.AnsiString)
                .Value = row.HardwareInfo;
                cmd.Parameters.Add("@ID", System.Data.DbType.Int64)
                .Value = row.ID;

                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 2
0
        List <LicenseRow> ToList(DataTable table)
        {
            var list = new List <LicenseRow>();

            foreach (DataRow r in table.Rows)
            {
                var lic = new LicenseRow
                {
                    ID           = (long)r[0],
                    Key          = (string)r[1],
                    Type         = (int)r[2],
                    Count        = (int)r[3],
                    IssueDate    = r[4] as DateTime?,
                    ExpireDate   = r[5] as DateTime?,
                    HardwareInfo = r[6] as string,
                    Product      = r[7] as string,
                    Comments     = r[8] as string,
                };
                list.Add(lic);
            }
            return(list);
        }