public TradePoint GetParent(TradePoint tradePoint)
        {
            var sqlResult = ServerHandler.GetInstance().GetRequest("TradePoints/GetParent/" + tradePoint.Id.ToString()).Result;

            if (sqlResult.Exception.Length != 0)
            {
                throw new Exception(sqlResult.Exception);
            }
            List <TradePoint> result = new List <TradePoint>();

            for (int i = 0; i < sqlResult.Rows.Count; ++i)
            {
                result.Add(GetTradePointFromRow(sqlResult.Rows[i]));
            }
            if (result.Count == 0)
            {
                return(null);
            }
            TradePoint res;

            try
            {
                res = result.First();
            }
            catch (Exception ex)
            {
                res = null;
            }
            return(res);
        }
Пример #2
0
        public void UpdateEmployeePositions()
        {
            var sqlResult = ServerHandler.GetInstance().GetRequest("EmployeePositions").Result;

            if (sqlResult.Exception.Length != 0)
            {
                throw new Exception(sqlResult.Exception);
            }

            for (int i = 0; i < sqlResult.Rows.Count; ++i)
            {
                employeePositions.Add(GetEmployeePosiionFromRow(sqlResult.Rows[i]));
            }
        }
Пример #3
0
 public static ServerHandler GetInstance()
 {
     if (instance == null)
     {
         lock (syncRoot)
         {
             if (instance == null)
             {
                 instance = new ServerHandler();
             }
         }
     }
     return(instance);
 }
Пример #4
0
 internal void EditProduct(Product product)
 {
     if (product == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("Products/Update", product);
     }
     catch (Exception ex)
     {
         return;
     }
 }
Пример #5
0
 internal void AddOrder(Order order)
 {
     if (order == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("Orders/Insert", order);
     }
     catch (Exception ex)
     {
         return;
     }
 }
 public void DeleteTradePoint(TradePoint tradePoint)
 {
     if (tradePoint == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("TradePoints/Delete", tradePoint);
     }
     catch (Exception ex)
     {
         return;
     }
 }
 internal void EditTradePointProduct(TradePointProduct tradePointProduct)
 {
     if (tradePointProduct == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("TradePointsProducts/Update", tradePointProduct);
     }
     catch (Exception ex)
     {
         return;
     }
 }
 public void EditTradePointPayment(TradePointPayment payment)
 {
     if (payment == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("TradePointsPayments/Update", payment);
     }
     catch (Exception ex)
     {
         return;
     }
 }
 internal void AddTradePointRequest(TradePointRequest tradePointRequest)
 {
     if (tradePointRequest == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("TradePointsRequests/Insert", tradePointRequest);
     }
     catch (Exception ex)
     {
         return;
     }
 }
Пример #10
0
 internal void AddSupply(Supply supply)
 {
     if (supply == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("Supplies/Insert", supply);
     }
     catch (Exception ex)
     {
         return;
     }
 }
Пример #11
0
 internal void EditSupplier(Supplier supplier)
 {
     if (supplier == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("Suppliers/Update", supplier);
     }
     catch (Exception ex)
     {
         return;
     }
 }
 internal void EditTradePointCustomer(TradePointCustomer tradePointCustomer)
 {
     if (tradePointCustomer == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("TradePointsCustomers/Update", tradePointCustomer);
     }
     catch (Exception ex)
     {
         return;
     }
 }
Пример #13
0
 public void EditEmployee(Employee employee)
 {
     if (employee == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("Employees/Update", employee);
     }
     catch (Exception ex)
     {
         return;
     }
 }
 internal void EditTradePointSale(TradePointSale tradePointSale)
 {
     if (tradePointSale == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("TradePointsSales/Update", tradePointSale);
     }
     catch (Exception ex)
     {
         return;
     }
 }
 public List <TradePointType> GetTradePointTypes()
 {
     if (tradePointTypes.Count == 0)
     {
         var sqlResult = ServerHandler.GetInstance().GetRequest("TradePointsTypes").Result;
         if (sqlResult.Exception.Length != 0)
         {
             throw new Exception(sqlResult.Exception);
         }
         for (int i = 0; i < sqlResult.Rows.Count; ++i)
         {
             tradePointTypes.Add(GetTradePointTypeFromRow(sqlResult.Rows[i]));
         }
     }
     return(tradePointTypes);
 }
        internal List <TradePointProduct> GetTradePointProducts(TradePoint tradePoint)
        {
            var sqlResult = ServerHandler.GetInstance().GetRequest("TradePointsProducts/Get/" + tradePoint.Id).Result;

            if (sqlResult.Exception.Length != 0)
            {
                throw new Exception(sqlResult.Exception);
            }
            List <TradePointProduct> result = new List <TradePointProduct>();

            for (int i = 0; i < sqlResult.Rows.Count; ++i)
            {
                result.Add(GetTradePointProductFromRow(sqlResult.Rows[i]));
            }
            return(result);
        }
