示例#1
0
 internal override bool confirmReservation(ref LocationData.LocationTransactionData transaction)
 {
     //This allows the admin to set up access codes for each box and then use them to allow the users to override the reservation system locally.
     //int box = Program.passwordMgr.FindLocationForCode(transaction.AccessCode);
     //if (box != -1)
     //{
     //    Program.logEvent("Local Access Code Overriding Reservation System");
     //    transaction.BoxNumber = box;
     //    Program.logEvent("Box Number = " + box.ToString());
     //    int transnumindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return ltd.name == "Transaction"; });
     //    Program.logEvent("transnumindex = " + transnumindex.ToString());
     //    transaction.ObjectList[transnumindex].data = "Code Override";
     //    return true;
     //}
     //This uses the standing reservation system to retrieve the box number, reservation status and transaction number from the reservation server.
     //else
     //{
     if (!makeHTTPPost(HTTPPostType.CheckReservation, transaction.AccessCode, "", "", ref transaction))
     {
         Program.ShowErrorMessage(LanguageTranslation.RESERVATION_VERIFICATION_ERROR, 10000);
         return(false);
     }
     else
     {
         return(true);
     }
     //}
 }
        internal override bool confirmReservation(ref LocationData.LocationTransactionData transaction)
        {
            //This allows the admin to set up access codes for each box and then use them to allow the users to override the reservation system locally.
            int box = Program.passwordMgr.FindLocationForCode(transaction.AccessCode);

            if (box != -1)
            {
                Program.logEvent("Local Access Code Overriding Reservation System");
                transaction.BoxNumber = box;
                Program.logEvent("Box Number = " + box.ToString());
                int transnumindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "Transaction"); });
                Program.logEvent("transnumindex = " + transnumindex.ToString());
                transaction.ObjectList[transnumindex].data = "Code Override";

                return(true);
            }
            //This uses the standing reservation system to retrieve the box number, reservation status and transaction number from the reservation server.
            else
            {
                int IDTypeIndex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "IdentificationType"); });
                if (!makeHTTPPost(HTTPPostType.CheckReservation, transaction.AccessCode, transaction.ObjectList[IDTypeIndex].data.ToString(), transaction.CardNumber, ref transaction))
                {
                    Program.ShowErrorMessage("Unfortunately we have\r\nbeen unable to verify\r\n your reservation\r\nPlease call 202-264-3803\r\nOR 202-264-3804", 10000);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
示例#3
0
        //Used to run the initial scan for the RFID tag after the door is opened so that the tag can be seen by the antennae
        //Used to deal with the RFID scanning thread which will run for approx 30 seconds after transaction ends to make sure the RFID tag is either
        //present or not depending on whether the key was taken or returned.
        internal override bool postDoorOpeningProcessing(LocationData.LocationTransactionData transaction)
        {
            if (transaction.ReturningKey)
            {
                int RFIDTagindex      = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "TagNum"); });
                int RFIDDetectedindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "TagDetected"); });

                RFIDScanForm scanform = new RFIDScanForm(transaction.ObjectList[RFIDTagindex].data.ToString());
                scanform.ShowDialog();

                bool scanSuccess = scanform.ReturnBool;
                if (scanSuccess)
                {
                    Program.ShowErrorMessage(LanguageTranslation.RFID_TAG_FOUND, 3000);
                }
                else
                {
                    Program.ShowErrorMessage(LanguageTranslation.RFID_TAG_NOT_DETECTED, 3000);
                }

                transaction.ObjectList[RFIDDetectedindex].data = scanSuccess.ToString();

                bool returnBool = transaction.ReturningKey;
                //Package all needed data for the thread into a single string
                string ThreadDataString = returnBool.ToString() + "," + transaction.ObjectList[RFIDTagindex].data.ToString();

                Thread afterTransScanThread = new Thread(DaimlerChinaLocationData.AfterTransactionScanThread);
                afterTransScanThread.Start(ThreadDataString);
            }
            return(true);
        }
