Example #1
0
        public void InsertImportRow(ImportRow ImportRowObj)
        {
            TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "Start Call: InsertImportRow");
            SQLiteCommand cmd;
            cmd = new SQLiteCommand(WDBSQLiteObj.conn);
            cmd.CommandText = @"INSERT INTO `ImportView`
            (`Username`, `Date_Time`, `FileSize`, `FileName`, `FileHash`, `Status`, `Message`)
            VALUES ( ?, ?, ?, ?, ?, ?, ?)";
            var Username = cmd.CreateParameter();
            Username.Value = ImportRowObj.Username;
            cmd.Parameters.Add(Username);

            var Date_Time = cmd.CreateParameter();
            Date_Time.Value = ImportRowObj.DateTime;
            cmd.Parameters.Add(Date_Time);

            var FileSize = cmd.CreateParameter();
            FileSize.Value = ImportRowObj.FileSize;
            cmd.Parameters.Add(FileSize);

            var FileName = cmd.CreateParameter();
            FileName.Value = ImportRowObj.FileName;
            cmd.Parameters.Add(FileName);

            var FileHash = cmd.CreateParameter();
            FileHash.Value = ImportRowObj.FileHash;
            cmd.Parameters.Add(FileHash);

            var Status = cmd.CreateParameter();
            Status.Value = ImportRowObj.Status;
            cmd.Parameters.Add(Status);

            var Message = cmd.CreateParameter();
            Message.Value = ImportRowObj.Message;
            cmd.Parameters.Add(Message);

            TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "cmd.ExecuteNonQuery(): " + cmd.ExecuteNonQuery().ToString());

            cmd.Dispose();
            TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "End Call: InsertImportRow");
        }
Example #2
0
        public void UpdateImportRow(ImportRow ImportRowObj)
        {
            TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "Start Call: UpdateImportRow");
            SQLiteCommand cmd;
            cmd = new SQLiteCommand(WDBSQLiteObj.conn);
            cmd.CommandText = @"UPDATE `ImportView` SET
            `ImportID` = ?,
            `ImportTitle` = ?,
            `Status` = ?,
            `Message` = ?
            WHERE `FileHash` = ?";

            var ImportIDParm = cmd.CreateParameter();
            ImportIDParm.Value = ImportRowObj.ImportID;
            cmd.Parameters.Add(ImportIDParm);

            var ImportTitleParm = cmd.CreateParameter();
            ImportTitleParm.Value = ImportRowObj.ImportTitle;
            cmd.Parameters.Add(ImportTitleParm);

            var StatusParm = cmd.CreateParameter();
            StatusParm.Value = ImportRowObj.Status;
            cmd.Parameters.Add(StatusParm);

            var MessageParm = cmd.CreateParameter();
            MessageParm.Value = ImportRowObj.Message;
            cmd.Parameters.Add(MessageParm);

            var FileHashParm = cmd.CreateParameter();
            FileHashParm.Value = ImportRowObj.FileHash.ToUpper();
            cmd.Parameters.Add(FileHashParm);

            TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "cmd.ExecuteNonQuery(): " + cmd.ExecuteNonQuery().ToString());

            cmd.Dispose();
            TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "End Call: UpdateImportRow");
        }
Example #3
0
        public List<ImportRow> GetImportRows()
        {
            TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "Start Call: GetImportRows");
            string ImportID;
            SQLiteCommand cmd;
            SQLiteDataReader reader;

            List<ImportRow> ImportRows = new List<ImportRow>();
            cmd = new SQLiteCommand(WDBSQLiteObj.conn);
            cmd.CommandText = @"SELECT * FROM `ImportView`";

            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                ImportRow ImportRowObj = new ImportRow();
                if (reader["ImportID"].ToString() == "")
                {
                    ImportID = "0";
                }else
                {
                    ImportID = reader["ImportID"].ToString();
                }
                TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "ImportID For IntParse: "+ImportID);
                ImportRowObj.ImportID = Int32.Parse(ImportID);
                ImportRowObj.Username = reader["Username"].ToString();
                ImportRowObj.ImportTitle = reader["ImportTitle"].ToString();
                ImportRowObj.DateTime = reader["Date_Time"].ToString();
                ImportRowObj.FileSize = reader["FileSize"].ToString();
                ImportRowObj.FileName = reader["FileName"].ToString();
                ImportRowObj.FileHash = reader["FileHash"].ToString();
                ImportRowObj.Status = reader["Status"].ToString();
                ImportRowObj.Message = reader["Message"].ToString();

                ImportRows.Add(ImportRowObj);

            }
            TraceLogObj.WriteToLog(_ThreadName, ObjectName, GetCurrentMethod(), "End Call: GetImportRows");
            return ImportRows;
        }