public EnrollmentErrorCodes InstallMachine(PositionDetails PosDetails, int userid, out int installationNo)
        {
            LockHandler Lock = new LockHandler();
            EnrollmentErrorCodes ReturnValue;
            installationNo = 0;

            int SPResult = Lock.InsertLockRecord(userid, Dns.GetHostName(), "MACHINEADMIN", "POS", PosDetails.Position);
            switch (SPResult)
            {
                case 0: ReturnValue = enrollment.InstallMachine(PosDetails, out installationNo);

                    break;
                case 1:
                    ReturnValue = EnrollmentErrorCodes.LockExists;
                    break;
                case 2:
                    ReturnValue = EnrollmentErrorCodes.LockError;
                    break;
                default:
                    ReturnValue = EnrollmentErrorCodes.DatabaseError;
                    break;

            }
            Lock.DeleteLockRecord(userid, Dns.GetHostName(), "MACHINEADMIN", "POS", PosDetails.Position);
            return ReturnValue;

            
        }
Beispiel #2
0
        public EnrollmentErrorCodes InstallMachine(PositionDetails PosDetails, int userid, out int installationNo)
        {
            LockHandler          Lock = new LockHandler();
            EnrollmentErrorCodes ReturnValue;

            installationNo = 0;

            int SPResult = Lock.InsertLockRecord(userid, Dns.GetHostName(), "MACHINEADMIN", "POS", PosDetails.Position);

            switch (SPResult)
            {
            case 0: ReturnValue = enrollment.InstallMachine(PosDetails, out installationNo);

                break;

            case 1:
                ReturnValue = EnrollmentErrorCodes.LockExists;
                break;

            case 2:
                ReturnValue = EnrollmentErrorCodes.LockError;
                break;

            default:
                ReturnValue = EnrollmentErrorCodes.DatabaseError;
                break;
            }
            Lock.DeleteLockRecord(userid, Dns.GetHostName(), "MACHINEADMIN", "POS", PosDetails.Position);
            return(ReturnValue);
        }
        public int VoidTransaction(VoidTranCreate VoidTransactionEntity)
        {
            LockHandler Lock = new LockHandler();

            int SPResult = Lock.InsertLockRecord(0, Dns.GetHostName(), "VOID", "TreasuryID", VoidTransactionEntity.TreasuryID.ToString());
            int ReturnValue = -1;

            switch (SPResult)
            {
                case 0: ReturnValue = voidTransaction.VoidCreate(VoidTransactionEntity);
                    
                    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(), "VOID", "TreasuryID", VoidTransactionEntity.TreasuryID.ToString());
            return ReturnValue;
            
            
            
        }
        public int VoidTransaction(VoidTranCreate VoidTransactionEntity)
        {
            LockHandler Lock = new LockHandler();

            int SPResult    = Lock.InsertLockRecord(0, Dns.GetHostName(), "VOID", "TreasuryID", VoidTransactionEntity.TreasuryID.ToString());
            int ReturnValue = -1;

            switch (SPResult)
            {
            case 0: ReturnValue = voidTransaction.VoidCreate(VoidTransactionEntity);

                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(), "VOID", "TreasuryID", VoidTransactionEntity.TreasuryID.ToString());
            return(ReturnValue);
        }
        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;
                        
            
        }
