예제 #1
0
        public List <ServiceListModel> GetService()
        {
            List <ServiceListModel> Models = new List <ServiceListModel>();

            base.Connect();
            DataTable dt = base.Select("SELECT[S_Id],[Subject],[Show_Menu],[Deleted],[Active] FROM [tbl_Services]");

            base.DC();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var model = new ServiceListModel()
                {
                    Num      = i + 1,
                    S_Id     = Convert.ToInt32(dt.Rows[i]["S_Id"]),
                    Deleted  = Convert.ToInt32(dt.Rows[i]["Deleted"]),
                    Subject  = dt.Rows[i]["Subject"].ToString(),
                    ShowMenu = Convert.ToInt32(dt.Rows[i]["Show_Menu"]),
                    Active   = Convert.ToInt32(dt.Rows[i]["Active"])
                };
                Models.Add(model);
            }

            return(Models);
        }
예제 #2
0
        public async Task <IActionResult> Index()
        {
            ServiceListModel model = new ServiceListModel();

            model.ServiceList = await _serviceBLL.GetListAsync();

            return(View(model));
        }
예제 #3
0
        public ActionResult Services()
        {
            var serviceList = new ServiceListModel
            {
                ServiceList = ServiceList
            };

            return(View(serviceList));
        }
        public PostInstallViewModel()
        {
            LoadedPanelEnabled = false;

            HostService             = new HostServiceModel();
            RadeonScheduledTaskList = new ScheduledTaskListModel();
            ServiceList             = new ServiceListModel();
            InstalledList           = new InstalledListModel();
            TempFileList            = new TempFileListModel();
        }
예제 #5
0
        // GET: Service/List/5
        public ActionResult List(int id)
        {
            try
            {
                ServiceListModel model = new ServiceListModel(id);
                if (model.servicesModel != null && model.servicesModel.group != null)
                {
                    ViewBag.Title = model.servicesModel.group.Name;
                }

                return(View(model));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static async Task RemoveService(ServiceModel consulService, ServiceListModel service)
        {
            HttpResponseMessage content;
            var host = $"{consulService.ConsulServerAddress}/v1/agent/service/deregister/{service.Service.ID}";

            using (var client = new HttpClient())
            {
                content = await client.PutAsync(host, new StringContent("", Encoding.UTF8, "text/plain"));
            }

            if (content.IsSuccessStatusCode)
            {
                Console.WriteLine($"Health Check Failed for ID: {service.Service.ID}. Removed from the Service list.");
            }
            else
            {
                Console.WriteLine($"Health Check Failed for ID: {service.Service.ID}. Failed to Remove from the Service list.");
            }
        }
예제 #7
0
        //private static ServiceListModel _services = null;

        //public void LoadData(object sender, InitiateEventArgs e)
        //{
        //    Load();
        //}

        //public void Subscribe(MasterDataInitiater evenSource)
        //{
        //    evenSource.InitiateEvent += new InitiateEventHandler(LoadData);
        //    evenSource.ActionEvent += new Action<object, InitiateEventArgs>(LoadData);
        //}

        //public void UnSubscribe(MasterDataInitiater evenSource)
        //{
        //    evenSource.InitiateEvent -= new InitiateEventHandler(LoadData);
        //    evenSource.ActionEvent -= new Action<object, InitiateEventArgs>(LoadData);
        //}

        public ServiceListModel GetAllServices(string salongCode)
        {
            //数据库检索
            ServiceListModel _services = new ServiceListModel();

            using (var context = new ApplicationDbContext())
            {
                _services.ServiceGroups = new List <ServiceGroupModel>();

                var list1 = context.ServiceGroups.OrderBy(m => m.ShowIndex).ToList();

                foreach (var item in list1)
                {
                    ServiceGroupModel model = new ServiceGroupModel();
                    ModelHelper.CopyModel(model, item);
                    _services.ServiceGroups.Add(model);
                }

                _services.Services = new Dictionary <string, List <ServiceModel> >();
                var list2 = context.SalonServices.Where(s => s.SalonCode == salongCode).Include(s => s.Service).ToList();

                foreach (var item in _services.ServiceGroups)
                {
                    var services = new List <ServiceModel>();
                    var list3    = list2.Select(s => s.Service).Where(m => m.GroupCode == item.Code).ToList();
                    foreach (var item1 in list3)
                    {
                        ServiceModel model = new ServiceModel();
                        ModelHelper.CopyModel(model, item1);
                        services.Add(model);
                    }
                    if (services.Count > 0)
                    {
                        _services.Services.Add(item.Code, services);
                        item.IsShow = true;
                    }
                }
            }
            return(_services);
            //Load();
            //return _services;
        }
        public static async Task <int> CheckWebApiHealth(ServiceListModel service)
        {
            var    host = $"http://{service.Service.Address}:{service.Service.Port}/api/health";
            string response;

            try
            {
                using (var client = new HttpClient())
                {
                    var get = await client.GetAsync(host);

                    response = await get.Content.ReadAsStringAsync();
                }

                return(Convert.ToInt32(response));
            }
            catch (Exception e)
            {
                return(0);
            }
        }
예제 #9
0
        public virtual ServiceListModel PrepareListModel(ServiceSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            var entities = _serviceService.GetAll(name: searchModel.SearchName,
                                                  pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize,
                                                  showHidden: true);

            //prepare list model
            var model = new ServiceListModel
            {
                //fill in model values from the entity
                Data  = entities.Select(x => x.ToModel <ServiceModel>()),
                Total = entities.TotalCount
            };

            return(model);
        }
예제 #10
0
        public ActionResponseModel Get(int id)
        {
            ActionResponseModel response = new ActionResponseModel();

            response.Error = new List <string>();

            try
            {
                ServiceListModel result;
                var businessId = _personnel.GetByEmail(User.Identity.Name).BusinessId;
                var service    = _servicesService.Get(id);

                if (businessId != service.BusinessId)
                {
                    response.Error.Add("Service not found");
                }


                if (response.Error.Count() > 0)
                {
                    response.Success = false;
                    response.Result  = null;
                }
                else
                {
                    result           = new ServiceListModel(service);
                    response.Success = true;
                    response.Result  = result;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Error.Add(ex.Message);
            }
            return(response);
        }
예제 #11
0
        public ActionResult List(GridCommand command, ServiceListModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
                return AccessDeniedView();

            var Services = _serviceService.GetAllServices(model.SearchServiceName,pageIndex: command.Page - 1,pageSize: command.PageSize);
            var gridModel = new GridModel<ServiceModel>
            {
                Data = Services.Select(x =>
                {
                    var m = x.ToModel();
                    m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc);
                    return m;
                }),
                Total = Services.TotalCount
            };
            return new JsonResult
            {
                Data = gridModel
            };
        }
예제 #12
0
        public ActionResult List()
        {
            var model = new ServiceListModel();

            return View(model);
        }