コード例 #1
0
ファイル: BusinessLogic.cs プロジェクト: ultrasonicsoft/css
 internal static void SaveMiscNotes(MiscNotes miscNote, string fileID)
 {
     string query = string.Format(Constants.INSERT_MISC_NOTES_QUERY, fileID, miscNote.NoteNumber, miscNote.CreatedDate, miscNote.ModifiedDate, miscNote.Description);
     int result = DBHelper.ExecuteNonQuery(query);
 }
コード例 #2
0
        private void btnSaveMiscNote_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(actionMiscNote))
                {
                    btnSaveMiscNote.IsEnabled = false;
                    txtMiscNoteName.IsReadOnly = true;
                    txtMiscNoteDescription.IsReadOnly = true;
                    return;
                }
                string query = string.Empty;

                if (actionMiscNote == "Add")
                {
                    MiscNotes miscNote = new MiscNotes();
                    miscNote.NoteNumber = txtMiscNoteName.Text;
                    miscNote.CreatedDate = dtMiscNoteDate.SelectedDate.Value.ToShortDateString();
                    miscNote.ModifiedDate = dtMiscNoteDate.SelectedDate.Value.ToShortDateString();
                    miscNote.Description = txtMiscNoteDescription.Text;
                    BusinessLogic.SaveMiscNotes(miscNote, txtFileNo.Text);
                }
                else if (actionMiscNote == "Edit")
                {
                    MiscNotes selectedValue = dgMiscNotes.SelectedValue as MiscNotes;
                    query = string.Format(Constants.UPDATE_MISC_NOTES_QUERY, txtMiscNoteName.Text, selectedValue.CreatedDate, dtMiscNoteDate.SelectedDate.Value.ToShortDateString(),
                                txtMiscNoteDescription.Text, txtFileNo.Text, selectedValue.NoteNumber, selectedValue.CreatedDate, selectedValue.ModifiedDate, selectedValue.Description);
                    int result = DBHelper.ExecuteNonQuery(query);
                }
                FillClientMiscList(txtFileNo.Text);

                btnAddNewMiscNote.IsEnabled = true;
                btnEditMiscNote.IsEnabled = true;
                btnSaveMiscNote.IsEnabled = false;
            }
            catch (Exception ex)
            {
                Helper.LogException(ex);
            }
        }