Beispiel #1
0
        internal void AddMaterial_OnClick(object sender, EventArgs e)
        {
            if (_isReadOnly)
            {
                return;
            }

            var eventStatus = (string)_currentEventDbRecordset["statusName"];

            if (eventStatus.Equals(EventStatus.Agreed, StringComparison.OrdinalIgnoreCase) ||
                eventStatus.Equals(EventStatus.Accepted, StringComparison.OrdinalIgnoreCase))
            {
                Dialog.Ask(Translator.Translate("start_event"), (innerSender, args) =>
                {
                    if (args.Result != Dialog.Result.Yes)
                    {
                        return;
                    }
                    ChangeEventStatus();

                    AddMaterialArgument();
                });
            }
            else
            {
                AddMaterialArgument();
            }
        }
Beispiel #2
0
        internal void AddService_OnClick(object sender, EventArgs e)
        {
            if (_isReadOnly)
            {
                return;
            }

            var eventStatus = (string)_currentEventDbRecordset["statusName"];

            if (eventStatus.Equals(EventStatus.Appointed))
            {
                Dialog.Ask(Translator.Translate("start_event"), (innerSender, args) =>
                {
                    if (args.Result != Dialog.Result.Yes)
                    {
                        return;
                    }
                    ChangeEventStatus();

                    AddServiceArgument();
                });
            }
            else
            {
                AddServiceArgument();
            }
        }
Beispiel #3
0
        internal void ApplicatioMaterials_OnClick(object sender, EventArgs e)
        {
            var eventStatus = (string)_currentEventDbRecordset["statusName"];

            if (eventStatus.Equals(EventStatus.Agreed, StringComparison.OrdinalIgnoreCase) ||
                eventStatus.Equals(EventStatus.Accepted, StringComparison.OrdinalIgnoreCase))
            {
                Dialog.Ask(Translator.Translate("start_event"), (innerSender, args) =>
                {
                    if (args.Result != Dialog.Result.Yes)
                    {
                        return;
                    }
                    ChangeEventStatus();
                    var dict = new Dictionary <string, object>
                    {
                        { Parameters.IdCurrentEventId, _currentEventId },
                        { Parameters.IdIsReadonly, _isReadOnly },
                        { Parameters.IdWasEventStarted, _wasStarted }
                    };
                    Navigation.ModalMove(nameof(CheckInfoScreen), dict);
                });
            }
            else
            {
                var dict = new Dictionary <string, object>
                {
                    { Parameters.IdCurrentEventId, _currentEventId },
                    { Parameters.IdIsReadonly, _isReadOnly },
                    { Parameters.IdWasEventStarted, _wasStarted }
                };
                Navigation.ModalMove(nameof(CheckInfoScreen), dict);
            }
        }
Beispiel #4
0
        internal void ChangeTaskTargetStatus_OnClick(object sender, EventArgs e)
        {
            if (_isReadOnly)
            {
                return;
            }
            var eventStatus = (string)_currentEvent["statusName"];

            if (eventStatus.Equals(EventStatus.Appointed))
            {
                Dialog.Ask(Translator.Translate("start_event"), (o, args) =>
                {
                    if (args.Result != Dialog.Result.Yes)
                    {
                        return;
                    }
                    ChangeEventStatus();

                    TaskTargetStatusAction(sender);
                });
            }
            else
            {
                TaskTargetStatusAction(sender);
            }
        }
Beispiel #5
0
        internal void CheckListCounterLayout_OnClick(object sender, EventArgs eventArgs)
        {
            var statusName = (string)_currentEventRecordset["statusName"];

            if (CheckAndGoIfNotExsist())
            {
                return;
            }
            if (statusName.Equals(EventStatus.Agreed, StringComparison.OrdinalIgnoreCase) ||
                statusName.Equals(EventStatus.Accepted, StringComparison.OrdinalIgnoreCase))
            {
                Dialog.Ask(Translator.Translate("start_event"), (o, args) =>
                {
                    if (args.Result != Dialog.Result.Yes)
                    {
                        return;
                    }
                    Event_OnStart();
                    Navigation.Move("CheckListScreen", new Dictionary <string, object>
                    {
                        [Parameters.IdIsReadonly] = _readonly
                    });
                });
            }
            else
            {
                Navigation.Move("CheckListScreen", new Dictionary <string, object>
                {
                    [Parameters.IdIsReadonly] = _readonly
                });
            }
        }