示例#4
0
        internal override bool confirmReservation(ref LocationData.LocationTransactionData transaction)
        {
            //This allows the admin to set up access codes for each box and then use them to allow the users to override the reservation system locally.
            int box = Program.passwordMgr.FindLocationForCode(transaction.AccessCode);

            if (box != -1)
            {
                Program.logEvent("Local Access Code Overriding Reservation System");
                transaction.BoxNumber = box;
                Program.logEvent("Box Number = " + box.ToString());
                int transnumindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "Transaction"); });
                Program.logEvent("transnumindex = " + transnumindex.ToString());
                transaction.ObjectList[transnumindex].data = "Code Override";

                ////
                ////BEGIN TEMPORARY CODE FOR 5/19 WA WATER DEMO
                ////

                if (File.Exists("./Transactions/" + DateTime.Today.Month.ToString() + "transaction.csv"))
                {
                    FileStream   readfile   = File.OpenRead("./Transactions/" + DateTime.Today.Month.ToString() + "transaction.csv");
                    StreamReader readstream = new StreamReader(readfile);
                    string       newline;
                    int          transactioncount = 0;
                    while (readstream.Peek() >= 0)
                    {
                        newline = readstream.ReadLine();
                        if (newline.Split(',')[4] == transaction.AccessCode)
                        {
                            transactioncount++;
                        }
                    }

                    if (transactioncount % 2 == 1)
                    {
                        transaction.ReturningKey = true;
                    }
                }
                ////
                ////END TEMPORARY CODE FOR 5/19 WA WATER DEMO
                ////
                return(true);
            }
            //This uses the standing reservation system to retrieve the box number, reservation status and transaction number from the reservation server.
            else
            {
                int IDTypeIndex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "IdentificationType"); });
                if (!makeHTTPPost(HTTPPostType.CheckReservation, transaction.AccessCode, transaction.ObjectList[IDTypeIndex].data.ToString(), transaction.CardNumber, ref transaction))
                {
                    Program.ShowErrorMessage("Unfortunately we have\r\nbeen unable to verify\r\n your reservation\r\nPlease call 202-264-3803\r\nOR 202-264-3804", 10000);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
示例#5
0
        //Used to deal with the RFID scanning thread which will run for approx 30 seconds after transaction ends to make sure the RFID tag is either
        //present or not depending on whether the key was taken or returned.
        internal override bool preDoorOpeningProcessing(LocationData.LocationTransactionData transaction)
        {
            if (!transaction.ReturningKey)
            {
                bool returnBool   = transaction.ReturningKey;
                int  RFIDTagindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "TagNum"); });
                //Package all needed data for the thread into a single string
                string ThreadDataString = returnBool.ToString() + "," + transaction.ObjectList[RFIDTagindex].data.ToString();

                Thread afterTransScanThread = new Thread(DaimlerChinaLocationData.AfterTransactionScanThread);
                afterTransScanThread.Start(ThreadDataString);
            }
            return(true);
        }
