示例#1
0
        public int ProcessHandPay(Treasury Treasury, int TE_ID)
        {
            LockHandler Lock = new LockHandler();

            int SPResult = TE_ID==0 ? 0: Lock.InsertLockRecord(0, Dns.GetHostName(), "ATTENDANTPAY", "TE_ID", TE_ID.ToString());
            int ReturnValue = -1;

            switch (SPResult)
            {
                case 0: ReturnValue= handPay.ProcessHandpay(Treasury, TE_ID);
                    if (TE_ID == 0) return ReturnValue;
                    break;
                case 1:
                    ReturnValue = -2;//LockExists
                    return ReturnValue;
                case 2:
                    ReturnValue = -3;//LockError
                    return ReturnValue;
                default:
                    ReturnValue = -4;//DatabaseError
                    return ReturnValue;

            }
            Lock.DeleteLockRecord(0, Dns.GetHostName(), "ATTENDANTPAY", "TE_ID", TE_ID.ToString());
            return ReturnValue;
                        
            
        }
        /// <summary>
        /// Save Handpay, short pay details in Treasury Table
        /// </summary>
        /// <param name="objTreasury">Treasuries</param>
        /// <returns >int</returns>
        public int SaveTreasuryDetails(Treasury objTreasury)
        {
            try
            {
                SqlParameter[] ObjParams = new SqlParameter[22];
                ObjParams[0] = new SqlParameter(DBConstants.CONST_PARAM_INSTALLATION_NO, objTreasury.InstallationNumber);
                ObjParams[1] = new SqlParameter(DBConstants.CONST_PARAM_COLLECTION_NO, objTreasury.CollectionNumber);
                ObjParams[2] = new SqlParameter(DBConstants.CONST_PARAM_USER_ID, objTreasury.UserID);
                ObjParams[3] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_TYPE, objTreasury.TreasuryType);
                ObjParams[4] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_REASON, objTreasury.TreasuryReason);
                ObjParams[5] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_BREAKDOWN_2P, objTreasury.TreasuryBreakdown2p);
                ObjParams[6] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_BREAKDOWN_5P, objTreasury.TreasuryBreakdown5p);
                ObjParams[7] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_BREAKDOWN_10P, objTreasury.TreasuryBreakdown10p);
                ObjParams[8] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_BREAKDOWN_20P, objTreasury.TreasuryBreakdown20p);
                ObjParams[9] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_BREAKDOWN_50P, objTreasury.TreasuryBreakdown50p);
                ObjParams[10] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_BREAKDOWN_100P, objTreasury.TreasuryBreakdown100p);
                ObjParams[11] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_BREAKDOWN_200P, objTreasury.TreasuryBreakdown200p);
                ObjParams[12] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_AMOUNT, objTreasury.TreasuryAmount);
                ObjParams[13] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_ALLOCATED, objTreasury.TreasuryAllocated);
                ObjParams[14] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_MEMBERSHIP_NO, objTreasury.TreasuryMembershipNo);
                ObjParams[15] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_REASON_CODE, objTreasury.TreasuryReasonCode);
                ObjParams[16] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_ISSUER_USER_NO, objTreasury.TreasuryIssuerUserNo);
                ObjParams[17] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_TEMP, objTreasury.TreasuryTemp);
                ObjParams[18] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_FLOATISSUEDBY, objTreasury.TreasuryFloatIssuedBy);
                ObjParams[19] = new SqlParameter("@AuthorizedUser_No", objTreasury.AuthorizedUser_No);
                ObjParams[20] = new SqlParameter("@Authorized_Date", objTreasury.Authorized_Date);
                ObjParams[21] = new SqlParameter(DBConstants.CONST_PARAM_TREASURY_NUMBER, 0);
                ObjParams[21].Direction = ParameterDirection.Output;

                SqlHelper.ExecuteNonQuery(CommonDataAccess.ExchangeConnectionString, CommandType.StoredProcedure, DBConstants.CONST_SP_SAVE_TREASURY_PROC, ObjParams);
                return (int.Parse(ObjParams[21].Value.ToString()));
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                return -1;
            }
        }
        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);
            }
        }
