예제 #1
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;

            
        }
예제 #2
0
 public PositionDetails GetPositionDetails(string Position)
 {
     PositionDetails positionDetails = new PositionDetails();
     DataTable dtPosition = enrollmentDataAccess.GetPositionDetails(Position);
     if (dtPosition != null)
     {
         positionDetails.Position = Position;
         positionDetails.InstallationNo = (Int32)dtPosition.Rows[0]["InstallationNo"];
         positionDetails.BarPosNo = dtPosition.Rows[0]["BarPosNo"].ToString();
         positionDetails.AssetNo = dtPosition.Rows[0]["Stock_No"].ToString();
         positionDetails.GMUNo = dtPosition.Rows[0]["DatapakNo"].ToString();
         positionDetails.SerialNo = dtPosition.Rows[0]["SerialNo"].ToString();
         positionDetails.AltSerialNo = dtPosition.Rows[0]["AltSerialNo"].ToString();
         positionDetails.MachineType = dtPosition.Rows[0]["MachineTypeCode"].ToString();
         positionDetails.Manufacturer = dtPosition.Rows[0]["Manufacturer_Name"].ToString();
         positionDetails.GameCode = dtPosition.Rows[0]["GameCode"].ToString();
         positionDetails.GameCategory = dtPosition.Rows[0]["GameCategory"].ToString();
         positionDetails.ActAssetNo = dtPosition.Rows[0]["ActAssetNo"].ToString();
         positionDetails.GMUNo = dtPosition.Rows[0]["GMUNo"].ToString();
         positionDetails.ActSerialNo = dtPosition.Rows[0]["ActSerialNo"].ToString();
         positionDetails.EnrolmentFlag = int.Parse(dtPosition.Rows[0]["EnrolmentFlag"].ToString());
         positionDetails.OperatorName = dtPosition.Rows[0]["OperatorName"].ToString();
         positionDetails.IsDefaultAssetDetail = Convert.ToBoolean(dtPosition.Rows[0]["IsDefaultAssetDetail"]);
         positionDetails.BaseDenom = int.Parse(dtPosition.Rows[0]["Base_Denom"].ToString());
         positionDetails.PercentagePayout = Convert.ToSingle(dtPosition.Rows[0]["Percentage_Payout"].ToString());
     }
     return positionDetails;
 }
        public EnrollmentWnd(string PositionName)
        {
            InitializeComponent();

            LogManager.WriteLog("Inside Constructor", LogManager.enumLogLevel.Info);

            objPosDetails = new PositionDetails() { Position = PositionName };
            lblPosition.Content = PositionName;
            lblStatus.Visibility = Visibility.Hidden;
            progressBar1.Visibility = Visibility.Hidden;
            if (Settings.RegulatoryEnabled && Settings.RegulatoryType == "AAMS")
            {
                chkInTransitAsset.Visibility = Visibility.Visible;
            }
            //txtBaseDenom.Text = "1";

            //if (BMC.Common.ConfigurationManagement.ConfigManager.Read("EnableDenomChange").ToUpper() == "FALSE")
            //    txtBaseDenom.IsEnabled = false;

            lblCoinType.Text = lblCoinType.Text + "(" + ExtensionMethods.GetCurrencyCoinSymbol() + "):";

            using (InstallationDataContext objCoinType = new InstallationDataContext(oCommonUtilities.CreateInstance().GetConnectionString()))
            {
                var vCoinType = (from CoinType in objCoinType.GetCoinType(ExtensionMethods.CurrentSiteCulture)
                                 select CoinType);

                cmbCoinType.DisplayMemberPath = "CoinType";
                cmbCoinType.SelectedValuePath = "CoinType";
                cmbCoinType.ItemsSource = vCoinType;

                if (cmbCoinType.Items.Count > 0)
                    cmbCoinType.SelectedIndex = 0;
            }

            bw.WorkerReportsProgress = true;
            bw.WorkerSupportsCancellation = true;
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
            bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

            bwGetAssetDetails.DoWork += new DoWorkEventHandler(bwGetAssetDetails_DoWork);
            bwGetAssetDetails.ProgressChanged += new ProgressChangedEventHandler(bwGetAssetDetails_ProgressChanged);
            bwGetAssetDetails.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwGetAssetDetails_RunWorkerCompleted);

            txtAsset.Focus();
        }
        public MachineRemoval(PositionDetails objPd)
		{
			this.InitializeComponent();
            MessageBox.childOwner = this;
            objPositionDetails = objPd;
            txt_GMU_No.Text = objPositionDetails.GMUNo;
            txt_MC_AssetNo.Text = objPositionDetails.AssetNo;
            txt_Position.Text = objPositionDetails.Position;

            txt_GMU_No.IsReadOnly = true;
            txt_MC_AssetNo.IsReadOnly = true;
            txt_Position.IsReadOnly = true;
            com_GMU_Type.Items.Add("MC300");
            com_GMU_Type.Items.Add("Connexus");
            com_GMU_Type.Items.Add("NoDevice");
            com_GMU_Type.SelectedIndex = 0;
            if (txt_GMU_No.Text.Trim().Length == 0 || txt_GMU_No.Text == "0")
                com_GMU_Type.SelectedIndex = 2;
		}
        public MachineEnrolment(bool IsEnrol, string Position)
        {
            this.InitializeComponent();
            MessageBox.childOwner = this;
            this.IsEnrol = IsEnrol;
            this.Position = Position;
            txt_Position.Text = Position;
            com_GMU_Type.Items.Add("MC300");
            com_GMU_Type.Items.Add("Connexus");
            com_GMU_Type.Items.Add("NoDevice");
            com_GMU_Type.SelectedIndex = 0;

            if (IsEnrol)
            {
                panel_Enrol_Button.Visibility = Visibility.Visible;
                panel_Remove_Button.Visibility = Visibility.Hidden;
                txt_MC_AssetNo.PreviewMouseUp += new MouseButtonEventHandler(txt_MC_AssetNo_PreviewMouseUp);
                txt_GMU_No.PreviewMouseUp += new MouseButtonEventHandler(txt_GMU_No_PreviewMouseUp);
            }
            else
            {
                panel_Enrol_Button.Visibility = Visibility.Hidden;
                panel_Remove_Button.Visibility = Visibility.Visible;
                objPositiondetails = Enrollment.GetPositionDetails(Position);
                txt_Mc_Serial_No.Text = objPositiondetails.SerialNo;
                txt_Mc_Alt_Serial_No.Text = objPositiondetails.AltSerialNo;
                txt_Manufacturer.Text = objPositiondetails.Manufacturer;
                txt_Mc_Type.Text = objPositiondetails.MachineType;
                txt_GameCode.Text = objPositiondetails.GameCode;
                txt_GameCat.Text = objPositiondetails.GameCategory;
                txt_Game.Text = objPositiondetails.Game;
                txt_GMU_No.Text = objPositiondetails.GMUNo;
                txt_MC_AssetNo.Text = objPositiondetails.AssetNo;
                lbl_Title.Text = "Machine Removal";

                if (txt_GMU_No.Text.Trim().Length == 0 || txt_GMU_No.Text.Trim() == "0")
                    com_GMU_Type.SelectedIndex = 2;

                txt_GMU_No.IsReadOnly = true;
                txt_Position.IsReadOnly = true;
                txt_MC_AssetNo.IsReadOnly = true;
            }
        }