示例#6
0
        //Used to deal with the RFID scanning thread which will run for approx 30 seconds after transaction ends to make sure the RFID tag is either
        //present or not depending on whether the key was taken or returned.
        internal override bool preDoorOpeningProcessing(LocationData.LocationTransactionData transaction)
        {
            //Check to see if the box number entered by the user matches the one for their card on file
            //int truebox = Program.passwordMgr.FindLocationForCard(transaction.CardNumber);
            //if (truebox != transaction.BoxNumber)
            //{
            //    Program.logEvent("Box number " + transaction.BoxNumber + " Entered by the user does not match box number " + truebox + " for card number " + transaction.CardNumber + " in keypassword.xml");
            //    Program.ShowErrorMessage("Invalid Box\r\nNumber", 3000);
            //    return false;
            //}

            if (!transaction.ReturningKey)
            {
                bool returnBool   = transaction.ReturningKey;
                int  RFIDTagindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "TagNum"); });
                //Package all needed data for the thread into a single string
                string ThreadDataString = returnBool.ToString() + "," + transaction.ObjectList[RFIDTagindex].data.ToString();

                Thread afterTransScanThread = new Thread(MontanaLocationData.AfterTransactionScanThread);
                afterTransScanThread.Start(ThreadDataString);
            }
            return(true);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="MethodType"></param>
        /// <param name="extradata1"></param>
        /// <param name="extradata2"></param>
        /// <param name="extradata3">This parameter is used to hold four boolean pieces of data</param>
        /// <returns></returns>
        internal override bool makeHTTPPost(HTTPPostType MethodType, string extradata1, string extradata2, string extradata3, ref LocationData.LocationTransactionData transaction)
        {
            string methodtype = "";
            NameValueCollection methodparams = new NameValueCollection();

            switch (MethodType)
            {
            case HTTPPostType.CheckReservation:
                methodtype = "Reservation";
                methodparams.Add("clientName", "DCWATER");
                methodparams.Add("reservationNumber", extradata1.ToUpper());     //any alpha characters in the res number must be capitals
                methodparams.Add("authMethod", extradata2);
                methodparams.Add("HIDcode", extradata3);
                methodparams.Add("kioskNumber", Program.KIOSK_ID);
                break;

            case HTTPPostType.KeyOut:
                methodtype = "TransactionComplete";
                methodparams.Add("clientName", "DCWATER");
                methodparams.Add("transactionNumber", extradata1.Split(',')[0]);
                methodparams.Add("reservationNumber", extradata1.Split(',')[1].ToUpper());
                methodparams.Add("status", "SUCCESS");
                methodparams.Add("question1", extradata3.Substring(1, 1));
                methodparams.Add("question2", extradata3.Substring(2, 1));
                methodparams.Add("question3", extradata3.Substring(3, 1));
                methodparams.Add("UDF1", "0");
                methodparams.Add("UDF2", "0");
                methodparams.Add("UDF3", "0");
                methodparams.Add("UDF4", "0");
                methodparams.Add("UDF5", "0");
                methodparams.Add("UDF6", "0");
                methodparams.Add("authMethod", extradata2.Split(',')[0]);
                methodparams.Add("HIDcode", extradata2.Split(',')[1]);
                break;

            case HTTPPostType.TransactionFail:
                return(true);
            }
            return(PostHudsonData(methodparams, Program.CUSTOMER_DATA_SERVER, methodtype, ref transaction));
        }
        private bool PostHudsonData(NameValueCollection methodParameters, string serverName, string methodName, ref LocationData.LocationTransactionData transaction)
        {
            XmlConfig.XmlConfigDoc  xml;
            XmlConfig.XmlConfigNode root;
            //SEND HTTP POST AND HANDLE RESPONSE
            StreamWriter myWriter = null;
            string       TransactionResult = "0", ResponseMessage, strPost = ""; //TransactionResult needs to be initialized to something so that you know for sure when it is empty

            //because that indicates a successful confirmation message.
            foreach (string key in methodParameters.AllKeys)
            {
                strPost += ("&" + key + "=" + methodParameters[key]);
            }
            strPost = strPost.TrimStart('&');

            HttpWebRequest serverReq = (HttpWebRequest)WebRequest.Create(serverName + "/" + methodName);

            serverReq.Method        = "POST";
            serverReq.ContentLength = strPost.Length;
            serverReq.ContentType   = "application/x-www-form-urlencoded";

            try
            {
                //send data
                myWriter = new StreamWriter(serverReq.GetRequestStream());
                myWriter.Write(strPost);
                myWriter.Close();

                //receive response
                HttpWebResponse serverResponse = (HttpWebResponse)serverReq.GetResponse();

                using (StreamReader sr = new StreamReader(serverResponse.GetResponseStream()))
                {
                    TransactionResult = sr.ReadToEnd();
                    // Close and clean up the StreamReader
                    sr.Close();
                }

                //write the response to a file
                File.WriteAllText("temp1.xml", TransactionResult, Encoding.UTF8);
                xml = new XmlConfig.XmlConfigDoc("temp1.xml");
                XmlNamespaceManager xnsm = new XmlNamespaceManager(xml.xmlDoc.NameTable);
                xnsm.AddNamespace("ns", "Chevin.WebServices.SafePak");
                root = xml.GetNode("ns:Result", xnsm);

                //
                //Deal with transactionresult file
                switch (methodName)
                {
                case "Reservation":
                    if (root.GetValue("ns:ReturnCode", xnsm).ToString() == "1")
                    {
                        Program.logEvent("Reservation Number Accepted.");
                        //set the box number
                        transaction.BoxNumber = int.Parse(root.GetValue("ns:Box", xnsm));
                        Program.logEvent("Box Number = " + transaction.BoxNumber);
                        //set the taking/returning status
                        string action = root.GetValue("ns:action", xnsm).ToString();
                        if (action.ToUpper() == "COLLECTING")
                        {
                            transaction.ReturningKey = false;
                            Program.logEvent("Key has COLLECTING status");
                        }
                        else if (action.ToUpper() == "RETURNING")
                        {
                            transaction.ReturningKey = true;
                            Program.logEvent("Key has RETURNING status");
                        }


                        //set the given transaction number
                        int transnumindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "Transaction"); });
                        Program.logEvent("transnumindex = " + transnumindex.ToString());
                        transaction.ObjectList[transnumindex].data = root.GetValue("ns:TransactionNumber", xnsm).ToString();
                        Program.logEvent("Trasnaction Number = " + transaction.ObjectList[transnumindex].data.ToString());
                    }
                    else
                    {
                        //error occurred
                        Program.logEvent("Check Reservation Error: " + root.GetValue("ns:Error", xnsm).ToString());
                        Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Check Reservation Error: " + root.GetValue("ns:Error", xnsm).ToString(), "", 0);
                        return(false);
                    }
                    break;

                case "TransactionComplete":
                    //needs to be checked for the "OK" response
                    if (root.GetValue("ns:ReturnCode", xnsm).ToString() == "1")    //(TransactionResult == "HTTP/1.1 200 OK")
                    {
                        Program.logEvent("Transaction Complete Message Accepted");
                    }
                    else
                    {
                        Program.logEvent("Transaction Complete Error: " + TransactionResult);
                        int transnumindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "Transaction"); });
                        Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, transaction.ObjectList[transnumindex].data.ToString(), DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Transaction Complete Error: " + root.GetValue("ns:Error", xnsm).ToString(), "", 0);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ResponseMessage = ex.Message;
                Program.logEvent(DateTime.Now.ToString() + "  " + ex.Message);
                return(false);
            }
            finally
            {
                if (myWriter != null)
                {
                    myWriter.Close();
                }
                //if (File.Exists("temp1.xml"))
                //    File.Delete("temp1.xml");
            }

            return(true);
        }