Beispiel #6
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);
        }
        //
        #endregion STM Methods
        //
        #endregion Functionality Methods
        //
        #region Event Methods
        //
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            int iResult = 0;
            LockHandler Lock = new LockHandler();
            //
            try
            {
                MarkSelectedMachines();
                if (TOTAL_SELECTED_MACHINES <= 0)
                {
                    MessageBox.ShowBox(iResult == -1 ? "MessageID378" : "MessageID80", BMC_Icon.Information);
                    return;
                }
                if ((rdoFinalCount.IsChecked == true) && (!AbandonCreditonAutoDrop()))
                {
                    return;
                }
                int m_count = 0;
                StringBuilder strMsg = new StringBuilder();
                foreach (int installation_no in _selectedInstallationNos)
                {
                    if (m_count > 3)
                    {
                        break;
                    }
                    if (!_collectionHelper.IsUndeclaredPartCollection(installation_no))
                    {
                        strMsg.Append(GetStockNo(installation_no) + ",");
                        m_count++;
                    }

                }
                if (strMsg.Length > 0)
                {
                    strMsg = strMsg.Remove(strMsg.Length-1, 1);
                    if (m_count > 3)
                    {
                        strMsg.Append("... ");
                    }
                    MessageBox.ShowBox(System.Windows.Application.Current.FindResource("MessageID82a").ToString().Replace("@@@@@", strMsg.ToString()),BMC_Icon.Information, true);
                    PopulateActiveMachine(true);
                    return;
                }
                //
                iResult = Lock.InsertLockRecord(0, "", "AUTODROP", "START", "START");
                LogManager.WriteLog("AUTODROP Lock Result: " + iResult.ToString(), LogManager.enumLogLevel.Debug);
                if (iResult == 1)
                {
                    MessageBox.ShowBox("MessageID380", BMC_Icon.Error);
                    InitializeAutoDropSession();
                    return;
                }
                //
                StartDropSession();
                //
                InitializeAutoDropSession();
                isADropStarted = true;

            }
            catch (Exception ex)
            {
                EnableDisableAutoDropScreen(true);
                Lock.DeleteLockRecord(0, "", "AUTODROP", "START", "START");
                LogError("btnStart_Click", ex);
                isADropStarted = false;
            }

        }
        private void btnVoid_Click(object sender, RoutedEventArgs e)
        {
            int iVoid;
            int iResult = 0;
            LockHandler Lock = new LockHandler();

            if (lstHandpay.Items.Count > 0)
            {
                if (lstHandpay.SelectedItem != null)
                {
                    sPos = "";
                    sTEid = "";
                    sPos = Convert.ToString((lstHandpay.SelectedItem as FillTreasuryList).Pos);
                    sTEid = Convert.ToString((lstHandpay.SelectedItem as FillTreasuryList).TE_ID);
                    iResult = Lock.InsertLockRecord(0, "", "HANDPAY", "HP", sTEid);
                    //
                    if (iResult == 1)
                    {
                        MessageBox.ShowBox("MessageID380", BMC_Icon.Error);
                        return;
                    }
                    if (MessageBox.ShowBox("MessageID109", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (Clearhandpay(Convert.ToInt32((lstHandpay.SelectedItem as FillTreasuryList).Installation_No)))
                        {
                            IsHandpayVoid = true;
                            ProcessHandpay(true);
                            if (Treasury_No < 0 || Treasury_No == 0)
                                return;
                            iVoid = VoidHandpay();

                            try
                            {

                                string TreasuryDate = (lstHandpay.SelectedItem as FillTreasuryList).TreasuryDate.ToString();
                                string Amount = (lstHandpay.SelectedItem as FillTreasuryList).Amount.ToString();
                                string TreasuryNo = (lstHandpay.SelectedItem as FillTreasuryList).TE_ID.ToString();
                                string TreasuryType = (lstHandpay.SelectedItem as FillTreasuryList).HP_Type;
                                string amount = BMC.Business.CashDeskOperator.CommonUtilities.GetCurrency(Convert.ToDouble(Amount));
                                string Position = (lstHandpay.SelectedItem as FillTreasuryList).Pos.ToString();

                                Asset = (lstHandpay.SelectedItem as FillTreasuryList).Asset.ToString();
                                VoidAmount = (lstHandpay.SelectedItem as FillTreasuryList).Amount;

                                if (iVoid > 0)
                                {
                                    MessageBox.ShowBox("MessageID110", BMC_Icon.Information);
                                    if (!Settings.CAGE_ENABLED)
                                    {
                                        oCommonUtilities objCommUtil = oCommonUtilities.CreateInstance();

                                        objCommUtil.PrintCommonReceipt(true, TreasuryType, iVoid.ToString());
                                    }
                                    // Already handled in the CAGE Printslip

                                    // Newly Added - Venkatesh Kumart.J - SGVI Requirements

                                    ////if (VoidAmount> Settings.W2GWinAmount)
                                    ////{
                                    ////    if (Settings.W2GMessage)
                                    ////    {
                                    ////        if (AppSettings.IsReceiptRequired && !Settings.CAGE_ENABLED)
                                    ////        {

                                    ////            (oCommonUtilities.CreateInstance()).PrintCommonReceipt(true, (lstHandpay.SelectedItem as FillTreasuryList).HP_Type, iVoid.ToString());


                                    ////        }
                                    ////    }
                                    ////}

                                    ////else
                                    ////{
                                    ////    if (VoidAmount <= Settings.W2GWinAmount && !Settings.CAGE_ENABLED)
                                    ////    {
                                    ////        (oCommonUtilities.CreateInstance()).PrintCommonReceipt(true, (lstHandpay.SelectedItem as FillTreasuryList).HP_Type, iVoid.ToString());
                                    ////    }

                                    ////}

                                    //if (AppSettings.IsReceiptRequired)
                                    //{
                                    //    if (!Settings.CAGE_ENABLED)
                                    //        (oCommonUtilities.CreateInstance()).PrintCommonReceipt(true, (lstHandpay.SelectedItem as FillTreasuryList).HP_Type, iVoid.ToString());
                                    //}

                                    //-----------------Untill Here -------------------------



                                    FillTreasury(Position);
                                    //BindListView();
                                    Helper_classes.Common.BindListView(treasuryList, lstHandpay);

                                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                    {

                                        AuditModuleName = ModuleName.Void,
                                        Audit_Screen_Name = "Postion Details|Attendant Pay|Void",
                                        Audit_Desc = TreasuryType + " Date: " + TreasuryDate + " Amount:" + Amount,
                                        AuditOperationType = OperationType.ADD,
                                        Audit_Field = "Treasury Number",
                                        Audit_New_Vl = TreasuryNo,
                                        Audit_Slot = Asset
                                    });
                                    //BMC.Business.CashDeskOperator.CommonUtilities.GetCurrency(0.00)
                                }
                                else if (iVoid == -1)
                                    MessageBox.ShowBox("MessageID111", BMC_Icon.Information);
                                else
                                {
                                    MessageBox.ShowBox("MessageID113", BMC_Icon.Error);

                                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                    {

                                        AuditModuleName = ModuleName.Void,
                                        Audit_Screen_Name = "Postion Details|Attendant Pay|Void",
                                        Audit_Desc = "Error occured while voiding this transaction.",
                                        AuditOperationType = OperationType.ADD,
                                        Audit_Slot = Asset
                                    });
                                }
                            }
                            catch (Exception Ex)
                            {
                                ExceptionManager.Publish(Ex);
                                MessageBox.ShowBox("MessageID113", BMC_Icon.Error);
                                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                {

                                    AuditModuleName = ModuleName.Void,
                                    Audit_Screen_Name = "Postion Details|Attendant Pay|Void",
                                    Audit_Desc = "Error occured while voiding this transaction.",
                                    AuditOperationType = OperationType.ADD,
                                    Audit_Slot = Asset
                                });

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

                    Lock.DeleteLockRecord(0, "", "HANDPAY", "HP", sTEid);
                }
                else
                    MessageBox.ShowBox("MessageID114", BMC_Icon.Information);
            }
            else
                MessageBox.ShowBox("MessageID115", BMC_Icon.Information);
        }
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            int iResult = 0;
            LockHandler Lock = new LockHandler();
            btnProcess.IsEnabled = false;


            try
            {
                if (lstHandpay.Items.Count > 0)
                {
                    if (lstHandpay.SelectedItem != null)
                    {
                        sPos = "";
                        sTEid = "";

                        sPos = Convert.ToString((lstHandpay.SelectedItem as FillTreasuryList).Pos);
                        sTEid = Convert.ToString((lstHandpay.SelectedItem as FillTreasuryList).TE_ID);

                        /*Lock the Handpay Process Transaction*/
                        iResult = Lock.InsertLockRecord(0, "", "HANDPAY", "HP", sTEid);
                        LogManager.WriteLog("Lock Result: " + iResult.ToString(), LogManager.enumLogLevel.Debug);
                        if (iResult == 1)
                        {
                            MessageBox.ShowBox("MessageID380", BMC_Icon.Error);
                            return;
                        }

                        if (MessageBox.ShowBox("MessageID106", BMC_Icon.Question, BMC_Button.YesNo) ==
                            System.Windows.Forms.DialogResult.Yes)
                        {
                            btnProcess.IsEnabled = false;
                            if (Clearhandpay(Convert.ToInt32((lstHandpay.SelectedItem as FillTreasuryList).Installation_No)))
                            {
                                ProcessHandpay(false);

                            }
                            else
                            {
                                MessageBox.ShowBox("MessageID382", BMC_Icon.Information);
                            }
                        }
                        Lock.DeleteLockRecord(0, "", "HANDPAY", "HP", sTEid);
                        // btnProcess.IsEnabled = true;
                    }
                    else
                        MessageBox.ShowBox("MessageID107", BMC_Icon.Information);
                }
                else
                    MessageBox.ShowBox("MessageID108", BMC_Icon.Information);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                LogManager.WriteLog("Process Handpay Exception", LogManager.enumLogLevel.Debug);
            }
            finally
            {

                btnProcess.IsEnabled = true;
            }

        }
        private void btnVoid_Click(object sender, RoutedEventArgs e)
        {

            int iVoid;
            int iResult = 0;
            LockHandler Lock = new LockHandler();

            if (dgHandpay.Items.Count > 0)
            {
                if (dgHandpay.SelectedItem != null)
                {
                    sPos = "";
                    sTEid = "";
                    FillTreasuryList handpay_Fill = dgHandpay.SelectedItem as FillTreasuryList;
                    sPos = handpay_Fill.Pos;
                    sTEid = handpay_Fill.TE_ID.ToString();
                    iResult = Lock.InsertLockRecord(0, "", "HANDPAY", "HP", sTEid);
                    //
                    if (iResult == 1)
                    {
                        MessageBox.ShowBox("MessageID380", BMC_Icon.Error);
                        return;
                    }
                    if (MessageBox.ShowBox("MessageID109", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (Clearhandpay(Convert.ToInt32(handpay_Fill.Installation_No)))
                        {
                            IsHandpayVoid = true;
                            ProcessHandpay(true);

                            if (Treasury_No < 0 || Treasury_No == 0)
                                return;
                            iVoid = VoidHandpay();

                            try
                            {

                                Asset = handpay_Fill.Asset.ToString();
                                VoidAmount = handpay_Fill.Amount;
                                if (iVoid > 0)
                                {
                                    MessageBox.ShowBox("MessageID110", BMC_Icon.Information);

                                    // Newly Added by Venkatesh Kumar.J - SGVI Requirements
                                    if (!Settings.CAGE_ENABLED)
                                        (oCommonUtilities.CreateInstance()).PrintCommonReceipt(true, handpay_Fill.HP_Type, iVoid.ToString());
                                    //if (VoidAmount > Settings.W2GWinAmount)
                                    //{
                                    //    if (Settings.W2GMessage)
                                    //    {
                                    //        if (AppSettings.IsReceiptRequired && !Settings.CAGE_ENABLED)
                                    //        {

                                    //            (oCommonUtilities.CreateInstance()).PrintCommonReceipt(true, handpay_Fill.HP_Type, iVoid.ToString());


                                    //        }
                                    //    }
                                    //}

                                    //else
                                    //{
                                    //    if (VoidAmount <= Settings.W2GWinAmount && !Settings.CAGE_ENABLED)
                                    //    {
                                    //        (oCommonUtilities.CreateInstance()).PrintCommonReceipt(true, handpay_Fill.HP_Type, iVoid.ToString());

                                    //    }

                                    //}



                                    //if (AppSettings.IsReceiptRequired && (!Settings.CAGE_ENABLED))
                                    //{
                                    //    (oCommonUtilities.CreateInstance()).PrintCommonReceipt(true, handpay_Fill.HP_Type, iVoid.ToString());
                                    //}

                                    //-----------Untill Here-------------------------------

                                    string TreasuryDate = handpay_Fill.TreasuryDate.ToString();
                                    string Amount = handpay_Fill.Amount.ToString();
                                    string TreasuryNo = handpay_Fill.TE_ID.ToString();
                                    string TreasuryType = handpay_Fill.HP_Type;
                                    string amount = BMC.Business.CashDeskOperator.CommonUtilities.GetCurrency(Convert.ToDouble(Amount));

                                    //FillTreasury((dgHandpay.SelectedItem as FillTreasuryList).Pos);
                                    FillTreasury(string.Empty);
                                    //BindListView();
                                    // Helper_classes.Common.BindListView(treasuryList, dgHandpay);

                                    dgHandpay.ItemsSource = treasuryList;

                                    if (Settings.CAGE_ENABLED)
                                    {
                                        jackpotProcessInfoDTO jpinfo = new jackpotProcessInfoDTO();
                                        jpinfo.Slot = this.BarPosition;
                                        jpinfo.assetConfigNumber = Asset;
                                        jpinfo.Denom = 0.01M;

                                        jpinfo.jackpotTypeId = handpay_Fill.HP_Type.ToLower() == "attendantpay Credit" ? Convert.ToInt16(1) :
                                                         handpay_Fill.HP_Type.ToLower() == "attendantpay jackpot" ? Convert.ToInt16(2) :
                                                         handpay_Fill.HP_Type.ToLower() == "progressive" ? Convert.ToInt16(3) : Convert.ToInt16(1);


                                        jpinfo.Slot = handpay_Fill.Pos;
                                        jpinfo.assetConfigNumber = Asset;

                                        double value = 0;
                                        double.TryParse(Amount, out value);
                                        jpinfo.hpjpAmount = (long)(-1 * (value * 100));
                                        try { jpinfo.jackpotNetAmount = (long)value; }
                                        catch { }


                                        double.TryParse(TreasuryNo, out value);
                                        jpinfo.sequenceNumber = (long)value;

                                        jpinfo.TransactionDate = TreasuryDate;
                                        jpinfo.UserID = Security.SecurityHelper.CurrentUser.SecurityUserID.ToString();
                                        jpinfo.siteNo = Settings.SiteName;
                                        jpinfo.siteId = Convert.ToInt32(Settings.SiteCode);
                                        //Commented for not printing in cage slip format

                                        handpay.PrintSlip(jpinfo);
                                    }
                                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                    {

                                        AuditModuleName = ModuleName.Void,
                                        Audit_Screen_Name = "Postion Details|Attendant Pay|Void",
                                        Audit_Desc = TreasuryType + " Date: " + TreasuryDate + " Amount:" + amount,
                                        AuditOperationType = OperationType.ADD,
                                        Audit_Field = "Treasury Number",
                                        Audit_New_Vl = TreasuryNo,
                                        Audit_Slot = Asset
                                    });
                                    //BMC.Business.CashDeskOperator.CommonUtilities.GetCurrency(0.00)
                                }
                                else if (iVoid == -1)
                                    MessageBox.ShowBox("MessageID111", BMC_Icon.Information);
                                else
                                {
                                    MessageBox.ShowBox("MessageID113", BMC_Icon.Error);

                                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                    {
                                        AuditModuleName = ModuleName.Void,
                                        Audit_Screen_Name = "Postion Details|Attendant Pay|Void",
                                        Audit_Desc = "Error occured while voiding this transaction.",
                                        AuditOperationType = OperationType.ADD,
                                        Audit_Slot = Asset
                                    });
                                }
                            }
                            catch (Exception Ex)
                            {
                                ExceptionManager.Publish(Ex);
                                MessageBox.ShowBox("MessageID113", BMC_Icon.Error);
                                AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                {
                                    AuditModuleName = ModuleName.Void,
                                    Audit_Screen_Name = "Postion Details|Attendant Pay|Void",
                                    Audit_Desc = "Error occured while voiding this transaction.",
                                    AuditOperationType = OperationType.ADD,
                                    Audit_Slot = Asset
                                });
                            }
                        }
                        else
                        {
                            MessageBox.ShowBox("MessageID382", BMC_Icon.Information);
                        }
                    }
                    Lock.DeleteLockRecord(0, "", "HANDPAY", "HP", sTEid);
                }
                else
                    MessageBox.ShowBox("MessageID114", BMC_Icon.Information);
            }
            else
                MessageBox.ShowBox("MessageID115", BMC_Icon.Information);
        }