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 VoidTreasuryNegGen(VoidTranCreate VoidTranCreate)
        {
            //DataBaseServiceHandler.AddParameter<DateTime>("dDate", System.Data.DbType.DateTime, VoidTranCreate.Date),
            //DataBaseServiceHandler.AddParameter<string>("dTime", System.Data.DbType.String, ""),
            SqlParameter outputValue =
                DataBaseServiceHandler.AddParameter<int>("OutVal", System.Data.DbType.Int32, 0, System.Data.ParameterDirection.Output);

            try
            {
                //DataBaseServiceHandler.ConnectionString = CommonDataAccess.ExchangeConnectionString;
                DataBaseServiceHandler.ExecuteNonQuery(CommonDataAccess.ExchangeConnectionString, CommandType.StoredProcedure, DBConstants.CONSTANT_USP_CREATEVOIDTREASURY,
                    DataBaseServiceHandler.AddParameter<string>("TreasuryNo", System.Data.DbType.String, VoidTranCreate.TreasuryID),
                   DataBaseServiceHandler.AddParameter<DateTime>("VoidedDate",System.Data.DbType.DateTime,VoidTranCreate.Date),
                    DataBaseServiceHandler.AddParameter<string>("UserNo", System.Data.DbType.String, VoidTranCreate.UserNo),
                    outputValue);

                return int.Parse(outputValue.Value.ToString());
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);                
            }
            return 99;
        }
 public int VoidCreate(VoidTranCreate VoidTransactionEntiy)
 {
     return voidTransactionDataAccess.VoidTreasuryNegGen(VoidTransactionEntiy);
 }
        /// <summary>
        /// Method to create a record in the Treasury table for negative amount.
        /// </summary>
        /// <param name="objVoid"></param>
        /// <returns></returns>
        public static int VoidTreasuryNegGen(VoidTranCreate objVoid)
        {
            SqlParameter[] objSQL = new SqlParameter[5];

            SqlParameter objParam1 = new SqlParameter();
            objParam1.ParameterName = "TreasuryNo";
            objParam1.Direction = ParameterDirection.Input;
            objParam1.SqlDbType = SqlDbType.Int;
            objParam1.Value = objVoid.TreasuryID;
            objSQL[0] = objParam1;

            SqlParameter objParam2 = new SqlParameter();
            objParam2.ParameterName = "dDate";
            objParam2.Direction = ParameterDirection.Input;
            objParam2.SqlDbType = SqlDbType.VarChar;
            objParam2.Value = objVoid.Date;
            objSQL[1] = objParam2;

            SqlParameter objParam3 = new SqlParameter();
            objParam3.ParameterName = "dTime";
            objParam3.Direction = ParameterDirection.Input;
            objParam3.SqlDbType = SqlDbType.VarChar;
            objParam3.Value = objVoid.Time;
            objSQL[2] = objParam3;

            SqlParameter objParam4 = new SqlParameter();
            objParam4.ParameterName = "UserNo";
            objParam4.Direction = ParameterDirection.Input;
            objParam4.SqlDbType = SqlDbType.Int;
            objParam4.Value = objVoid.UserNo;
            objSQL[3] = objParam4;

            SqlParameter objParam5 = new SqlParameter();
            objParam5.ParameterName = "OutVal";
            objParam5.Direction = ParameterDirection.Output;
            objParam5.SqlDbType = SqlDbType.Int;
            objSQL[4] = objParam5;

            try
            {
                SqlHelper.ExecuteNonQuery(GetExchangeConnectionString(), CommandType.StoredProcedure, DBConstants.CONSTANT_USP_CREATEVOIDTREASURY, objSQL);
                return int.Parse(objSQL[4].Value.ToString());
            }
            catch (SqlException Ex)
            {
                ExceptionManager.Publish(Ex);
                return 99;
            }
        }