예제 #6
0
        public EnrollmentErrorCodes InstallMachine(PositionDetails PosDetails, out int installationNo)
        {
            int HQInstallationNo;
            installationNo = 0;

            try
            {
                //2.START transaction & Call the SP & //3.Get the new Installation_No from SP output variable
                PosDetails.InstallationNo = enrollmentDataAccess.CreateInstallation(PosDetails);
                installationNo = PosDetails.InstallationNo;
                if (PosDetails.InstallationNo < 1)
                {
                    //1
                    enrollmentDataAccess.RollbackTransaction(0);
                    return EnrollmentErrorCodes.DatabaseError;
                }
                LogManager.WriteLog("InstallMachine:Created Installation in database with Installation no: " + PosDetails.InstallationNo.ToString(), LogManager.enumLogLevel.Info);


                //4.Add to Polling List
                //if (!AddToPollingList(PosDetails))
                //{
                //    //This function callls rollback multiple times 
                //    //2
                //    enrollmentDataAccess.RollbackTransaction(PosDetails.InstallationNo);
                //    return EnrollmentErrorCodes.AddToPollingListFailure;
                //}
                int nPollingList =AddToPollingList(PosDetails);

                if (nPollingList == -1)
                {
                    enrollmentDataAccess.RollbackTransaction(PosDetails.InstallationNo);
                    return EnrollmentErrorCodes.AddToPollingListFailure;
                }
                if (nPollingList == -2)
                {
                    enrollmentDataAccess.RollbackTransaction(PosDetails.InstallationNo);
                    return EnrollmentErrorCodes.ExchangeHostServiceNotRunning;
                }


                LogManager.WriteLog("InstallMachine:Added to Polling list ...datapak no: " + PosDetails.InstallationNo.ToString(), LogManager.enumLogLevel.Info);

                //MachineManagerInterface machineManagerInterface = new MachineManagerInterface();
                //if (!machineManagerInterface.UpdateOptionFileParameter(PosDetails.InstallationNo))
                //{
                //    enrollmentDataAccess.RollbackTransaction(PosDetails.InstallationNo);
                //    return EnrollmentErrorCodes.UpdateToOptionFileParameterFailure;
                //}
                //LogManager.WriteLog("InstallMachine:Updated Option File Parameter ...datapak no: " + PosDetails.InstallationNo.ToString(), LogManager.enumLogLevel.Info);

                //5.If Success send the details to Enterprise else rollback
                EnrollmentErrorCodes WebServiceReturnValue = SendInstallationToEnterprise(PosDetails, out HQInstallationNo);
                if (WebServiceReturnValue != EnrollmentErrorCodes.Success || HQInstallationNo <= 0)
                {
                    LogManager.WriteLog("InstallMachine:Unable to Create Installation in Enterprise: " + PosDetails.InstallationNo.ToString(), LogManager.enumLogLevel.Info);
                    //3
                    RemoveMachineFromPollingList(PosDetails.InstallationNo, 0);
                    enrollmentDataAccess.RollbackTransaction(PosDetails.InstallationNo);
                    return WebServiceReturnValue;

                }
                LogManager.WriteLog("InstallMachine: Installation Created in Enterprise successfully with HQ ID: " + HQInstallationNo.ToString(), LogManager.enumLogLevel.Info);

                LogManager.WriteLog("InstallMachine: Before commiting the transaction", LogManager.enumLogLevel.Info);
                //6.If Success from enterprise then COMMIT else Rollback.. If any other errors display
                enrollmentDataAccess.CommitTransaction();
                LogManager.WriteLog("InstallMachine: Transaction Committed", LogManager.enumLogLevel.Info);

                // Updates the UpdateGMUSiteCodeStatus
                LogManager.WriteLog("InstallMachine: UpdateGMUSiteCodeStatus with Status 1 (START)", LogManager.enumLogLevel.Info);
                enrollmentDataAccess.UpdateGMUSiteCodeStatus(PosDetails.InstallationNo, 1);
                LogManager.WriteLog("InstallMachine: UpdateGMUSiteCodeStatus with Status 1 (END)", LogManager.enumLogLevel.Info);

                //7. update the HQ Id in Installation table
                enrollmentDataAccess.UpdateHQID(PosDetails.InstallationNo, HQInstallationNo);
                LogManager.WriteLog("InstallMachine: Updated HQID", LogManager.enumLogLevel.Info);

                return EnrollmentErrorCodes.Success;
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                return EnrollmentErrorCodes.DatabaseError;
            }


        }