示例#9
0
 /// <summary>
 /// This method allows for the customer to be able to remotely confirm their reservation. It is designed to be
 /// customized by each customer (or left alone if it is unnecessary) to send out to where the reservation data
 /// is stored and get a yes/no answer back whether or not the reservation is valid.
 /// </summary>
 /// <param name="reservationNum"></param>
 /// <returns></returns>
 internal virtual bool confirmReservation(ref LocationData.LocationTransactionData transaction)
 {
     return(true);
 }
示例#10
0
 /// <summary>
 /// This method gives the ability for the customer to show customizable content and have customizable retrieval
 /// of reservation data for the user to confirm.
 /// </summary>
 /// <returns>a bool which states whether or not the data retrieval was successful</returns>
 internal virtual bool showReservationData(ref LocationData.LocationTransactionData transaction, ref YesNoForm ReservationConfirmScreen)
 {
     return(true);
 }
示例#11
0
 /// <summary>
 /// This method should allow the program to take the user-input odometer reading and go out to the reservation server and test
 /// to see if the driver drove more than the pre-defined (Program.MILEAGE_DIFFERENCE_ACCEPTABLE) amount, or if the odometer entry
 /// is less than the amount entered by the last renter, both of which most likely indicates that they entered the wrong number.
 /// </summary>
 /// <param name="Odometer"></param>
 /// <returns></returns>
 internal virtual bool validateOdometerReading(LocationData.LocationTransactionData transaction)
 {
     return(true);
 }
