public void DeleteTenant_Handler() { // Delete a tenant // Get the first name and the last name of the tenant to be deleted string firstName = null; string lastName = null; if (!terminalDevice.GetTenantName(ref firstName, ref lastName)) { return; } TenantData.DeleteTenant(firstName, lastName); }
public void WorkOnTenant_Handler() { // Work on a specific tenant // Input the first name and the last name of the tenant to work on string firstName = null; string lastName = null; if (!terminalDevice.GetTenantName(ref firstName, ref lastName)) { return; } if (TenantData.FindTenant(firstName, lastName, ref currentTenant)) { terminalDevice.ShowTenantMenuDialog(); } }
// handlers for MainMenuDialog public void AddTenant_Handler() { // Add a tenant // Get the name and access code of the tenant to be added string firstName = null; string lastName = null; string accessCode = null; if (!terminalDevice.GetTenantInfo(ref firstName, ref lastName, ref accessCode)) { return; } BarredNumbersList bnl = new BarredNumbersList(); CallData cl = new CallData(); TenantData.AddTenant(new Tenant(firstName, lastName, accessCode, bnl, cl)); }
public void Restore_Handler() { List <SerializableKeyValuePair <string, object> > list = new List <SerializableKeyValuePair <string, object> >(); FileStream f = new FileStream("savefile.svf", FileMode.OpenOrCreate, FileAccess.Read); BinaryFormatter fo = new BinaryFormatter(); list = (List <SerializableKeyValuePair <string, object> >)fo.Deserialize(f); for (int i = 0; i < list.Count; i++) { Tenant toTenant = (Tenant)list[i].Value; Tenant toTenantData = new Tenant(toTenant.firstName, toTenant.lastName, toTenant.accessCode, toTenant.barredList, toTenant.callData); TenantData.AddTenant(toTenantData); } f.Close(); }
public void Activate() { // Receive an access code string accessCode = null; if (!telephoneDevice.GetAccessCode(ref accessCode)) { return; } if (TenantData.FindTenantByAC(accessCode, ref currentTenant)) { // Receive a telephone number string areaCode = null; string exchange = null; string number = null; if (!telephoneDevice.GetTelephoneNumber(ref areaCode, ref exchange, ref number)) { return; } StringBuilder sb = new StringBuilder(); sb.Append(areaCode); sb.Append("-"); sb.Append(exchange); sb.Append("-"); sb.Append(number); if (!currentTenant.barredList.checkIfBarred(areaCode) && !currentTenant.barredList.checkIfBarred(sb.ToString())) { DateTime date = DateTime.Now; currentTenant.callData.StartCall(areaCode, exchange, number, date.ToString()); // Connect the phone telephoneDevice.ConnectPhone(); // User has terminated the call DateTime localDate = DateTime.Now; currentTenant.callData.EndCall(localDate.ToString()); } } }
public void DisplayBarList_Handler() { // call "void DisplayList(object[] list)" to list Bar Numbers TenantData.FindTenant(currentTenant.firstName, currentTenant.lastName, ref currentTenant); terminalDevice.DisplayList(currentTenant.barredList.toObjectArray(currentTenant.barredList.barredNumbers)); }