Beispiel #6
0
        internal void CheckListCounterLayout_OnClick(object sender, EventArgs eventArgs)
        {
            var statusName = (string)_currentEventRecordset["statusName"];

            if (statusName.Equals(EventStatus.Appointed))
            {
                Dialog.Ask(Translator.Translate("start_task"), (o, args) =>
                {
                    if (args.Result != Dialog.Result.Yes)
                    {
                        return;
                    }
                    Event_OnStart();
                    Navigation.Move("CheckListScreen", new Dictionary <string, object>
                    {
                        [Parameters.IdIsReadonly] = _readonly
                    });
                });
            }
            else
            {
                Navigation.Move("CheckListScreen", new Dictionary <string, object>
                {
                    [Parameters.IdIsReadonly] = _readonly
                });
            }
        }
Beispiel #7
0
        internal void TaskFinishedButton_OnClick(object sender, EventArgs eventArgs)
        {
            if (_isReadOnly)
            {
                return;
            }
            var eventStatus = (string)_currentEvent["statusName"];

            if (eventStatus.Equals(EventStatus.Agreed, StringComparison.OrdinalIgnoreCase) ||
                eventStatus.Equals(EventStatus.Accepted, StringComparison.OrdinalIgnoreCase))
            {
                Dialog.Ask(Translator.Translate("start_event"), (o, args) =>
                {
                    if (args.Result != Dialog.Result.Yes)
                    {
                        return;
                    }
                    ChangeEventStatus();

                    FinishedButtonAction();
                });
            }
            else
            {
                FinishedButtonAction();
            }
        }
Beispiel #8
0
 internal void DeleteButton_OnClick(object sender, EventArgs args)
 {
     Dialog.Ask(Translator.Translate("areYouSure"), (o, eventArgs) =>
     {
         var path = _photo.Source.StartsWith("~") ? _photo.Source.Substring(1) : _photo.Source;
         FileSystem.Delete(path);
         ChangePhotoInDB(null);
         Navigation.Back();
     });
 }
Beispiel #9
0
 internal void StartButton_OnClick(object sender, EventArgs eventArgs)
 {
     Dialog.Ask(Translator.Translate("areYouSure"), (o, args) =>
     {
         if (args.Result == Dialog.Result.Yes)
         {
             ChangeLayoutToStartedEvent();
         }
     });
 }
Beispiel #10
0
        internal void SelectUser_OnClick(object sender, EventArgs e)
        {
            if (_isAsTask)
            {
                findText = null;
                BusinessProcess.GlobalVariables.Remove(Parameters.IsAsTask);
                Navigation.ModalMove(nameof(AddTaskScreen),
                                     new Dictionary <string, object>
                {
                    { Parameters.IdUserId, ((VerticalLayout)sender).Id }
                });
            }
            else
            {
                try
                {
                    var eventId = (string)Variables[Parameters.IdCurrentEventId];
                    Utils.TraceMessage($"{eventId.GetType()}");
                    var currentEvent = (Event)DBHelper.LoadEntity(eventId);
                    var user         = (User)DBHelper.LoadEntity(((VerticalLayout)sender).Id);

                    Dialog.Ask(Translator.Translate("assign_on") + " " + user.Description + "?", (o, args) =>
                    {
                        if (args.Result == Dialog.Result.No)
                        {
                            return;
                        }

                        currentEvent.UserMA = user.Id;
                        DBHelper.SaveEntity(currentEvent);

                        try
                        {
                            PushNotification.PushMessage(Translator.Translate("assign_task"), new[] { $"{user.Id.Guid}" });
                        }
                        catch (Exception exception)
                        {
                            Utils.TraceMessage($"{exception.Message}{Environment.NewLine}" +
                                               $"{exception.StackTrace}");
                        }
                        finally
                        {
                            findText = null;
                            Navigation.CleanStack();
                            Navigation.ModalMove(nameof(EventListScreen));
                        }
                    });
                }
                catch (Exception exception)
                {
                    Utils.TraceMessage($"{exception.Message}" +
                                       $"{Environment.NewLine} {exception.StackTrace}");
                }
            }
        }