示例#12
0
 internal virtual bool makeHTTPPost(HTTPPostType MethodType, string extradata1, string extradata2, string extradata3, ref LocationData.LocationTransactionData transaction)
 {
     return(true);
 }
示例#13
0
        internal override bool confirmReservation(ref LocationData.LocationTransactionData transaction)
        {
            int                    intReturnValue = 0;
            SqlCommand             comm           = new SqlCommand(); //This is needed because there is no public contructor for SqlParameterCollection
            SqlParameterCollection Parameters     = comm.Parameters;
            SqlParameterCollection ReturnParameters;

            try
            {
                if (!transaction.ReturningKey)
                {
                    //Add Input Values
                    Parameters.Add(Program.SqlManager.CreateParameter("ResvNum", ParameterDirection.Input, transaction.AccessCode, SqlDbType.VarChar));
                    Parameters.Add(Program.SqlManager.CreateParameter("KioskDateOut", ParameterDirection.Input, String.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now), SqlDbType.VarChar));
                    Parameters.Add(Program.SqlManager.CreateParameter("KioskNumOut", ParameterDirection.Input, Program.KIOSK_ID.PadLeft(4, '0'), SqlDbType.VarChar));
                    //Add Return Value
                    Parameters.Add(Program.SqlManager.CreateParameter("Return_Val", ParameterDirection.ReturnValue, 0, SqlDbType.Int));

                    ReturnParameters = Program.SqlManager.SqlStoredProcedure("SPA_TestResvNum", Parameters);
                    if (ReturnParameters == null) //Error msg already given by SQLManager
                    {
                        return(false);
                    }

                    //set the return code (of the stored procedure) to the results sent back.
                    intReturnValue = (int)ReturnParameters["Return_Val"].Value;

                    switch (intReturnValue)
                    {
                    case 1:
                        //Success
                        return(true);

                    case 2:
                        //Failure: Reservation does not exist
                        Program.ShowErrorMessage("Sorry Your Entry Did\r\nNot Find A Match\r\nPlease Re-Enter Or\r\nCall " + Program.SERVICE_MANAGER_NUMBER, 5000);
                        Program.logEvent("Reservation Confirmation Error: Reservation Does not exist");
                        Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Reservation Confirmation Error: Reservation Does not exist", "", 0);
                        return(false);

                    case 3:
                        //Failure: Current Date is not correct for your reservation
                        Program.ShowErrorMessage("Sorry Your Entry Did\r\nNot Find A Match\r\nPlease Re-Enter Or\r\nCall " + Program.SERVICE_MANAGER_NUMBER, 5000);
                        Program.logEvent("Reservation Confirmation Error: The pickup date for the reservation is not the current date");
                        Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Reservation Confirmation Error: The pickup date for the reservation is not the current date", "", 0);
                        return(false);

                    case 4:
                        //Failure: Reservation is for a different key cabinet
                        Program.ShowErrorMessage("Sorry Your Entry Did\r\nNot Find A Match\r\nPlease Re-Enter Or\r\nCall " + Program.SERVICE_MANAGER_NUMBER, 5000);
                        Program.logEvent("Reservation Confirmation Error: The Reservation is not for this kiosk location");
                        Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Reservation Confirmation Error: The Reservation is not for this kiosk location", "", 0);
                        return(false);
                    }
                }
                else
                {
                    //Add Input Values
                    Parameters.Add(Program.SqlManager.CreateParameter("ResvNum", ParameterDirection.Input, transaction.AccessCode, SqlDbType.VarChar));
                    Parameters.Add(Program.SqlManager.CreateParameter("KioskDateIn", ParameterDirection.Input, String.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now), SqlDbType.VarChar));
                    Parameters.Add(Program.SqlManager.CreateParameter("KioskNumIn", ParameterDirection.Input, Program.KIOSK_ID.PadLeft(4, '0'), SqlDbType.VarChar));
                    //Add Return Value
                    Parameters.Add(Program.SqlManager.CreateParameter("Return_Val", ParameterDirection.ReturnValue, 0, SqlDbType.Int));

                    ReturnParameters = Program.SqlManager.SqlStoredProcedure("SPA_TestResvRtn", Parameters);
                    if (ReturnParameters == null) //Error msg already given by SQLManager
                    {
                        return(false);
                    }

                    //set the return code (of the stored procedure) to the results sent back.
                    intReturnValue = (int)ReturnParameters["Return_Val"].Value;

                    switch (intReturnValue)
                    {
                    case 1:
                        //Success
                        if (transaction.ReturningKey)
                        {
                            YesNoForm yesno = new YesNoForm("");
                            return(getBoxNum(ref transaction, ref yesno));
                        }

                        return(true);

                    case 15:
                        //Failure: Reservation does not exist
                        Program.ShowErrorMessage("Sorry Your Entry Did\r\nNot Find A Match\r\nPlease Re-Enter Or\r\nCall " + Program.SERVICE_MANAGER_NUMBER, 5000);
                        Program.logEvent("Reservation Return Confirmation Error: Reservation Does not exist");
                        Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Reservation Return Confirmation Error: Reservation Does not exist", "", 0);
                        return(false);

                    case 16:
                        //Failure: Reservation is for a different key cabinet
                        Program.ShowErrorMessage("Sorry Your Entry Did\r\nNot Find A Match\r\nPlease Re-Enter Or\r\nCall " + Program.SERVICE_MANAGER_NUMBER, 5000);
                        Program.logEvent("Reservation Return Confirmation Error: The Reservation is not for this kiosk location");
                        Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Reservation Return Confirmation Error: The Reservation is not for this kiosk location", "", 0);
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                //An application exception was thrown - process/display exception.
                Program.logEvent("GENERAL EXCEPTION:" + "ReservationConfirmation: " + ex.Message);
                Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "GENERAL EXCEPTION:" + "ReservationConfirmation: " + ex.Message, "", 0);
                return(false);
            }
            return(true);
        }
