示例#1
0
 public void SaveJournal(Action<int> callback, JournalModel journalModel)
 {
     ViewSaveCallback = callback;
     JournalRepository journalRepository = new JournalRepository();
     SaveJournalCallback handler = new SaveJournalCallback(SaveJournalCompleted);
     journalRepository.SaveJournal(new Action<int>(handler), journalModel);
 }
 public void SaveJournal(Action<int> callback, JournalModel journalModel)
 {
     SaveJournalCallback = callback;
     Journal journal = MappingJournalModelToJournal(journalModel);
     JournalServiceClient journalSvc = new JournalServiceClient();
     journalSvc.InsertJournalAsync(journal);
     journalSvc.InsertJournalCompleted += new EventHandler
         <InsertJournalCompletedEventArgs>(journalSvc_InsertJournalCompleted);
 }
        private Journal MappingJournalModelToJournal(JournalModel journalModel)
        {
            Journal journal = new Journal();
            journal.cropid = journalModel.CropId;
            journal.dateentered = journalModel.DateEntered;
            journal.description = journalModel.Description;
            journal.journalimage = journalModel.Photo;

            return journal;
        }
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            JournalModel journalModel = new JournalModel();
            journalModel.CropId = cropId;
            journalModel.DateEntered = (DateTime) dateOfJournal.Value;
            journalModel.Description = descTxt.Text;
            journalModel.Photo = image;

            SaveJournalCallback handler = new SaveJournalCallback(SaveJournalCompleted);
            journalModel.SaveJournal(new Action<int>(handler), journalModel);
        }