private void AuthenticatedUser(string firstname, string lastname, string email, string uid, string authProvider)
        {
            var client = new FirstForRentalsService();

            var userType = client.GetUserAuthorization(uid, firstname, lastname, email);

            var emailHash     = GetMD5Hash(email);
            var gravatarImage = HttpUtility.UrlEncode("http://www.gravatar.com/avatar/" + emailHash + "?d=mm&s=70").ToString();

            var user = new FirstForRentalsUser
            {
                FirstName   = firstname,
                LastName    = lastname,
                FullName    = firstname + " " + lastname,
                Email       = email,
                Uid         = uid,
                Provider    = authProvider,
                GravatarUrl = gravatarImage,
                UserType    = userType.ToString()
            };


            HttpCookie retroUserCredentials = new HttpCookie("FirstForRentalsUserCredentials", user.ToJson())
            {
                Expires = DateTime.Now.AddDays(30)
            };

            Response.Cookies.Add(retroUserCredentials);
            Response.Redirect("./Home.aspx");
        }
Пример #2
0
        void GetFaults(CallbackParameterContainer instructionSet)
        {
            var client       = new FirstForRentalsService();
            var resultString = client.GetCarFaultsOverview(int.Parse(instructionSet.Parameters[0].ToString()));

            returnObject = new CallbackReturnContainer("ReturnVehicleFaults");
            returnObject.Parameters.Add(resultString);
        }
Пример #3
0
        //

        void GetVehicleAlerts()
        {
            var client       = new FirstForRentalsService();
            var resultString = client.GetRentalAlerts();

            returnObject = new CallbackReturnContainer("ReturnVehicleAlerts");
            returnObject.Parameters.Add(resultString);
        }
Пример #4
0
        void GetVehicleStatus(CallbackParameterContainer instructionSet)
        {
            var client       = new FirstForRentalsService();
            var resultString = client.GetVehicleStatus(instructionSet.Parameters[0].ToString());

            returnObject = new CallbackReturnContainer("VehicleStatus");
            returnObject.Parameters.Add(resultString);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var client = new FirstForRentalsService();

                var seasonalGraphResponse = client.GetSeasonalVariationGraph();
                var popularityGraphResponse = client.GetVehiclePopularityGraph();
                var incomeTrendGraphResponse = client.GetIncomeTrendGraph();

                ClientScript.RegisterClientScriptBlock(this.GetType(), "seasonalVariationKey", "var seasonalVariation = " + seasonalGraphResponse, true);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "popularityGraphKey", ";var popularityGraph = " + popularityGraphResponse, true);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "incomeTrendGraphKey", ";var incomeTrendGraph = " + incomeTrendGraphResponse, true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var client = new FirstForRentalsService();

                var seasonalGraphResponse    = client.GetSeasonalVariationGraph();
                var popularityGraphResponse  = client.GetVehiclePopularityGraph();
                var incomeTrendGraphResponse = client.GetIncomeTrendGraph();

                ClientScript.RegisterClientScriptBlock(this.GetType(), "seasonalVariationKey", "var seasonalVariation = " + seasonalGraphResponse, true);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "popularityGraphKey", ";var popularityGraph = " + popularityGraphResponse, true);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "incomeTrendGraphKey", ";var incomeTrendGraph = " + incomeTrendGraphResponse, true);
            }
        }
        //
        private void AddRental(CallbackParameterContainer instructionSet)
        {
            var client = new FirstForRentalsService();
            var collection = RentalCollection.ReturnObject(instructionSet.Parameters[0]);

            var rentailId = client.InsertRental("1",collection.RentalId,collection.StartDate,collection.EndDate,collection.StartDestination,collection.EndDestination);

            var status = client.InsertPayment(rentailId, collection.RentalDate, collection.StartDestination, collection.EndDestination, collection.RentalAmount,
                                collection.InsuranceAmount,collection.ExtrasAmount,collection.VatAmount,collection.TotalAmount,
                                collection.DepositAmount,collection.DepositStatus,collection.PaymentStatus);

            if(status){
                returnObject = new CallbackReturnContainer("VehicleRentalAdded");
            }
        }