Пример #17
0
        public List <Employee> GetEmployees()
        {
            var sqlResult = ServerHandler.GetInstance().GetRequest("Employees").Result;

            if (sqlResult.Exception.Length != 0)
            {
                throw new Exception(sqlResult.Exception);
            }
            List <Employee> result = new List <Employee>();

            for (int i = 0; i < sqlResult.Rows.Count; ++i)
            {
                result.Add(GetEmployeeFromRow(sqlResult.Rows[i]));
            }
            return(result);
        }
Пример #18
0
        internal List <Supplier> GetSuppliers()
        {
            var sqlResult = ServerHandler.GetInstance().GetRequest("Suppliers").Result;

            if (sqlResult.Exception.Length != 0)
            {
                throw new Exception(sqlResult.Exception);
            }
            List <Supplier> result = new List <Supplier>();

            for (int i = 0; i < sqlResult.Rows.Count; ++i)
            {
                result.Add(GetSupplierFromRow(sqlResult.Rows[i]));
            }
            return(result);
        }
        public List <TradePoint> GetParents()
        {
            var sqlResult = ServerHandler.GetInstance().GetRequest("TradePoints/GetParents").Result;

            if (sqlResult.Exception.Length != 0)
            {
                throw new Exception(sqlResult.Exception);
            }
            List <TradePoint> result = new List <TradePoint>();

            for (int i = 0; i < sqlResult.Rows.Count; ++i)
            {
                result.Add(GetTradePointFromRow(sqlResult.Rows[i]));
            }
            return(result);
        }
        internal void DeleteTradePointRequest(TradePointRequest tradePointRequest)
        {
            if (tradePointRequest == null)
            {
                return;
            }
            try
            {
                var sqlResult = ServerHandler.GetInstance().GetRequest("TradePointsRequests/Delete/" + tradePointRequest.Id).Result;
            }
            catch (Exception ex)
            {
                return;
            }

            return;
        }
Пример #21
0
        internal void DeleteSupplier(Supplier supplier)
        {
            if (supplier == null)
            {
                return;
            }
            try
            {
                var sqlResult = ServerHandler.GetInstance().GetRequest("Suppliers/Delete/" + supplier.Id).Result;
            }
            catch (Exception ex)
            {
                return;
            }

            return;
        }
Пример #22
0
        internal void DeleteProduct(Product product)
        {
            if (product == null)
            {
                return;
            }
            try
            {
                var sqlResult = ServerHandler.GetInstance().GetRequest("Products/Delete/" + product.Id).Result;
            }
            catch (Exception ex)
            {
                return;
            }

            return;
        }
        public void DeleteTradePointPayment(TradePointPayment payment)
        {
            if (payment == null)
            {
                return;
            }
            try
            {
                var sqlResult = ServerHandler.GetInstance().GetRequest("TradePointsPayments/Delete/" + payment.Id).Result;
            }
            catch (Exception ex)
            {
                return;
            }

            return;
        }
        internal void DeleteTradePointCustomer(TradePointCustomer tradePointCustomer)
        {
            if (tradePointCustomer == null)
            {
                return;
            }
            try
            {
                var sqlResult = ServerHandler.GetInstance().GetRequest("TradePointsCustomers/Delete/" + tradePointCustomer.Id).Result;
            }
            catch (Exception ex)
            {
                return;
            }

            return;
        }
Пример #25
0
        internal void DeleteOrder(Order order)
        {
            if (order == null)
            {
                return;
            }
            try
            {
                var sqlResult = ServerHandler.GetInstance().GetRequest("Orders/Delete/" + order.Id).Result;
            }
            catch (Exception ex)
            {
                return;
            }

            return;
        }