Пример #1
0
        public AffairForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text  = GetSubmitButtonText();
            datePicker.Visible = false;

            Affair affair = _editedNote as Affair;

            if (affair != null)
            {
                nameTextBox.Text            = affair.Name;
                descriptionRichTextBox.Text = affair.Description;
                setDateCheckBox.Checked     = affair.IsDateSet;
                datePicker.Value            = affair.Date;
                stateComboBox.SelectedIndex = (int)affair.CurrentState;
                commentRichTextBox.Text     = affair.Comment;
            }

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #2
0
        public SerialForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();

            Serial serial = _editedNote as Serial;

            if (serial != null)
            {
                nameTextBox.Text            = serial.Name;
                seasonTextBox.Text          = serial.Season.ToString();
                episodeTextBox.Text         = serial.Episode.ToString();
                stateComboBox.SelectedIndex = (int)serial.CurrentState;
                commentRichTextBox.Text     = serial.Comment;
            }

            seasonTextBox.KeyPress  += new KeyPressEventHandler(InputEventHandler.CheckNumeric);
            episodeTextBox.KeyPress += new KeyPressEventHandler(InputEventHandler.CheckNumeric);

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #3
0
        public ProgramForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();

            Program program = _editedNote as Program;

            if (program != null)
            {
                nameTextBox.Text            = program.Name;
                linkRichTextBox.Text        = program.DownloadLink;
                versionTextBox.Text         = program.Version;
                loginTextBox.Text           = program.Login;
                passwordTextBox.Text        = program.Password;
                emailTextBox.Text           = program.Email;
                stateComboBox.SelectedIndex = (int)program.CurrentState;
                commentRichTextBox.Text     = program.Comment;
            }

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #4
0
        public DescribedNoteForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();

            DescribedNote describedNote = _editedNote as DescribedNote;

            if (describedNote != null)
            {
                nameTextBox.Text            = describedNote.Name;
                descriptionRichTextBox.Text = describedNote.Description;
                stateComboBox.SelectedIndex = (int)describedNote.CurrentState;
                commentRichTextBox.Text     = describedNote.Comment;
            }

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #5
0
        public PersonForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();
            sexComboBox.Items.AddRange(PeopleTable.Sex);
            sexComboBox.SelectedIndex = 0;

            Person person = _editedNote as Person;

            if (person != null)
            {
                nameTextBox.Text            = person.Name;
                nicknameTextBox.Text        = person.Nickname;
                sexComboBox.SelectedIndex   = (int)person.Sex;
                birthdateTextBox.Text       = person.Birthdate;
                addressTextBox.Text         = person.Address;
                contactsRichTextBox.Text    = person.Contacts;
                stateComboBox.SelectedIndex = (int)person.CurrentState;
                commentRichTextBox.Text     = person.Comment;
            }

            birthdateTextBox.KeyPress += new KeyPressEventHandler(InputEventHandler.CheckDate);

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
        public async Task <IActionResult> Edit(int id, [Bind("NoteId,NoteTitle,NoteText,UserId")] NoteTable noteTable)
        {
            if (id != noteTable.NoteId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(noteTable);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NoteTableExists(noteTable.NoteId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.User, "Id", "Id", noteTable.UserId);
            return(View(noteTable));
        }
Пример #7
0
        public DatedNoteForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();

            DatedNote datedNote = _editedNote as DatedNote;

            if (datedNote != null)
            {
                nameTextBox.Text            = datedNote.Name;
                yearTextBox.Text            = (datedNote.Year == 0) ? "" : datedNote.Year.ToString();
                stateComboBox.SelectedIndex = (int)datedNote.CurrentState;
                commentRichTextBox.Text     = datedNote.Comment;
            }

            yearTextBox.KeyPress += new KeyPressEventHandler(InputEventHandler.CheckNumeric);

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #8
0
        public BookmarkForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();

            Bookmark b = _editedNote as Bookmark;

            if (b != null)
            {
                nameTextBox.Text            = b.Name;
                URLRichTextBox.Text         = b.URL;
                loginTextBox.Text           = b.Login;
                passwordTextBox.Text        = b.Password;
                emailTextBox.Text           = b.Email;
                stateComboBox.SelectedIndex = (int)b.CurrentState;
                commentRichTextBox.Text     = b.Comment;
            }

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #9
0
        public void saveDocumentDB(HttpPostedFileBase[] documentFiles, string addedStep, string errorNo)
        {
            var userModel = common.getCurrentUserModel();

            System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/" + userModel.Company)); // geçerli şirket resimlerine ait klasör yaratılır


            // Add image flie to db------------------
            int counter = 0;

            foreach (var document in documentFiles)
            {
                try
                {
                    var fileNameWithOutExtension = Path.GetFileNameWithoutExtension(document.FileName);                               // uzantısız adı alınır
                    var extension = Path.GetExtension(document.FileName);                                                             // uzantısı alınır
                    // uzantısız dosya adı illegal karakterlerden arındırıldı
                    fileNameWithOutExtension = Regex.Replace(fileNameWithOutExtension, "[^a-zA-Z0-9_]+", "_", RegexOptions.Compiled); // dosya adı uzantısız olarak değiştirildi


                    counter++;
                    NoteTable noteTable = new NoteTable();
                    noteTable.ErrorNo    = errorNo;
                    noteTable.AddedPlace = addedStep;
                    string filePath = "~/UploadFiles/" + userModel.Company + "/" + "(" + addedStep + ")" + errorNo + "_" + "KanitDosyasi(" + counter.ToString() + ")_" + fileNameWithOutExtension + extension;
                    noteTable.Note = filePath; // file path
                    db.NoteTable.Add(noteTable);
                    db.SaveChanges();
                    //Save the Image File in Folder.
                    document.SaveAs(HttpContext.Current.Server.MapPath(filePath));
                }
                catch (Exception ex) { }
            }
        }
Пример #10
0
        public MealForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();

            Meal meal = _editedNote as Meal;

            if (meal != null)
            {
                nameTextBox.Text            = meal.Name;
                ingredientsRichTextBox.Text = meal.Ingredients;
                recipeRichTextBox.Text      = meal.Recipe;
                stateComboBox.SelectedIndex = (int)meal.CurrentState;
                commentRichTextBox.Text     = meal.Comment;
            }

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #11
0
 public Task DropTables()
 {
     return(Task.WhenAll(new List <Task>()
     {
         UserTable.DropIfExistsAsync(),
         NoteTable.DropIfExistsAsync(),
     }));
 }
Пример #12
0
 public Task CreateTables()
 {
     return(Task.WhenAll(new List <Task>()
     {
         Task.Run(() => UserTable.CreateIfNotExists()),
         Task.Run(() => NoteTable.CreateIfNotExists()),
     }));
 }
Пример #13
0
        private void ReplaceNoteTableInControls(string tableNameDB)
        {
            if (_currentNoteTable != null)
            {
                Controls.Remove(_currentNoteTable);
            }

            _currentNoteTable = _noteTables[tableNameDB];

            Controls.Add(_currentNoteTable);
        }
        public async Task <IActionResult> Create([Bind("NoteId,NoteTitle,NoteText,UserId")] NoteTable noteTable)
        {
            if (ModelState.IsValid)
            {
                _context.Add(noteTable);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.User, "Id", "Id", noteTable.UserId);
            return(View(noteTable));
        }
Пример #15
0
        // GET: api/notes
        public List <Note> Get(string query = null)
        {
            List <Note> notes = null;

            if (query == null)
            {
                notes = NoteTable.GetNotes();
            }
            else
            {
                notes = NoteTable.GetNoteByBody(query);
            }
            return(notes);
        }
Пример #16
0
        void ReleaseDesignerOutlets()
        {
            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (DetailsView != null)
            {
                DetailsView.Dispose();
                DetailsView = null;
            }

            if (JobTable != null)
            {
                JobTable.Dispose();
                JobTable = null;
            }

            if (NewNoteField != null)
            {
                NewNoteField.Dispose();
                NewNoteField = null;
            }

            if (NoteTable != null)
            {
                NoteTable.Dispose();
                NoteTable = null;
            }

            if (OrderNoLabel != null)
            {
                OrderNoLabel.Dispose();
                OrderNoLabel = null;
            }

            if (StatusLabel != null)
            {
                StatusLabel.Dispose();
                StatusLabel = null;
            }

            if (DetailsSection != null)
            {
                DetailsSection.Dispose();
                DetailsSection = null;
            }
        }
Пример #17
0
        public NoteForm(MainForm mainForm, NoteTable editedTable, Mode mode)
        {
            _mainForm    = mainForm;
            _editedTable = editedTable;
            _editedNote  = (mode == Mode.Edit) ? _editedTable.GetNoteFromSelectedRow() : null;
            OpenMode     = mode;

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Escape)
                {
                    Close();
                }
            };
        }
