Ejemplo n.º 1
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cboProfitShareGroup.SelectedIndex <= 0)
                {
                    MessageBox.ShowBox("MessageID490", BMC_Icon.Information);
                    return;
                }

                decimal FixedExpenseAmount = (Convert.ToDecimal(txtExpenseShareAmount.Text) * (Convert.ToDecimal(((ExpenseShareGroup)cboExpenseShareGroup.SelectedItem).ExpenseSharePercentage) / 100));
                decimal dTotal             = Convert.ToDecimal(FixedExpenseAmount) + Convert.ToDecimal(txtCarriedForwardAmount.Text);
                if (Math.Round(Convert.ToDecimal(txtWriteOffExpense.Text), 2, MidpointRounding.AwayFromZero) > (Math.Round(FixedExpenseAmount, 2) + Math.Round(Convert.ToDecimal(txtCarriedForwardAmount.Text), 2, MidpointRounding.AwayFromZero)))
                {
                    CAuthorize oCAuthorize = new CAuthorize("BMC.Presentation.CProfitShare.ProfitShareApprover");
                    oCAuthorize.ShowDialog();
                    if (!oCAuthorize.IsAuthorized)
                    {
                        return;
                    }
                    //string strMsg = Application.Current.FindResource("MessageID890").ToString().Replace("@@@@", Convert.ToDecimal(txtWriteOffExpense.Text).ToString("#,##0.00")).Replace("****", dTotal.ToString("#,##0.00"));
                    //MessageBox.ShowBox(strMsg, BMC_Icon.Error, true);
                }
                objCommonLiquidation.ProfitShareGroupId     = Convert.ToInt32(cboProfitShareGroup.SelectedValue);
                objCommonLiquidation.ExpenseShareGroupID    = Convert.ToInt32(cboExpenseShareGroup.SelectedValue);
                objCommonLiquidation.ExpenseShareAmount     = Convert.ToDecimal(txtExpenseShareAmount.Text);
                objCommonLiquidation.WriteOffAmount         = Convert.ToDecimal(txtWriteOffExpense.Text);
                objCommonLiquidation.PayPeriodId            = objPayPeriods == null ? 0 : objPayPeriods.Calendar_Period_ID;
                objCommonLiquidation.Percentage_Setting     = Convert.ToDecimal(((ProfitShareGroup)cboProfitShareGroup.SelectedItem).ProfitSharePercentage);
                objCommonLiquidation.ExpenseSharePercentage = Convert.ToDecimal(((ExpenseShareGroup)cboExpenseShareGroup.SelectedItem).ExpenseSharePercentage);
                this.Close();
            }

            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
Ejemplo n.º 2
0
        private void GenerateManulJackpot()
        {
            double amount = 0;

            if (txtBox != null && txtBox.Text.Length > 0)
            {
                double.TryParse(txtBox.Text.ToString(), NumberStyles.Currency, new CultureInfo(ExtensionMethods.CurrentCurrenyCulture), out amount);
            }

            //if (amount > Settings.W2GWinAmount)
            //{
            //    MessageBox.ShowBox("MessageID367", BMC_Icon.Information);
            //    //return;
            //}
            try
            {
                jackpotProcessInfoDTO jpinfo       = new jackpotProcessInfoDTO();
                CAuthorize            objAuthorize = null;
                string HP_Type = string.Empty;
                Double iAmount = 0;
                if (txtBox != null && txtBox.Text.Length > 0)
                {
                    // Issue fix for ->set cultureinfo='en-US',  currencyculture='it-IT'
                    Double.TryParse(txtBox.Text.ToString(), NumberStyles.Currency, new CultureInfo(ExtensionMethods.CurrentCurrenyCulture), out iAmount);
                }

                if (Settings.Client != null && Settings.Client.ToLower() == "winchells" &&
                    Settings.MaxHandPayAuthRequired &&
                    txtBox != null &&
                    (iAmount > Settings.HandpayPayoutCustomer_Max))
                {
                    objAuthorize      = new CAuthorize("CashdeskOperator.Authorize.cs.MaxHandpay");
                    objAuthorize.User = Security.SecurityHelper.CurrentUser;
                    if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.MaxHandpay"))
                    {
                        objAuthorize.ShowDialog();
                        if (!objAuthorize.IsAuthorized)
                        {
                            return;
                        }
                    }
                    else
                    {
                        objAuthorize.IsAuthorized = true;
                    }
                }
                if (optHandpay.IsChecked == true)
                {
                    HP_Type = "AttendantPay Credit";
                    jpinfo.jackpotTypeId = 4;
                }
                else if (optJackpot.IsChecked == true)
                {
                    HP_Type = "AttendantPay Jackpot";
                    jpinfo.jackpotTypeId = 5;
                }
                else
                {
                    HP_Type = "AttendantPay Progressive";
                    jpinfo.jackpotTypeId = 6;
                }

                // Finding Denom for the machine-CR# 167677

                decimal DenomValue = 0;
                DataSet oDt        = handpay.createTickeException_HandpayCAGE(int.Parse((cmbBarPositions.SelectedItem as BarPositions).Bar_Pos_Name), iAmount, 0, HP_Type);
                List <DenomValueResult> lstDenom = handpay.GetDenomValue(oDt.Tables[0].Rows[0]["Asset"].ToString());
                foreach (var denom in lstDenom)
                {
                    DenomValue = denom.Denom;
                }
                jpinfo.Slot = (cmbBarPositions.SelectedItem as BarPositions).Bar_Pos_Name;
                jpinfo.assetConfigNumber = oDt.Tables[0].Rows[0]["Asset"].ToString();
                jpinfo.Denom             = DenomValue;
                jpinfo.hpjpAmount        = long.Parse(oDt.Tables[0].Rows[0]["TE_VALUE"].ToString());
                jpinfo.jackpotNetAmount  = long.Parse(oDt.Tables[0].Rows[0]["TE_VALUE"].ToString());
                jpinfo.sequenceNumber    = long.Parse(oDt.Tables[0].Rows[0]["TE_ID"].ToString());
                jpinfo.TransactionDate   = oDt.Tables[0].Rows[0]["TE_Date"].ToString();
                jpinfo.UserID            = Security.SecurityHelper.CurrentUser.SecurityUserID.ToString();
                jpinfo.siteNo            = Settings.SiteName;
                jpinfo.siteId            = Convert.ToInt32(Settings.SiteCode);
                txtBox.Text = this.DefaultAmount();
                handpay.PrintSlip(jpinfo);


                //send PT 10 from client

                Treasury treasury = new Treasury();
                treasury.ActualTreasuryDate = Convert.ToDateTime(jpinfo.TransactionDate);
                treasury.Asset              = Asset;
                treasury.Authorized_Date    = Convert.ToDateTime(jpinfo.TransactionDate);
                treasury.AuthorizedUser_No  = SecurityHelper.CurrentUser.User_No;
                treasury.CustomerID         = SecurityHelper.CurrentUser.User_No;
                treasury.InstallationNumber = InstallationNumber;
                treasury.TreasuryAmount     = iAmount;
                treasury.UserID             = SecurityHelper.CurrentUser.User_No;
                treasury.TreasuryType       = HP_Type;

                if (((bool)optJackpot.IsChecked) || ((bool)optProgressive.IsChecked)) //|| ((bool)optHandpay.IsChecked))
                {
                    PostHandpayEvent(treasury);
                }
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
            }
        }
