public void OnTlfIaPosStateEngine(object sender, RangeMsg <TlfIaDestination> msg) { _Logger.Trace("Procesando {0}: {1}", EventTopicNames.TlfIaPosStateEngine, msg); foreach (TlfIaDestination tlf in msg.Info) { string number = Tlf.NumberToPresentation(tlf.Number); if (tlf.Number == tlf.Alias) { tlf.Alias = number; } tlf.Number = number; } _StateManager.Tlf.Reset(msg); }
public void OnConfListEngine(object sender, RangeMsg <string> msg) { _Logger.Trace("Procesando {0}: {1}", EventTopicNames.ConfListEngine, msg); if (msg != null) { for (int i = 0, to = msg.Count; i < to; i++) { msg.Info[i] = Tlf.NumberToPresentation(msg.Info[i]); } _StateManager.Tlf.ConfList.Reset(msg); } else { _StateManager.Tlf.ConfList.Reset(); } }
private void TlfClick(string number, bool ia, string givenLiteral = null, int id = Int32.MaxValue) { string literal = null; if (number.Length > 0) { number = Tlf.NumberToEngine(number); if (_StateManager.Tlf.Listen.State == FunctionState.Ready) { _EngineCmdManager.ListenTo(number); } else if (_StateManager.Tlf.Transfer.State == FunctionState.Ready) { _EngineCmdManager.TransferTo(number); } else if (_StateManager.Tlf.PickUp.State == FunctionState.Ready) { _EngineCmdManager.PreparePickUp(number); } else if (_StateManager.Tlf.PickUp.State == FunctionState.Executing) { _EngineCmdManager.CancelPickUp(); _EngineCmdManager.PreparePickUp(number); } else if (_StateManager.Tlf.Forward.State == FunctionState.Ready) { _EngineCmdManager.PrepareForward(number); } else { bool wait = false; for (int i = 0; i < Tlf.NumDestinations + Tlf.NumIaDestinations; i++) { TlfDst dst = _StateManager.Tlf[i]; literal = dst.Dst; switch (dst.State) { case TlfState.Hold: //if (i == Tlf.IaMappedPosition) //{ // _EngineCmdManager.EndTlfCall(i, TlfState.Hold); // wait = true; //} break; case TlfState.Conf: _EngineCmdManager.EndTlfConfCall(i); wait = true; break; case TlfState.Out: case TlfState.Set: case TlfState.RemoteHold: case TlfState.Congestion: case TlfState.OutOfService: case TlfState.Busy: _EngineCmdManager.EndTlfCall(i); wait = true; break; case TlfState.InProcess: //Do nothing break; } } if (wait && (_EngineCmdManager.Name == "Ope")) { _EngineCmdManager.Wait(500); } if (_StateManager.Tlf.PickUp.State == FunctionState.Error) { _EngineCmdManager.CancelPickUp(); } if (id != Int32.MaxValue) { _EngineCmdManager.BeginTlfCall(number, _StateManager.Tlf.Priority.NewCall(Tlf.IaMappedPosition), id, literal); } else { _EngineCmdManager.BeginTlfCall(number, _StateManager.Tlf.Priority.NewCall(Tlf.IaMappedPosition), givenLiteral); } _StateManager.Tlf.Unhang.NewCall(ia); } } }
public void opretKunde() { Console.Clear(); Forside.DisplayTop(); Console.WriteLine("Indtast Navn: "); Console.WriteLine("Indtast Efternavn: "); Console.WriteLine("Indtast Adresse: "); Console.WriteLine("Indtast Postnummer: "); Console.WriteLine("Indtast Telefonnummer: "); Console.WriteLine("Indtast E-Mail adresse: "); Console.SetCursorPosition(50, 7); Navn = Console.ReadLine(); erDerTal = Navn.Any(c => char.IsDigit(c)); while (erDerTal) { Console.SetCursorPosition(0, 7); Console.Write(" "); Console.SetCursorPosition(0, 7); Console.WriteLine("Navn må ikke indeholde tal, prøv igen:"); Console.SetCursorPosition(50, 7); Navn = Console.ReadLine(); erDerTal = Navn.Any(c => char.IsDigit(c)); } Console.SetCursorPosition(0, 7); Console.Write(" "); Console.SetCursorPosition(0, 7); Console.WriteLine("Navn:"); Console.SetCursorPosition(50, 7); Console.WriteLine(Navn); Console.SetCursorPosition(50, 8); Efternavn = Console.ReadLine(); erDerTal = Efternavn.Any(c => char.IsDigit(c)); while (erDerTal) { Console.SetCursorPosition(0, 8); Console.Write(" "); Console.SetCursorPosition(0, 8); Console.WriteLine("Efternavn må ikke indeholde tal, prøv igen:"); Console.SetCursorPosition(50, 8); Efternavn = Console.ReadLine(); erDerTal = Efternavn.Any(c => char.IsDigit(c)); } Console.SetCursorPosition(0, 8); Console.Write(" "); Console.SetCursorPosition(0, 8); Console.WriteLine("Efternavn:"); Console.SetCursorPosition(50, 8); Console.WriteLine(Efternavn); Console.SetCursorPosition(50, 9); Adr = Console.ReadLine(); Console.SetCursorPosition(0, 9); Console.Write(" "); Console.SetCursorPosition(0, 9); Console.WriteLine("Adresse:"); Console.SetCursorPosition(50, 9); Console.WriteLine(Adr); Console.SetCursorPosition(50, 10); bool PostNrLoop = true; while (PostNrLoop) { try { Postnr = Convert.ToInt32(Console.ReadLine()); if (Postnr.ToString().Length != 4) { Console.SetCursorPosition(0, 10); Console.Write(" "); Console.SetCursorPosition(0, 10); Console.WriteLine("Et postnummer er altid 4 cifre, prøv igen:"); Console.SetCursorPosition(50, 10); } else { PostNrLoop = false; } } catch (Exception) { Console.SetCursorPosition(0, 10); Console.Write(" "); Console.SetCursorPosition(0, 10); Console.WriteLine("Et postnummer er altid et tal med 4 cifre, prøv igen:"); Console.SetCursorPosition(50, 10); } } Console.SetCursorPosition(0, 10); Console.Write(" "); Console.SetCursorPosition(0, 10); Console.WriteLine("Postnummer:"); Console.SetCursorPosition(50, 10); Console.WriteLine(Postnr); Console.SetCursorPosition(50, 11); bool TlfLoop = true; while (TlfLoop) { try { Tlf = Convert.ToInt32(Console.ReadLine()); if (Tlf.ToString().Length != 8) { Console.SetCursorPosition(0, 11); Console.Write(" "); Console.SetCursorPosition(0, 11); Console.WriteLine("Et telefonnummer er altid 8 cifre:"); Console.SetCursorPosition(50, 11); } else { TlfLoop = false; } } catch (Exception) { Console.SetCursorPosition(0, 11); Console.Write(" "); Console.SetCursorPosition(0, 11); Console.WriteLine("Et telefonnummer er altid tal med 8 cifre:"); Console.SetCursorPosition(50, 11); } } Console.SetCursorPosition(0, 11); Console.Write(" "); Console.SetCursorPosition(0, 11); Console.WriteLine("Telefonnummer:"); Console.SetCursorPosition(50, 11); Console.WriteLine(Tlf); Console.SetCursorPosition(50, 12); Email = Console.ReadLine(); while (!IsValidEmail(Email)) { Console.SetCursorPosition(0, 12); Console.Write(" "); Console.SetCursorPosition(0, 12); Console.WriteLine("Ugyldig indtastning, prøv igen:"); Console.SetCursorPosition(50, 12); Email = Console.ReadLine(); } Console.SetCursorPosition(0, 12); Console.Write(" "); Console.SetCursorPosition(0, 12); Console.WriteLine("Email adresse:"); Console.SetCursorPosition(50, 12); Console.WriteLine(Email); OpretDato = DateTime.Now.ToString("d"); SQL.Change("insert into Kunder values('" + Navn + "', '" + Efternavn + "', '" + Adr + "', " + Postnr + ", " + Tlf + ", '" + Email + "', '" + OpretDato + "')"); kunder.Add(new Kunde(Navn, Efternavn, Adr, Postnr, Tlf, Email, OpretDato)); }