private void OnSalaryItemDeleting(object obj)
        {
            EmployeePaymentDetail detail = ListOfPaymentDetails.CurrentItem as EmployeePaymentDetail;

            if (detail == null)
            {
                return;
            }
            Telerik.Windows.Controls.GridViewDeletingEventArgs e = obj as Telerik.Windows.Controls.GridViewDeletingEventArgs;
            if (e == null)
            {
                return;
            }
            ConfirmationRequest.Raise(new Confirmation()
            {
                Title   = "QauntCo Deutschland GmbH",
                Content = $"Wollen Sie den Eintrag wirklich löschen?"
            }, respone =>
            {
                if (respone.Confirmed)
                {
                    dbAccess.RemoveEmployeePaymentDetail(detail);
                }
                else
                {
                    e.Cancel = true;
                }
            });
        }
 ///<summary>Inserts one ConfirmationRequest into the database.  Returns the new priKey.</summary>
 public static long Insert(ConfirmationRequest confirmationRequest)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         confirmationRequest.ConfirmationRequestNum = DbHelper.GetNextOracleKey("confirmationrequest", "ConfirmationRequestNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(confirmationRequest, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     confirmationRequest.ConfirmationRequestNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(confirmationRequest, false));
     }
 }
        private void OnDeleteProduct(Product product)
        {
            string question = string.Format($"Do you wish to delete\nProduct: {product.ProductName}, with the Id: {product.ProductId}");
            string message  = string.Format($"Product: {product.ProductName}, With the Id: {product.ProductId}, Deleted Successfully, {DateTime.Now}");

            ConfirmationRequest.Raise(
                new Confirmation {
                Title = "Delete Product", Content = question
            },
                (result) => {
                if (result.Confirmed)
                {
                    Products.Remove(product);
                    _eventAggregator.GetEvent <ProductsMessagingEvent>().Publish(message);
                }
                else
                {
                    _eventAggregator.GetEvent <ProductsMessagingEvent>().Publish("Did not Delete");
                }
            }
                );


            #region With StatuBar
            //string message = string.Format($"Product: {product.ProductName}, With the Id: {product.ProductId}, Deleted Successfully, {DateTime.Now}");
            //_eventAggregator.GetEvent<ProductsMessagingEvent>().Publish(message);
            #endregion
        }
        private async Task <DataServiceResponse <ConfirmationResponse> > ConfirmAppointmentAsync()
        {
            ScheduleDataSource  ds      = new ScheduleDataSource();
            Appointment         a       = ApplicationData.Current.NewAppointment;
            ConfirmationRequest request = new ConfirmationRequest()
            {
                AppointmentType       = a.AppointmentType.Value,
                AppointmentReason     = a.AppointmentSubType.Value,
                AppointmentSource     = Appointment.MOBILE_APP_SOURCE,
                AdvisorEmailAddress   = a.AdvisorEmail,
                AppointmentLanguage   = a.AppointmentLanguage,
                BranchNumber          = a.BranchNumber,
                ClientNumber          = ApplicationData.Current.Client.CustomerNumber,
                SendEmailConfirmation = true,
                StartTimeUtc          = a.StartDate.ToUniversalTime().ToString("o"),
                EndTimeUtc            = a.EndDate.ToUniversalTime().ToString("o"),
                IncludeIcsFile        = true,
                UiLanguageCode        = 1033,
                PreferredDateUtc      = a.StartDate.Date,
                AdvisorComments       = string.Empty,
                ClientComments        = string.Empty
            };
            DataServiceResponse <ConfirmationResponse> response = await ds.ConfirmAppointmentAsync(request);

            return(response);
        }
Exemplo n.º 5
0
        //削除処理
        private void DeleteExecute()
        {
            ConfirmationRequest.Raise(
                new Confirmation()
            {
                Title   = "確認",
                Content = "削除しますか?"
            },
                r =>
            {
                if (r.Confirmed)
                {
                    if (SQL.DeleteMemo(NaviParam))
                    {
                        NotificationRequest.Raise(new Notification {
                            Content = "削除しました", Title = "成功"
                        });
                        //消す処理
                        Category = null;
                        Title    = "";
                        Detail   = "";

                        _regionManager.Regions["ContentRegion1"].RemoveAll();
                        _regionManager.RequestNavigate("ContentRegion1", "NotesMainView");
                    }
                    else
                    {
                        NotificationRequest.Raise(new Notification {
                            Content = "削除に失敗しました", Title = "失敗"
                        });
                    }
                }
            }
                );
        }