Ejemplo n.º 3
0
        private void btnVerify_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string ticketNumber = this.ucValueCalc.txtDisplay.Text.Trim();

                //check if ticketstring is numeric
                double Num;
                bool   isNum = double.TryParse(ticketNumber, out Num);


                btnVerify.IsEnabled = false;

                if (isNum && (ticketNumber.IndexOf('.') < 0) && this.ucValueCalc.txtDisplay.Text.Trim().Length > 0)
                {
                    ExceptionVoucher objExceptionVoucher = new ExceptionVoucher();


                    this.txtStatus.Visibility = Visibility.Visible;
                    this.txtStatus.Text       = Application.Current.FindResource("MessageID401") as string;


                    //LogManager.WriteLog("Checking Voucher:" + ticketNumber+" is PP Ticket", LogManager.enumLogLevel.Info);
                    if (objExceptionVoucher.IsExceptionVoucher(ticketNumber) == 1)
                    {
                        this.txtStatus.Text = Application.Current.FindResource("MessageID221") as string;


                        if (MessageBox.ShowBox("MessageID395", BMC_Icon.Warning, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            disptimerRedeem.IsEnabled = true;
                            disptimerRedeem.Start();

                            //******Check for user access rights.
                            CAuthorize objAuthorize = null;
                            objAuthorize      = new CAuthorize("BMC.Presentation.CPpTicket");
                            objAuthorize.User = Security.SecurityHelper.CurrentUser;
                            if (!Security.SecurityHelper.HasAccess("BMC.Presentation.CPpTicket"))
                            {
                                objAuthorize.ShowDialog();
                                if (!objAuthorize.IsAuthorized)
                                {
                                    ClearAll();
                                    return;
                                }
                            }
                            else
                            {
                                objAuthorize.IsAuthorized = true;
                            }

                            //Go ahead and Mark the ticket as active
                            if (objExceptionVoucher.MarkExceptionVoucherActive(ticketNumber) == -1)
                            {
                                //Unsuccessfull in Activating PP ticket :(
                                //LogManager.WriteLog("Unsuccessfull in Activating PP Voucher:" + ticketNumber + "!!!", LogManager.enumLogLevel.Info);
                                MessageBox.ShowBox("MessageID397", BMC_Icon.Error, BMC_Button.OK);
                            }
                            else
                            {
                                //Success in Activating PP ticket! :)
                                //LogManager.WriteLog("Success in Activating PP Voucher:" + ticketNumber + "!!!", LogManager.enumLogLevel.Info);
                                disptimerRedeem.Stop();
                                this.txtStatus.Text = Application.Current.FindResource("MessageID402") as string;
                                MessageBox.ShowBox("MessageID396", BMC_Icon.Information, BMC_Button.OK);

                                //****Audit code***
                                #region "Audit log for PP ticket"

                                if (objAuthorize != null && objAuthorize.IsAuthorized)
                                {
                                    // Modified description, removed field & new value for Exception Voucher
                                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                    {
                                        AuditModuleName    = ModuleName.Exception_Voucher,
                                        Audit_Screen_Name  = "Exception Voucher",
                                        Audit_Desc         = "Voucher Number - " + ticketNumber + " activated by " + objAuthorize.User.DisplayName,
                                        AuditOperationType = OperationType.MODIFY,
                                    });
                                }
                                #endregion
                            }

                            disptimerRedeem.Stop();
                            this.txtStatus.Visibility = Visibility.Hidden;
                        }
                        else
                        {
                            disptimerRedeem.Stop();
                            this.txtStatus.Visibility = Visibility.Hidden;
                        }
                    }
                    else // you will enter here if its not an exception voucher
                    {
                        disptimerRedeem.Start();
                        this.txtStatus.Text = Application.Current.FindResource("MessageID398") as string;
                        MessageBox.ShowBox("MessageID399", BMC_Icon.Information, BMC_Button.OK, ticketNumber);

                        this.ucValueCalc.txtDisplay.Focus();
                        disptimerRedeem.Stop();
                        this.txtStatus.Visibility = Visibility.Hidden;
                    }
                }    //  Outer most IF ends here
                else // enter here if Voucher number has anything other than numerals
                {
                    if (ticketNumber.Length > 0)//Show message only if there is something in the textbox
                    {
                        disptimerRedeem.Start();
                        this.txtStatus.Text = Application.Current.FindResource("MessageID403") as string;
                        MessageBox.ShowBox("MessageID400", BMC_Icon.Error, BMC_Button.OK);
                        this.ucValueCalc.txtDisplay.Focus();
                        disptimerRedeem.Stop();
                    }
                    this.txtStatus.Visibility = Visibility.Hidden;
                }
            }//try ends here


            catch (Exception ex)
            {
                BMC.Common.ExceptionManagement.ExceptionManager.Publish(ex);
            }
            finally
            {
                ClearAll();
                btnVerify.IsEnabled = true;
            }
        }
        private void btnMainain_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CMachineMaintenance objMachineMaintenance = new CMachineMaintenance();

                //Start 
                if (btnMainain.Content == FindResource("CMachineMaintenanceView_xaml_btnMainain"))
                {
                    if (MessageBox.ShowBox("MessageID256", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                        return;

                    if (objMachineMaintenance.ManageMaintenance(installationNo, 0, Security.SecurityHelper.CurrentUser.SecurityUserID) > 0)
                    {
                        MessageBox.ShowBox("MessageID339", BMC_Icon.Information, BMC_Button.OK);

                        PopulateSession();
                        if (txtOpenSession.Tag != null)
                        {
                            PopulateEvents((int)txtOpenSession.Tag);
                        }
                        return;
                    }

                    //LogManager.WriteLog("Executing Path : " + BMCRegistryHelper.GetRegKeyValue(string.Empty,"InstallationPath").ToString().Trim()  + Common.ConfigurationManagement.ConfigManager.Read(
                    //                "HandpayCommandLinePrompt") + " DisableMachine " + installationNo, LogManager.enumLogLevel.Info);



                    //System.Diagnostics.Process.Start(BMCRegistryHelper.GetRegKeyValue(string.Empty, "InstallationPath").ToString().Trim().ToString().Trim() + Common.ConfigurationManagement.ConfigManager.Read(
                    //            "HandpayCommandLinePrompt"), " DisableMachine " + installationNo);

                    LogManager.WriteLog("Executing Path : " + Path.Combine(Extensions.GetStartupDirectory(), Common.ConfigurationManagement.ConfigManager.Read(
                "HandpayCommandLinePrompt")) + " DisableMachine " + installationNo, LogManager.enumLogLevel.Info);

                    System.Diagnostics.Process.Start(Path.Combine(Extensions.GetStartupDirectory(), Common.ConfigurationManagement.ConfigManager.Read(
                                "HandpayCommandLinePrompt")), " DisableMachine " + installationNo);


                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {
                        
                        AuditModuleName = ModuleName.MachineMaintenance,
                        Audit_Screen_Name = "Machine Maintenance View",
                        Audit_Desc = "Start Maintenance - Installation No: " + installationNo.ToString(),
                        AuditOperationType = OperationType.MODIFY,
                    });

                    MessageBox.ShowBox("MessageID309", BMC_Icon.Information, BMC_Button.OK);
                }
                else//Close 
                {
                    int iMachineEventStatus = objMachineMaintenance.CheckMachineMaintenance(installationNo);
                    if (iMachineEventStatus < 0)
                    {
                        if (MessageBox.ShowBox("MessageID304", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                        {
                            return;
                        }
                        CAuthorize objAuthorize = new CAuthorize("CashdeskOperator.Authorize.cs.OverrideEvents");
                        objAuthorize.User = Security.SecurityHelper.CurrentUser;
                        if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.OverrideEvents"))
                        {
                            objAuthorize.ShowDialog();
                            if (!objAuthorize.IsAuthorized)
                                return;
                        }
                        else
                        {
                            objAuthorize.IsAuthorized = true;
                        }
                    }

                    if (MessageBox.ShowBox("MessageID257", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                        return;

                    var objReasonCategory = new CReasonCategory();
                    objReasonCategory.ShowDialog();

                    if (objReasonCategory.MaintenanceReasonCategory != null && objReasonCategory.MaintenanceReasonCategory.Length > 0)
                    {
                        objMachineMaintenance.CloseMaintenance(installationNo, Security.SecurityHelper.CurrentUser.SecurityUserID,
                            objReasonCategory.MaintenanceReasonCategory);



                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            
                            AuditModuleName = ModuleName.MachineMaintenance,
                            Audit_Screen_Name = "Machine Maintenance View",
                            Audit_Desc = "Close Maintenance - Installation No: " + installationNo.ToString(),
                            AuditOperationType = OperationType.MODIFY,
                        });

                        MessageBox.ShowBox("MessageID310", BMC_Icon.Information, BMC_Button.OK);
                    }
                    else
                        return;
                }
                PopulateSession();
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void SaveManualHandpay()
        {
            Window Owner;
            double amount = 0;
            Treasury treasury = null;
            int AuthUserID = 0;
            try
            {
                CAuthorize objAuthorize = null;
                if (txtBox != null && txtBox.Text.Length > 0)
                {
                    // Issue fix for ->set cultureinfo='en-US',  currencyculture='it-IT'
                    double.TryParse(txtBox.Text.ToString(), NumberStyles.Currency, new CultureInfo(ExtensionMethods.CurrentCurrenyCulture), out amount);
                }
                AuthUserID = Security.SecurityHelper.CurrentUser.User_No;
                if (Settings.Client != null && Settings.Client.ToLower() == "winchells"
                    && Settings.MaxHandPayAuthRequired
                    && txtBox != null
                    && (amount > Settings.HandpayPayoutCustomer_Max))
                {
                    objAuthorize = new CAuthorize("CashdeskOperator.Authorize.cs.MaxHandpay");
                    objAuthorize.User = Security.SecurityHelper.CurrentUser;
                    AuthUserID = Security.SecurityHelper.CurrentUser.User_No;

                    if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.MaxHandpay"))
                    {
                        objAuthorize.ShowDialog();
                        if (!objAuthorize.IsAuthorized)
                        {
                            IsProcessed = true;
                            return;
                        }
                        else
                        {
                            AuthUserID = handpay.GetUserID(objAuthorize.User.SecurityUserID);

                        }
                    }
                    else
                    {
                        objAuthorize.IsAuthorized = true;
                    }
                }

                if (Settings.RegulatoryEnabled == true && Settings.RegulatoryType == "AAMS")
                {
                    if (txtBox != null)
                    {
                        Custid = 0;
                        ProcessCancelled = false;
                        if (amount >= Settings.HandpayPayoutCustomer_Min && amount <= Settings.HandpayPayoutCustomer_Max)
                        {
                            oCustomerDetails = new BMC.Presentation.POS.Views.CustomerDetails();
                            oCustomerDetails.delCustomerUpdated += new BMC.Presentation.POS.Views.CustomerDetails.CustomerUpdateHandler(delCustomerUpdated);
                            oCustomerDetails.delCustomerCancelled += new BMC.Presentation.POS.Views.CustomerDetails.CustomerCancelHandler(delCustomerCancelled);
                            Owner = Window.GetWindow(this);
                            oCustomerDetails.ShowDialog();
                        }
                        else if (amount >= Settings.HandpayPayoutCustomer_BankAccNo)
                        {
                            oCustomerDetails = new BMC.Presentation.POS.Views.CustomerDetails(true);
                            oCustomerDetails.delCustomerUpdated += new BMC.Presentation.POS.Views.CustomerDetails.CustomerUpdateHandler(delCustomerUpdated);
                            oCustomerDetails.delCustomerCancelled += new BMC.Presentation.POS.Views.CustomerDetails.CustomerCancelHandler(delCustomerCancelled);
                            Owner = Window.GetWindow(this);
                            oCustomerDetails.ShowDialog();
                        }
                        else if (amount >= Settings.HandpayPayoutCustomer_Max && amount <= Settings.HandpayPayoutCustomer_BankAccNo)
                        {
                            oCustomerDetails = new BMC.Presentation.POS.Views.CustomerDetails();
                            oCustomerDetails.delCustomerUpdated += new BMC.Presentation.POS.Views.CustomerDetails.CustomerUpdateHandler(delCustomerUpdated);
                            oCustomerDetails.delCustomerCancelled += new BMC.Presentation.POS.Views.CustomerDetails.CustomerCancelHandler(delCustomerCancelled);
                            Owner = Window.GetWindow(this);
                            oCustomerDetails.ShowDialog();
                        }
                    }

                    if (ProcessCancelled) // if the process cancelled from the customer then  back to the handpay screen
                        return;
                }


                treasury = new Treasury { InstallationNumber = InstallationNumber };

                if (optHandpay.IsChecked == true)
                    treasury.TreasuryType = "AttendantPay Credit";
                else if (optJackpot.IsChecked == true)
                    treasury.TreasuryType = "AttendantPay Jackpot";
                else
                    treasury.TreasuryType = "PROGRESSIVE";
                treasury.TreasuryAmount = amount;
                treasury.ActualTreasuryDate = DateTime.Now;
                treasury.UserID = AuthUserID;

                treasury.Authorized_Date = DateTime.MinValue.DBMinValue();
                if (objAuthorize != null && objAuthorize.IsAuthorized)
                {
                    treasury.AuthorizedUser_No = objAuthorize.User.SecurityUserID;
                    treasury.Authorized_Date = DateTime.Now;

                    //Audit for authorization
                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {

                        AuditModuleName = ModuleName.ManualAttendantPay,
                        Audit_Screen_Name = "PositionDetails|ManualAttendantPay",
                        Audit_Desc = "Manual AttendantPay Type-" + treasury.TreasuryType,
                        AuditOperationType = OperationType.ADD,
                        Audit_Field = "AuthorizedUser_No",
                        Audit_New_Vl = objAuthorize.User.SecurityUserID.ToString(),
                        Audit_Slot = handpay.GetAssetNumber(InstallationNumber)[0].Stock_No
                    });

                }

                treasury.CustomerID = Custid; // add the customer to the treasury if amt between 1000 & 4000 or >5000

                //if (Settings.W2GMessage)
                //{
                //    if (amount > Settings.W2GWinAmount)
                //    {
                //        MessageBox.ShowBox("MessageID367", BMC_Icon.Information);
                //        //Treasury_No = 0;
                //    }

                //    else
                //    {
                Treasury_No = handpay.ProcessHandPay(treasury, 0);
                //    }
                //}

                IsProcessed = true;
                if (Treasury_No > 0)
                {
                    DateTime dtTreasury = (DateTime)handpay.GetTreasuryDateTime(Treasury_No);
                    TextBlock_11.Text = "#" + BarPosition + dtTreasury.ToString("ddMMyyyyHHmmss");
                    txtAmount.Text = Convert.ToDecimal((treasury.TreasuryAmount)).GetUniversalCurrencyFormat();

                    #region GCD
                    if (Settings.IsGloryCDEnabled && Settings.CashDispenserEnabled)
                    {

                        LoadingWindow ld = new LoadingWindow(Window.GetWindow(this), ModuleName.ManualAttendantPay, Treasury_No.ToString(), BarPosition, Convert.ToInt32(treasury.TreasuryAmount * 100));
                        ld.Topmost = true;
                        ld.ShowDialog();
                        Result res = ld.Result;
                        if (res.IsSuccess && (Treasury_No > 0))
                        {
                            LogManager.WriteLog(string.Format("Cash Dispensed Successfully - Treasury Amount: {0:0.00}", treasury.TreasuryAmount), LogManager.enumLogLevel.Info);
                            LogManager.WriteLog("Export Manual AttendantPay Details to Enterprise", LogManager.enumLogLevel.Info);
                            handpay.ExportHandPay(Treasury_No);

                            BMC.Presentation.MessageBox.ShowBox(res.error.Message, res.error.MessageType.Equals("Error") ? BMC_Icon.Error : BMC_Icon.Information, true);

                            AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                            {

                                AuditModuleName = ModuleName.AttendantPay,
                                Audit_Screen_Name = "PositionDetails|AttendantPay|Manual HandPay",
                                Audit_Desc = "Manual HandPay Succeed",
                                AuditOperationType = OperationType.ADD,
                                Audit_Old_Vl = "Ticket_ExceptionID:0 (Manual Handpay); TreasuryNo:" + Treasury_No + ";",

                            });

                        }
                        else
                        {
                            BMC.Presentation.MessageBox.ShowBox(res.error.Message, res.error.MessageType.Equals("Error") ? BMC_Icon.Error : BMC_Icon.Information, true);
                            LogManager.WriteLog(string.Format("Unable to Dispense Cash - Treasury Amount: {0:0.00}", treasury.TreasuryAmount), LogManager.enumLogLevel.Info);
                            LogManager.WriteLog("Rollback Manual HandPay Process", LogManager.enumLogLevel.Info);
                            handpay.RollbackHandPay(0, Treasury_No);
                            MessageBox.ShowBox("MessageID117", BMC_Icon.Error);
                            AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                            {

                                AuditModuleName = ModuleName.AttendantPay,
                                Audit_Screen_Name = "PositionDetails|AttendantPay",
                                Audit_Desc = treasury.TreasuryType + " processing was not completed.",
                                AuditOperationType = OperationType.ADD,
                                Audit_Slot = (lstHandpay.SelectedItem as FillTreasuryList).Asset
                            });
                            AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                            {
                                AuditModuleName = ModuleName.AttendantPay,
                                Audit_Screen_Name = "PositionDetails|AttendantPay|Manual HandPay Process Failed",
                                Audit_Desc = "Rollback HandPay Process Voucher due to cash dispenser error",
                                AuditOperationType = OperationType.MODIFY,
                                Audit_Old_Vl = "Ticket_ExceptionID:0 (Manual Handpay); TreasuryNo:" + Treasury_No + ";"
                            });
                        }
                    }
                    else
                    {
                        this.ProcessCashDispense("Manual AttendantPay Type", treasury.TreasuryType, Convert.ToDecimal(amount));
                        MessageBox.ShowBox("MessageID116", BMC_Icon.Information);
                    }
                    #endregion


                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {

                        AuditModuleName = ModuleName.ManualAttendantPay,
                        Audit_Screen_Name = "PositionDetails|ManualAttendantPay",
                        Audit_Desc = "Manual AttendantPay Type-" + treasury.TreasuryType,
                        AuditOperationType = OperationType.ADD,
                        Audit_Field = "Amount",
                        Audit_New_Vl = String.Format("{0:0.00}", treasury.TreasuryAmount),
                        Audit_Slot = handpay.GetAssetNumber(InstallationNumber)[0].Stock_No
                    });

                    if (txtBox != null)
                    {
                        //txtBox.Text = "0.00";

                        txtBox.Text = this.DefaultAmount();
                        ucValueCalcComp.s_UnformattedText = "";
                    }
                    if (objAuthorize != null && objAuthorize.User != null)
                        (oCommonUtilities.CreateInstance()).PrintCommonReceipt(false, treasury.TreasuryType, Treasury_No.ToString(), objAuthorize.User);
                    else
                        (oCommonUtilities.CreateInstance()).PrintCommonReceipt(false, treasury.TreasuryType, Treasury_No.ToString());

                    if (((bool)optJackpot.IsChecked) || ((bool)optProgressive.IsChecked))// || ((bool)optHandpay.IsChecked))
                    {
                        //string installationType = installationPathkey.GetValue("InstallationType").ToString();

                        //if (installationType.ToUpper().Equals("EXCHANGECLIENT"))
                        //{
                        //    if (Settings.SendPT10FromClient)
                        //        PostHandpayEvent(treasury);
                        //}
                        //else
                        PostHandpayEvent(treasury);
                    }
                }
                else
                {
                    if (optHandpay.IsChecked == true)
                        MessageBox.ShowBox("MessageID119", BMC_Icon.Error);
                    else if (optJackpot.IsChecked == true)
                        MessageBox.ShowBox("MessageID1191", BMC_Icon.Error);
                    else
                        MessageBox.ShowBox("MessageID1192", BMC_Icon.Error);


                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {

                        AuditModuleName = ModuleName.ManualAttendantPay,
                        Audit_Screen_Name = "PositionDetails|ManualAttendantPay",

                        Audit_Desc = "Manual AttendantPay Type-" + treasury.TreasuryType + " processing was not completed.",
                        AuditOperationType = OperationType.ADD,
                        Audit_Slot = handpay.GetAssetNumber(InstallationNumber)[0].Stock_No
                    });
                }
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
                MessageBox.ShowBox("MessageID119", BMC_Icon.Error);

                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                {

                    AuditModuleName = ModuleName.ManualAttendantPay,
                    Audit_Screen_Name = "PositionDetails|ManualAttendantPay",
                    Audit_Desc = "Manual AttendantPay Type-" + treasury.TreasuryType + " processing was not completed.",
                    AuditOperationType = OperationType.ADD,
                    Audit_Slot = handpay.GetAssetNumber(InstallationNumber)[0].Stock_No
                });
            }
        }
        private void GenerateManulJackpot()
        {
            double amount = 0;
            if (txtBox != null && txtBox.Text.Length > 0)
            {
                double.TryParse(txtBox.Text.ToString(), NumberStyles.Currency, new CultureInfo(ExtensionMethods.CurrentCurrenyCulture), out amount);
            }

            //if (amount > Settings.W2GWinAmount)
            //{
            //    MessageBox.ShowBox("MessageID367", BMC_Icon.Information);
            //    //return;
            //}
            try
            {
                jackpotProcessInfoDTO jpinfo = new jackpotProcessInfoDTO();
                CAuthorize objAuthorize = null;
                string HP_Type = string.Empty;
                Double iAmount = 0;
                if (txtBox != null && txtBox.Text.Length > 0)
                {
                    // Issue fix for ->set cultureinfo='en-US',  currencyculture='it-IT'
                    Double.TryParse(txtBox.Text.ToString(), NumberStyles.Currency, new CultureInfo(ExtensionMethods.CurrentCurrenyCulture), out iAmount);
                }

                if (Settings.Client != null && Settings.Client.ToLower() == "winchells"
               && Settings.MaxHandPayAuthRequired
               && txtBox != null
               && (iAmount > Settings.HandpayPayoutCustomer_Max))
                {
                    objAuthorize = new CAuthorize("CashdeskOperator.Authorize.cs.MaxHandpay");
                    objAuthorize.User = Security.SecurityHelper.CurrentUser;
                    if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.MaxHandpay"))
                    {
                        objAuthorize.ShowDialog();
                        if (!objAuthorize.IsAuthorized)
                            return;
                    }
                    else
                    {
                        objAuthorize.IsAuthorized = true;
                    }
                }
                if (optHandpay.IsChecked == true)
                {
                    HP_Type = "AttendantPay Credit";
                    jpinfo.jackpotTypeId = 4;
                }
                else if (optJackpot.IsChecked == true)
                {
                    HP_Type = "AttendantPay Jackpot";
                    jpinfo.jackpotTypeId = 5;
                }
                else
                {
                    HP_Type = "AttendantPay Progressive";
                    jpinfo.jackpotTypeId = 6;
                }

                // Finding Denom for the machine-CR# 167677

                decimal DenomValue = 0;
                DataSet oDt = handpay.createTickeException_HandpayCAGE(int.Parse((cmbBarPositions.SelectedItem as BarPositions).Bar_Pos_Name), iAmount, 0, HP_Type);
                List<DenomValueResult> lstDenom = handpay.GetDenomValue(oDt.Tables[0].Rows[0]["Asset"].ToString());
                foreach (var denom in lstDenom)
                {
                    DenomValue = denom.Denom;
                }
                jpinfo.Slot = (cmbBarPositions.SelectedItem as BarPositions).Bar_Pos_Name;
                jpinfo.assetConfigNumber = oDt.Tables[0].Rows[0]["Asset"].ToString();
                jpinfo.Denom = DenomValue;
                jpinfo.hpjpAmount = long.Parse(oDt.Tables[0].Rows[0]["TE_VALUE"].ToString());
                jpinfo.jackpotNetAmount = long.Parse(oDt.Tables[0].Rows[0]["TE_VALUE"].ToString());
                jpinfo.sequenceNumber = long.Parse(oDt.Tables[0].Rows[0]["TE_ID"].ToString());
                jpinfo.TransactionDate = oDt.Tables[0].Rows[0]["TE_Date"].ToString();
                jpinfo.UserID = Security.SecurityHelper.CurrentUser.SecurityUserID.ToString();
                jpinfo.siteNo = Settings.SiteName;
                jpinfo.siteId = Convert.ToInt32(Settings.SiteCode);
                txtBox.Text = this.DefaultAmount();
                handpay.PrintSlip(jpinfo);


                //send PT 10 from client

                Treasury treasury = new Treasury();
                treasury.ActualTreasuryDate = Convert.ToDateTime(jpinfo.TransactionDate);
                treasury.Asset = Asset;
                treasury.Authorized_Date = Convert.ToDateTime(jpinfo.TransactionDate);
                treasury.AuthorizedUser_No = SecurityHelper.CurrentUser.User_No;                
                treasury.CustomerID = SecurityHelper.CurrentUser.User_No;                
                treasury.InstallationNumber = InstallationNumber;
                treasury.TreasuryAmount = iAmount;
                treasury.UserID = SecurityHelper.CurrentUser.User_No;                
                treasury.TreasuryType = HP_Type;

                if (((bool)optJackpot.IsChecked) || ((bool)optProgressive.IsChecked) )//|| ((bool)optHandpay.IsChecked))
                {
                    PostHandpayEvent(treasury);
                }
            }
            catch (Exception Ex)
            {

                ExceptionManager.Publish(Ex);
            }

        }
        private void ProcessHandpay(bool IsVoid)
        {
            Window Owner;
            double amount = 0;
            CAuthorize objAuthorize = null;
            Treasury treasury = null;
            int AuthUserID = 0;
            try
            {
                //
                if (!IsHandpayVoid)
                {
                    if ((lstHandpay.SelectedItem as FillTreasuryList).Amount != null && (double)(lstHandpay.SelectedItem as FillTreasuryList).Amount > 0)
                    {
                        //double.TryParse((lstHandpay.SelectedItem as FillTreasuryList).Amount.ToString(), NumberStyles.Currency, new CultureInfo(ExtensionMethods.CurrentCurrenyCulture), out amount);
                        //------->
                        // Issue fix for ->In ITALY environment if user currency setting is set as italy then while processing handpay amount 
                        // of 99,36 customer information screen is displaying. (If we set user currency setting as US or UK then 
                        // we are able to process handpays properly)
                        //<--------
                        double.TryParse((lstHandpay.SelectedItem as FillTreasuryList).Amount.ToString(), out amount);
                    }

                    if (Settings.W2GMessage)
                    {
                        if (amount > Settings.W2GWinAmount)
                        {
                            MessageBox.ShowBox("MessageID367", BMC_Icon.Information);
                            if (!Settings.ProcessW2GAmount)
                            {
                                MessageBox.ShowBox("MessageID531", BMC_Icon.Information);
                                IsProcessed = true;
                                return;
                            }
                        }
                    }
                    AuthUserID = Security.SecurityHelper.CurrentUser.User_No;

                    if (Settings.Client != null && Settings.Client.ToLower() == "winchells"
                        && Settings.MaxHandPayAuthRequired
                        && (lstHandpay.SelectedItem as FillTreasuryList).Amount != null
                        && (amount > Settings.HandpayPayoutCustomer_Max))
                    {
                        objAuthorize = new CAuthorize("CashdeskOperator.Authorize.cs.MaxHandpay");
                        objAuthorize.User = Security.SecurityHelper.CurrentUser;
                        if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.MaxHandpay"))
                        {
                            objAuthorize.ShowDialog();
                            if (!objAuthorize.IsAuthorized)
                                return;

                            else
                            {
                                AuthUserID = handpay.GetUserID(objAuthorize.User.SecurityUserID);

                            }
                        }
                        else
                        {
                            objAuthorize.IsAuthorized = true;
                        }
                    }

                    if (Settings.RegulatoryEnabled == true && Settings.RegulatoryType == "AAMS")
                    {
                        if ((lstHandpay.SelectedItem as FillTreasuryList).Amount != null)
                        {
                            Custid = 0;
                            ProcessCancelled = false;
                            if (amount >= Settings.HandpayPayoutCustomer_Min && amount <= Settings.HandpayPayoutCustomer_Max)
                            {
                                oCustomerDetails = new BMC.Presentation.POS.Views.CustomerDetails();
                                oCustomerDetails.delCustomerUpdated += new BMC.Presentation.POS.Views.CustomerDetails.CustomerUpdateHandler(delCustomerUpdated);
                                oCustomerDetails.delCustomerCancelled += new BMC.Presentation.POS.Views.CustomerDetails.CustomerCancelHandler(delCustomerCancelled);
                                Owner = Window.GetWindow(this);
                                oCustomerDetails.ShowDialog();
                            }
                            else if (amount >= Settings.HandpayPayoutCustomer_BankAccNo)
                            {
                                oCustomerDetails = new BMC.Presentation.POS.Views.CustomerDetails(true);
                                oCustomerDetails.delCustomerUpdated += new BMC.Presentation.POS.Views.CustomerDetails.CustomerUpdateHandler(delCustomerUpdated);
                                oCustomerDetails.delCustomerCancelled += new BMC.Presentation.POS.Views.CustomerDetails.CustomerCancelHandler(delCustomerCancelled);
                                Owner = Window.GetWindow(this);
                                oCustomerDetails.ShowDialog();
                            }
                            else if (amount >= Settings.HandpayPayoutCustomer_Max && amount <= Settings.HandpayPayoutCustomer_BankAccNo)
                            {
                                oCustomerDetails = new BMC.Presentation.POS.Views.CustomerDetails();
                                oCustomerDetails.delCustomerUpdated += new BMC.Presentation.POS.Views.CustomerDetails.CustomerUpdateHandler(delCustomerUpdated);
                                oCustomerDetails.delCustomerCancelled += new BMC.Presentation.POS.Views.CustomerDetails.CustomerCancelHandler(delCustomerCancelled);
                                Owner = Window.GetWindow(this);
                                oCustomerDetails.ShowDialog();
                            }
                        }
                        if (ProcessCancelled)
                            return;
                    }
                }

                int TE_ID = (lstHandpay.SelectedItem as FillTreasuryList).TE_ID;
                treasury = new Treasury
                {
                    InstallationNumber =
                        (lstHandpay.SelectedItem as FillTreasuryList).Installation_No,
                    TreasuryType = (lstHandpay.SelectedItem as FillTreasuryList).HP_Type,
                    TreasuryAmount = (double)(lstHandpay.SelectedItem as FillTreasuryList).Amount,
                    TreasuryTemp = IsVoid ? true : false,
                    ActualTreasuryDate =
                        (DateTime)((lstHandpay.SelectedItem as FillTreasuryList).TreasuryDate)
                };
                treasury.CustomerID = Custid;
                treasury.UserID = AuthUserID;
                treasury.Authorized_Date = DateTime.Now.DBMinValue();

                if (objAuthorize != null && objAuthorize.IsAuthorized)
                {
                    treasury.AuthorizedUser_No = objAuthorize.User.SecurityUserID;
                    treasury.Authorized_Date = DateTime.Now;

                    //Audit for authorization
                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {

                        AuditModuleName = ModuleName.ManualAttendantPay,
                        Audit_Screen_Name = "PositionDetails|ManualAttendantPay",
                        Audit_Desc = "Manual AttendantPay Type-" + treasury.TreasuryType,
                        AuditOperationType = OperationType.ADD,
                        Audit_Field = "AuthorizedUser_No",
                        Audit_New_Vl = objAuthorize.User.SecurityUserID.ToString(),
                        Audit_Slot = (lstHandpay.SelectedItem as FillTreasuryList).Asset
                    });

                }
                Treasury_No = handpay.ProcessHandPay(treasury, TE_ID);

                if (Treasury_No > 0)
                {
                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {

                        AuditModuleName = ModuleName.AttendantPay,
                        Audit_Screen_Name = "PositionDetails|AttendantPay",
                        Audit_Desc = "AttendantPay Type-" + treasury.TreasuryType,
                        AuditOperationType = OperationType.ADD,
                        Audit_Field = "Treasury Amount",
                        Audit_New_Vl = String.Format("{0:0.00}", treasury.TreasuryAmount),
                        Audit_Slot = (lstHandpay.SelectedItem as FillTreasuryList).Asset
                    });

                    txtAmount.Text = "";

                    if ((bool)(lstHandpay.SelectedItem as FillTreasuryList).HP_Uncleared)
                    {
                        //LogManager.WriteLog("Executing Path : " + BMCRegistryHelper.GetRegLocalMachine().OpenSubKey("Software\\Honeyframe").GetValue("InstallationPath").ToString().Trim() + Common.ConfigurationManagement.ConfigManager.Read(
                        //            "HandpayCommandLinePrompt") + " ClearHandpay " + (lstHandpay.SelectedItem as FillTreasuryList).Datapak_No, LogManager.enumLogLevel.Info);



                        //System.Diagnostics.Process.Start(BMCRegistryHelper.GetRegLocalMachine().OpenSubKey("Software\\Honeyframe").GetValue("InstallationPath").ToString().Trim() + Common.ConfigurationManagement.ConfigManager.Read(
                        //            "HandpayCommandLinePrompt"), " ClearHandpay " + (lstHandpay.SelectedItem as FillTreasuryList).Datapak_No);

                        //var proc = new System.Diagnostics.Process
                        //{
                        //    StartInfo =
                        //    {
                        //        FileName =
                        //            Environment.CurrentDirectory + "\\" + Common.ConfigurationManagement.ConfigManager.Read(
                        //            "HandpayCommandLinePrompt"),
                        //        Arguments =
                        //            "ClearHandpay "+ (lstHandpay.SelectedItem as FillTreasuryList).Datapak_No
                        //    }
                        //};
                        //proc.Start();
                    }

                    if (!IsVoid)
                    {

                        #region GCD
                        if (Settings.IsGloryCDEnabled && Settings.CashDispenserEnabled)
                        {
                            LoadingWindow ld = new LoadingWindow(this, ModuleName.AttendantPay, Treasury_No.ToString(), sPos, Convert.ToInt32(treasury.TreasuryAmount * 100));
                            ld.Topmost = true;
                            ld.ShowDialog();
                            Result res = ld.Result;
                            if (res.IsSuccess && (Treasury_No > 0))
                            {
                                LogManager.WriteLog(string.Format("Cash Dispensed Successfully - Treasury Amount: {0:0.00}", treasury.TreasuryAmount), LogManager.enumLogLevel.Info);
                                LogManager.WriteLog("Export HandPay Details to Enterprise", LogManager.enumLogLevel.Info);
                                handpay.ExportHandPay(Treasury_No);

                                BMC.Presentation.MessageBox.ShowBox(res.error.Message, res.error.MessageType.Equals("Error") ? BMC_Icon.Error : BMC_Icon.Information, true);
                                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                {

                                    AuditModuleName = ModuleName.AttendantPay,
                                    Audit_Screen_Name = "PositionDetails|AttendantPay|HandPay",
                                    Audit_Desc = "HandPay Succeed",
                                    AuditOperationType = OperationType.ADD,
                                    Audit_Old_Vl = "Ticket_ExceptionID:" + TE_ID + ";TreasuryNo:" + Treasury_No + ";",

                                });

                            }
                            else
                            {
                                BMC.Presentation.MessageBox.ShowBox(res.error.Message, res.error.MessageType.Equals("Error") ? BMC_Icon.Error : BMC_Icon.Information, true);
                                LogManager.WriteLog(string.Format("Unable to Dispense Cash - Treasury Amount: {0:0.00}", treasury.TreasuryAmount), LogManager.enumLogLevel.Info);
                                LogManager.WriteLog("Rollback HandPay Process", LogManager.enumLogLevel.Info);
                                handpay.RollbackHandPay(TE_ID, Treasury_No);
                                MessageBox.ShowBox("MessageID117", BMC_Icon.Error);
                                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                {

                                    AuditModuleName = ModuleName.AttendantPay,
                                    Audit_Screen_Name = "PositionDetails|AttendantPay",
                                    Audit_Desc = treasury.TreasuryType + " processing was not completed.",
                                    AuditOperationType = OperationType.ADD,
                                    Audit_Slot = (lstHandpay.SelectedItem as FillTreasuryList).Asset
                                });
                                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                {
                                    AuditModuleName = ModuleName.AttendantPay,
                                    Audit_Screen_Name = "PositionDetails|AttendantPay|HandPay Process Failed",
                                    Audit_Desc = "Rollback HandPay Process Voucher due to cash dispenser error",
                                    AuditOperationType = OperationType.MODIFY,
                                    Audit_Old_Vl = "Ticket_ExceptionID:" + TE_ID + ";TreasuryNo:" + Treasury_No + ";"
                                });
                            }
                        }
                        else
                        {
                            this.ProcessCashDispense("AttendantPay Type", treasury.TreasuryType, Convert.ToDecimal(treasury.TreasuryAmount));
                            MessageBox.ShowBox("MessageID116", BMC_Icon.Information);
                        }
                        #endregion

                        FillTreasury(sPos);
                        Helper_classes.Common.BindListView(treasuryList, lstHandpay);

                        //Newly Added - Venkatesh Kumar - SGVI

                        if (AppSettings.IsReceiptRequired)
                        {
                            if (objAuthorize != null && objAuthorize.User != null)
                                (oCommonUtilities.CreateInstance()).PrintCommonReceipt(false, treasury.TreasuryType, Treasury_No.ToString(), objAuthorize.User);
                            else
                                (oCommonUtilities.CreateInstance()).PrintCommonReceipt(false, treasury.TreasuryType, Treasury_No.ToString());
                        }

                        //---------************---------------

                        LogManager.WriteLog("Binding of Hand Pay completed for the pos : " + sPos, LogManager.enumLogLevel.Info);
                    }
                }
                else
                {

                    switch (Treasury_No)
                    {

                        case -2://LockExists
                        case -3://LockError
                            {
                                MessageBox.ShowBox("MessageID373", BMC_Icon.Error);

                                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                {

                                    AuditModuleName = ModuleName.AttendantPay,
                                    Audit_Screen_Name = "PositionDetails|AttendantPay",
                                    Audit_Desc = treasury.TreasuryType + " has been locked by another user for processing.",
                                    AuditOperationType = OperationType.ADD,
                                    Audit_Slot = (lstHandpay.SelectedItem as FillTreasuryList).Asset
                                });

                                break;
                            }
                        case -4://DatabaseError
                            {
                                MessageBox.ShowBox("MessageID374", BMC_Icon.Error);

                                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                {

                                    AuditModuleName = ModuleName.AttendantPay,
                                    Audit_Screen_Name = "PositionDetails|AttendantPay",
                                    Audit_Desc = treasury.TreasuryType + " -Unable to Access the database.",
                                    AuditOperationType = OperationType.ADD,
                                    Audit_Slot = (lstHandpay.SelectedItem as FillTreasuryList).Asset
                                });
                                break;
                            }
                        default:
                            {
                                MessageBox.ShowBox("MessageID117", BMC_Icon.Error);

                                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                {

                                    AuditModuleName = ModuleName.AttendantPay,
                                    Audit_Screen_Name = "PositionDetails|AttendantPay",
                                    Audit_Desc = treasury.TreasuryType + " processing was not completed.",
                                    AuditOperationType = OperationType.ADD,
                                    Audit_Slot = (lstHandpay.SelectedItem as FillTreasuryList).Asset
                                });
                                break;
                            }
                    }


                }
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
                MessageBox.ShowBox("MessageID117", BMC_Icon.Error);

                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                {

                    AuditModuleName = ModuleName.AttendantPay,
                    Audit_Screen_Name = "PositionDetails|AttendantPay",
                    Audit_Desc = treasury.TreasuryType + " processing was not completed.",
                    AuditOperationType = OperationType.ADD,
                    Audit_Slot = handpay.GetAssetNumber(InstallationNumber)[0].Stock_No
                });
            }
            finally
            {
                IsHandpayVoid = false;
            }
        }
        private void btnGenerateSlipNo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int Auth_User_ID = 0;
                if (lstHandpay.Items.Count > 0)
                {
                    LogManager.WriteLog("Generating Slip", LogManager.enumLogLevel.Debug);
                    if (Clearhandpay(Convert.ToInt32((lstHandpay.SelectedItem as FillTreasuryList).Installation_No)))
                    {
                        jackpotProcessInfoDTO jpinfo = new jackpotProcessInfoDTO();
                        CAuthorize objAuthorize = null;
                        int TE_ID = (lstHandpay.SelectedItem as FillTreasuryList).TE_ID;
                        Treasury treasury = new Treasury
                        {
                            InstallationNumber =
                                (lstHandpay.SelectedItem as FillTreasuryList).Installation_No,
                            TreasuryType = (lstHandpay.SelectedItem as FillTreasuryList).HP_Type,
                            TreasuryAmount = (double)(lstHandpay.SelectedItem as FillTreasuryList).Amount,
                            TreasuryTemp = false,
                            ActualTreasuryDate =
                                (DateTime)((lstHandpay.SelectedItem as FillTreasuryList).TreasuryDate)
                        };
                        Auth_User_ID = Security.SecurityHelper.CurrentUser.User_No;

                        if (treasury.TreasuryAmount > Settings.HandpayPayoutCustomer_Max)
                        {
                            objAuthorize = new CAuthorize("CashdeskOperator.Authorize.cs.MaxHandpay");
                            objAuthorize.User = Security.SecurityHelper.CurrentUser;
                            if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.MaxHandpay"))
                            {
                                objAuthorize.ShowDialog();
                                if (!objAuthorize.IsAuthorized)
                                    return;
                                else
                                    Auth_User_ID = handpay.GetUserID(objAuthorize.User.SecurityUserID);
                            }
                            else
                            {
                                objAuthorize.IsAuthorized = true;
                            }
                        }
                        treasury.CustomerID = Custid;
                        treasury.UserID = Auth_User_ID;
                        treasury.Authorized_Date = DateTime.Now.DBMinValue();
                        jpinfo.Slot = (lstHandpay.SelectedItem as FillTreasuryList).Pos;
                        jpinfo.assetConfigNumber = (lstHandpay.SelectedItem as FillTreasuryList).Asset;
                        jpinfo.Denom = 0.01M;
                        jpinfo.hpjpAmount = Convert.ToInt32((lstHandpay.SelectedItem as FillTreasuryList).Amount * 100);
                        jpinfo.jackpotNetAmount = Convert.ToInt32((lstHandpay.SelectedItem as FillTreasuryList).Amount);
                        jpinfo.jackpotTypeId = (lstHandpay.SelectedItem as FillTreasuryList).HP_Type.ToLower() == "attendantpay Credit" ? Convert.ToInt16(1) :
                            (lstHandpay.SelectedItem as FillTreasuryList).HP_Type.ToLower() == "attendantpay jackpot" ? Convert.ToInt16(2) :
                              (lstHandpay.SelectedItem as FillTreasuryList).HP_Type.ToLower() == "progressive" ? Convert.ToInt16(3) : Convert.ToInt16(1);



                        jpinfo.sequenceNumber = (lstHandpay.SelectedItem as FillTreasuryList).TE_ID;
                        jpinfo.TransactionDate = (lstHandpay.SelectedItem as FillTreasuryList).TreasuryDate.ToString();
                        jpinfo.UserID = Security.SecurityHelper.CurrentUser.SecurityUserID.ToString();
                        jpinfo.siteNo = Settings.SiteName;
                        jpinfo.siteId = Convert.ToInt32(Settings.SiteCode);

                        handpay.PrintSlip(jpinfo);
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID382", BMC_Icon.Information);
                    }

                }
                else
                    MessageBox.ShowBox("MessageID383", BMC_Icon.Information);
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
            }
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cboProfitShareGroup.SelectedIndex <= 0)
                {
                    MessageBox.ShowBox("MessageID490", BMC_Icon.Information);
                    return;
                }

                decimal FixedExpenseAmount = (Convert.ToDecimal(txtExpenseShareAmount.Text) * (Convert.ToDecimal(((ExpenseShareGroup)cboExpenseShareGroup.SelectedItem).ExpenseSharePercentage) / 100));
                decimal dTotal = Convert.ToDecimal(FixedExpenseAmount) + Convert.ToDecimal(txtCarriedForwardAmount.Text);
                if (Math.Round(Convert.ToDecimal(txtWriteOffExpense.Text), 2, MidpointRounding.AwayFromZero) > (Math.Round(FixedExpenseAmount, 2) + Math.Round(Convert.ToDecimal(txtCarriedForwardAmount.Text), 2, MidpointRounding.AwayFromZero)))
                {
                    CAuthorize oCAuthorize = new CAuthorize("BMC.Presentation.CProfitShare.ProfitShareApprover");
                    oCAuthorize.ShowDialog();
                    if (!oCAuthorize.IsAuthorized)
                        return;
                    //string strMsg = Application.Current.FindResource("MessageID890").ToString().Replace("@@@@", Convert.ToDecimal(txtWriteOffExpense.Text).ToString("#,##0.00")).Replace("****", dTotal.ToString("#,##0.00"));
                    //MessageBox.ShowBox(strMsg, BMC_Icon.Error, true);
                }
                objCommonLiquidation.ProfitShareGroupId = Convert.ToInt32(cboProfitShareGroup.SelectedValue);
                objCommonLiquidation.ExpenseShareGroupID = Convert.ToInt32(cboExpenseShareGroup.SelectedValue);
                objCommonLiquidation.ExpenseShareAmount = Convert.ToDecimal(txtExpenseShareAmount.Text);
                objCommonLiquidation.WriteOffAmount = Convert.ToDecimal(txtWriteOffExpense.Text);
                objCommonLiquidation.PayPeriodId = objPayPeriods == null ? 0 : objPayPeriods.Calendar_Period_ID;
                objCommonLiquidation.Percentage_Setting = Convert.ToDecimal(((ProfitShareGroup)cboProfitShareGroup.SelectedItem).ProfitSharePercentage);
                objCommonLiquidation.ExpenseSharePercentage = Convert.ToDecimal(((ExpenseShareGroup)cboExpenseShareGroup.SelectedItem).ExpenseSharePercentage);
                this.Close();
            }

            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
