Exemplo n.º 1
0
        /// <summary>
        /// Handles the display text for custom grid columns
        /// </summary>
        private void gvTenders_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            switch (e.Column.FieldName)
            {
            case COLQTY:
                e.DisplayText = LSRetailPosis.ApplicationLocalizer.Language.Translate(1957);     // "Count..."
                break;

            case COLTOTAL:
                // Get amount value
                decimal amount = gridSource[e.ListSourceRowIndex].Total;

                // Get currency code for symbol display
                PosisOperations operationTenderType = gridSource[e.ListSourceRowIndex].TenderOperationType;
                string          currCode            = operationTenderType == PosisOperations.PayCurrency
                        ? gridSource[e.ListSourceRowIndex].Currency
                        : ApplicationSettings.Terminal.StoreCurrency;

                // Display amount with currency code
                e.DisplayText = Dialog.InternalApplication.Services.Rounding.RoundForDisplay(amount, currCode, true, true);
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        private bool UserHasAccessRights(PosisOperations OperationID)
        {
            bool userHasAccess = false;

            if (logonMode == LogonModes.UserList)
            {
                operatorId = grvUserData.GetDataRow(grvUserData.GetSelectedRows()[0])["STAFFID"].ToString();

                if (!PosApplication.Instance.BusinessLogic.UserAccessSystem.UserHasAccess(operatorId, OperationID))
                {
                    using (frmMessage dialog = new frmMessage(1322)) // Unauthorized
                    {
                        POSFormsManager.ShowPOSForm(dialog);
                    }
                }
                else
                {
                    using (frmInputNumpad frmNumPad = new frmInputNumpad())
                    {
                        frmNumPad.EntryTypes = NumpadEntryTypes.Password;
                        frmNumPad.PromptText = ApplicationLocalizer.Language.Translate(2379); //"Password";

                        do
                        {
                            POSFormsManager.ShowPOSForm(frmNumPad);
                            if (frmNumPad.DialogResult == DialogResult.OK)
                            {
                                LogonData logonData = new LogonData(PosApplication.Instance.Settings.Database.Connection, PosApplication.Instance.Settings.Database.DataAreaID);
                                password      = frmNumPad.InputText;
                                userHasAccess = logonData.ValidatePasswordHash(ApplicationSettings.Terminal.StoreId, operatorId, LogonData.ComputePasswordHash(operatorId, password, ApplicationSettings.Terminal.StaffPasswordHashName));

                                if (!userHasAccess)
                                {
                                    using (frmMessage errorMessage = new frmMessage(1325))
                                    {
                                        POSFormsManager.ShowPOSForm(errorMessage);                                         // Invalid password
                                    }

                                    frmNumPad.TryAgain();
                                }
                            }
                            else
                            {
                                break;
                            }
                        }while (!userHasAccess);
                    }
                }
            }
            else
            {
                using (ManagerAccessForm frmManager = new ManagerAccessForm(OperationID))
                {
                    POSFormsManager.ShowPOSForm(frmManager);
                    userHasAccess = DialogResult.OK == frmManager.DialogResult;
                }
            }

            return(userHasAccess);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Verifies if the transaction operator has access for a given operation.
        /// </summary>
        /// <param name="posTransaction">The pos transaction.</param>
        /// <param name="operation">The operation.</param>
        /// <returns>
        /// True if operator has access, false otherwise.
        /// </returns>
        /// <remarks>Use this method when transaction is available.</remarks>
        public bool VerifyOperationAccess(IPosTransaction posTransaction, PosisOperations operation)
        {
            if (posTransaction == null)
            {
                throw new ArgumentNullException("posTransaction");
            }

            return(VerifyOperationAccess(posTransaction.OperatorId, operation, posTransaction.TransactionId));
        }
Exemplo n.º 4
0
        public ManagerAccessForm(ManagerAccessConfirmation managerAccessConfirmation)
            : this()
        {
            if (managerAccessConfirmation == null)
            {
                throw new ArgumentNullException("managerAccessConfirmation");
            }

            this.operationId = (PosisOperations)managerAccessConfirmation.Operation;
        }
Exemplo n.º 5
0
        private void PerformOperation(object sender, EventArgs e)
        {
            PosBatchStaging selectedShift = shiftsData[grdView.GetSelectedRows()[0]];
            PosisOperations operation     = (PosisOperations)((Control)sender).Tag;

            EOD.InternalApplication.RunOperation(operation, selectedShift);

            // If operation changed the batch status (E.g. closed) then delete from list.
            if (selectedShift.Status != PosBatchStatus.BlindClosed)
            {
                shiftsData.Remove(selectedShift);
                grdView.RefreshData();
            }

            UpdateControlButtons();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Verifies the operation access.
        /// </summary>
        /// <param name="operatorID">The operator ID.</param>
        /// <param name="operation">The operation.</param>
        /// <param name="transactionId">The transaction id.</param>
        /// <returns>
        /// /// True if operator has access, false otherwise.
        /// </returns>
        private bool VerifyOperationAccess(string operatorID, PosisOperations operation, string transactionId)
        {
            bool result = true;
            IUserAccessSystem userAccess = Application.BusinessLogic.UserAccessSystem;

            if (!userAccess.UserHasAccess(operatorID, operation))
            {
                ManagerAccessConfirmation managerAccessInteraction = new ManagerAccessConfirmation()
                {
                    Operation = (int)operation
                };

                // If a manager key is already in "Supervisor" position then don't prompt manager access.
                if (Application.Services.Peripherals.KeyLock.SupervisorPosition())
                {
                    managerAccessInteraction.Confirmed = true;
                }
                else
                {
                    InteractionRequestedEventArgs request = new InteractionRequestedEventArgs(managerAccessInteraction, () => { });
                    Application.Services.Interaction.InteractionRequest(request);
                }

                if (managerAccessInteraction.Confirmed)
                {
                    string authorizedBy = string.IsNullOrWhiteSpace(managerAccessInteraction.OperatorId) // If no operator ID is found then key was used
                        ? "Keylock"
                        : managerAccessInteraction.OperatorId;

                    // Log manager authorizations to audit log
                    ApplicationLog.WriteAuditEntry("LogOn:VerifyOperationAccess()",
                                                   string.Format("Manager '{0}' authorized the operation '{1}' for transaction '{2}'", authorizedBy, operation, transactionId));
                }
                else
                {
                    ApplicationLog.WriteAuditEntry("LogOn:VerifyOperationAccess()",
                                                   string.Format("Manager authorization either failed or was cancelled for operation '{0}'.", operation));

                    Application.Services.Dialog.ShowMessage(3540, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    result = false;
                }
            }

            return(result);
        }
Exemplo n.º 7
0
        private void gvTenders_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            string column = e.Column.FieldName;

            if (column == COLQTY || column == COLTOTAL)
            {
                // Determine the tender type
                PosisOperations operationTenderType = gridSource[e.RowHandle].TenderOperationType;

                // Draw the calculator icon in the quantity column if the tender type is not cash or currency
                bool drawIcon = (column == COLQTY) && (operationTenderType != PosisOperations.PayCash) && (operationTenderType != PosisOperations.PayCurrency);

                e.Appearance.FillRectangle(e.Cache, e.Bounds);
                DrawButton(e.Cache, e.Bounds, gridTenders.LookAndFeel.ActiveLookAndFeel.ActiveStyle, e.Appearance, GetButtonState(e.RowHandle, column), e.DisplayText, drawIcon);

                e.Handled = true;
            }
        }
Exemplo n.º 8
0
        private void OnQtyButtonClick(int rowHandle)
        {
            if (!gridSource[rowHandle].Enabled)
            {
                return;
            }

            // Determine the tender type
            PosisOperations operationTenderType = gridSource[rowHandle].TenderOperationType;

            // Open the denominations form for currencies
            if (operationTenderType == PosisOperations.PayCash || operationTenderType == PosisOperations.PayCurrency)
            {
                using (frmDenominations frmDenom = new frmDenominations(gridSource[rowHandle].Currency,
                                                                        (denominationDataSources.ContainsKey(rowHandle) ? denominationDataSources[rowHandle] : null)))
                {
                    POSFormsManager.ShowPOSForm(frmDenom);
                    if (frmDenom.DialogResult == DialogResult.OK)
                    {
                        gridSource[rowHandle].Total             = frmDenom.Total;
                        this.denominationDataSources[rowHandle] = frmDenom.GridSource;
                        UpdateTotalAmount();
                    }
                }
            }
            else
            {
                // Launch the system calculator
                try
                {
                    System.Diagnostics.Process.Start("calc.exe");
                }
                catch (System.ComponentModel.Win32Exception)
                {
                }
                catch (System.IO.FileNotFoundException)
                {
                }
            }
        }
Exemplo n.º 9
0
        // Get all text through the Translation function in the ApplicationLocalizer
        // TextID's for the CCTV service are reserved at 58000 - 58999

        /// <summary>
        /// Gives CCTV output details as per passed parameters.
        /// </summary>
        /// <param name="posTransaction"></param>
        /// <param name="operationId"></param>
        /// <param name="mainOperation"></param>
        /// <param name="operationInfo"></param>
        /// <param name="text"></param>
        public void CCTVOutput(IPosTransaction posTransaction, PosisOperations operationId, bool mainOperation, object operationInfo, string text)
        {
            LSRetailPosis.POSProcesses.OperationInfo opInfo = (LSRetailPosis.POSProcesses.OperationInfo)operationInfo;
        }
Exemplo n.º 10
0
 /// <summary>
 /// Verifies if the operator has access for a given operation.
 /// </summary>
 /// <param name="operatorID">The operator ID.</param>
 /// <param name="operation">The operation.</param>
 /// <returns>
 /// True if operator has access, false otherwise.
 /// </returns>
 public bool VerifyOperationAccess(string operatorID, PosisOperations operation)
 {
     return(VerifyOperationAccess(operatorID, operation, null));
 }
Exemplo n.º 11
0
 internal ManagerAccessForm(PosisOperations operationId)
     : this()
 {
     this.operationId = operationId;
 }
Exemplo n.º 12
0
        public void PostProcessOperation(IPosTransaction posTransaction, PosisOperations posisOperation)
        {
            if (posisOperation == PosisOperations.CustomerAccountDeposit)
            {
                LSRetailPosis.Transaction.CustomerPaymentTransaction custTrans = posTransaction as LSRetailPosis.Transaction.CustomerPaymentTransaction;
                if (custTrans != null && custTrans.Amount != 0)
                {
                    custTrans.PartnerData.EFTCardNo = string.Empty;

                    if (!string.IsNullOrEmpty(Convert.ToString(custTrans.Customer.CustomerId)))
                    {
                        bool   IsRepair   = false;
                        string sCustOrder = OrderNum(out IsRepair);

                        //string sCustOrder = OrderNum();
                        if (!string.IsNullOrEmpty(sCustOrder))
                        {
                            decimal dFixedRatePercentage = 0m;
                            decimal dCustOrderTotalAmt   = 0m;

                            if (!IsRepair)
                            {
                                dFixedRatePercentage = GetCustOrderFixedRateInfo(sCustOrder, ref dCustOrderTotalAmt);
                            }


                            SqlConnection connection = new SqlConnection();

                            if (application != null)
                            {
                                connection = application.Settings.Database.Connection;
                            }
                            else
                            {
                                connection = ApplicationSettings.Database.LocalConnection;
                            }

                            Enums.EnumClass oEnum       = new Enums.EnumClass();
                            string          sMaxAmount  = string.Empty;
                            string          sTerminalID = ApplicationSettings.Terminal.TerminalId;
                            string          sMinAmt     = Convert.ToString(oEnum.ValidateMinDeposit(connection, out sMaxAmount, sTerminalID, dCustOrderTotalAmt));

                            (((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Comment = "INFORMATION : MINIMUM DEPOSIT AMOUNT IS " + decimal.Round(Convert.ToDecimal(sMinAmt), 2, MidpointRounding.AwayFromZero) + " " +
                                                                                                                                     "AND MAXIMUM DEPOSIT AMOUNT IS " + decimal.Round(Convert.ToDecimal(sMaxAmount), 2, MidpointRounding.AwayFromZero);



                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdNo         = sCustOrder;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdPercentage = dFixedRatePercentage;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdTotAmt     = dCustOrderTotalAmt;

                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.GSSNum        = string.Empty;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.NumMonths     = string.Empty;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OperationType = Convert.ToString("NORMALCUSTOMERDEPOSIT");
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OperationDone = Convert.ToBoolean(false);
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OrderNo       = sCustOrder;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.SKUData       = string.Empty;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.ItemIds       = string.Empty;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.IsRepair      = IsRepair;
                        }
                        else
                        {
                            #region Comment
                            //frmOptionSelectionGSSorCustomerOrder optionSelection = new frmOptionSelectionGSSorCustomerOrder();
                            //optionSelection.ShowDialog();
                            //SqlConnection connection = new SqlConnection();

                            //if (application != null)
                            //    connection = application.Settings.Database.Connection;
                            //else
                            //    connection = ApplicationSettings.Database.LocalConnection;


                            //if (connection.State == ConnectionState.Closed)
                            //{
                            //    connection.Open();
                            //}

                            //if (optionSelection.isGSS)
                            //{
                            //    string commandText = string.Empty;

                            //    commandText = " SELECT   GSSACCOUNTOPENINGPOSTED.GSSACCOUNTNO AS [GSSACCOUNTNO.], " +
                            //                  " DIRPARTYTABLE.NAMEALIAS AS [CUSTOMERNAME],  " +
                            //                  "  CAST(GSSACCOUNTOPENINGPOSTED.INSTALLMENTAMOUNT AS NUMERIC(28,2)) AS [INSTALLMENTAMOUNT], " +
                            //                  " ( CASE  WHEN  GSSACCOUNTOPENINGPOSTED.SCHEMETYPE=0 THEN 'FIXED' ELSE 'FLEXIBLE' END) AS [SCHEMETYPE], " +
                            //                  " GSSACCOUNTOPENINGPOSTED.SCHEMECODE AS [SCHEMECODE], " +
                            //                  " ( CASE WHEN GSSACCOUNTOPENINGPOSTED.SCHEMEDEPOSITTYPE=0 THEN 'GOLD' ELSE 'AMOUNT' END) AS [DEPOSITTYPE],   " +
                            //                  " GSSACCOUNTOPENINGPOSTED.GSSConfirm AS [GSSCONFIRM] " +
                            //                  " FROM         DIRPARTYTABLE INNER JOIN " +
                            //                  " CUSTTABLE ON DIRPARTYTABLE.RECID = CUSTTABLE.PARTY INNER JOIN " +
                            //                  " GSSACCOUNTOPENINGPOSTED ON CUSTTABLE.ACCOUNTNUM = GSSACCOUNTOPENINGPOSTED.CUSTACCOUNT " +
                            //                  " WHERE GSSACCOUNTOPENINGPOSTED.CUSTACCOUNT = '" + custTrans.Customer.CustomerId + "'";

                            //    if (connection.State == ConnectionState.Closed)
                            //        connection.Open();


                            //    SqlCommand cmd = new SqlCommand(commandText, connection);
                            //    SqlDataReader rdr = cmd.ExecuteReader();
                            //    DataTable dtGSS = new DataTable();
                            //    dtGSS.Load(rdr);



                            //    BlankOperations.WinFormsTouch.frmGSSInput oGSS = new frmGSSInput(dtGSS, (((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Amount);
                            //    oGSS.ShowDialog();

                            //    rdr.Dispose();

                            //    if (oGSS.bStatus)
                            //    {
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.GSSNum = Convert.ToString(oGSS.GSSnumber);
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.NumMonths = Convert.ToString(oGSS.months);
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OperationType = Convert.ToString("GSS");

                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OperationDone = Convert.ToBoolean(true);
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.GoldFixing = oGSS.GoldFixing;
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).Amount = Convert.ToDecimal(oGSS.Amount);
                            //        (((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Amount = Convert.ToDecimal(oGSS.Amount);
                            //        (((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).TransSalePmtDiff = Convert.ToDecimal(oGSS.Amount);

                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdNo = string.Empty;

                            //    }
                            //    else
                            //    {
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.GSSNum = string.Empty;
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.NumMonths = string.Empty;
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OperationType = Convert.ToString("NORMALCUSTOMERDEPOSIT");

                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OperationDone = Convert.ToBoolean(false);

                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdNo = string.Empty;
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdPercentage = 0;
                            //        ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdTotAmt = 0;


                            //    }
                            //}
                            #endregion

                            //else
                            //{
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.GSSNum        = string.Empty;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.NumMonths     = string.Empty;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OperationType = Convert.ToString("NORMALCUSTOMERDEPOSIT");

                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.OperationDone = Convert.ToBoolean(false);

                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdNo         = string.Empty;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdPercentage = 0;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.FixedRateCustOrdTotAmt     = 0;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.ItemIds  = string.Empty;
                            ((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction)).PartnerData.IsRepair = false;

                            //}
                        }
                    }
                }
                else
                {
                    UpdateRetailTempTable();
                }
            }

            LSRetailPosis.ApplicationLog.Log("IOperationTriggersV1.PostProcessOperation", "After the operation has been processed this trigger is called.", LSRetailPosis.LogTraceLevel.Trace);
        }
Exemplo n.º 13
0
 /// <summary>
 /// Before the operation is processed this trigger is called.
 /// </summary>
 /// <param name="preTriggerResult"></param>
 /// <param name="posTransaction"></param>
 /// <param name="posisOperation"></param>
 public void PreProcessOperation(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction, PosisOperations posisOperation)
 {
     LSRetailPosis.ApplicationLog.Log("ICustomerTriggersV1.PreProcessOperation", "Before the operation is processed this trigger is called.", LSRetailPosis.LogTraceLevel.Trace);
 }