Exemplo n.º 6
0
        ///<summary>Create a confirmation request. If isEmail is false, it will be marked as an SMS</summary>
        public static ConfirmationRequest CreateConfirmationRequest(Appointment appt, Patient pat)
        {
            bool isEmail = pat.PreferContactMethod == ContactMethod.Email;
            ConfirmationRequest request = new ConfirmationRequest {
                ApptNum                  = appt.AptNum,
                AptDateTimeOrig          = appt.AptDateTime,
                ClinicNum                = appt.ClinicNum, //use appt clinic; not prov clinic, pat clinic, or operatory clinic.
                DateTimeConfirmExpire    = DateTime.Now.AddDays(1),
                IsForSms                 = !isEmail,
                IsForEmail               = isEmail,
                MsgTextToMobileTemplate  = "",
                MsgTextToMobile          = "",
                GuidMessageToMobile      = Guid.NewGuid().ToString(),
                EmailSubjTemplate        = "",
                EmailSubj                = "",
                EmailTextTemplate        = "",
                EmailText                = "",
                SecondsFromEntryToExpire = 0,
                PatNum     = appt.PatNum,
                PhonePat   = pat.HmPhone,
                RSVPStatus = RSVPStatusCodes.PendingRsvp
            };

            ConfirmationRequests.Insert(request);
            return(request);
        }
Exemplo n.º 7
0
        /// <summary>
        /// executeDelete(DelegateCommand)
        /// </summary>
        private void executeDelete()
        {
            ConfirmationRequest.Raise(new Confirmation {
                Title = "Confirmation", Content = "Are you delete the select item?"
            }, r => ConfirmationRequestResult = r.Confirmed ? "Ok" : "Cancel");

            if (ConfirmationRequestResult != "Ok")
            {
                return;
            }

            Action a = () => {
                HttpResponseMessage response = MainWindowViewModel._httpClient.DeleteAsync("api/Members/" + SelectedItem.MemberID).Result;
                if (!response.IsSuccessStatusCode)
                {
                    throw new HttpRequestException();
                }
                var m = response.Content.ReadAsAsync <Member>().Result;

                this.Items.Remove(this.SelectedItem);
                this.SelectedItem = this.Items[0];
                ItemPropertyChanged();
            };

            ExecuteAction(a);
        }
Exemplo n.º 8
0
 private void Ok(Window window)
 {
     if (ChangesRequireRestart)
     {
         //Warn if restart required and prompt for Confirmation before restarting
         ConfirmationRequest.Raise(
             new Confirmation
         {
             Title   = "May I restart OptiKey?",
             Content = "OptiKey needs to restart to apply your changes.\nPlease click OK to continue with the restart, or CANCEL to discard your changes"
         }, confirmation =>
         {
             if (confirmation.Confirmed)
             {
                 ApplyChanges();
                 System.Windows.Forms.Application.Restart();
                 Application.Current.Shutdown();
             }
         });
     }
     else
     {
         ApplyChanges();
         window.Close();
     }
 }
Exemplo n.º 9
0
 private void Ok(Window window)
 {
     if (ChangesRequireRestart)
     {
         //Warn if restart required and prompt for Confirmation before restarting
         ConfirmationRequest.Raise(
             new Confirmation
         {
             Title   = "May I restart OptiKey?",
             Content = "OptiKey needs to restart to apply your changes.\nPlease click OK to continue with the restart, or CANCEL to discard your changes"
         }, confirmation =>
         {
             if (confirmation.Confirmed)
             {
                 Log.Info("Applying management changes and attempting to restart OptiKey");
                 ApplyChanges();
                 try
                 {
                     System.Windows.Forms.Application.Restart();
                 }
                 catch { }     //Swallow any exceptions (e.g. DispatcherExceptions) - we're shutting down so it doesn't matter.
                 Application.Current.Shutdown();
             }
         });
     }
     else
     {
         Log.Info("Applying management changes");
         ApplyChanges();
         window.Close();
     }
 }
