Esempio n. 1
0
        public void Process(BTRRequest request, ref ResponseCloseBooking response)
        {
            SQLServer server = new SQLServer();

            response.JobID   = int.Parse(request.JobID);
            response.Action  = request.Action;
            response.Request = "CloseProcessed";

            if (request.Action == "C")
            {
                decimal originalQuote   = decimal.Parse(request.OriginalQuote);
                decimal extWaiting      = decimal.Parse(request.ExtWaiting);
                decimal extParking      = decimal.Parse(request.ExtParking);
                decimal extTolls        = decimal.Parse(request.ExtTolls);
                decimal extAmendment    = decimal.Parse(request.ExtAmendment);
                decimal extPhone        = decimal.Parse(request.ExtPhone);
                decimal extCancellation = decimal.Parse(request.ExtCancellation);
                float   totalHours      = float.Parse(request.TotalHours);

                if (server.updCloseJobs(int.Parse(request.JobID), request.Action, originalQuote, extWaiting, extParking, extTolls, extAmendment, extPhone, extCancellation, request.ExtReason, totalHours))
                {
                    response.ErrorCode = 0;
                    response.ErrorDesc = "NA";
                    response.Request   = "OK";
                }
                else
                {
                    response.ErrorCode = 9000;
                    response.ErrorDesc = "Failed to update Db";
                    response.Request   = "Error";
                }
            }
            else
            {
                // Add decline code here
                if (request.Action == "R")
                {
                    response.ErrorCode = 0;
                    response.ErrorDesc = "NA";
                    response.Request   = "OK";
                }
                else
                {
                    response.ErrorCode = 9000;
                    response.ErrorDesc = "Action not valid";
                    response.Request   = "Error";
                }
            }

            return;
        }
Esempio n. 2
0
 public void Process(BTRRequest request, ref ResponseAvailableJobs response)
 {
     try
     {
         SQLServer server = new SQLServer();
         ParseAvailableJobs(server.GetAvailableJobs(), ref response, request.UserID);
         response.Result    = "OK";
         response.ErrorDesc = "NA";
         response.ErrorCode = 0;
     }
     catch (Exception exc)
     {
         response.Result    = "ERROR";
         response.ErrorDesc = exc.Message;
         response.ErrorCode = 9000;
         Log.LogToFile("Process:" + exc.Message + exc.StackTrace + exc.Source);
     }
     return;
 }
Esempio n. 3
0
        public static BTRRequest Deserialize(string xmlBTRResponse)
        {
            xmlBTRResponse = xmlBTRResponse.Replace("[PR&D]", "[PR&D]");

            //xmlBTRResponse = "<?xml version=\"1.0\">" + xmlBTRResponse;
            XmlSerializer xs            = new XmlSerializer(typeof(BTRRequest));
            MemoryStream  memoryStream  = new MemoryStream(StringToUTF8ByteArray(xmlBTRResponse));
            XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
            BTRRequest    resultObj     = null;

            try
            {
                resultObj = (BTRRequest)xs.Deserialize(memoryStream);
            }
            catch (Exception exc)
            {
                throw new Exception("Exception while trying to Deserialize Request: " + exc.Message, exc);
            }
            return(resultObj);
        }
Esempio n. 4
0
        public void Process(BTRRequest request, ref ResponseConfirmReceived response)
        {
            SQLServer sqlserver = new SQLServer();
            string    trancode  = request.TransCode;

            // Check if trancode has already been recieved
            sqlserver.UpdateTransaction(trancode + "-" + request.UserID);

            foreach (BTRRequest.JobDetail jobDetail in request.JobDetailArray)
            {
                sqlserver.UpdateTransactionDetail(trancode + "-" + request.UserID, jobDetail.Jobid, jobDetail.Action);

                // Add code here to move Successfully actions into Inprogress and Failures into Waiting
            }

            response.TransCode = trancode;
            response.Result    = "OK";
            response.ErrorCode = 0;
            response.ErrorDesc = "NA";

            return;
        }