示例#4
0
        //
        public int ProcessHandpay(Treasury Treasury, int TE_ID)
        {
            //return handpayDataAccess.SaveTreasuryDetails(Treasury);
            int? Treasury_No = 0;
            int result;
            int IsManualAttendantPay = TE_ID == 0 ? 1 : 0;
            int? IsExport = 0;
            try
            {

                if (Settings.IsGloryCDEnabled && Settings.CashDispenserEnabled)
                {
                    IsExport = 1;
                }
            }
            catch (Exception Ex)
            {
                Exception exc = new Exception("Config IsGloryCDEnabled not found");
                ExceptionManager.Publish(exc);
            }
            ///Param IsExport: if 1-default; 0-Can't Export to Enterprise*/
            try
            {
                result = linqDB.InsertTreasury(Treasury.InstallationNumber, 0, Treasury.UserID, Treasury.TreasuryType,
                    Treasury.TreasuryReason, Convert.ToDecimal(Treasury.TreasuryAmount), false, "0", 0, Treasury.UserID, Treasury.TreasuryTemp, 0,
                    Treasury.ActualTreasuryDate, Treasury.CustomerID, Treasury.AuthorizedUser_No, Treasury.Authorized_Date, IsManualAttendantPay, ref Treasury_No, IsExport);

                if (Treasury_No.Value > 0)
                {
                    if (TE_ID > 0)
                        result = linqDB.UpdateFinalStatusTicketException(TE_ID);

                    return Treasury_No.Value;
                }
                else
                    return -1;

            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
                return -1;
            }
        }
示例#5
0
 /// <summary>
 /// saves the manual handpay entries to DB
 /// </summary>
 /// <returns>success or failure</returns>        
 public int ProcessManualHandpay(Treasury Treasury)
 {
     return handpayDataAccess.SaveTreasuryDetails(Treasury);
 }
        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 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);
            }

        }
示例#8
0
 public bool CreateShortPayForApproval(Treasury TreasuryEntity, ref int iShortPayID)
 {
     return shortPay.CreateShortPayForApproval(TreasuryEntity, ref iShortPayID);
 }
        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);
            }
        }
        internal void PostHandpayEvent(Treasury objTreasury)
        {
            try
            {

                List<AssetNumberResult> lstTreasury = handpay.GetAssetNumber(objTreasury.InstallationNumber);

                JackpotEventRequest request = new JackpotEventRequest();

                request.CardNumber = handpay.GetEPIDetails(InstallationNumber);
                request.JackpotAmount = objTreasury.TreasuryAmount * 100;
                request.InstallationNo = InstallationNumber;

                if (App.client != null)
                    App.client.SendToServer(App.clientObj, request);
                else
                    LogManager.WriteLog("CViewHandpay PostHandpayEvent - Connection not set", LogManager.enumLogLevel.Error);
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("PostHandpayEvent" + ex.Message, LogManager.enumLogLevel.Error);
            }
        }
示例#12
0
 public int ProcessHandPay(Treasury Treasury)
 {
     return handPay.ProcessManualHandpay(Treasury);
 }
示例#13
0
 public int SaveShortpayDetails(Treasury TreasuryEntity)
 {
     return shortPayDataAccess.SaveTreasuryDetails(TreasuryEntity);          
 }
        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);
            }
        }
        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;
            }
        }
        private void SaveManualHandpay()
        {
            if (cmbBarPositions.SelectedIndex <= 0)
                return;
            Window Owner;
            double amount = 0;
            int Auth_User_ID = 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);
                }
                Auth_User_ID = 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");
                   Auth_User_ID = Security.SecurityHelper.CurrentUser.User_No;
                    if (!Security.SecurityHelper.HasAccess("CashdeskOperator.Authorize.cs.MaxHandpay"))
                    {
                        objAuthorize.ShowDialogEx(this);
                        if (!objAuthorize.IsAuthorized)
                        {
                            IsProcessed = true;
                            return;
                        }
                        else
                        {
                            Auth_User_ID = 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.ShowDialogEx(this);
                        }
                        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.ShowDialogEx(this);
                        }
                        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.ShowDialogEx(this);
                        }
                    }

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

                List<AssetNumberResult> lstasset = handpay.GetAssetNumber((cmbBarPositions.SelectedItem as BarPositions).Installation_No);

                string Asset = lstasset[0].Stock_No;

                treasury = new Treasury { InstallationNumber = (cmbBarPositions.SelectedItem as BarPositions).Installation_No };

                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 = Security.SecurityHelper.CurrentUser.User_No;               
                treasury.UserID = Auth_User_ID;


                treasury.Authorized_Date = DateTime.MinValue.DBMinValue();
                if (objAuthorize != null && objAuthorize.IsAuthorized)
                {
                    treasury.AuthorizedUser_No = Auth_User_ID;
                    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 = Auth_User_ID.ToString(),
                        Audit_Slot = Asset
                    });

                }

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

                Treasury_No = handpay.ProcessHandPay(treasury, 0);


                IsProcessed = true;
                if (Treasury_No > 0)
                {
                    DateTime dtTreasury = (DateTime)handpay.GetTreasuryDateTime(Treasury_No);

                    TextBlock_11.Text = "#" + (cmbBarPositions.SelectedItem as BarPositions).Bar_Pos_Name + 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(), (cmbBarPositions.SelectedItem as BarPositions).Bar_Pos_Name, Convert.ToInt32(treasury.TreasuryAmount * 100));
                        ld.Topmost = true;
                        ld.ShowDialogEx(this);
                        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 = 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 = Asset
                    });

                    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))
                    {
                        treasury.Asset = Asset;
                        //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 = Asset
                    });
                }
            }
            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 = Asset
                });
            }
        }