Exemplo n.º 10
0
 private void Ok(Window window)
 {
     if (ChangesRequireRestart)
     {
         //Warn if restart required and prompt for Confirmation before restarting
         ConfirmationRequest.Raise(
             new Confirmation
         {
             Title   = Resources.VERIFY_RESTART,
             Content = Resources.RESTART_MESSAGE
         }, confirmation =>
         {
             if (confirmation.Confirmed)
             {
                 Log.Info("Applying management changes and attempting to restart OptiKey");
                 ApplyChanges();
                 try
                 {
                     System.Windows.Forms.Application.Restart();
                 }
                 catch { }     //Swallow any exceptions (e.g. DispatcherExceptions) - we're shutting down so it doesn't matter.
                 Application.Current.Shutdown();
             }
         });
     }
     else
     {
         Log.Info("Applying management changes");
         ApplyChanges();
         window.Close();
     }
 }
Exemplo n.º 11
0
 void RaiseConfirmation()
 {
     ConfirmationRequest.Raise(new Confirmation {
         Title = "Confirmation", Content = "Confirmation Message"
     }, r =>
                               data = r.Confirmed ? "Confirmed" : "Not Confirmed");
 }
        private void OnDeletingTravelExpense(object obj)
        {
            TravelExpense te = ListOfTravelExpenses.CurrentItem as TravelExpense;

            if (te == null)
            {
                return;
            }
            Telerik.Windows.Controls.GridViewDeletingEventArgs e = obj as Telerik.Windows.Controls.GridViewDeletingEventArgs;
            if (e == null)
            {
                return;
            }
            ConfirmationRequest.Raise(new Confirmation()
            {
                Title   = "QauntCo Deutschland GmbH",
                Content = $"Wollen Sie die ausgewählten Reisekosten ({te.EmployeeName}) wirklich löschen?"
            }, respone =>
            {
                if (respone.Confirmed)
                {
                    dbAccess.RemoveTravelExpense(te);
                }
                else
                {
                    e.Cancel = true;
                }
            });
        }
Exemplo n.º 13
0
        public MainWindowViewModel()
        {
            Logger.Info("Initializing...");

            // DB Context (SQLite)
            var context = new MainDbContext();

            // Create ViewModel collection from the models
            Companies = context.Companies
                        .ToObservable()
                        .Select(x => new CompanyViewModel(x))
                        .ToReactiveCollection();
            // SelectFileCommand is fired from click event of button through EventToReactiveCommand.
            // SelectedFilename will be set after a file selected from OpenFileDialog through OpenFileDialogConverter.
            SelectedFilename = SelectFileCommand
                               .Select(filename => filename)
                               .ToReadOnlyReactiveProperty();
            // ReactiveCommand (can execute when SelectedFilename is set)
            StartCommand = SelectedFilename.Select(x => !string.IsNullOrWhiteSpace(x)).ToReactiveCommand <string>();
            StartCommand.Subscribe(async _ =>
            {
                var res = await ConfirmationRequest.RaiseAsync(new Confirmation {
                    Title = "Demo", Content = "Are you sure?"
                });
                if (res.Confirmed)
                {
                    await NotificationRequest.RaiseAsync(new Notification {
                        Title = "Demo", Content = "Done!"
                    });
                }
            });
            Logger.Info("Initialized.");
        }
Exemplo n.º 14
0
        private void Delete()
        {
            ConfirmationRequest.Raise(new Confirmation
            {
                Content = "删除供应商" + CurrentSupplier.Number + "?",
                Title   = "确认"
            },
                                      r =>
            {
                if (r.Confirmed)
                {
                    using (var context = new MasterDataContext())
                    {
                        context.Suppliers.Remove(CurrentSupplier);
                        context.SaveChanges();
                    }

                    IsEdit = false;
                    NotificationRequest.Raise(new Notification {
                        Content = "已删除", Title = "提示"
                    });
                    CurrentSupplier = new Supplier
                    {
                        InternalType = "Supplier",
                        Contacts     = new ObservableCollection <Contact>(),
                    };
                    Title = "供应商新增";
                }
            });
        }