Example #5
0
 //<summary>
 //Void the treasury transactions.
 //</summary>
 //<returns>success or failure</returns>        
 public int VoidTreasuryNegativeTrans(VoidTranCreate NegativeTransaction)
 {
     int? OutVal = 0;
     int result;
     try
     {
         result = linqDB.VoidCreate(int.Parse(NegativeTransaction.TreasuryID),NegativeTransaction.Date, 
             int.Parse(NegativeTransaction.UserNo), ref OutVal);
         return OutVal.Value;
     }
     catch (Exception Ex)
     {
         ExceptionManager.Publish(Ex);
         return -99;
     }
 }
        private int VoidHandpay()
        {
            int result = 0;
            VoidTranCreate voidTran = null;

            try
            {
                voidTran = new VoidTranCreate
                                   {
                                       TreasuryID = Treasury_No.ToString(),
                                       Date = DateTime.Now,
                                       UserNo = Security.SecurityHelper.CurrentUser.User_No.ToString()
                                       //Date = DateTime.Now
                                   };

                result = handpay.VoidTransaction(voidTran);
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
                return -99;
            }
            finally
            {
                if (result > 0)
                {
                    try
                    {
                        jackpotProcessInfoDTO jpinfo = new jackpotProcessInfoDTO();
                        jpinfo.Slot = this.BarPosition;
                        jpinfo.assetConfigNumber = Asset;
                        jpinfo.Denom = 0.01M;

                        string TreasuryDate = string.Empty;
                        string Amount = string.Empty;
                        string TreasuryNo = string.Empty;
                        string TreasuryType = string.Empty;
                        short jackpotTypeId = 0;
                        string slot = string.Empty;
                        string assetConfigNumber = string.Empty;

                        try
                        {
                            FillTreasuryList list = (lstHandpay.SelectedItem as FillTreasuryList);
                            if (list != null)
                            {
                                TreasuryDate = list.TreasuryDate.ToString();
                                Amount = list.Amount.ToString();
                                TreasuryNo = list.TE_ID.ToString();
                                TreasuryType = list.HP_Type;
                                jackpotTypeId = list.HP_Type.ToLower() == "attendantpay Credit" ? Convert.ToInt16(1) :
                                                list.HP_Type.ToLower() == "attendantpay jackpot" ? Convert.ToInt16(2) :
                                                list.HP_Type.ToLower() == "progressive" ? Convert.ToInt16(3) : Convert.ToInt16(1);

                                slot = list.Pos;
                                assetConfigNumber = list.Asset;
                            }
                            LogManager.WriteLog("|==> VOID AMOUNT IS : " + Amount, LogManager.enumLogLevel.Info);
                        }
                        catch (Exception ex)
                        {
                            LogManager.WriteLog("|==> Exception Occured in VoidHandpy " + Amount, LogManager.enumLogLevel.Info);
                            ExceptionManager.Publish(ex);
                        }

                        jpinfo.Slot = slot;
                        jpinfo.assetConfigNumber = assetConfigNumber;

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

                        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
                        if (Settings.CAGE_ENABLED)
                            handpay.PrintSlip(jpinfo);
                    }
                    catch (Exception ex)
                    {
                        ExceptionManager.Publish(ex);
                    }
                }
            }

            return result;
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if(lstVoidTransaction.Items.Count<=0)
            {
                MessageBox.ShowBox("MessageID115", BMC_Icon.Information);
                return;
            }
            if (lstVoidTransaction.SelectedItems.Count == 0) return;

            int returnValue;
            string strType;
            string amount;

            var objCDOEntity = new VoidTranCreate();
            var objCDO = VoidTransactionBusinessObject.CreateInstance();

            try
            {


                if ((((GetVoidTransactionListResult)lstVoidTransaction.SelectedItem)).Treasury_Reason != "NEGATIVE TREASURY ENTRY")
                {
                    if (MessageBox.ShowBox("MessageID109", BMC_Icon.Question, BMC_Button.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        objCDOEntity.TreasuryID = ((GetVoidTransactionListResult)lstVoidTransaction.SelectedItem).Treasury_No.ToString();
                        objCDOEntity.UserNo = SecurityHelper.CurrentUser.User_No.ToString();
                        objCDOEntity.Date = DateTime.Now;
                            //clsSecurity.UserNo.ToString();
                            //SecurityHelper.CurrentUser.User_No.ToString();
                           // ((GetVoidTransactionListResult)lstVoidTransaction.SelectedItem).User_No.ToString();
                        strType = ((GetVoidTransactionListResult)lstVoidTransaction.SelectedItem).Type;
                        amount = BMC.Business.CashDeskOperator.CommonUtilities.GetCurrency(((GetVoidTransactionListResult)lstVoidTransaction.SelectedItem).Amount.Value);
                        returnValue = objCDO.VoidTransaction(objCDOEntity);

                        if (returnValue > 0)
                        {
                            MessageBox.ShowBox("MessageID125", BMC_Icon.Information);

                            AuditViewerBusiness.InsertAuditData(new Audit_History
                            {

                                AuditModuleName = ModuleName.Void,
                                Audit_Screen_Name = "Void|VoidTransaction",
                                Audit_Desc = strType + " Date: " + ((GetVoidTransactionListResult)lstVoidTransaction.SelectedItem).FormattedDate
                                                            + " Amount: " + amount,
                                AuditOperationType = OperationType.ADD,
                                Audit_Field = "Treasury Number",
                                Audit_New_Vl = ((GetVoidTransactionListResult)lstVoidTransaction.SelectedItem).Treasury_No.ToString()
                            });


                            (oCommonUtilities.CreateInstance()).PrintCommonReceipt(true, strType, returnValue.ToString());
                            FillData();
                            _common.CustomPaging(Helper_classes.Common.PagingMode.Next, _dtTabVoid, _pagingNoOfRecPerPage, lstVoidTransaction, true);
                            _common.DisplayPagingInfo(_dtTabVoid, _common, _pagingNoOfRecPerPage);
                        }
                        else
                        {
                            switch (returnValue)
                            {
                                case -2://LockExists
                                case -3://LockError
                                    {
                                        MessageBox.ShowBox("MessageID375", BMC_Icon.Error);

                                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                        {

                                            AuditModuleName = ModuleName.Void,
                                            Audit_Screen_Name = "Void|VoidTransaction",
                                            Audit_Desc = "Locked by another user for processing.",
                                            AuditOperationType = OperationType.ADD
                                        });

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

                                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                                        {

                                            AuditModuleName = ModuleName.Void,
                                            Audit_Screen_Name = "Void|VoidTransaction",
                                            Audit_Desc =  "Unable to Access the database.",
                                            AuditOperationType = OperationType.ADD
                                        });
                                        break;
                                    }
                                case -5://Cashdesk transaction included in drop
                                    {
                                        MessageBox.ShowBox("MessageID546", BMC_Icon.Information);
                                        AuditViewerBusiness.InsertAuditData(new Audit_History
                                        {

                                            AuditModuleName = ModuleName.Void,
                                            Audit_Screen_Name = "Void|VoidTransaction",
                                            Audit_Desc = "Transaction already included in drop.",
                                            AuditOperationType = OperationType.ADD
                                        });

										FillData();

                                        break;
                                    }
                                default:
                                    {
                                        MessageBox.ShowBox("MessageID126", BMC_Icon.Information);
                                        AuditViewerBusiness.InsertAuditData(new Audit_History
                                        {

                                            AuditModuleName = ModuleName.Void,
                                            Audit_Screen_Name = "Void|VoidTransaction",
                                            Audit_Desc = "Error occured while voiding this transaction.",
                                            AuditOperationType = OperationType.ADD
                                        });
                                        break;
                                    }

                            }
                        }
                        //else if (returnValue == -1)
                        //{
                        //    MessageBox.ShowBox("MessageID126", BMC_Icon.Information);
                        //    AuditViewerBusiness.InsertAuditData(new Audit_History
                        //    {

                        //        AuditModuleName = ModuleName.Void,
                        //        Audit_Screen_Name = "Void|VoidTransaction",
                        //        Audit_Desc = "Error occured while voiding this transaction.",
                        //        AuditOperationType = OperationType.ADD
                        //    });

                        //}
                        //else
                        //    MessageBox.ShowBox("MessageID127", BMC_Icon.Error);
                    }
                    else
                        return;
                }
                else
                    MessageBox.ShowBox("MessageID128", BMC_Icon.Information);
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
            }
        }