示例#14
0
        internal override bool validateOdometerReading(LocationData.LocationTransactionData transaction)
        {
            int intReturnValue = 0;
            OregonStateUTransactionData thistransaction = new OregonStateUTransactionData();

            thistransaction = (OregonStateUTransactionData)transaction;
            SqlCommand             comm       = new SqlCommand(); //This is needed because there is no public contructor for SqlParameterCollection
            SqlParameterCollection Parameters = comm.Parameters;
            SqlParameterCollection ReturnParameters;

            try
            {
                //Add Input Params
                Parameters.Add(Program.SqlManager.CreateParameter("ResvNum", ParameterDirection.Input, thistransaction.AccessCode, SqlDbType.VarChar));
                Parameters.Add(Program.SqlManager.CreateParameter("OperNum", ParameterDirection.Input, thistransaction.OperatorNumber, SqlDbType.VarChar));
                Parameters.Add(Program.SqlManager.CreateParameter("KioskDateIn", ParameterDirection.Input, String.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now), SqlDbType.VarChar));
                Parameters.Add(Program.SqlManager.CreateParameter("KioskNumIn", ParameterDirection.Input, Program.KIOSK_ID.PadLeft(4, '0'), SqlDbType.VarChar));
                Parameters.Add(Program.SqlManager.CreateParameter("MileageEnd", ParameterDirection.Input, thistransaction.Odometer, SqlDbType.Int));
                Parameters.Add(Program.SqlManager.CreateParameter("MileageDiff", ParameterDirection.Input, Program.MILEAGE_DIFFERENCE_ALLOWED, SqlDbType.Int));
                //Add Return Value
                Parameters.Add(Program.SqlManager.CreateParameter("Return_Val", ParameterDirection.ReturnValue, 0, SqlDbType.Int));

                ReturnParameters = Program.SqlManager.SqlStoredProcedure("SPA_TestMileageIn", Parameters);

                if (ReturnParameters == null) //Error msg already given by SQLManager
                {
                    return(false);
                }

                //set the return code (of the stored procedure) to the results sent back.
                intReturnValue = (int)ReturnParameters["Return_Val"].Value;

                switch (intReturnValue)
                {
                case 1:
                    //Success
                    Program.logEvent("Odometer Reading Verified Successfully");
                    return(true);

                case 10:
                    //Failure
                    Program.ShowErrorMessage("Sorry Your Entry Did\r\nNot Find A Match\r\nPlease Re-Enter Or\r\nCall " + Program.SERVICE_MANAGER_NUMBER, 5000);
                    Program.logEvent("Failure - can't find transaction data row - perhaps RES_KEY table reservation row does not exist");
                    Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Failure - can't find transaction data row - perhaps RES_KEY table reservation row does not exist", "", 0);
                    return(false);

                case 11:
                    //Failure here is now deemed unnecessary. A note is made of it and we move on. 4/26/13
                    Program.logEvent("Odometer Reading: Was too far based on MILEAGE_DIFFERENCE_ALLOWED or it was less than or equal to the previous odometer reading");
                    //MessageStrings.OdometerError();
                    //Thread.Sleep(4000);
                    //Program.logEvent("Odometer Reading Rejected: Either it was too far based on MILEAGE_DIFFERENCE_ALLOWED or it was less than or equal to the previous odometer reading");
                    Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "Odometer Reading Rejected: Either it was too far based on MILEAGE_DIFFERENCE_ALLOWED or it was less than or equal to the previous odometer reading", "", 0);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                //An application exception was thrown - process/display exception.
                Program.logEvent("GENERAL EXCEPTION:" + "ReservationConfirmation: " + ex.Message);
                Program.SqlManager.ErrorDatabaseEntry(transaction.AccessCode, "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "GENERAL EXCEPTION:" + "ReservationConfirmation: " + ex.Message, "", 0);
                return(false);
            }
            return(false);
        }
