示例#1
0
        public static TableScripts SqlLiteDBInsertEmployee(Employee model)
        {
            TableScripts tableInsertScripts;

            tableInsertScripts =
                new TableScripts
            {
                nameTable = @"\employee.db",
                script    = @"insert into Employee values"
                            + "(" + model.employee_id.ToString() + ",'"
                            + model.employee_name + "')",
                operationType        = OperationType.write,
                connectionProperties = new Microsoft.Data.Sqlite.SqliteConnection(@"DataSource=" + GetPathDBFile() + @"\employee.db")
            };
            return(tableInsertScripts);
        }
示例#2
0
 public static string ExecuteQuery(TableScripts tableScripts)
 {
     using (var com0 = new SqliteCommand(tableScripts.script, tableScripts.connectionProperties))
     {
         try
         {
             tableScripts.connectionProperties.Open();
             com0.ExecuteNonQuery();
             tableScripts.connectionProperties.Close();
             return(string.Empty);
         }
         catch (SqliteException ex)
         {
             SLogToFile.SaveInfoInFile("|ExecuteQuery|" + ex.Message);
             return(ex.Message);
         }
     }
 }
示例#3
0
        public static TableScripts SqlLiteDBInsertClient(Client model)
        {
            TableScripts tableInsertScripts;

            tableInsertScripts = new TableScripts
            {
                nameTable = @"\client.db",
                script    = @"insert into Client values"
                            + "(" + model.client_id.ToString() + ",'"
                            + model.client_name + "','"
                            + model.client_sname + "','"
                            + model.client_phone + "','"
                            + model.client_description + "')",
                operationType        = OperationType.write,
                connectionProperties = new Microsoft.Data.Sqlite.SqliteConnection(@"DataSource=" + GetPathDBFile() + @"\client.db")
            };

            return(tableInsertScripts);
        }
示例#4
0
        public static TableScripts SqlLiteDBInsertReservation(Reservation model, int client_id, int services_id, int employee_id)
        {
            TableScripts tableInsertScripts;

            tableInsertScripts =
                new TableScripts
            {
                nameTable = @"\reservation.db",
                script    = @"insert into Reservation values"
                            + "(" + model.reservation_id.ToString() + ",'"
                            + model.reservation_date + "','"
                            + model.reservation_time + "',"
                            + client_id.ToString() + ","
                            + services_id.ToString() + ","
                            + employee_id.ToString()
                            + ")",
                operationType        = OperationType.write,
                connectionProperties = new Microsoft.Data.Sqlite.SqliteConnection(@"DataSource=" + GetPathDBFile() + @"\reservation.db")
            };
            return(tableInsertScripts);
        }