Example #8
0
 public int VoidTransaction(VoidTranCreate VoidTransactionEntity)
 {
     return handPay.VoidTreasuryNegativeTrans(VoidTransactionEntity);
 }
        private void btnVoid_Click(object sender, RoutedEventArgs e)
        {
            IVoidTransaction objCashDeskOperator = VoidTransactionBusinessObject.CreateInstance();
            if (lvUnprocessedHandpays.Items.Count == 0)
            {
                MessageBox.showBox("No handpay entry exists to make it Void", BMC_Icon.Information);
                return;
            }
            else
                if (lvUnprocessedHandpays.SelectedIndex != -1)
                {
                    System.Windows.Forms.DialogResult dr = System.Windows.Forms.MessageBox.Show("Are you sure you want to void this handpay?",
                        "Cash Desk Operator", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                    if (dr.ToString() == "Yes")
                    {
                        SaveDetails_EventsFromConnexus(true);

                        VoidTranCreate objVoidTreasury = new VoidTranCreate();
                        objVoidTreasury.UserNo = BMC.Common.clsSecurity.UserID.ToString();
                        objVoidTreasury.Time = DateTime.Now.ToString("HH:mm:ss");
                        objVoidTreasury.Date = DateTime.Now.Date.ToString("dd MMM yyyy");
                        objVoidTreasury.TreasuryID = iTreasuryID.ToString();

                        int iResult = objCashDeskOperator.VoidTransaction(objVoidTreasury);

                        if (iResult == -1)
                        {
                            MessageBox.showBox("This Handpay entry has already been voided!", BMC_Icon.Information);
                        }
                        else if (iResult == 0)
                        {
                            MessageBox.showBox("The Handpay entry voided successfully ", BMC_Icon.Information);
                        }
                        else
                        {
                            MessageBox.showBox("Error occured while voiding Handpay entry", BMC_Icon.Information);
                            return;
                        }
                    }
                }

            FillHandpays();

        }
 private int VoidHandpay()
 {
     try
     {
         var voidTran = new VoidTranCreate
         {
             TreasuryID = Treasury_No.ToString(),
             UserNo = Security.SecurityHelper.CurrentUser.User_No.ToString(),
             Date = DateTime.Now
         };
         return handpay.VoidTransaction(voidTran);
     }
     catch (Exception Ex)
     {
         ExceptionManager.Publish(Ex);
         return -99;
     }
 }