Exemplo n.º 1
0
        public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back && e.Action == KeyEventActions.Down)
            {
                FragmentTransaction ft = FragmentManager.BeginTransaction();

                CSIMessageDialog SignOutDialog = (CSIMessageDialog)FragmentManager.FindFragmentByTag("Exit");

                if (SignOutDialog != null)
                {
                    ft.Show(SignOutDialog);
                }
                else
                {
                    SignOutDialog            = new CSIMessageDialog(GetString(Resource.String.app_name), string.Format(GetString(Resource.String.AskForExit), string.IsNullOrEmpty(CSISystemContext.UserDesc) ? CSISystemContext.User : CSISystemContext.UserDesc), DialogTypes.OKCancel, this);
                    SignOutDialog.OkHandler += (sender, args) =>
                    {
                        Finish();
                    };
                    SignOutDialog.Show(ft, "Exit");
                }
                return(true);
            }
            return(base.OnKeyDown(keyCode, e));
        }
Exemplo n.º 2
0
        private void ShowNoEmpMessage()
        {
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            CSIMessageDialog SignOutDialog = (CSIMessageDialog)FragmentManager.FindFragmentByTag("NoEmp");

            if (SignOutDialog != null)
            {
                ft.Show(SignOutDialog);
            }
            else
            {
                SignOutDialog = new CSIMessageDialog(GetString(Resource.String.app_name), GetString(Resource.String.NoEmployee), DialogTypes.OK, this);
                SignOutDialog.Show(ft, "NoEmp");
            }
        }
Exemplo n.º 3
0
        private void DeleteLogFileButton_Click(object sender, EventArgs args)
        {
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            CSIMessageDialog DeleteLogFileDialog = (CSIMessageDialog)FragmentManager.FindFragmentByTag("DeleteLogFileDialog");

            if (DeleteLogFileDialog != null)
            {
                ft.Show(DeleteLogFileDialog);
            }
            else
            {
                DeleteLogFileDialog            = new CSIMessageDialog(GetString(Resource.String.app_name), GetString(Resource.String.DeleteLogFile), DialogTypes.OKCancel);
                DeleteLogFileDialog.OkHandler += (o, e) =>
                {
                    CSIErrorLog.DeleteErrorLogFile();
                    LogEdit.Text = CSIErrorLog.ReadLog();
                };
                DeleteLogFileDialog.Show(ft, "DeleteLogFileDialog");
            }
        }
Exemplo n.º 4
0
        private void SLDcjms_SaveDataSetCompleted(object sender, SaveDataSetCompletedEventArgs e)
        {
            try
            {
                if (e.Error == null)
                {
                    //check result status
                    if (SLDcjms.CurrentTable.Rows.Count <= 0)
                    {
                        //nothing happen or just delete rows
                    }
                    else
                    {
                        string RowStatus    = SLDcjms.GetCurrentPropertyValueOfString("Stat");
                        string ErrorMessage = SLDcjms.GetCurrentPropertyValueOfString("ErrorMessage");

                        if ((RowStatus != "E") || string.IsNullOrEmpty(ErrorMessage))
                        {
                            if (CSISystemContext.ForceAutoPost)
                            {
                                //Ready to Post -- calling DcjrPSp
                                ShowProgressBar(true);
                                string strParmeters = "";
                                strParmeters = CSIBaseInvoker.BuildXMLParameters(strParmeters, SLDcjms.GetCurrentPropertyValueOfString("TransNum"));
                                strParmeters = CSIBaseInvoker.BuildXMLParameters(strParmeters, "");
                                strParmeters = CSIBaseInvoker.BuildXMLParameters(strParmeters, "", true);
                                SLDcjms.InvokeMethod("DcjrPSp", strParmeters);
                            }
                            else
                            {
                                if (CSISystemContext.ShowSuccessMessage)
                                {
                                    ShowProcessedMessage();
                                }
                                //Clear Result if no error.
                                Initialize();
                            }
                        }
                        else
                        {
                            //delete first before prompt message.
                            SLDcjms.CurrentTable.Rows[0].Delete();
                            ShowProgressBar(true);
                            SLDcjms.DeleteIDO();

                            //Populate Error
                            FragmentTransaction ft           = FragmentManager.BeginTransaction();
                            CSIMessageDialog    DeleteDialog = (CSIMessageDialog)FragmentManager.FindFragmentByTag("DeleteDialog");

                            if (DeleteDialog != null)
                            {
                                ft.Show(DeleteDialog);
                            }
                            else
                            {
                                DeleteDialog = new CSIMessageDialog(GetString(Resource.String.app_name), ErrorMessage, DialogTypes.OK);
                                DeleteDialog.Show(ft, "DeleteDialog");
                            }
                        }
                    }
                }
                else
                {
                    WriteErrorLog(e.Error);
                }
            }catch (Exception Ex)
            {
                WriteErrorLog(Ex);
            }
            ShowProgressBar(false);
        }
        private bool ValidateExit(bool Exit = false)
        {
            bool IsChanged = false;

            try
            {
                IsChanged = !(
                    CSIWebServerName == CSIWebServerEdit.Text &&
                    Configuration == ((string)ConfigurationSpinner.SelectedItem ?? string.Empty) &&
                    Theme == InterpretThemeValue(((string)ThemeSpinner.SelectedItem ?? string.Empty)) &&
                    SavedUser == UserEdit.Text &&
                    SavedPassword == PasswordEdit.Text &&
                    EnableHTTPS == EnableHTTPSSwitch.Checked &&
                    UseRESTForRequest == UseRESTForRequestSwitch.Checked &&
                    LoadPicture == LoadPictureSwitch.Checked &&
                    ForceAutoPost == ForceAutoPostSwitch.Checked &&
                    ShowSuccessMessage == ShowSuccessMessageSwitch.Checked &&
                    RecordCap == RecordCapEdit.Text &&
                    SaveUser == SaveUserSwitch.Checked &&
                    SavePassword == SavePasswordSwitch.Checked
                    );
                if (IsChanged)
                {
                    FragmentTransaction ft            = FragmentManager.BeginTransaction();
                    CSIMessageDialog    SignOutDialog = new CSIMessageDialog(GetString(Resource.String.app_name), GetString(Resource.String.SettingChanged), DialogTypes.YesNoCancle, this.BaseActivity);
                    SignOutDialog.YesHandler += (sender, args) =>
                    {
                        bool bChangeTheme = false;
                        if (CSISystemContext.CSIWebServerName != Theme)
                        {
                            bChangeTheme = true;
                        }
                        SaveConfiguration();
                        if (Exit)
                        {
                            Dismiss();
                            Dispose();
                            if (bChangeTheme)
                            {
                                Intent intent = new Intent(Application.Context, typeof(MainActivity));
                                Bundle bundle = BaseActivity.GetCSISystemContext().BuildBundle();
                                intent.PutExtra("CSISystemContext", bundle);
                                BaseActivity.StartActivity(intent);
                                BaseActivity.Finish();
                            }
                        }
                    };
                    SignOutDialog.NoHandler += (sender, args) =>
                    {
                        CSISystemContext.CSIWebServerName   = CSIWebServerName;
                        CSISystemContext.Theme              = Theme;
                        CSISystemContext.SavedUser          = SavedUser;
                        CSISystemContext.SavedPassword      = SavedPassword;
                        CSISystemContext.EnableHTTPS        = EnableHTTPS;
                        CSISystemContext.UseRESTForRequest  = UseRESTForRequest;
                        CSISystemContext.LoadPicture        = LoadPicture;
                        CSISystemContext.ForceAutoPost      = ForceAutoPost;
                        CSISystemContext.ShowSuccessMessage = ShowSuccessMessage;
                        CSISystemContext.RecordCap          = RecordCap;
                        CSISystemContext.SaveUser           = SaveUser;
                        CSISystemContext.SavePassword       = SavePassword;
                        if (Exit)
                        {
                            Dismiss();
                            Dispose();
                        }
                    };
                    SignOutDialog.CancelHandler += (sender, args) =>
                    {
                    };
                    SignOutDialog.Show(ft, "");
                }
                else
                {
                    Dismiss();
                    Dispose();
                }
            }
            catch (Exception Ex)
            {
                WriteErrorLog(Ex);
                return(false);
            }
            return(true);
        }
