Esempio n. 1
0
        /// <summary>
        /// update the client's information
        /// </summary>
        /// <param name="oldCli"></param>
        /// <param name="newCli"></param>
        ///
        public void UpdateInformation(Client oldCli, Client newCli)
        {
            //read the original txt
            List <Client> listOfOldClient = ClientDataMangement.ReadClientDA();
            List <Client> listOfNewClient = new List <Client>();

            //update the line
            foreach (Client aclient in listOfOldClient)
            {
                if (aclient.Equals(newCli))
                {
                    listOfNewClient.Add(newCli);
                }
                else
                {
                    listOfNewClient.Add(aclient);
                }
            }
            //delete file
            ClientDataMangement.DeleteClientFile();
            //save a new list
            foreach (Client newClient in listOfNewClient)
            {
                ClientDataMangement.WriteClientDA(newClient);
            }
        }
Esempio n. 2
0
 //implemtment the interface
 /// <summary>
 /// save to txt file by client object
 /// </summary>
 /// <param name="cli"></param>
 public void SaveInformation(Client cli)
 {
     //TO-DO:validate
     ClientDataMangement.WriteClientDA(cli);
 }