示例#15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="MethodType"></param>
        /// <param name="extradata1"></param>
        /// <param name="extradata2"></param>
        /// <param name="extradata3">This parameter is used to hold four boolean pieces of data</param>
        /// <returns></returns>
        internal override bool makeHTTPPost(HTTPPostType MethodType, string extradata1, string extradata2, string extradata3, ref LocationData.LocationTransactionData transaction)
        {
            //ErrorForm commwithserver = Program.ShowMessage("Communicating with\r\nServer...");
            string methodtype = "";
            NameValueCollection methodparams = new NameValueCollection();

            string securityToken = getDaimlerSecurityToken();

            if (securityToken == "")
            {
                Program.logEvent("Daimler Security Token Error");
                return(false);
            }

            switch (MethodType)
            {
            case HTTPPostType.CheckReservation:
                methodtype = "Reservation";
                methodparams.Add("kioskLocation", Program.KIOSK_ID);
                methodparams.Add("reservationNumber", extradata1.ToUpper());     //any alpha characters in the res number must be capitals
                methodparams.Add("accessToken", securityToken);
                break;

            case HTTPPostType.KeyOut:
                methodtype = "TransactionComplete";
                methodparams.Add("kioskLocation", Program.KIOSK_ID);
                methodparams.Add("transactionNumber", extradata1);
                methodparams.Add("reservationNumber", extradata2.ToUpper());
                methodparams.Add("status", "SUCCESS");
                methodparams.Add("accessToken", securityToken);
                break;

            case HTTPPostType.TransactionFail:
                int transnumindex = transaction.ObjectList.FindIndex(0, delegate(LocationTransactionData.TransactionDataObject ltd) { return(ltd.name == "Transaction"); });
                string TNumber = transaction.ObjectList[transnumindex].data.ToString();

                methodtype = "TransactionComplete";
                methodparams.Add("kioskLocation", Program.KIOSK_ID);
                methodparams.Add("transactionNumber", TNumber);
                methodparams.Add("reservationNumber", transaction.AccessCode.ToUpper());
                methodparams.Add("status", "FAIL");
                methodparams.Add("accessToken", securityToken);
                break;

            case HTTPPostType.RFIDInventory:
                methodtype = "RFIDInventory";
                methodparams.Add("kioskLocation", Program.KIOSK_ID);
                methodparams.Add("inventory", extradata1);
                methodparams.Add("accessToken", securityToken);
                break;
            }
            bool ret = PostWAWaterData(methodparams, Program.CUSTOMER_DATA_SERVER, methodtype, ref transaction);

            //commwithserver.Dispose();
            return(ret);
        }
        public bool GenerateReport(LocationData.LocationTransactionData TransactionData, ReportType type)
        {
            bool firstpass = true;

            try
            {
                //
                //This needs to be rewritten in a generic manner using the Object List for the
                //current location.
                //
                //
                StringBuilder sb = new StringBuilder();

                sb.AppendLine("Key cabinet " + type.ToString() + " report");

                if (type == ReportType.Email)
                {
                    sb.AppendLine();
                }

                sb.AppendLine("Kiosk ID: " + Program.KIOSK_ID);
                if (type == ReportType.Email)
                {
                    sb.AppendLine();
                }

                if (TransactionData.AccessCode != "0")
                {
                    sb.Append("Access Code: " + TransactionData.AccessCode);
                }

                sb.AppendLine();

                if (firstpass) //this will catch all of the data bits which should only be used
                {              //once in each receipt
                    firstpass = false;
                    foreach (LocationData.LocationTransactionData.TransactionDataObject t in TransactionData.ObjectList)
                    {
                        if (t.UseOnceInReceipt && t.UseInReceipt)
                        {
                            sb.AppendFormat("{0}: {1}\r\n", new string[] { t.name, t.data.ToString() });
                        }
                    }
                }
                if (type == ReportType.Email)
                {
                    sb.AppendLine();
                }
                //This will catch all data bits which need to be repeated for each box opening.
                //Currently the code does not allow for multiple openings per transaction so this won't do anything
                //but it is possible it will be used in the future.
                foreach (LocationData.LocationTransactionData.TransactionDataObject t in TransactionData.ObjectList)
                {
                    if (!t.UseOnceInReceipt && t.UseInReceipt)
                    {
                        sb.AppendFormat("{0}: {1}\r\n", t.name, t.data);
                    }
                }

                if (TransactionData.CardNumber != "")
                {
                    sb.AppendFormat("Card Number {0} \r\n", TransactionData.CardNumber);
                }

                if (TransactionData.CardName != "")
                {
                    sb.AppendFormat("Card Name {0} \r\n", TransactionData.CardName);
                }

                //find if any of the customer screens asked if they were taking or returning a key
                if (Program.locationdata.CustomerScreenOrderList.Find(delegate(CustomerScreen cs) { return(cs.Type == CustomerScreenType.ReturningQuestion); }) != null)
                {   //if the program doesn't ask the user if they are returning a key, then the receipt shouldn't
                    //say anything about it.
                    if (TransactionData.ReturningKey)
                    {
                        sb.AppendLine("Key Returned.");
                    }
                    else
                    {
                        sb.AppendLine("Key Taken.");
                    }
                }


                sb.AppendFormat("Box {0} ", TransactionData.BoxNumber);
                if (TransactionData.DoorOpened == true)
                {
                    sb.AppendLine("was opened");
                }
                else
                {
                    sb.AppendLine("failed to open");
                }
                sb.AppendFormat("At {0} on {1}\r\n", TransactionData.Time, TransactionData.Date);


                report = sb.ToString();

                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception("EmailerManager:GenerateReport exception-" + ex.Message);
            }
        }