Beispiel #1
0
 /// <summary>
 /// this method is used to execute the copy command, by calling each of the appropriate methods to add not only the queries, but also the data to the second table
 /// </summary>
 /// <param name="database">
 /// the name of the first database
 /// </param>
 /// <param name="database2">
 /// the name of the second database
 /// </param>
 /// <param name="connNumber">
 /// the connection number of the first database
 /// </param>
 /// <param name="connNumber2">
 /// the connection number of the second database
 /// </param>
 /// <param name="queryStep">
 /// the action we want to take every query action
 /// </param>
 /// <param name="justStructure">
 /// a boolean dictating if the user just wants to copy the structure for now (incase they want to add any fields to the database before copying the data)
 /// </param>
 /// <returns>
 /// the asyncronous task, so it does not lock the UI
 /// </returns>
 public static void ExecuteCopy(string database, string database2, int connNumber, int connNumber2, Action <string> queryStep, Boolean justStructure)
 {
     //using the opened connection...
     using (DbConnection conn = SQLConnectionHandler.GetOpenedConnection(connNumber2))
     {
         //using the opened transaction...
         using (DbTransaction sqlTran = conn.BeginTransaction())
         {
             try
             {
                 //run the queries before, after, and copy the data
                 SQLQueryHandler.RunBeforeQueries(connNumber2, conn, sqlTran, queryStep);
                 if (!justStructure)
                 {
                     SQLDataHandler.CopyData(database, database2, connNumber, connNumber2, conn, sqlTran,
                                             queryStep);
                 }
                 SQLQueryHandler.RunAfterQueries(connNumber2, conn, sqlTran, queryStep);
                 //commit the changes
                 sqlTran.Commit();
             }
             catch (Exception)
             {
                 // rollback the transaction on error
                 sqlTran.Rollback();
                 throw;
             }
         }
     }
 }
 // GET: TradePointsTypes
 public JsonResult Index()
 {
     return(Json(
                SQLConnectionHandler.GetInstance()
                .Execute(SQLCommand.SelectAllTradePointsTypes()).GetResult(),
                JsonRequestBehavior.AllowGet));
 }
Beispiel #3
0
 public bool Insert(Employee employee)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertEmployee(employee), true);
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertEmployeesList(employee), true);
     return(true);
 }
 // GET: ObjectRelations
 public JsonResult Index()
 {
     return(Json(
                SQLConnectionHandler.GetInstance()
                .Execute(SQLCommand.SelectAllObjectsRelations()).GetResult(),
                JsonRequestBehavior.AllowGet
                ));
 }
 public bool Update(TradePointProduct product)
 {
     if (product.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.UpdateTradePointProduct(product), true);
     return(true);
 }
Beispiel #6
0
 public bool Insert(TradePointPayment payment)
 {
     if (payment.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertTradePointPayment(payment), true);
     return(true);
 }
 public bool Update(Supplier supplier)
 {
     if (supplier.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.UpdateSupplier(supplier), true);
     return(true);
 }
 public bool Delete(TradePoint point)
 {
     if (point.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.DeleteTradePoint(point), true);
     return(true);
 }
 public bool Delete(TradePointType type)
 {
     if (type.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.DeleteTradePointType(type), true);
     return(true);
 }
Beispiel #10
0
 public bool Update(TradePointCustomer customer)
 {
     if (customer.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.UpdateTradePointsCustomer(customer), true);
     return(true);
 }
 public bool Delete(ObjectRelation relation)
 {
     if (relation.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.DeleteObjectsRelations(relation), true);
     return(true);
 }
 public bool Update(TradePointSale sale)
 {
     if (sale.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.UpdateTradePointSale(sale), true);
     return(true);
 }
 public bool Update(Order order)
 {
     if (order.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.UpdateOrder(order), true);
     return(true);
 }
Beispiel #14
0
 public bool Update(TradePointRequest request)
 {
     if (request.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.UpdateTradePointRequest(request), true);
     return(true);
 }
Beispiel #15
0
 public bool Delete(Employee employee)
 {
     if (employee.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.DeleteEmployee(employee), true);
     return(true);
 }
Beispiel #16
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            OracleConnection conn = DBUtils.GetDBConnection();

            try
            {
                conn.Open();
            }
            catch (Exception ex)
            {
                return;
            }

            SQLConnectionHandler.GetInstance().SetConnection(conn);
        }
Beispiel #17
0
 /// <summary>
 /// this method is used to call the underlying method that will gather all Key values from the providers list
 /// </summary>
 /// <returns>
 /// the list of provider keys
 /// </returns>
 public static IEnumerable GetProviders()
 {
     return(SQLConnectionHandler.GetProviders());
 }
Beispiel #18
0
 public JsonResult Delete(int id)
 {
     return(Json(SQLConnectionHandler.GetInstance()
                 .Execute(SQLCommand.DeleteTradePointRequest(id), true).GetResult(), JsonRequestBehavior.AllowGet));
 }
 public bool Insert(Order order)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertOrder(order), true);
     return(true);
 }
        // GET: Auth
        public JsonResult Index()
        {
            var result = SQLConnectionHandler.GetInstance().Execute(SQLCommand.SelectTest()).GetResult();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #21
0
 public JsonResult Get(int id)
 {
     return(Json(SQLConnectionHandler.GetInstance()
                 .Execute(SQLCommand.SelectTradePointRequests(id)).GetResult(), JsonRequestBehavior.AllowGet));
 }
Beispiel #22
0
 public bool Insert(TradePointCustomer customer)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertTradePointsCustomer(customer), true);
     return(true);
 }
 public bool Insert(ObjectRelation relation)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertObjectsRelations(relation), true);
     return(true);
 }
 public bool Insert(Supplier supplier)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertSupplier(supplier), true);
     return(true);
 }
 public JsonResult GetParents()
 {
     return(Json(SQLConnectionHandler.GetInstance()
                 .Execute(SQLCommand.SelectAllParents()).GetResult(), JsonRequestBehavior.AllowGet));
 }
 public bool Insert(TradePoint point)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertTradePoint(point), true);
     return(true);
 }
Beispiel #27
0
 /// <summary>
 /// this method will set up any application related options that need to be set
 /// </summary>
 /// <param name="changes">
 /// the action we want to use when adding a new change
 /// </param>
 public static void SetUp(Action <string> changes)
 {
     Change = changes;
     SQLConnectionHandler.AddProviders();
 }
Beispiel #28
0
 public bool Insert(Product product)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertProduct(product), true);
     return(true);
 }
Beispiel #29
0
 /// <summary>
 /// this method is used to call the method that will add a new connection
 /// </summary>
 /// <param name="serverType">
 /// the type of server we are looking at (provider)
 /// </param>
 /// <param name="server">
 /// the name of the server we are connecting to
 /// </param>
 /// <param name="integratedSecurity">
 /// this is used if the provider is SQL server, and if is set, uses the Windows Login to login
 /// </param>
 /// <param name="username">
 /// this is the username to use for this connection
 /// </param>
 /// <param name="password">
 /// this is the password to use for this connection
 /// </param>
 /// <returns>
 /// the ID used to identify this connection throughout the application
 /// </returns>
 public static int AddNewConnection(string serverType, string server, bool integratedSecurity, string username, string password)
 {
     return(SQLConnectionHandler.AddNewConnection(serverType, server, integratedSecurity, username, password));
 }
Beispiel #30
0
 /// <summary>
 /// this method is used to reset the SQL objects defined, such as remove connections and clear queries
 /// </summary>
 public static void Reset()
 {
     SQLConnectionHandler.RemoveConnections();
     SQLQueryHandler.ClearQueries();
 }