Ejemplo n.º 10
0
        private void btnMainain_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CMachineMaintenance objMachineMaintenance = new CMachineMaintenance();

                //Start
                if (btnMainain.Content == FindResource("CMachineMaintenanceView_xaml_btnMainain"))
                {
                    if (MessageBox.ShowBox("MessageID256", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }

                    if (objMachineMaintenance.ManageMaintenance(installationNo, 0, Security.SecurityHelper.CurrentUser.SecurityUserID) > 0)
                    {
                        MessageBox.ShowBox("MessageID339", BMC_Icon.Information, BMC_Button.OK);

                        PopulateSession();
                        if (txtOpenSession.Tag != null)
                        {
                            PopulateEvents((int)txtOpenSession.Tag);
                        }
                        return;
                    }

                    //LogManager.WriteLog("Executing Path : " + BMCRegistryHelper.GetRegKeyValue(string.Empty,"InstallationPath").ToString().Trim()  + Common.ConfigurationManagement.ConfigManager.Read(
                    //                "HandpayCommandLinePrompt") + " DisableMachine " + installationNo, LogManager.enumLogLevel.Info);



                    //System.Diagnostics.Process.Start(BMCRegistryHelper.GetRegKeyValue(string.Empty, "InstallationPath").ToString().Trim().ToString().Trim() + Common.ConfigurationManagement.ConfigManager.Read(
                    //            "HandpayCommandLinePrompt"), " DisableMachine " + installationNo);

                    LogManager.WriteLog("Executing Path : " + Path.Combine(Extensions.GetStartupDirectory(), Common.ConfigurationManagement.ConfigManager.Read(
                                                                               "HandpayCommandLinePrompt")) + " DisableMachine " + installationNo, LogManager.enumLogLevel.Info);

                    System.Diagnostics.Process.Start(Path.Combine(Extensions.GetStartupDirectory(), Common.ConfigurationManagement.ConfigManager.Read(
                                                                      "HandpayCommandLinePrompt")), " DisableMachine " + installationNo);


                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {
                        AuditModuleName    = ModuleName.MachineMaintenance,
                        Audit_Screen_Name  = "Machine Maintenance View",
                        Audit_Desc         = "Start Maintenance - Installation No: " + installationNo.ToString(),
                        AuditOperationType = OperationType.MODIFY,
                    });

                    MessageBox.ShowBox("MessageID309", BMC_Icon.Information, BMC_Button.OK);
                }
                else//Close
                {
                    int iMachineEventStatus = objMachineMaintenance.CheckMachineMaintenance(installationNo);
                    if (iMachineEventStatus < 0)
                    {
                        if (MessageBox.ShowBox("MessageID304", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                        {
                            return;
                        }
                        CAuthorize objAuthorize = new CAuthorize("CashdeskOperator.Authorize.cs.OverrideEvents");
                        objAuthorize.User = Security.SecurityHelper.CurrentUser;
                        if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.OverrideEvents"))
                        {
                            objAuthorize.ShowDialog();
                            if (!objAuthorize.IsAuthorized)
                            {
                                return;
                            }
                        }
                        else
                        {
                            objAuthorize.IsAuthorized = true;
                        }
                    }

                    if (MessageBox.ShowBox("MessageID257", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }

                    var objReasonCategory = new CReasonCategory();
                    objReasonCategory.ShowDialog();

                    if (objReasonCategory.MaintenanceReasonCategory != null && objReasonCategory.MaintenanceReasonCategory.Length > 0)
                    {
                        objMachineMaintenance.CloseMaintenance(installationNo, Security.SecurityHelper.CurrentUser.SecurityUserID,
                                                               objReasonCategory.MaintenanceReasonCategory);



                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = ModuleName.MachineMaintenance,
                            Audit_Screen_Name  = "Machine Maintenance View",
                            Audit_Desc         = "Close Maintenance - Installation No: " + installationNo.ToString(),
                            AuditOperationType = OperationType.MODIFY,
                        });

                        MessageBox.ShowBox("MessageID310", BMC_Icon.Information, BMC_Button.OK);
                    }
                    else
                    {
                        return;
                    }
                }
                PopulateSession();
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void btnVerify_Click(object sender, RoutedEventArgs e)
        {
            try
            {

                string ticketNumber = this.ucValueCalc.txtDisplay.Text.Trim();

                //check if ticketstring is numeric
                double Num;
                bool isNum = double.TryParse(ticketNumber, out Num);

                
                btnVerify.IsEnabled = false;

                if (isNum && (ticketNumber.IndexOf('.') < 0) && this.ucValueCalc.txtDisplay.Text.Trim().Length > 0)
                {
                    ExceptionVoucher objExceptionVoucher = new ExceptionVoucher();
                    

                    this.txtStatus.Visibility = Visibility.Visible;
                    this.txtStatus.Text = Application.Current.FindResource("MessageID401") as string;


                    //LogManager.WriteLog("Checking Voucher:" + ticketNumber+" is PP Ticket", LogManager.enumLogLevel.Info);
                    if (objExceptionVoucher.IsExceptionVoucher(ticketNumber) == 1)
                    {
                        
                        this.txtStatus.Text = Application.Current.FindResource("MessageID221") as string;

                        
                        if (MessageBox.ShowBox("MessageID395", BMC_Icon.Warning, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            disptimerRedeem.IsEnabled = true;
                            disptimerRedeem.Start();

                            //******Check for user access rights.
                            CAuthorize objAuthorize = null;
                            objAuthorize = new CAuthorize("BMC.Presentation.CPpTicket");
                            objAuthorize.User = Security.SecurityHelper.CurrentUser;
                            if (!Security.SecurityHelper.HasAccess("BMC.Presentation.CPpTicket"))
                            {
                                objAuthorize.ShowDialog();
                                if (!objAuthorize.IsAuthorized)
                                {
                                    ClearAll();
                                    return;
                                }
                            }
                            else
                            {
                                objAuthorize.IsAuthorized = true;
                            }

                            //Go ahead and Mark the ticket as active
                            if (objExceptionVoucher.MarkExceptionVoucherActive(ticketNumber) == -1)
                            {
                                //Unsuccessfull in Activating PP ticket :(
                                //LogManager.WriteLog("Unsuccessfull in Activating PP Voucher:" + ticketNumber + "!!!", LogManager.enumLogLevel.Info);                                
                                MessageBox.ShowBox("MessageID397", BMC_Icon.Error, BMC_Button.OK);
                            }
                            else
                            {
                                //Success in Activating PP ticket! :)
                                //LogManager.WriteLog("Success in Activating PP Voucher:" + ticketNumber + "!!!", LogManager.enumLogLevel.Info);                                
                                disptimerRedeem.Stop();
                                this.txtStatus.Text = Application.Current.FindResource("MessageID402") as string;
                                MessageBox.ShowBox("MessageID396", BMC_Icon.Information, BMC_Button.OK);

                                //****Audit code***
                                #region "Audit log for PP ticket"

                                if (objAuthorize != null && objAuthorize.IsAuthorized)
                                {
                                    // Modified description, removed field & new value for Exception Voucher
                                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                    {
                                        AuditModuleName = ModuleName.Exception_Voucher,
                                        Audit_Screen_Name = "Exception Voucher",
                                        Audit_Desc = "Voucher Number - " + ticketNumber + " activated by " + objAuthorize.User.DisplayName,
                                        AuditOperationType = OperationType.MODIFY,
                                    });
                                }
                                #endregion

                            }

                            disptimerRedeem.Stop();
                            this.txtStatus.Visibility = Visibility.Hidden;

                        }
                        else
                        {
                            disptimerRedeem.Stop();
                            this.txtStatus.Visibility = Visibility.Hidden;
                        }

                    }
                    else // you will enter here if its not an exception voucher 
                    {
                        disptimerRedeem.Start();
                        this.txtStatus.Text = Application.Current.FindResource("MessageID398") as string;
                        MessageBox.ShowBox("MessageID399", BMC_Icon.Information, BMC_Button.OK, ticketNumber);
                        
                        this.ucValueCalc.txtDisplay.Focus();
                        disptimerRedeem.Stop();
                        this.txtStatus.Visibility = Visibility.Hidden;
                    }
                    

                }//  Outer most IF ends here
                else // enter here if Voucher number has anything other than numerals
                {                    
                    if (ticketNumber.Length > 0)//Show message only if there is something in the textbox
                    {
                        disptimerRedeem.Start();
                        this.txtStatus.Text = Application.Current.FindResource("MessageID403") as string;
                        MessageBox.ShowBox("MessageID400", BMC_Icon.Error, BMC_Button.OK);
                        this.ucValueCalc.txtDisplay.Focus();
                        disptimerRedeem.Stop();
                    }                    
                    this.txtStatus.Visibility = Visibility.Hidden;
                }
                

            }//try ends here
            

            catch (Exception ex)
            {
                BMC.Common.ExceptionManagement.ExceptionManager.Publish(ex);
            }
            finally
            {
                ClearAll();
                btnVerify.IsEnabled = true;
            }
        }