Example #1
0
        public CManualAttendantPays()
        {
            InitializeComponent();
            this.ucValueCalcComp.MaxLength = 9;
            optHandpay.IsChecked           = true;

            if (!Settings.CAGE_ENABLED)
            {
                btnSave.Content = Application.Current.FindResource("CViewHandpay_xaml_btnSave");
            }
            else
            {
                btnSave.Content = Application.Current.FindResource("CViewHandpay_xaml_btnGenerateSlipNo");
            }

            handpay = HandpayBusinessObject.CreateInstance();
            ConfigManager.SetConfigurationMode(ConfigManager.ConfigurationMode.AppConfig);
            //installationPathkey = BMCRegistryHelper.GetRegLocalMachine().OpenSubKey(ConfigManager.Read("ExchangeClientInstallationPath"));
            this.Unloaded += new RoutedEventHandler(CManualAttendantPays_Unloaded);
            if (!Settings.IsGloryCDEnabled)
            {
                this.InitializeCashDispenser();
            }

            this.ucValueCalcComp.EnterClicked += (btnSave_Click);
        }
Example #2
0
        private void LoadmachineList()
        {
            IHandpay objCashDeskOperator = HandpayBusinessObject.CreateInstance();

            DataTable dtMachines = null;// objCashDeskOperator.FillMachines();
            Binding   bind       = new Binding();

            bind.Source = dtMachines;
            lvMachines.SetBinding(ListView.ItemsSourceProperty, bind);
        }
Example #3
0
        private void FillHandpays()
        {
            IHandpay  objCashDeskOperator = HandpayBusinessObject.CreateInstance();
            DataTable dtHandpay           = objCashDeskOperator.GetUnprocessedHandpays();

            foreach (DataRow row in dtHandpay.Rows)
            {
                row["Amount"] = CommonBusinessObjects.GetCurrency(Convert.ToDouble(row["Amount"]));
            }
            Binding bind = new Binding();

            bind.Source = dtHandpay;

            lvUnprocessedHandpays.SetBinding(ListView.ItemsSourceProperty, bind);

            if (lvUnprocessedHandpays.Items.Count > 0)
            {
                lvUnprocessedHandpays.SelectedItem = 0;
                DataRowView row = (DataRowView)lvUnprocessedHandpays.SelectedItem;
                txtSelectedValue.Text = row["Amount"].ToString();
            }
        }