Пример #8
0
        void AddFault(CallbackParameterContainer instructionSet)
        {
            int car;

            if (Int32.TryParse(instructionSet.Parameters[0].ToString(), out car))
            {
            }

            DateTime faultDate;

            if (DateTime.TryParse(instructionSet.Parameters[1].ToString(), out faultDate))
            {
            }

            string faultDetail = instructionSet.Parameters[2];

            decimal faultAmount = decimal.Parse(instructionSet.Parameters[3].ToString(), CultureInfo.InvariantCulture);

            bool faultServiceSuspension;

            bool.TryParse(instructionSet.Parameters[4].ToString(), out faultServiceSuspension);

            bool faultInsuranceClaim;

            bool.TryParse(instructionSet.Parameters[5].ToString(), out faultInsuranceClaim);

            string faultInsuranceClaimStatus;

            if (faultInsuranceClaim == true)
            {
                faultInsuranceClaimStatus = "Submitted";
            }
            else
            {
                faultInsuranceClaimStatus = "";
            }

            var client   = new FirstForRentalsService();
            var response = client.InsertVehicleFault(car, faultDate, faultDetail, faultAmount, faultServiceSuspension, faultInsuranceClaim, faultInsuranceClaimStatus);

            if (response)
            {
                returnObject = new CallbackReturnContainer("VehicleFaultAdded");
            }
            else
            {
            }
        }
        //

        private void AddRental(CallbackParameterContainer instructionSet)
        {
            var client     = new FirstForRentalsService();
            var collection = RentalCollection.ReturnObject(instructionSet.Parameters[0]);

            var rentailId = client.InsertRental("1", collection.RentalId, collection.StartDate, collection.EndDate, collection.StartDestination, collection.EndDestination);

            var status = client.InsertPayment(rentailId, collection.RentalDate, collection.StartDestination, collection.EndDestination, collection.RentalAmount,
                                              collection.InsuranceAmount, collection.ExtrasAmount, collection.VatAmount, collection.TotalAmount,
                                              collection.DepositAmount, collection.DepositStatus, collection.PaymentStatus);

            if (status)
            {
                returnObject = new CallbackReturnContainer("VehicleRentalAdded");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            customerSearchOption.ClientIDMode = ClientIDMode.Static;
            paymentSearchOption.ClientIDMode = ClientIDMode.Static;
            rentalSearchOption.ClientIDMode = ClientIDMode.Static;

            var client = new FirstForRentalsService();

            var customerResponse = client.GetCustomers();
            var paymentResponse = client.GetPayments();
            var rentalResponse = client.GetRentals();

            customerSearchOption.InnerHtml = customerResponse;
            paymentSearchOption.InnerHtml = paymentResponse;
            rentalSearchOption.InnerHtml = rentalResponse;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            customerSearchOption.ClientIDMode = ClientIDMode.Static;
            paymentSearchOption.ClientIDMode  = ClientIDMode.Static;
            rentalSearchOption.ClientIDMode   = ClientIDMode.Static;

            var client = new FirstForRentalsService();

            var customerResponse = client.GetCustomers();
            var paymentResponse  = client.GetPayments();
            var rentalResponse   = client.GetRentals();

            customerSearchOption.InnerHtml = customerResponse;
            paymentSearchOption.InnerHtml  = paymentResponse;
            rentalSearchOption.InnerHtml   = rentalResponse;
        }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Hookup Client Side Event Handlers
                ClientScriptManager cm = Page.ClientScript;
                String cbReference     = cm.GetCallbackEventReference(this, "arg", "ReceiveServerData", "");
                String callbackScript  = "function CallServer(arg, context) {" + cbReference + "; }";
                cm.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true);
                //

                var client           = new FirstForRentalsService();
                var overviewResponse = client.GetCarsOverview();

                ClientScript.RegisterClientScriptBlock(this.GetType(), "carOverviewKey", "var carOverview = " + overviewResponse, true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Hookup Client Side Event Handlers
                ClientScriptManager cm = Page.ClientScript;
                String cbReference = cm.GetCallbackEventReference(this, "arg","ReceiveServerData", "");
                String callbackScript = "function CallServer(arg, context) {" + cbReference + "; }";
                cm.RegisterClientScriptBlock(this.GetType(),"CallServer", callbackScript, true);
                //

                var client = new FirstForRentalsService();
                var overviewResponse = client.GetCarsOverview();

                ClientScript.RegisterClientScriptBlock(this.GetType(), "carOverviewKey", "var carOverview = " + overviewResponse, true);

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Hookup Client Side Event Handlers
                ClientScriptManager cm = Page.ClientScript;
                String cbReference     = cm.GetCallbackEventReference(this, "arg", "ReceiveServerData", "");
                String callbackScript  = "function CallServer(arg, context) {" + cbReference + "; }";
                cm.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true);
                //

                string contextClass = Page.RouteData.Values["contextClass"].ToString();

                var client = new FirstForRentalsService();
                var carCollectionResponse = client.GetCarsByClass(contextClass);

                ClientScript.RegisterClientScriptBlock(this.GetType(), "carCollectionKey", "var carCollectionByClass = " + carCollectionResponse, true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Hookup Client Side Event Handlers
                ClientScriptManager cm = Page.ClientScript;
                String cbReference = cm.GetCallbackEventReference(this, "arg", "ReceiveServerData", "");
                String callbackScript = "function CallServer(arg, context) {" + cbReference + "; }";
                cm.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true);
                //

                string contextClass = Page.RouteData.Values["contextClass"].ToString();

                var client = new FirstForRentalsService();
                var carCollectionResponse = client.GetCarsByClass(contextClass);

                ClientScript.RegisterClientScriptBlock(this.GetType(), "carCollectionKey", "var carCollectionByClass = " + carCollectionResponse, true);
            }
        }
        void AddFault(CallbackParameterContainer instructionSet)
        {
            int car;
            if(Int32.TryParse(instructionSet.Parameters[0].ToString(),out car))
            {

            }

            DateTime faultDate;
            if(DateTime.TryParse(instructionSet.Parameters[1].ToString(),out faultDate))
            {

            }

            string faultDetail = instructionSet.Parameters[2];

            decimal faultAmount = decimal.Parse(instructionSet.Parameters[3].ToString(),CultureInfo.InvariantCulture);

            bool faultServiceSuspension;
            bool.TryParse(instructionSet.Parameters[4].ToString(), out faultServiceSuspension);

            bool faultInsuranceClaim;
            bool.TryParse(instructionSet.Parameters[5].ToString(), out faultInsuranceClaim);

            string faultInsuranceClaimStatus;
            if(faultInsuranceClaim == true)
            {
                faultInsuranceClaimStatus = "Submitted";
            }else {
                faultInsuranceClaimStatus = "";
            }

            var client = new FirstForRentalsService();
            var response = client.InsertVehicleFault(car,faultDate,faultDetail,faultAmount,faultServiceSuspension,faultInsuranceClaim,faultInsuranceClaimStatus);

            if (response)
            {
                returnObject = new CallbackReturnContainer("VehicleFaultAdded");
            }
            else
            {

            }
        }
        void GetFaults(CallbackParameterContainer instructionSet)
        {
            var client = new FirstForRentalsService();
            var resultString = client.GetCarFaultsOverview(int.Parse(instructionSet.Parameters[0].ToString()));

            returnObject = new CallbackReturnContainer("ReturnVehicleFaults");
            returnObject.Parameters.Add(resultString);
        }
        //
        void GetVehicleAlerts()
        {
            var client = new FirstForRentalsService();
            var resultString = client.GetRentalAlerts();

            returnObject = new CallbackReturnContainer("ReturnVehicleAlerts");
            returnObject.Parameters.Add(resultString);
        }
        void GetVehicleStatus(CallbackParameterContainer instructionSet)
        {
            var client = new FirstForRentalsService();
            var resultString = client.GetVehicleStatus(instructionSet.Parameters[0].ToString());

            returnObject = new CallbackReturnContainer("VehicleStatus");
            returnObject.Parameters.Add(resultString);
        }
        private void AuthenticatedUser(string firstname, string lastname, string email, string uid , string authProvider)
        {
            var client = new FirstForRentalsService();

            var userType = client.GetUserAuthorization(uid,firstname,lastname,email);

            var emailHash = GetMD5Hash(email);
            var gravatarImage = HttpUtility.UrlEncode("http://www.gravatar.com/avatar/" + emailHash + "?d=mm&s=70").ToString();

            var user = new FirstForRentalsUser
                           {
                               FirstName = firstname,
                               LastName = lastname,
                               FullName = firstname + " " + lastname,
                               Email = email,
                               Uid = uid,
                               Provider = authProvider ,
                               GravatarUrl = gravatarImage,
                               UserType = userType.ToString()
                           };

            HttpCookie retroUserCredentials = new HttpCookie("FirstForRentalsUserCredentials", user.ToJson()) { Expires = DateTime.Now.AddDays(30) };
            Response.Cookies.Add(retroUserCredentials);
            Response.Redirect("./Home.aspx");
        }