Beispiel #1
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);
        }