Exemplo n.º 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Client aClient = new Client();

            aClient.Client_ID = Convert.ToInt32(textBoxClientID.Text);
            aClient.FirstName = textBoxFirstName.Text;
            aClient.LastName  = textBoxLastName.Text;

            ClientDA.SetClient(aClient);

            listViewClient.Items.Clear();
            RefreshList();
        }
Exemplo n.º 2
0
        public static void DeleteClient(Client client)
        {
            List <Client> myClientList = ClientDA.GetClient();

            using (StreamWriter sw = new StreamWriter(filePathTemp))
            {
                foreach (Client element in myClientList)
                {
                    if (element.Client_ID != client.Client_ID)
                    {
                        sw.WriteLine(element.GetClientInfo());
                    }
                }
            }
            File.Replace(filePathTemp, filePathClient, filePathBackup);
        }
Exemplo n.º 3
0
        private void listViewOrder_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = listViewOrder.FocusedItem.Index;

            textBoxOrderID.Text          = Convert.ToString(myOrderList[index].OrderId);
            textBoxProductID.Text        = Convert.ToString(myOrderList[index].Ordered.ProductId);
            textBoxQuantity.Text         = Convert.ToString(myOrderList[index].Ordered.Quantity);
            textBoxSalesClerk.Text       = Convert.ToString(myOrderList[index].SalesClerkId);
            dateTimePickerOrderDate.Text = Convert.ToString(myOrderList[index].OrderDate);
            dateTimePickerShipDate.Text  = Convert.ToString(myOrderList[index].ShipDate);
            textBoxClient.Text           = Convert.ToString(myOrderList[index].ClientId);

            List <Client> myClientList = ClientDA.GetClient();

            foreach (Client element in myClientList)
            {
                if (myOrderList[index].ClientId == element.Client_ID)
                {
                    textBoxClientID.Text  = Convert.ToString(element.Client_ID);
                    textBoxFirstName.Text = element.FirstName;
                    textBoxLastName.Text  = element.LastName;
                }
            }
        }