예제 #1
0
        public async Task <IActionResult> Update(string id, ConfigurationEndPoint info)
        {
            if (info == null)
            {
                return(BadRequest($"{nameof(info)}参数校检错误"));
            }
            if (id != info.Id)
            {
                return(BadRequest($"{nameof(info.Id)}参数不一致"));
            }
            if (string.IsNullOrWhiteSpace(info.Key))
            {
                return(BadRequest($"{nameof(info.Key)}参数校检错误"));
            }
            if (string.IsNullOrWhiteSpace(info.Key))
            {
                return(BadRequest($"{nameof(info.Value)}参数校检错误"));
            }
            var res = await services.UpdateConfiguration(info);

            DashboardResult dashboardResult = new DashboardResult();

            dashboardResult.code = 0;
            dashboardResult.data = res;
            return(Ok(dashboardResult));
        }
예제 #2
0
        public async Task <ActionResult <DashboardResult> > Dashboard(long MasterSubCategoryId, long MasterBranchId)
        {
            try
            {
                List <ProductDetailResult> AssetsCategoryList       = _IDashboardInterface.GetAllASMasterCategory().ToList();
                List <ProductDetailResult> AssetsSubCategoryList    = _IDashboardInterface.GetAllASMasterSubCategory(MasterSubCategoryId, MasterBranchId).ToList();
                List <ProductDetailResult> MicrosoftSubCategoryList = _IDashboardInterface.GetAllMicrosoftSubCategory().ToList();

                DashboardResult objDashboardResult = new DashboardResult();
                objDashboardResult.AssetsCategoryList    = AssetsCategoryList;
                objDashboardResult.AssetsSubCategoryList = AssetsSubCategoryList;


                objDashboardResult.TotalAssetsInStock = AssetsSubCategoryList.Sum(a => a.TotalAssetsInStock);
                objDashboardResult.AssetsAssign       = AssetsSubCategoryList.Sum(a => a.AssetsAssign);
                objDashboardResult.AssetsInRepair     = AssetsSubCategoryList.Sum(a => a.AssetsInRepair);


                objDashboardResult.TotalLaptopInStock = AssetsSubCategoryList.Where(a => a.MasterSubCategoryId == 1).Sum(a => a.TotalAssetsInStock);
                objDashboardResult.LaptopAssign       = AssetsSubCategoryList.Where(a => a.MasterSubCategoryId == 1).Sum(a => a.AssetsAssign);
                objDashboardResult.LaptopInRepair     = AssetsSubCategoryList.Where(a => a.MasterSubCategoryId == 1).Sum(a => a.AssetsInRepair);


                objDashboardResult.MicrosoftInStock  = MicrosoftSubCategoryList.Sum(a => a.TotalAssetsInStock);
                objDashboardResult.MicrosoftAssign   = MicrosoftSubCategoryList.Sum(a => a.AssetsAssign);
                objDashboardResult.MicrosoftInExpire = MicrosoftSubCategoryList.Sum(a => a.ServiceInExpire);

                return(objDashboardResult);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(null);
        }
예제 #3
0
        public async Task <IActionResult> Delete(string id)
        {
            var res = await services.DeleteConfiguration(id.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToArray());

            DashboardResult dashboardResult = new DashboardResult();

            dashboardResult.code = 0;
            dashboardResult.data = res;
            return(Ok(dashboardResult));
        }
예제 #4
0
        public async Task <IActionResult> QueryFirst(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(BadRequest($"{nameof(id)}参数校检失败"));
            }
            var info = await services.QueryFirstConfiguration(id);

            DashboardResult dashboardResult = new DashboardResult();

            dashboardResult.code = 0;
            dashboardResult.data = info;
            return(Ok(dashboardResult));
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var model = new DashboardResult
            {
                sumSupplier = CatalogBLL.Supplier_Count(""),
                sumCustomer = CatalogBLL.Customer_Count(""),
                sumShipper  = CatalogBLL.Shipper_Count(""),
                sumCategory = CatalogBLL.Category_Count(""),
                sumProduct  = CatalogBLL.Product_Count("", "", ""),
                sumOrder    = SaleManagementBLL.Order_Count("", ""),
                sumEmployee = HumanResourceBLL.Employee_Count("", "")
            };

            return(View(model));
        }
예제 #6
0
        public static DashboardResult TransformToDashboardResult(UrlConfiguration configuration)
        {
            if (configuration.UrlTestStatuses == null)
            {
                configuration.UrlTestStatuses = new List <UrlTestStatus>();
            }

            var lastStatus = configuration.UrlTestStatuses.FirstOrDefault();

            var result = new DashboardResult
            {
                Id          = configuration.Id,
                Description = configuration.Description,
            };

            if (lastStatus == default(UrlTestStatus))
            {
                result.LastStatus = Status[2];
            }
            else
            {
                result.LastStatus = lastStatus.Succeeded ? Status[0] : Status[1];
                result.LastUpdate = lastStatus.CompletedDateTime;

                if (configuration.Enabled)
                {
                    var nextTick = Math.Ceiling(DateTime.Now.AddMinutes(1).Minute / (configuration.ScheduleTime * 1.0));
                    var minutes  = (int)(nextTick * configuration.ScheduleTime);
                    var now      = DateTime.Now;


                    if (minutes >= 60)
                    {
                        now     = now.AddHours(1);
                        minutes = 0;
                    }

                    result.NextUpdate = new DateTime(now.Year,
                                                     now.Month,
                                                     now.Day,
                                                     now.Hour,
                                                     minutes,
                                                     0);
                }
            }

            return(result);
        }
예제 #7
0
        public DashboardResult Get(string id)
        {
            DashboardResult result = new DashboardResult
            {
                Id     = id,
                Title  = "My Application",
                Groups = new List <BuildResultGroup>
                {
                    new BuildResultGroup
                    {
                        Title  = "Frontend builds",
                        Builds = new List <BuildResult>
                        {
                            new BuildResult {
                                Title = "Component A"
                            },
                            new BuildResult {
                                Title = "Component B"
                            },
                            new BuildResult {
                                Title = "Component C"
                            },
                        }
                    },
                    new BuildResultGroup
                    {
                        Title  = "Backend builds",
                        Builds = new List <BuildResult>
                        {
                            new BuildResult {
                                Title = "Service A"
                            },
                            new BuildResult {
                                Title = "Service B"
                            },
                            new BuildResult {
                                Title = "Service C"
                            },
                        }
                    }
                }
            };

            return(result);
        }
예제 #8
0
 public Task TestEnded(DashboardResult dashboardResult)
 {
     return(Clients.All.SendAsync("TestEnded", dashboardResult));
 }