private void saveTenant(SharedCode.Tenant newTenant)
 {
     string saveTenantDir;
     saveTenantDir = CurrentPath + Database + currentLoad + newTenant.Name + ".db";
     XmlWriterSettings writer_settings = new XmlWriterSettings();
     writer_settings.Indent = true; ;
     writer_settings.OmitXmlDeclaration = true;
     writer_settings.Encoding = Encoding.ASCII;
     int noInfo = 0;
     XmlWriter writer = XmlWriter.Create(saveTenantDir, writer_settings);
     using (writer)
     {
         writer.WriteStartDocument();
         //----------
         writer.WriteStartElement("Details"); //Details
         //----------
         writer.WriteElementString("UserName", newTenant.Name);
         writer.WriteElementString("LotNo", newTenant.LotNo);
         writer.WriteElementString("PhoneNo", newTenant.PhoneNo);
         writer.WriteElementString("LandNo", newTenant.LandNo);
         writer.WriteElementString("Email", newTenant.Email);
         writer.WriteElementString("Address", newTenant.Address);
         writer.WriteElementString("Remarks", newTenant.Remarks);
         writer.WriteElementString("Start", newTenant.TenureStart.ToShortDateString());
         writer.WriteElementString("End", newTenant.TenureEnd.ToShortDateString());
         writer.WriteElementString("Rent", noInfo.ToString());
         writer.WriteElementString("Total", noInfo.ToString());
         //----------
         writer.WriteEndElement(); //Details
         writer.WriteEndDocument();
     }
     writer.Flush();
     writer.Close();
 }
 private void editTenant(SharedCode.Tenant editTenant)
 {
     string saveTenantDir = CurrentPath + Database + currentLoad + editTenant.Name + ".db";
     Console.WriteLine("Saving tenant to {0}", saveTenantDir);
     XmlReader readXML = XmlReader.Create(saveTenantDir);
     XmlDocument saveXML = new XmlDocument();
     saveXML.Load(readXML);
     saveXML.SelectSingleNode("//Details/UserName").InnerText = editTenant.Name;
     saveXML.SelectSingleNode("//Details/LotNo").InnerText = editTenant.LotNo;
     saveXML.SelectSingleNode("//Details/PhoneNo").InnerText = editTenant.PhoneNo;
     saveXML.SelectSingleNode("//Details/LandNo").InnerText = editTenant.LandNo;
     saveXML.SelectSingleNode("//Details/Email").InnerText = editTenant.Email;
     saveXML.SelectSingleNode("//Details/Address").InnerText = editTenant.Address;
     saveXML.SelectSingleNode("//Details/Remarks").InnerText = editTenant.Remarks;
     saveXML.Save(saveTenantDir + ".tmp");
     readXML.Close();
     System.IO.File.Delete(saveTenantDir);
     System.IO.File.Move(saveTenantDir + ".tmp", saveTenantDir);
 }
 private void loadUI(SharedCode.appUser currentUser)
 {
     lblWelcome.Text += currentUser.Name;
 }
 private void showData(SharedCode.appUser setUser)
 {
     txtT1Username.Text = setUser.Name;
     txtT1IC.Text = setUser.IC;
     txtT1Address.Text = setUser.HomeAddress;
     txtT1HouseNo.Text = setUser.HouseNumber;
     txtT1PhoneNo.Text = setUser.PhoneNumber;
     txtT1Email.Text = setUser.Email;
 }