Esempio n. 1
0
        internal string GetBusinessCategoryName(int id)
        {
            BusinessCategoryService   businessCategoryService = new BusinessCategoryService();
            BusinessCategoryViewModel businessName            = businessCategoryService.getBusinessCategoryName(id);

            return(businessName.CategoryName);
        }
Esempio n. 2
0
 protected bool LoginStatus()
 {
     try
     {
         admin                        = GetAdminSession();
         this.adminService            = new AdminService(token);
         this.dashboardService        = new DashboardService(token);
         this.countryService          = new CountryService(token);
         this.timezoneService         = new TimezoneService(token);
         this.membershipService       = new MembershipService(token);
         this.businessCategoryService = new BusinessCategoryService(token);
         //if (string.IsNullOrEmpty(accessToken))
         //    return false;
         if (admin != null)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 3
0
        // GET: Common
        // private reviewItContext context;
        public SelectList GetAllBusinessCategory()
        {
            BusinessCategoryService businessCategoryService = new BusinessCategoryService();

            return(new SelectList(businessCategoryService.GetAllBusinessCategory(), "Value", "Text"));
            //return View();
        }
 protected bool LoginStatus()
 {
     try
     {
         RegisterViewModel            = GetAdminSession();
         this.CountryService          = new CountryService(Token);
         this.BusinessCategoryService = new BusinessCategoryService(Token);
         this.TimezoneService         = new TimezoneService(Token);
         this.MembershipService       = new MembershipService(Token);
         this.BusinessService         = new BusinessService(Token);
         this.BusinessEmployeeService = new BusinessEmployeeService(Token);
         this.BusinessHourService     = new BusinessHourService(Token);
         this.BusinessHolidayService  = new BusinessHolidayService(Token);
         //Call service;
         if (RegisterViewModel != null)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
        public HttpResponseMessage DeleteBusinessCategory(BusinessCategoryModel model)
        {
            IUnitOfWork uWork = new UnitOfWork();
            IBusinessCategoryRepository businessCategory        = new BusinessCategoryRepository(uWork);
            IBusinessCategoryService    businessCategoryService = new BusinessCategoryService(businessCategory);

            try
            {
                if (this.ModelState.IsValid)
                {
                    var result = businessCategoryService.DeleteBusinessCategory(model);
                    if (result != null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, result));
                    }
                    else
                    {
                        string message = "Not deleted successfully";
                        return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
            }
        }
        public HttpResponseMessage GetBusinessCategoryModels(BusinessCategoryModel model)
        {
            IUnitOfWork uWork = new UnitOfWork();
            IBusinessCategoryRepository businessCategory        = new BusinessCategoryRepository(uWork);
            IBusinessCategoryService    businessCategoryService = new BusinessCategoryService(businessCategory);

            try
            {
                if (this.ModelState.IsValid)
                {
                    var BusinessCategoryList = businessCategoryService.GetAllBusinessCategoryList(model);
                    if (BusinessCategoryList != null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, BusinessCategoryList));
                    }
                    else
                    {
                        string message = "Error in getting Data";
                        return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message));
            }
        }
Esempio n. 7
0
        public async Task <ActionResult> SubIndex(int?page, string search, int?id)
        {
            var model = new ServiceDataViewModel <IPagedList <BusinessCategoryViewModel> >();

            try
            {
                Session["HomeLink"] = "Business Sub Category";
                var pageNumber = page ?? 1;
                ViewBag.search = search;

                if (id.HasValue)
                {
                    ViewBag.ParentId = id.Value;
                }
                else
                {
                    return(RedirectToAction("Index"));
                }

                var response = await BusinessCategoryService.Gets();

                if (response.Status)
                {
                    var data = response.Data.Where(d => d.ParentId != null && d.ParentId == id.Value).ToList();
                    if (search == null)
                    {
                        if (data.Count > 0)
                        {
                            model.Data = data.ToPagedList <BusinessCategoryViewModel>(pageNumber, 10);
                        }
                        return(View(model));
                    }
                    else
                    {
                        model.Data = data.Where(d => d.Name.ToLower().Contains(search.ToLower())).ToList().ToPagedList(pageNumber, 5);
                        return(View(model));
                    }
                }
                else
                {
                    model.HasError = !response.Status;
                    model.Error    = response.Message;
                }
            }
            catch (Exception ex)
            {
                model.HasError         = true;
                model.Error            = "There was a problem. Please try again later.";
                model.HasMore          = true;
                model.ErrorDescription = ex.Message.ToString();
            }
            return(View(model));
        }
Esempio n. 8
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var status = LoginStatus();

            if (status)
            {
                filterContext.Result = RedirectToAction("Index", "Dashboard", new { area = "Admin" });
            }
            else
            {
                this.BusinessCategoryService = new BusinessCategoryService(this.Token);
                this.BusinessEmployeeService = new BusinessEmployeeService(this.Token);
            }
        }
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var status = this.LoginStatus();

            if (!status)
            {
                filterContext.Result = RedirectToAction("Index", "Login");
            }
            else
            {
                this.DashboardService        = new DashboardService(this.Token);
                this.BusinessCategoryService = new BusinessCategoryService(this.Token);
            }
        }
Esempio n. 10
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var status = this.LoginStatus();

            if (!status)
            {
                filterContext.Result = RedirectToAction("Login", "Home", new { area = "Admin" });
            }
            else
            {
                this.BusinessService         = new BusinessService(this.Token);
                this.TimezoneService         = new TimezoneService(this.Token);
                this.BusinessCategoryService = new BusinessCategoryService(this.Token);
                this.CountryService          = new CountryService(this.Token);
            }
        }