Exemplo n.º 15
0
        public void OpenUrl()
        {
            // see also https://support.microsoft.com/en-us/help/305703/how-to-start-the-default-internet-browser-programmatically-by-using-vi

            string target = "https://www.featureadmin.com";

            try
            {
                System.Diagnostics.Process.Start(target);
            }
            catch
            (
                System.ComponentModel.Win32Exception noBrowser)
            {
                if (noBrowser.ErrorCode == -2147467259)
                {
                    var dialog = new ConfirmationRequest(
                        "No Browser found",
                        noBrowser.Message
                        );
                    DialogViewModel dialogVm = new DialogViewModel(eventAggregator, dialog);
                    this.windowManager.ShowDialog(dialogVm, null, GetDialogSettings());
                }
            }
            catch (System.Exception other)
            {
                var dialog = new ConfirmationRequest(
                    "System Exception when opening browser",
                    other.Message
                    );
                DialogViewModel dialogVm = new DialogViewModel(eventAggregator, dialog);
                this.windowManager.ShowDialog(dialogVm, null, GetDialogSettings());
            }
        }
Exemplo n.º 16
0
        private void SaveConfirmedProgress(ConfirmationRequest request)
        {
            if (request.Type == ConfirmationType.Challenge)
            {
                var progress = new ChallengeProgress
                {
                    ChallengeId  = request.TargetId,
                    Id           = request.ChallengeProgressId,
                    LastModified = DateTime.UtcNow,
                    Status       = ProgressStatus.Confirmed,
                    UserId       = request.UserId
                };

                using (var db = new SQLite.SQLiteConnection(AppState.State.Instance.DbPath))
                {
                    db.InsertOrReplace(progress);
                }
            }
            else
            {
                using (var db = new SQLite.SQLiteConnection(AppState.State.Instance.DbPath))
                {
                    var challenge = AppState.State.Instance
                                    .Challenges.FirstOrDefault((c) => c.BasicTasks.Any(t => t.Id == request.TargetId) || c.ExtraTasks.Any(t => t.Id == request.TargetId));
                    var challengeProgress = db
                                            .Table <ChallengeProgress>()
                                            .ToList()
                                            .FirstOrDefault(c => c.ChallengeId == challenge.Id);

                    // If a user started a challenge and has not synced yet, confirming a task from that challenge
                    // could crash the app - thus, a new challenge progress object is created on the device of the
                    // confirming participant. On nearest synchronization, thi progress is passed to the db.

                    if (challengeProgress == null)
                    {
                        challengeProgress = new ChallengeProgress
                        {
                            ChallengeId  = challenge.Id,
                            Id           = request.ChallengeProgressId,
                            LastModified = DateTime.UtcNow,
                            Status       = ProgressStatus.InProgress,
                            UserId       = request.UserId,
                        };

                        db.InsertOrReplace(challengeProgress, typeof(ChallengeProgress));
                    }

                    var progress = new TaskProgress
                    {
                        TaskId              = request.TargetId,
                        Id                  = request.TaskProgressId,
                        LastModified        = DateTime.UtcNow,
                        Status              = ProgressStatus.Confirmed,
                        ChallengeProgressId = request.ChallengeProgressId,
                    };

                    db.InsertOrReplace(progress, typeof(TaskProgress));
                }
            }
        }
Exemplo n.º 17
0
 private void ShowConfirmation(string content)
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title   = ApplicationNames.NotificationTitle,
         Content = content + Environment.NewLine + "Möchten Sie es nochmal versuchen?"
     }, OnConfirmFileOpen);
 }
 private void OnRemoveFund()
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title   = ApplicationNames.NotificationTitle,
         Content = $"Möchten Sie den Fund {SelectedFund.FundHqTrustNumber} {SelectedFund.FundShortName} wirklich löschen?"
     }, (OnConfirmationResponse));
 }
Exemplo n.º 19
0
        public void DeleteConfirmationToken(ConfirmationRequest request)
        {
            Require.NotNull(request, nameof(request));

            var session = _sessionProvider.GetCurrentSession();

            session.Delete(request);
        }
Exemplo n.º 20
0
 private void OnDeleteInvestor()
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title   = ApplicationNames.NotificationTitle,
         Content = $"Möchten Sie den Investor {Investor.InvestorHqTrustAccount} {Investor.IName.FullName} wirklich löschen?"
     }, (OnConfirmationResponse));
 }