Beispiel #11
0
        internal void PrintZ_OnClick(object sender, EventArgs e)
        {
            if (!Settings.EnableFPTR)
            {
                Toast.MakeToast(Translator.Translate("fr_disable"));
                return;
            }
            if (!DBHelper.CheckRole(nameof(WebactionsEnum.MobileFPRAccess)))
            {
                Toast.MakeToast(Translator.Translate("fr_role_disable"));
                return;
            }
            if (_readonlyForIos)
            {
                Toast.MakeToast(Translator.Translate("Функциональность не поддерживается на iOS"));
                return;
            }


            Dialog.Ask(Translator.Translate("printZ_caption_ask"), (o, args) =>
            {
                if (args.Result == Dialog.Result.No)
                {
                    return;
                }

                Dialog.ShowProgressDialog(Translator.Translate("please_wait"), true);

                TaskFactory.RunTaskWithTimeout(() =>
                {
                    try
                    {
                        _fptr.PrintZ();
                    }
                    catch (FPTRException exception)
                    {
                        Toast.MakeToast(exception.Message);
                    }
                }, FptrAction.PrintingTimeOut, result =>
                {
                    if (result.Finished)
                    {
                        Dialog.HideProgressDialog();
                        return;
                    }

                    Application.InvokeOnMainThread(() => ChangeLayoutStatus(-1));

                    Dialog.HideProgressDialog();

                    Application.InvokeOnMainThread(()
                                                   => Toast.MakeToast(Translator.Translate("сonnection_error")));
                });
            });
        }
Beispiel #12
0
 internal void Logout_OnClick(object sender, EventArgs e)
 {
     Dialog.Ask(Translator.Translate("exit"), (o, args) =>
     {
         if (args.Result != Dialog.Result.Yes)
         {
             return;
         }
         Logout();
     });
 }
 internal void Logout_OnClick(object sender, EventArgs e)
 {
     Dialog.Ask(Translator.Translate("exit"), (o, args) =>
     {
         if (args.Result != Dialog.Result.Yes)
         {
             return;
         }
         Dialog.ShowProgressDialog(Translator.Translate("logout_message"), true);
         Logout();
     });
 }
Beispiel #14
0
        internal void EditServicesOrMaterials_OnClick(object sender, EventArgs e)
        {
            if (_isReadOnly)
            {
                return;
            }
            if (!ChechFiscal())
            {
                return;
            }
            var eventStatus = (string)_currentEventDbRecordset["statusName"];
            var vl          = (VerticalLayout)sender;

            if (eventStatus.Equals(EventStatus.Agreed, StringComparison.OrdinalIgnoreCase) ||
                eventStatus.Equals(EventStatus.Accepted, StringComparison.OrdinalIgnoreCase))
            {
                Dialog.Ask(Translator.Translate("start_event"), (innerSender, args) =>
                {
                    if (args.Result != Dialog.Result.Yes)
                    {
                        return;
                    }
                    ChangeEventStatus();

                    var dictionary = new Dictionary <string, object>
                    {
                        { Parameters.IdBehaviour, BehaviourEditServicesOrMaterialsScreen.UpdateDB },
                        { Parameters.IdLineId, vl.Id },
                        { Parameters.IsEdit, true }
                    };

                    Navigation.Move("EditServicesOrMaterialsScreen", dictionary);
                });
            }
            else
            {
                var dictionary = new Dictionary <string, object>
                {
                    { Parameters.IdBehaviour, BehaviourEditServicesOrMaterialsScreen.UpdateDB },
                    { Parameters.IdLineId, vl.Id },
                    { Parameters.IsEdit, true }
                };

                Navigation.Move("EditServicesOrMaterialsScreen", dictionary);
            }
        }
        internal void SendLog_OnClick(object sender, EventArgs e)
        {
            Dialog.Ask(Translator.Translate("ask_send_log"),
                       (o, args) =>
            {
                if (args.Result == Dialog.Result.No)
                {
                    return;
                }

                var isLogSend = Settings.SendDatabase();
                Utils.TraceMessage($"Log is send. Result of sending: {isLogSend}");

                Toast.MakeToast(isLogSend
                        ? Translator.Translate("send_log_ok")
                        : Translator.Translate("send_log_fail"));
            });
        }
        internal void PrintZ_OnClick(object sender, EventArgs e)
        {
            Dialog.Ask(Translator.Translate("printZ_caption_ask")
                       , (o, args) =>
            {
                if (args.Result == Dialog.Result.No)
                {
                    return;
                }

                //TODO: По хорошему должна быть проверка статуса устройства, но всем как всегда
                try
                {
                    FptrInstance.Instance.PrintZ();
                }
                catch (FPTRException exception)
                {
                    Toast.MakeToast(exception.Message);
                }
            });
        }
 private void Alert_Handler(object sender, ResultEventArgs <int> args)
 {
     DConsole.WriteLine(args.Result.ToString());
     Dialog.Ask("Are you ok ?", Ask_Handler);
 }