Beispiel #1
0
        public ChartDataModel GetOrganStateData(int?organId)
        {
            ChartDataModel result = new ChartDataModel(); //{ Titles = new List<string>(), Datas = new List<int>() };

            if (organId == null)                          //SysAdmin
            {
                var item        = new OrganDataProvider().GetPosition("", "");
                var alarmcount  = item.Where(n => n.State == 0).Count();
                var normalcount = item.Where(n => n.State == 1).Count();
                result.Titles = new List <string> {
                    "异常网点", "正常网点"
                };
                result.Datas = new List <int> {
                    alarmcount, normalcount
                };
            }
            else
            {
                var list = new OrganBusiness().GetChildren(organId.Value);

                var alarmcount  = list.FindAll(n => n.State != 1).Count;
                var normalcount = list.Count - alarmcount;
                result.Titles = new List <string> {
                    "异常网点", "正常网点"
                };
                result.Datas = new List <int> {
                    alarmcount, normalcount
                };
            }
            return(result);
        }
Beispiel #2
0
        public ChartDataModel GetOrganlData(int?organId)
        {
            string         haslinesql = "select o.Id,o.`Name`,COUNT(o.Id) as 'Linecount' from tb_organization as o INNER  JOIN tb_line as l on o.Id=l.OrganizationId GROUP BY o.Id";
            string         nolinesql  = "SELECT o.`Name`,'0' as 'LineCount' from tb_organization as o where 1=1 ";//AND o.Id NOT IN @Id
            ChartDataModel result     = new ChartDataModel()
            {
                Titles = new List <string>(), Datas = new List <int>()
            };
            var haslinelist = new OrganBusiness().GetBySql(haslinesql, null);

            result.Titles = haslinelist.Select(n => n.Name).ToList();
            result.Datas  = haslinelist.Select(n => n.LineCount).ToList();
            var haslineIdArray = haslinelist.Select(n => n.Id).ToArray();
            var nolineList     = new OrganBusiness().GetBySql(haslineIdArray.Length > 0 ? $"{nolinesql} AND o.Id NOT IN @Id" : nolinesql, new { Id = haslineIdArray }).ToList();

            if (nolineList != null)
            {
                nolineList.ForEach(n =>
                {
                    result.Titles.Add(n.Name);
                    result.Datas.Add(n.LineCount);
                });
            }

            return(result);
        }
Beispiel #3
0
        public void SysConfigEdit(string sysName, string rootName, string defaultPassword)
        {
            Dictionary <string, string> updates = new Dictionary <string, string>();

            updates.Add("SysName", sysName);
            updates.Add("RootName", rootName);
            updates.Add("DefaultPassword", defaultPassword);
            _sysprovider.Update(updates);

            //同时修改组织机构
            //new OrganBusiness().Update(new OrganModel() { Id=1, Description = rootName, Name = rootName, State = 1, ParentId = 0 });
            var model = new OrganBusiness().GetParentNode();

            if (model != null)
            {
                model.Name        = rootName;
                model.Description = rootName;
                new OrganBusiness().Update(model);
            }
        }