/// <summary>
        /// Handles Authenticate message
        /// </summary>
        /// <param name="ct"></param>
        /// <param name="hi"></param>
        /// <returns></returns>
        public string Authenticate(HttpListenerContext ct, ActionInfo hi)
        {
            // Get an Object from the request.
            AuthenticationCredentials AuthCredentials = GetRequestObject <AuthenticationCredentials>(ct);

            DataLogics DataBase = new DataLogics();

            bool loginSucess = DataBase.Authenticate(AuthCredentials.UserName, AuthCredentials.Password);

            // The return result.
            AuthenticationResult result = new AuthenticationResult();

            if (!loginSucess)
            {
                result.Status = AuthenticationStatus.Failed;
                return(GetResponseString <AuthenticationResult>(result, ct));
            }

            // Login is okej. Lets continue.
            result.Status = AuthenticationStatus.Success;
            // Always create a new sessionCookie on Authenticate.
            Cookie SessionCookie = HttpUtils.NewSessionCookie(ct.Request.Url.Host);

            // Add Cookie to Cookies list.
            sessionCookies.Add(SessionCookie);
            // Send cookie to client.
            ct.Response.SetCookie(SessionCookie);
            // result.ClientDeviceSecret = guid.ToString();
            if (DataBase.SaveCookie(SessionCookie.Value, AuthCredentials.UserName))
            {
                Logger.Error(String.Format("Couldn't save sessionCookie {0} for user {1} to database", SessionCookie.ToString(), AuthCredentials.UserName));
            }

            return(GetResponseString <AuthenticationResult>(result, ct));
        }
        /// GET: AccountAdmin/Edit/5
        /// <summary>
        /// Gets an account for editing.
        /// </summary>
        /// <param name="id"> The id. </param>
        /// <returns> The <see cref="ActionResult"/>. </returns>
        public ActionResult Edit(int id)
        {
            var logics = new DataLogics();
            //ViewBag.ServiceProviders = new SelectList(logics.GetServiceProviders(string.Empty), "Id", "Name");
            var user = this.userAccounts.GetUserForAdmin(id);

            return(this.View(user));
        }
        public string ActivateCustomer(HttpListenerContext ct, ActionInfo hi)
        {
            //activate customer.
            var        paramList   = hi.GetParameterList(ct.Request.RawUrl);
            long       customerId  = paramList["customerId"];
            DataLogics logicsLayer = new DataLogics();
            bool       result      = logicsLayer.ActivateCustomer(customerId.ToString());

            return(GetResponseString <Boolean>(result, ct));
        }
        public ActionResult Details(int id, int?locationId)
        {
            DatabaseToWebServiceProvider dbConverter = new DatabaseToWebServiceProvider();
            var dataLogics = new DataLogics();
            WebsiteServiceProvider provider = dbConverter.GetServiceProvider(id);
            var categories = dataLogics.GetWebsiteCategories();

            categories.Sort((category1, category2) => category1.Name.CompareTo(category2.Name));
            ViewBag.AllCategories = categories;

            return(this.View(provider));
        }
        public string CreateCustomer(HttpListenerContext ct, ActionInfo hi)
        {
            Customer cust = GetRequestObject <Customer>(ct);

            Logger.Debug(cust.ToString());

            DataLogics logicsLayer = new DataLogics();

            Customer CustResult = logicsLayer.CreateCustomer(cust);

            return(GetResponseString <Customer>(CustResult, ct));
        }
        public string GetAllCustomers(HttpListenerContext ct, ActionInfo hi)
        {
            DataLogics logicsLayer = new DataLogics();
            var        result      = logicsLayer.SelectAllCustomers();

            CustomerCollection cc = new CustomerCollection();

            foreach (var cust in result)
            {
                cc.Add(cust);
            }

            return(GetResponseString <CustomerCollection>(cc, ct));
        }
        // GET: PersonalResources

        /// <summary>
        /// Get all the personal resources for display.
        /// </summary>
        /// <returns> The <see cref="ActionResult"/>. </returns>
        public ActionResult Index(string family, string category)
        {
            if (!string.IsNullOrEmpty(family) || !string.IsNullOrEmpty(category))
            {
                return(this.View("ServiceProviderList"));
            }

            var familiesLogic = new FamiliesLogic();
            var dataLogics    = new DataLogics();

            var viewModel = new PersonalResourcesViewModel
            {
                General = familiesLogic.GetFamilies().OrderBy(fam => fam.Name).ToList(),
                Crime   = dataLogics.GetCrimeCategories().OrderBy(crime => crime.Name).ToList()
            };

            return(this.View(viewModel));
        }
        public void MyTestInitialize()
        {
            this.target = new DataLogics();

            this.websiteCountry = new WebsiteCountry {
                Abbreviation = "OH", FullName = "Ohio", Id = 1
            };
            this.websiteState = new WebsiteState {
                Id = 1, Name = "OH"
            };
            this.websiteCounty = new WebsiteCounty {
                Id = 1, Name = "test"
            };
            this.websiteCategory = new ProviderServiceCategory
            {
                Active      = true,
                Name        = "Test",
                ID          = 1,
                Description = "this is a test",
                Crime       = false
            };
        }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppLawEnforcementController"/> class.
 /// </summary>
 public AppLawEnforcementController()
 {
     this.dataLogic = new DataLogics();
     this.lawEnforcementProviderLogic = new LawEnforcementProviderQueryLogics();
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppDataController"/> class.
 /// </summary>
 public AppDataController()
 {
     this.dataLogic            = new DataLogics();
     this.familiesLogic        = new FamiliesLogic();
     this.serviceProviderLogic = new ServiceProviderQueryLogics();
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppCompensationController"/> class.
 /// </summary>
 public AppCompensationController()
 {
     this.dataLogic = new DataLogics();
     this.compensationProviderLogic = new CompensationProviderQueryLogics();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceProviderController"/> class.
 /// </summary>
 public ServiceProviderController()
 {
     this.dataLogics = new DataLogics();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AppVeteransController"/> class.
 /// </summary>
 public AppVeteransController()
 {
     this.dataLogic            = new DataLogics();
     this.veteranProviderLogic = new VeteranProviderQueryLogics();
 }