Exemplo n.º 21
0
 private void OnDeleteCommitment()
 {
     ConfirmationRequest.Raise(new Confirmation
     {
         Title   = "delete ",
         Content = $"Delete Commitment on {SelectedCommitment.PeFund.FundShortName}"
     }, (OnConfirmDeleteCommitment));
 }
Exemplo n.º 22
0
 private void OnDeleteCashFlows()
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title   = ApplicationNames.NotificationTitle,
         Content = "Sollen die ausgewählten Cashflows wirklich gelöscht werden?"
     }, OnDeleteCashFlowConfirmation);
 }
Exemplo n.º 23
0
        public void SaveConfirmationRequest(ConfirmationRequest request)
        {
            Require.NotNull(request, nameof(request));

            var session = _sessionProvider.GetCurrentSession();

            session.Save(request);
        }
Exemplo n.º 24
0
        private void OnShowConfirmation()
        {
            var confirmation = new YesNoCancelNotification("Really?");

            confirmation.Title = "Really?";

            ConfirmationRequest.Raise(confirmation, c => Response = c.Response.ToString());
        }
        private void OnShowConfirmation()
        {
            var notification = new Notification();

            notification.Title = "Really?";

            ConfirmationRequest.Raise(notification, n => { });
        }
Exemplo n.º 26
0
        private void Delete()
        {
            var supplier = SuppliersView.CurrentItem as Supplier;

            ConfirmationRequest.Raise(
                new Confirmation
            {
                Content = "删除供应商" + supplier.Name + "?",
                Title   = "确认",
            },
                r =>
            {
                if (r.Confirmed)
                {
                    using (var context = new MasterDataContext())
                    {
                        var existingSupplier = context.Suppliers.Where(s => s.Id == supplier.Id)
                                               .Include(s => s.Contacts).FirstOrDefault();
                        if (existingSupplier == null)
                        {
                            NotificationRequest.Raise(
                                new Notification
                            {
                                Content = "供应商" + supplier.Name + "不存在。\n可能已删除,请重新查询。",
                                Title   = "提示"
                            }
                                );
                            return;
                        }
                        context.Remove(existingSupplier);
                        context.SaveChanges();
                    }

                    NotificationRequest.Raise(
                        new Notification
                    {
                        Content = "已删除。",
                        Title   = "提示"
                    }
                        );
                    Suppliers.Remove(supplier);
                    SuppliersView.Refresh();
                    TotalRecords -= 1;
                    TotalPages    = (int)Math.Ceiling(1.0 * TotalRecords / PageSize);

                    if (TotalPages == 0)
                    {
                        PageIndex = 0;
                    }
                    else if (PageIndex > TotalPages)
                    {
                        PageIndex     = TotalPages;
                        SuppliersView = CollectionViewSource.GetDefaultView(Suppliers.Skip((PageIndex - 1) * PageSize).Take(PageSize));
                    }
                }
            }
                );
        }
Exemplo n.º 27
0
        public static ConfirmationRequest read(BinaryReader binaryReader)
        {
            ConfirmationRequest newObj = new ConfirmationRequest();

            newObj.confirm  = (ConfirmationType)binaryReader.ReadUInt32();
            newObj.context  = binaryReader.ReadUInt32();
            newObj.userData = PStringChar.read(binaryReader);
            return(newObj);
        }
Exemplo n.º 28
0
        private bool confirmation <T>(T _)
        {
            bool ret = false;

            ConfirmationRequest.Raise(new Confirmation {
                Title = "確認", Content = "何もしないですけど良いですか?", Confirmed = false
            }, c => ret = c.Confirmed);
            return(ret);
        }
Exemplo n.º 29
0
 private void ShowConfirmation()
 {
     ConfirmationRequest.Raise(new Confirmation()
     {
         Title = "Confirmation", Content = "This is an example of confirmation"
     }, r =>
     {
         Status = r.Confirmed ? "Confirmation raised" : "Cancellation raised";
     });
 }
Exemplo n.º 30
0
        private MsgBoxResult RaiseConfirmation(string title, string confirmationMessage)
        {
            var j = MsgBoxResult.None;

            ConfirmationRequest.Raise(
                new Confirmation {
                Content = title, Title = confirmationMessage
            },
                c => { j = c.Confirmed ? MsgBoxResult.OK : MsgBoxResult.Cancel; });
            return(j);
        }