示例#17
0
        public int SaveShortpayDetails(Treasury TreasuryEntity)
        {
            return shortPay.SaveShortpayDetails(TreasuryEntity);

        }
        internal void PostHandpayEvent(Treasury objTreasury)
        {
            try
            {

                List<AssetNumberResult> lstTreasury = handpay.GetAssetNumber((cmbBarPositions.SelectedItem as BarPositions).Installation_No);

                JackpotEventRequest request = new JackpotEventRequest();


                request.CardNumber = handpay.GetEPIDetails((cmbBarPositions.SelectedItem as BarPositions).Installation_No);
                request.JackpotAmount = objTreasury.TreasuryAmount * 100;
                request.InstallationNo = (cmbBarPositions.SelectedItem as BarPositions).Installation_No;

                if (App.client != null)
                    App.client.SendToServer(App.clientObj, request);
                else
                    LogManager.WriteLog("CManualAttendantPays PostHandpayEvent - Connection not set", LogManager.enumLogLevel.Error);


            }
            catch (Exception ex)
            {
                LogManager.WriteLog("PostHandpayEvent" + ex.Message, LogManager.enumLogLevel.Error);
            }
        }
        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;
            }
        }
        private void GenerateManulJackpot()
        {

            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.ShowDialogEx(this);
                        if (!objAuthorize.IsAuthorized)
                            return;
                    }
                    else
                    {
                        objAuthorize.IsAuthorized = true;
                    }
                }
                if ((dgHandpay.SelectedItem as FillTreasuryList).HP_Type.ToUpper() == "HANDPAY")
                {
                    HP_Type = "AttendantPay Credit";
                    jpinfo.jackpotTypeId = 4;
                }
                else if ((dgHandpay.SelectedItem as FillTreasuryList).HP_Type.ToUpper() == "JACKPOT")
                {
                    HP_Type = "AttendantPay Jackpot";
                    jpinfo.jackpotTypeId = 5;
                }
                else
                {
                    HP_Type = "AttendantPay Progressive";
                    jpinfo.jackpotTypeId = 6;
                }

                DataSet oDt = handpay.createTickeException_HandpayCAGE(int.Parse(this.BarPosition), iAmount, 0, HP_Type);
                if (Asset.IsNullOrEmpty())
                {
                    Asset = handpay.GetAssetNumber(InstallationNumber)[0].Stock_No;
                }

                jpinfo.Slot = this.BarPosition;
                jpinfo.assetConfigNumber = Asset;
                jpinfo.Denom = 0.01M;
                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 = objAuthorize.User.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 = BMC.Security.SecurityHelper.CurrentUser.User_No;
                treasury.CustomerID = BMC.Security.SecurityHelper.CurrentUser.User_No;
                treasury.InstallationNumber = InstallationNumber;
                treasury.TreasuryAmount = iAmount;

                treasury.UserID = BMC.Security.SecurityHelper.CurrentUser.User_No;
                treasury.TreasuryType = HP_Type;

                PostHandpayEvent(treasury);
            }
            catch (Exception Ex)
            {

                ExceptionManager.Publish(Ex);
            }

        }