예제 #7
0
        /// <summary>
        /// Adds the Installation to Polling List
        /// </summary>
        /// <param name="PosDetails"></param>
        /// <returns>Installation Number</returns>
        private int AddToPollingList(PositionDetails PosDetails)
        {
            try
            {
                if (PosDetails.InstallationNo > 0)//For new installation
                {
                    int Bar_Pos_Port = enrollmentDataAccess.GetBarPosPort(PosDetails.InstallationNo);
                    int nResult = this.GetMachineManager().AddUDPToListWithoutWait(PosDetails.InstallationNo, Bar_Pos_Port);
                    LogManager.WriteLog("Return Value from AddUDPToList:" + nResult.ToString(), LogManager.enumLogLevel.Info);
                    return nResult;
                    #region commented
                    //int Polling_ID, PollType;
                    //Polling_ID = 0;
                    //PollType = 7;



                    //Parameters parameter = new Parameters() { InstallationNo = PosDetails.InstallationNo, BarPositionNo = Bar_Pos_Port };

                    //Thread t = new Thread(CallAddToUPD);
                    //t.Start(parameter);

                    //Application.DoEvents();
                    //Thread.Sleep(TimeSpan.FromSeconds(15));
                    //Application.DoEvents();

                    //bSuccess = MachineManagerInterface.AckMessage;

                    //LogManager.WriteLog("AddToPollingList: ADD UDP TO LIST for Installation No:" + PosDetails.InstallationNo.ToString() + " Success value: " + bSuccess, LogManager.enumLogLevel.Info);
                    //return bSuccess; 
                    #endregion
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("Exception thrown in AddUDPToList", LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
                return -1;
            }
            finally
            {
                this.ReleaseMachineManager();
            }
          return -1;
        }
예제 #8
0
        /// <summary>
        /// Send New Installation to Enterprise
        /// </summary>
        /// <param name="PosDetails"></param>
        /// <param name="HQInstallatioNo"></param>
        /// <returns></returns>
        private EnrollmentErrorCodes SendInstallationToEnterprise(PositionDetails PosDetails, out int HQInstallatioNo)
        {
            try
            {
                HQInstallatioNo = 0;
                //Get Old installation XML to close in enetrprise.
                string InstallationXML = enrollmentDataAccess.GetInstallationXML(PosDetails.InstallationNo);
                if (InstallationXML.Length == 0)
                {
                    LogManager.WriteLog("SendInstallationToEnterprise Installation XML From SP is empty. May be some problem in generating the XML from DB", LogManager.enumLogLevel.Info);
                    return EnrollmentErrorCodes.DatabaseError;
                }
                Proxy WebService = new Proxy(Settings.SiteCode,ConnectionStringHelper.ExchangeConnectionString);
                
                LogManager.WriteLog("InstallMachine:SendInstallationToEnterprise Calling Webmethod", LogManager.enumLogLevel.Info);
                int ReturnValue = WebService.CreateInstallation(InstallationXML);
                switch (ReturnValue)
                {

                    case -4:
                        return EnrollmentErrorCodes.EnterpriseAssetInUse;
                       

                    case -3:
                        return EnrollmentErrorCodes.EnterpriseAssetNotAvailable;
                        
                    case -90:          //general sql error
                        return EnrollmentErrorCodes.EnterpriseDatabaseError;
                        

                    case -99:          //general sql error
                        return EnrollmentErrorCodes.EnterpriseDatabaseError;
                        

                    default:
                        //STORE HQ ID IN Installation table
                        HQInstallatioNo = ReturnValue;
                        if(ReturnValue > 0)
                            return EnrollmentErrorCodes.Success;
                        else
                            return EnrollmentErrorCodes.EnterpriseDatabaseError;
                       

                }
            }
            catch (Exception ex)
            {
                HQInstallatioNo = 0;
                ExceptionManager.Publish(ex);
                return EnrollmentErrorCodes.EnterpriseWebServiceCommunicationFailure;
            }
        }