Пример #18
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            NoteTable.CreateDatabase();
        }
Пример #19
0
        private void AddNote(object sender, EventArgs e)
        {
            if (_currentOrder != null && !string.IsNullOrWhiteSpace(NewNoteField.StringValue))
            {
                var note = new Note
                {
                    WorkOrderId = _currentOrder.WorkOrderId,
                    Author      = User.CurrentUser,
                    Added       = DateTime.Now,
                    Content     = NewNoteField.StringValue
                };

                _db.Notes.Add(note);
                _db.SaveChanges();

                ((NoteViewSource)NoteTable.Source).AddNote(note);
                NoteTable.ReloadData();

                NewNoteField.StringValue = string.Empty;
            }
        }
Пример #20
0
        public GameForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();

            AutoCompleteStringCollection genres = new AutoCompleteStringCollection();

            genres.AddRange(Database.SelectUniqueValues("Games", "Genre").Where(x => x != "").ToArray());
            genreTextBox.AutoCompleteCustomSource = genres;

            playersCountComboBox.Items.AddRange(GameTable.PlayersCount);
            playersCountComboBox.SelectedIndex = 0;

            Game game = _editedNote as Game;

            if (game != null)
            {
                nameTextBox.Text     = game.Name;
                linkRichTextBox.Text = game.DownloadLink;
                versionTextBox.Text  = game.Version;
                genreTextBox.Text    = game.Genre;
                loginTextBox.Text    = game.Login;
                passwordTextBox.Text = game.Password;
                emailTextBox.Text    = game.Email;
                playersCountComboBox.SelectedIndex = (int)game.Players;
                stateComboBox.SelectedIndex        = (int)game.CurrentState;
                commentRichTextBox.Text            = game.Comment;
            }

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #21
0
        /// <summary>
        /// Determine if note is a duplicate, and adjust mid and/or guid as required
        /// returns true if note should be added
        /// </summary>
        /// <param name="note"></param>
        /// <returns></returns>
        private bool UniquifyNote(NoteTable note)
        {
            string origGuid = note.GuId;
            long   srcMid   = note.Mid;
            long   dstMid   = GetMid(srcMid);

            // duplicate Schemas?
            if (srcMid == dstMid)
            {
                return(!notes.ContainsKey(origGuid));
            }
            // differing schemas and note doesn't exist?
            note.Mid = dstMid;
            if (!notes.ContainsKey(origGuid))
            {
                return(true);
            }
            // as the schemas differ and we already have a note with a different
            // note type, this note needs a new guid
            if (!dupeOnSchemaChange)
            {
                return(false);
            }
            while (true)
            {
                note.GuId = Utils.GetGuidIncrease(note.GuId);
                changedGuids.Add(origGuid, (note.GuId));
                // if we don't have an existing guid, we can add
                if (!notes.ContainsKey(note.GuId))
                {
                    return(true);
                }
                // if the existing guid shares the same mid, we can reuse
                if (dstMid == Convert.ToInt64(notes[note.GuId][MID]))
                {
                    return(false);
                }
            }
        }
