Exemplo n.º 1
0
 public bool Update(TradePointCustomer customer)
 {
     if (customer.Id < 0)
     {
         return(false);
     }
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.UpdateTradePointsCustomer(customer), true);
     return(true);
 }
        private void ApplyChangesBy(TradePointCustomer tradePointCustomer)
        {
            tradePointCustomer.Name        = textBoxes[0].Text;
            tradePointCustomer.Description = textBoxes[1].Text;

            if (tradePointCustomer.Id < 0)
            {
                TradePointCustomersController.GetInstance().AddTradePointCustomer(tradePointCustomer);
            }
            else
            {
                TradePointCustomersController.GetInstance().EditTradePointCustomer(tradePointCustomer);
            }
        }
 internal void EditTradePointCustomer(TradePointCustomer tradePointCustomer)
 {
     if (tradePointCustomer == null)
     {
         return;
     }
     try
     {
         bool res = ServerHandler.GetInstance().PostRequest("TradePointsCustomers/Update", tradePointCustomer);
     }
     catch (Exception ex)
     {
         return;
     }
 }
        private void AddFieldsBy(TradePointCustomer customer)
        {
            TextBox nameTB = new TextBox()
            {
                Text = customer.Name, Margin = new Thickness(5, 5, 5, 5), Width = 200
            };
            TextBox descTB = new TextBox()
            {
                Text = customer.Description, Margin = new Thickness(5, 5, 5, 5), Width = 200
            };

            Elements.Children.Add(nameTB);
            Elements.Children.Add(descTB);

            textBoxes.Add(nameTB);
            textBoxes.Add(descTB);
        }
        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;
        }
Exemplo n.º 6
0
 internal static string InsertTradePointsCustomer(TradePointCustomer customer)
 {
     return(GetCommand(ref insertTradePointsCustomer, insertTradePointsCustomerPath, new string[] { customer.Name, customer.Description }));
 }
Exemplo n.º 7
0
 internal static string UpdateTradePointsCustomer(TradePointCustomer customer)
 {
     return(GetCommand(ref updateTradePointsCustomer, updateTradePointsCustomerPath, new string[] { customer.Name, customer.Description, customer.Id.ToString() }));
 }
Exemplo n.º 8
0
 public bool Insert(TradePointCustomer customer)
 {
     SQLConnectionHandler.GetInstance()
     .Execute(SQLCommand.InsertTradePointsCustomer(customer), true);
     return(true);
 }