Exemplo n.º 6
0
        public override bool InvokeCommand(string Command, Dictionary <string, object> ParmList = null)
        {
            bool Success = false;

            switch (Command)
            {
            case "ShowSettings":
                ShowSettingsDialog();
                Success = true;
                break;

            case "ShowAbout":
                ShowAbout();
                Success = true;
                break;

            case "ShowLog":
                ShowLog();
                Success = true;
                break;

            case "GetToken":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else
                {
                    Success = true;
                }
                break;

            case "CreateToken":
            case "ShowSignIn":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                }
                else
                {
                    FragmentTransaction ft          = FragmentManager.BeginTransaction();
                    CSIMessageDialog    AlertDialog = new CSIMessageDialog(GetString(Resource.String.app_name), string.Format(GetString(Resource.String.AlreadySignIn), string.IsNullOrEmpty(CSISystemContext.UserDesc) ? CSISystemContext.User : CSISystemContext.UserDesc), DialogTypes.OKCancel, this);
                    AlertDialog.OkHandler += (sender, args) =>
                    {
                        CSISystemContext.Token = "";
                        ShowSignInDialog();
                    };
                    AlertDialog.Show(ft, "Exit");
                }
                Success = true;
                break;

            case "ShowChangeWarehouse":
                ShowChangeWarehouse();
                Success = true;
                break;

            case "QtyMove":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCQuantityMoveFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "MiscIssue":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCMiscIssueFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "MiscReceive":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCMiscReceiveFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "JobReceipt":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCJobReceiptFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "JobMaterial":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCJobMaterialTransactionsFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "JobTransaction":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCJobRunFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "OrderShipping":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCOrderShippingFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "OrderReturn":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCOrderReturnFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "PurchaseReceive":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCPurchaseReceiveFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "PurchaseReturn":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCPurchaseReturnFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "TransferShip":

                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCTransferOrderShipFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "TransferReceive":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    DCTransferOrderReceiveFragment.RunFragment(this);
                    Success = true;
                }
                break;

            case "Items":
                if (string.IsNullOrEmpty(CSISystemContext.Token))
                {
                    ShowSignInDialog();
                    Success = false;
                }
                else if (string.IsNullOrEmpty(CSISystemContext.EmpNum))
                {
                    ShowNoEmpMessage();
                    return(false);
                }
                else
                {
                    ItemListFragment.RunFragment(this);
                    Success = true;
                }
                break;

            default:
                break;
            }
            return(Success);
        }