Пример #22
0
        public LiteratureForm(MainForm mainForm, NoteTable editedTable, Mode mode) :
            base(mainForm, editedTable, mode)
        {
            InitializeComponent();

            Text = GetFormText();
            submitButton.Text = GetSubmitButtonText();

            AutoCompleteStringCollection authors = new AutoCompleteStringCollection();

            authors.AddRange(Database.SelectUniqueValues("Literature", "Author").Where(x => x != "").ToArray());
            authorTextBox.AutoCompleteCustomSource = authors;

            AutoCompleteStringCollection genres = new AutoCompleteStringCollection();

            genres.AddRange(Database.SelectUniqueValues("Literature", "Genre").Where(x => x != "").ToArray());
            genreTextBox.AutoCompleteCustomSource = genres;

            AutoCompleteStringCollection universes = new AutoCompleteStringCollection();

            universes.AddRange(Database.SelectUniqueValues("Literature", "Universe").Where(x => x != "").ToArray());
            universeTextBox.AutoCompleteCustomSource = universes;

            AutoCompleteStringCollection serieses = new AutoCompleteStringCollection();

            serieses.AddRange(Database.SelectUniqueValues("Literature", "Series").Where(x => x != "").ToArray());
            seriesTextBox.AutoCompleteCustomSource = serieses;

            Literature lit = _editedNote as Literature;

            if (lit != null)
            {
                nameTextBox.Text            = lit.Name;
                authorTextBox.Text          = lit.Author;
                genreTextBox.Text           = lit.Genre;
                universeTextBox.Text        = lit.Universe;
                seriesTextBox.Text          = lit.Series;
                volumeTextBox.Text          = (lit.Volume == 0) ?  "" : lit.Volume.ToString();
                chapterTextBox.Text         = (lit.Chapter == 0) ? "" : lit.Chapter.ToString();
                pageTextBox.Text            = (lit.Page == 0) ?    "" : lit.Page.ToString();
                pagesTextBox.Text           = (lit.Pages == 0) ?   "" : lit.Pages.ToString();
                yearTextBox.Text            = (lit.Year == 0) ?    "" : lit.Year.ToString();
                stateComboBox.SelectedIndex = (int)lit.CurrentState;
                commentRichTextBox.Text     = lit.Comment;
            }

            // При редактировании вносится только 1 том, а при добавлении можно указать сразу диапазон.
            if (lit != null)
            {
                volumeTextBox.KeyPress += new KeyPressEventHandler(InputEventHandler.CheckNumeric);
            }
            else
            {
                volumeTextBox.KeyPress += delegate(object o, KeyPressEventArgs e)
                {
                    if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '-'))
                    {
                        e.Handled = true;
                    }
                };
            }
            chapterTextBox.KeyPress += new KeyPressEventHandler(InputEventHandler.CheckNumeric);
            pageTextBox.KeyPress    += new KeyPressEventHandler(InputEventHandler.CheckNumeric);
            pagesTextBox.KeyPress   += new KeyPressEventHandler(InputEventHandler.CheckNumeric);
            yearTextBox.KeyPress    += new KeyPressEventHandler(InputEventHandler.CheckNumeric);

            KeyDown += delegate(object o, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control)
                {
                    submitButton.PerformClick();
                }
            };
        }
Пример #23
0
        // GET: api/notes/(int)
        public Note Get(int id)
        {
            Note note = NoteTable.GetNoteById(id);

            return(note);
        }
Пример #24
0
 // POST: api/notes
 public Note Post([FromBody] Note note)
 {
     return(NoteTable.InsertNote(note.Body));
 }