Beispiel #1
0
        public Note(bool isTest    = false, string name   = "", string surname = "", string midName = "", string phoneNum   = "",
                    string country = "", string birthDate = "", string company = "", string post    = "", string otherNotes = "")
        {
            if (!isTest)
            {
                Id = count;
                count++;

                Enter.TryEnter(out this.name, "Enter name", false, true);
                Enter.TryEnter(out this.surname, "Enter surname", false, true);
                Enter.TryEnter(out this.midName, "Enter middlename", false, false);
                Enter.TryEnter(out this.phoneNum, "Enter phone number");
                Enter.TryEnter(out this.country, "Enter country", false, true);
                Enter.TryEnter(out this.birthDate, "Enter birth date (dd.MM.yyyy)", DateTime.MinValue);
                Enter.TryEnter(out this.company, "Enter company", true, false);
                Enter.TryEnter(out this.post, "Enter person's post", true, false);
                Enter.TryEnter(out this.otherNotes, "Enter other notes", true, false);
            }
            else
            {
                Id = count;
                count++;

                this.name       = name;
                this.surname    = surname;
                this.midName    = midName;
                this.phoneNum   = phoneNum;
                this.country    = country;
                this.birthDate  = DateTime.Parse(birthDate);
                this.company    = company;
                this.post       = post;
                this.otherNotes = otherNotes;
            }
        }
        private static void ShowNote()
        {
            int id;

            Enter.TryEnter(out id, "Enter note id");
            Note note = FindNote(id);

            if (note == null)
            {
                Error.PrintError(Error.ErrorTypes.noteNotFound);
            }
            else
            {
                note.PrintFullInfo();
                Command.CommandSucceed(Command.CommandTypes.show);
            }
        }
        private static void DeleteNote()
        {
            int id;

            Enter.TryEnter(out id, "Enter note id");
            Note note = FindNote(id);

            if (note == null)
            {
                Error.PrintError(Error.ErrorTypes.noteNotFound);
            }
            else
            {
                notes.Remove(note);
                Command.CommandSucceed(Command.CommandTypes.delete);
            }
        }
Beispiel #4
0
 private void EditField(string fieldName, out DateTime field, DateTime currenValue)
 {
     PrintCurrentValue(fieldName, "", currenValue.ToShortDateString());
     Enter.TryEnter(out field, $"Enter new {fieldName} or enter space to leave the current value", currenValue, true);
 }
Beispiel #5
0
 private void EditField(string fieldName, out string field, string currenValue)
 {
     PrintCurrentValue(fieldName, currenValue, "");
     Enter.TryEnter(out field, $"Enter new {fieldName} or enter space to leave the current value", currenValue, true);
 }
Beispiel #6
0
 private void EditField(string fieldName, out string field, bool canContainNotLetters, bool required, string currenValue)
 {
     PrintCurrentValue(fieldName, currenValue, "");
     Enter.TryEnter(out field, $"Enter new {fieldName} or enter space to leave the current value",
                    canContainNotLetters, required, currenValue, true);
 }