Example #4
0
        private void SaveDetails_EventsFromConnexus(bool IsVoid)
        {
            string strTreasuryType = string.Empty;
            float  fTreasuryAmount = 0.00F;

            try
            {
                Treasury    objHandpayEntity    = new Treasury();
                IHandpay    objCashDeskOperator = HandpayBusinessObject.CreateInstance();
                DataRowView objHandpays         = null;

                if (lvUnprocessedHandpays.SelectedItem != null)
                {
                    objHandpays     = (DataRowView)lvUnprocessedHandpays.SelectedItem;
                    strTreasuryType = objHandpays.Row["Type"].ToString();

                    if (strTreasuryType.ToUpper() == "HANDPAY")
                    {
                        strTreasuryType = TREASURY_HANDPAY_CREDIT;;
                    }
                    else if (strTreasuryType.ToUpper() == "JACKPOT")
                    {
                        strTreasuryType = TREASURY_HANDPAY_JACKPOT;
                    }
                    else if (strTreasuryType.ToUpper() == "PROG")
                    {
                        strTreasuryType = TREASURY_PROG;
                    }

                    objHandpayEntity.TreasuryType = strTreasuryType;

                    objHandpayEntity.CollectionNumber      = 0;
                    objHandpayEntity.InstallationNumber    = int.Parse(objHandpays.Row["Installation_No"].ToString());
                    objHandpayEntity.UserID                = BMC.Common.clsSecurity.UserID;
                    objHandpayEntity.TreasuryReason        = "";
                    objHandpayEntity.TreasuryReasonCode    = 0;
                    objHandpayEntity.TreasuryAllocated     = 0;
                    objHandpayEntity.TreasuryBreakdown100p = 0;
                    objHandpayEntity.TreasuryBreakdown10p  = 0;
                    objHandpayEntity.TreasuryBreakdown200p = 0;
                    objHandpayEntity.TreasuryBreakdown20p  = 0;
                    objHandpayEntity.TreasuryBreakdown2p   = 0;
                    objHandpayEntity.TreasuryBreakdown50p  = 0;
                    objHandpayEntity.TreasuryBreakdown5p   = 0;
                    objHandpayEntity.TreasuryIssuerUserNo  = BMC.Common.clsSecurity.UserID;
                    objHandpayEntity.TreasuryMembershipNo  = "0";

                    objHandpayEntity.TreasuryAmount = float.Parse(objHandpays.Row["Amount"].ToString());
                    fTreasuryAmount = objHandpayEntity.TreasuryAmount;

                    iTreasuryID = objCashDeskOperator.ProcessHandPay(objHandpayEntity);

                    string strTEID = string.Empty;
                    strTEID = objHandpays.Row["TE_Id"].ToString();
                    if (objCashDeskOperator.UpdateTicketException(strTEID) == false)
                    {
                        BMC.Common.LogManagement.LogManager.WriteLog("Error while updating ticket exception table", BMC.Common.LogManagement.LogManager.enumLogLevel.Info);
                    }

                    if (IsVoid == true)
                    {
                        fTreasuryAmount = -fTreasuryAmount;
                    }

                    //MachineDetails.TreasuryNo = iTreasuryID.ToString();
                    //MachineDetails.Value = objHandpayEntity.TreasuryAmount.ToString();

                    if (strTreasuryType == TREASURY_HANDPAY_CREDIT)
                    {
                        strTreasuryType = "Handpay";
                    }
                    (oCommonUtilities.CreateInstance()).PrintCommonReceipt(strTreasuryType);

                    objCashDeskOperator.ClearHandpayLock(int.Parse(objHandpays.Row["Installation_No"].ToString()));

                    if (IsVoid == false)
                    {
                        MessageBox.showBox("Data is now saved", BMC_Icon.Information);
                    }
                    txtSelectedValue.Text = string.Empty;

                    FillHandpays();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
Example #5
0
        private void SaveManualHandpay()
        {
            string strTreasuryType = string.Empty;

            try
            {
                Treasury objHandpayEntity = new Treasury();
                if (optHandpay.IsChecked == true)
                {
                    strTreasuryType = TREASURY_HANDPAY_CREDIT;;
                }
                else if (optJackpot.IsChecked == true)
                {
                    strTreasuryType = TREASURY_HANDPAY_JACKPOT;
                }
                else
                {
                    strTreasuryType = TREASURY_PROG;
                }

                objHandpayEntity.TreasuryType = strTreasuryType;
                DataRowView rowview = (DataRowView)lvMachines.SelectedItem;

                objHandpayEntity.InstallationNumber    = int.Parse(rowview.Row[3].ToString());
                objHandpayEntity.UserID                = BMC.Common.clsSecurity.UserID;
                objHandpayEntity.TreasuryReason        = "";
                objHandpayEntity.TreasuryReasonCode    = 0;
                objHandpayEntity.TreasuryAllocated     = 0;
                objHandpayEntity.TreasuryBreakdown100p = 0;
                objHandpayEntity.TreasuryBreakdown10p  = 0;
                objHandpayEntity.TreasuryBreakdown200p = 0;
                objHandpayEntity.TreasuryBreakdown20p  = 0;
                objHandpayEntity.TreasuryBreakdown2p   = 0;
                objHandpayEntity.TreasuryBreakdown50p  = 0;
                objHandpayEntity.TreasuryBreakdown5p   = 0;
                objHandpayEntity.TreasuryIssuerUserNo  = BMC.Common.clsSecurity.UserID;
                objHandpayEntity.TreasuryMembershipNo  = "0";

                if (txtBox != null)
                {
                    objHandpayEntity.TreasuryAmount = float.Parse(txtBox.Text);
                }

                IHandpay objCashDeskOperator = HandpayBusinessObject.CreateInstance();
                int      iTreasuryID         = objCashDeskOperator.ProcessHandPay(objHandpayEntity);
                if (iTreasuryID != 0)
                {
                    MessageBox.showBox("This Data is now saved", BMC_Icon.Information);

                    //MachineDetails.TreasuryNo = iTreasuryID.ToString();
                    //MachineDetails.Value = objHandpayEntity.TreasuryAmount.ToString();
                    if (strTreasuryType == TREASURY_HANDPAY_CREDIT)
                    {
                        strTreasuryType = "Handpay";
                    }
                    (oCommonUtilities.CreateInstance()).PrintCommonReceipt(strTreasuryType);

                    txtBox.Text = "0.00";
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int iReasonID = 0;
                btnSave.IsEnabled = false;
                if (!CheckData())
                {
                    return;
                }

                int    iSelectedInstallation = 0;
                int    iSelectedReasoncode   = 0;
                string strExceptionDetails   = string.Empty;
                int    iExceptionCode        = 0;
                string strExpectedStatus     = string.Empty;
                string strReason             = "";
                string strComment            = "";

                IHandpay IUser_No         = HandpayBusinessObject.CreateInstance();
                int      AuthorizedUserNo = Security.SecurityHelper.CurrentUser.User_No;

                DataRowView drv = (DataRowView)lstInstallation.SelectedItem;
                iSelectedInstallation = Convert.ToInt32(drv["Installation_No"]);

                if (lvReason.SelectedIndex >= 0)
                {
                    iSelectedReasoncode = 0;
                    drv = (DataRowView)lvReason.SelectedItem;
                    iSelectedReasoncode = Convert.ToInt32(drv[0]);
                }
                else
                {
                    if (lvReason.Items.SourceCollection is System.Data.DataView)
                    {
                        DataView  dvReason = (DataView)lvReason.Items.SourceCollection;
                        DataTable dtReason = new DataTable();
                        dtReason = dvReason.ToTable().Copy();
                        DataView dvReasonClone = new DataView(dtReason);
                        dvReasonClone.RowFilter = "ReasonDescription='" + txtComments.Text + "'";
                        if (dvReasonClone.ToTable().Rows.Count > 0)
                        {
                            iSelectedReasoncode = Convert.ToInt32(dvReasonClone.ToTable().Rows[0]["ReasonCode"]);
                        }
                        else
                        {
                            iSelectedReasoncode = lvReason.Items.Count + 1;
                        }
                    }
                }

                double dValue = Convert.ToDouble(objValueCalc.txtDisplay.Text);
                bool   blnTicketFoundinException = false;

                IShortPay objCashDesk = ShortPayBusinessObject.CreateInstance();

                BMC.Transport.CashDeskOperatorEntity.Treasury objTreasuries = new BMC.Transport.CashDeskOperatorEntity.Treasury();
                objTreasuries.InstallationNumber = iSelectedInstallation;
                objTreasuries.UserID             = Security.SecurityHelper.CurrentUser.User_No;
                objTreasuries.TreasuryType       = "Shortpay";
                objTreasuries.TreasuryReasonCode = iSelectedReasoncode;

                if (lvReason.SelectedIndex >= 0)
                {
                    DataRowView drvReason = (DataRowView)lvReason.SelectedItem;
                    strReason  = drvReason[1].ToString();
                    strComment = strReason + ". Voucher Number is" + txtTicketNumber.Text;
                }
                else
                {
                    objReasonCode.Reason_Code       = iSelectedReasoncode;
                    objReasonCode.ReasonDescription = txtComments.Text;
                    if (!String.IsNullOrEmpty(txtComments.Text))
                    {
                        if (Settings.AddShortpayCommentstoDefault)
                        {
                            iReasonID = objCashDesk.SaveReasonDetails(objReasonCode);
                        }
                        strComment = txtComments.Text + " . Voucher Number is " + txtTicketNumber.Text;
                        strReason  = txtComments.Text;
                        objTreasuries.TreasuryReason = strComment;
                    }
                }

                if (strComment.Length > 199)
                {
                    objTreasuries.TreasuryReason = strComment.Substring(0, 199);
                }
                else
                {
                    objTreasuries.TreasuryReason = strComment;
                }

                objTreasuries.TreasuryAmount       = dValue;
                objTreasuries.TreasuryIssuerUserNo = AuthorizedUserNo;

                int iShortPayID    = 0;
                int UserSecurityId = 0;
                if (BMC.Transport.Settings.ShortPayAuthorizationRequired &&
                    objTreasuries.TreasuryAmount >= BMC.Transport.Settings.ShortPayAuthorizationLimit)
                {
                    if (objCashDesk.CreateShortPayForApproval(objTreasuries, ref iShortPayID))
                    {
                        LogManager.WriteLog("Shortpay saved for authorization. Ticketnumber: " + txtTicketNumber.Text, LogManager.enumLogLevel.Info);
                    }
                    else
                    {
                        LogManager.WriteLog("Unable to save Shortpay authorization. Ticketnumber: " + txtTicketNumber.Text, LogManager.enumLogLevel.Info);
                        MessageBox.ShowBox("MessageID198");
                        return;
                    }

                    CAuthorize oCAuthorize = new CAuthorize("BMC.Presentation.CShortPay.ShortPayApprover");
                    oCAuthorize.ShowDialog();
                    if (!oCAuthorize.IsAuthorized)
                    {
                        objCashDesk.CancelShortPayForApproval(iShortPayID);
                        return;
                    }
                    bIsAuthorised    = true;
                    AuthorisedUsr    = oCAuthorize.User;
                    UserSecurityId   = oCAuthorize.User.SecurityUserID;
                    AuthorizedUserNo = IUser_No.GetUserID(UserSecurityId);
                }

                //Update user no with authorized user if shortpay is authorised by different user
                objTreasuries.TreasuryIssuerUserNo = AuthorizedUserNo;
                objTreasuries.AuthorizedUser_No    = AuthorizedUserNo;
                objTreasuries.Authorized_Date      = DateTime.Now;

                int iTreasuryID = objCashDesk.SaveShortpayDetails(objTreasuries);

                if (iShortPayID > 0)
                {
                    objCashDesk.ApproveShortPay(iShortPayID.ToString(), UserSecurityId, iTreasuryID);
                }

                if (iTreasuryID > 0)
                {
                    LogManager.WriteLog("Shortpay saved in treasury. Ticketnumber: " + txtTicketNumber.Text, LogManager.enumLogLevel.Info);
                    if (iReasonID > 0)
                    {
                        LogManager.WriteLog("ReasonCode saved in Reason_Code. ReasonCode: " + objReasonCode.Reason_Code, LogManager.enumLogLevel.Info);
                    }
                }
                else
                {
                    LogManager.WriteLog("Unable to save Shortpay in treasury. Ticketnumber: " + txtTicketNumber.Text, LogManager.enumLogLevel.Info);
                    return;
                }

                strExceptionDetails = "Normal Treasury Entry";
                iExceptionCode      = (int)ShortpayExceptionCodes.NormalTreasuryEntry;
                IHandpay  handpay     = HandpayBusinessObject.CreateInstance();
                DataTable dtException = handpay.GetTicketingExceptionTable(txtTicketNumber.Text);

                if (dtException.Rows.Count > 0)
                {
                    LogManager.WriteLog("Voucher Number :" + txtTicketNumber.Text + " found in Ticket_Exception table.", LogManager.enumLogLevel.Info);
                    strExpectedStatus         = dtException.Rows[0]["TE_Status_Create_Expected"].ToString();
                    blnTicketFoundinException = true;
                    if (objCashDesk.UpdateTicketException(0, txtTicketNumber.Text, "V") == 0)
                    {
                        LogManager.WriteLog("Ticket Exception table updated. Voucher Number:" + txtTicketNumber.Text, LogManager.enumLogLevel.Info);
                    }

                    strExceptionDetails = "House Keeping Void";
                    iExceptionCode      = (int)ShortpayExceptionCodes.HouseKeepingVoid;
                }

                if (blnTicketFoundinException && !string.IsNullOrEmpty(strExpectedStatus))
                {
                    if (strExpectedStatus == "VOID_SP" || strExpectedStatus == "ACTIVE")
                    {
                        BMC.Transport.CashDeskOperatorEntity.VoidOrExpiredTreasury objVoidTreasury = new BMC.Transport.CashDeskOperatorEntity.VoidOrExpiredTreasury();
                        objVoidTreasury.TicketNumber    = txtTicketNumber.Text;
                        objVoidTreasury.TransactionType = "Shortpay";
                        objVoidTreasury.TreasuryReason  = "Voiding Voucher for ShortPay";
                        objCashDesk.UpdateVoidorExpiredTreasury(objVoidTreasury);
                        LogManager.WriteLog("Updated void or expired treasury. Ticketnumber: " + txtTicketNumber.Text, LogManager.enumLogLevel.Info);
                        strExceptionDetails = "Voiding Vocuher for ShortPay";
                        iExceptionCode      = (int)ShortpayExceptionCodes.VoidTicketForShortpay;
                    }
                }
                if (!blnTicketFoundinException)
                {
                    strExceptionDetails = "No entry found in ticket_exception table for the Voucher entered";
                    iExceptionCode      = (int)ShortpayExceptionCodes.NoEntryInTicket_Exception;
                }

                Transport.CashDeskOperatorEntity.TicketException objException = new BMC.Transport.CashDeskOperatorEntity.TicketException();
                objException.InstallationNumber = iSelectedInstallation;
                objException.ExceptionDetails   = strExceptionDetails;
                objException.ExceptionType      = iExceptionCode;
                objException.Reference          = txtTicketNumber.Text;
                objException.User = AuthorizedUserNo;
                objCashDesk.InsertException(objException);
                LogManager.WriteLog("Voucher inserted into Exception. Voucher Number :" + txtTicketNumber.Text, LogManager.enumLogLevel.Info);

                //MachineDetails.Value = dValue.ToString();
                //MachineDetails.TreasuryNo = iTreasuryID.ToString();

                string sDesc = "Position: " + ((System.Data.DataRowView)(lstInstallation.SelectedValue)).Row.ItemArray[0].ToString() + " Details: " + strReason + " TicketNo.: " + txtTicketNumber.Text + " Amount: " + dValue;
                sDesc += bIsAuthorised ? " Approved By : " + AuthorisedUsr.UserName : "";

                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                {
                    AuditModuleName    = ModuleName.Shortpay,
                    Audit_Screen_Name  = "Shortpay",
                    Audit_Desc         = sDesc,
                    AuditOperationType = OperationType.ADD,
                    Audit_Field        = "Shortpay ",
                    Audit_New_Vl       = "NULL"
                });

                MessageBox.ShowBox("MessageID197");

                LoadControls();
                lstInstallation.Focus();
                if (dtInstallations.Rows.Count > 0)
                {
                    lstInstallation.SelectedIndex = 0;
                }

                //To Print Receipt.
                if (!bIsAuthorised)
                {
                    (oCommonUtilities.CreateInstance()).PrintCommonReceipt(false, "Shortpay", iTreasuryID.ToString());
                }
                else
                {
                    (oCommonUtilities.CreateInstance()).PrintCommonReceipt(false, "Shortpay", iTreasuryID.ToString(), AuthorisedUsr);
                }

                AuthorisedUsr = null;
                bIsAuthorised = false;
                LogManager.WriteLog("Recipt printed for shortpay. Voucher Number :" + txtTicketNumber.Text, LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID198");
                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                {
                    AuditModuleName    = ModuleName.Shortpay,
                    Audit_Screen_Name  = "Shortpay",
                    Audit_Desc         = "Exception Occured while saving the Data",
                    AuditOperationType = OperationType.ADD,
                    Audit_Field        = "Shortpay ",
                    Audit_New_Vl       = "NULL"
                });
            }
            finally
            {
                btnSave.IsEnabled = true;
            }
        }
Example #7
0
        void EXClas_ACK(ComExchangeLib.MessageAck MessageAck)
        {
            if (MessageAck.ACK)
            {
                bool   IsVoid          = false;
                string strTEID         = string.Empty;
                string strTreasuryType = string.Empty;
                //float fTreasuryAmount = 0.00F;
                double fTreasuryAmount;
                try
                {
                    Treasury objHandpayEntity    = new Treasury();
                    IHandpay objCashDeskOperator = HandpayBusinessObject.CreateInstance();

                    strTreasuryType = TREASURY_HANDPAY_CREDIT;

                    //Get the type of treasury event
                    if (_POSDetail.HandPayType == "HandPay")
                    {
                        strTreasuryType = TREASURY_HANDPAY_CREDIT;;
                    }
                    else if (_POSDetail.HandPayType == "Jackpot")
                    {
                        strTreasuryType = TREASURY_HANDPAY_JACKPOT;
                    }
                    else if (_POSDetail.HandPayType == "Progressive")
                    {
                        strTreasuryType = TREASURY_PROG;
                    }

                    //Save the treasury details in treasury table.
                    objHandpayEntity.TreasuryType = strTreasuryType;

                    objHandpayEntity.CollectionNumber      = 0;
                    objHandpayEntity.InstallationNumber    = _POSDetail.InstallationNo;
                    objHandpayEntity.UserID                = Security.SecurityHelper.CurrentUser.SecurityUserID;
                    objHandpayEntity.TreasuryReason        = "";
                    objHandpayEntity.TreasuryReasonCode    = 0;
                    objHandpayEntity.TreasuryAllocated     = 0;
                    objHandpayEntity.TreasuryBreakdown100p = 0;
                    objHandpayEntity.TreasuryBreakdown10p  = 0;
                    objHandpayEntity.TreasuryBreakdown200p = 0;
                    objHandpayEntity.TreasuryBreakdown20p  = 0;
                    objHandpayEntity.TreasuryBreakdown2p   = 0;
                    objHandpayEntity.TreasuryBreakdown50p  = 0;
                    objHandpayEntity.TreasuryBreakdown5p   = 0;
                    objHandpayEntity.TreasuryIssuerUserNo  = Security.SecurityHelper.CurrentUser.SecurityUserID;
                    objHandpayEntity.TreasuryMembershipNo  = "0";

                    objHandpayEntity.TreasuryAmount = double.Parse(_POSDetail.HandPayValue.ToString());
                    fTreasuryAmount = objHandpayEntity.TreasuryAmount;

                    iTreasuryID = objCashDeskOperator.ProcessHandPay(objHandpayEntity);

                    DataTable dt = new DataTable();
                    dt = analysisBusinessObject.GetTicketException(_POSDetail.InstallationNo);

                    foreach (DataRow dr in dt.Rows)
                    {
                        strTEID = BMC.Presentation.Helper_classes.Common.GetRowValue <int>(dr, "TE_ID").ToString();
                        break;
                    }


                    if (objCashDeskOperator.UpdateTicketException(strTEID) == false)
                    {
                        BMC.Common.LogManagement.LogManager.WriteLog("Error while updating ticket exception table", BMC.Common.LogManagement.LogManager.enumLogLevel.Info);
                    }

                    //Create a receipt with -ve amount incase of a void transaction
                    if (IsVoid == true)
                    {
                        fTreasuryAmount = -fTreasuryAmount;
                    }
                    //Print the receipt for handpay.


                    //MachineDetails.TreasuryNo = iTreasuryID.ToString();
                    //MachineDetails.Value = objHandpayEntity.TreasuryAmount.ToString();

                    if (strTreasuryType == TREASURY_HANDPAY_CREDIT)
                    {
                        strTreasuryType = "Handpay";
                    }
                    (oCommonUtilities.CreateInstance()).PrintCommonReceipt(false, strTreasuryType, "");
                    if (IsVoid == false)
                    {
                        MessageBox.ShowBox("MessageID57", BMC_Icon.Information);
                    }

                    this.Visibility = Visibility.Hidden;
                }
                catch (Exception ex)
                {
                    MessageBox.ShowBox("MessageID59", BMC_Icon.Error);
                    ExceptionManager.Publish(ex);
                }
            }
            else
            {
                MessageBox.ShowBox("MessageID59", BMC_Icon.Error);
            }
        }