Ejemplo n.º 1
0
 /// <summary>
 /// Задать прямую по её коэффициентам из уравнения ax+by+c=0
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <param name="c"></param>
 public Line2D(double a, double b, double c, EquType t = EquType.Other)
 {
     A = a;
     B = b;
     C = c;
     Modif(t);
 }
Ejemplo n.º 2
0
 public static void UpdateEquType(this EquType item, EquTypeVM itemVM)
 {
     item.Name        = itemVM.Name;
     item.DisplayName = itemVM.DisplayName;
     item.Standards   = itemVM.Standards;
     item.Price       = itemVM.Price;
     item.Description = itemVM.Description;
 }
Ejemplo n.º 3
0
        public static void Update(EquTypeVM item)
        {
            EquType dbItem = GetSingleById(item.Id);

            dbItem.UpdateEquType(item);
            RepositoryBase <EquType> .Update(dbItem);

            RepositoryBase <EquType> .SaveChanges();
        }
Ejemplo n.º 4
0
        public static void SetBlocked(string Id, bool value, string StaffID)
        {
            EquType model = GetSingleById(Id);

            model.Blocked = value;

            model.UpdatedDate = DateTime.Now;
            model.UpdatedBy   = StaffID;
            RepositoryBase <EquType> .SaveChanges();
        }
Ejemplo n.º 5
0
        public static void SetActived(string Id, bool value)
        {
            EquType model = RepositoryBase <EquType> .GetSingleById(Id);

            model.Actived = value;

            model.UpdatedDate = DateTime.Now;
            model.UpdatedBy   = HttpContext.Current.User.Identity.Name;
            RepositoryBase <EquType> .SaveChanges();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Задать прямую, находящуюся относительно указанной прямой и указанной точки в заданном соотношении
 /// </summary>
 /// <param name="line"></param>
 /// <param name="p"></param>
 /// <param name="m"></param>
 public Line2D(Line2D line, Point p, Mode m, EquType t = EquType.Other)
 {
     if (m == Mode.Parallel)
     {
         A = line.A; B = line.B;
         C = -A * p.x - B * p.y;
     }
     else
     {
         A = -line.B;
         B = line.A;
         C = -line.A * p.y + line.B * p.x;
     }
     Modif(t);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 读取设备集合(Type数值:设备类型:1;设备:2)
        /// </summary>
        private void GetEquTypeAndEquTree()
        {
            string         equJsonStr     = JesonOperateHelper.ReadJesonFile("EquList.json");
            string         equTypeJsonStr = JesonOperateHelper.ReadJesonFile("EquTypeList.json");
            List <Equ>     equList        = JsonConvert.DeserializeObject(equJsonStr, typeof(List <Equ>)) as List <Equ>;
            List <EquType> equTypeList    = JsonConvert.DeserializeObject(equTypeJsonStr, typeof(List <EquType>)) as List <EquType>;
            var            rootTypes      = (from r in equTypeList where string.IsNullOrEmpty(r.ParentId) select r).ToList();

            if (rootTypes.Count > 0)
            {
                EquType         rootType = rootTypes.First();//获取根节点
                ComBoxTreeModel rootNode = new ComBoxTreeModel()
                {
                    Id = rootType.Id, Code = rootType.Code, Type = IoConfigParam.Type_EquType, Name = rootType.Name
                };
                #region 加载设备信息
                var             equs = equList.Where(p => p.EquTypeId == rootType.Id).ToList();
                ComBoxTreeModel etemp;
                foreach (var equ in equs)
                {
                    etemp = new ComBoxTreeModel()
                    {
                        Id     = equ.Id,
                        Code   = equ.Code,
                        Name   = equ.Name,
                        Type   = IoConfigParam.Type_Equ,
                        Parent = rootNode
                    };
                    rootNode.Child.Add(etemp);
                }
                #endregion
                InitTreeObjects(rootNode, rootType.Child, equList);
                var             list      = from r in rootNode.Child select new TreeNode().Parse(r, () => r.Name, () => r.Child);
                List <TreeNode> final     = new List <TreeNode>();
                TreeNode        rootNode1 = new TreeNode(rootNode.Name, list)
                {
                    Target = new ComBoxTreeModel()
                    {
                        Child = rootNode.Child, Id = rootNode.Id, Code = rootNode.Code, Name = rootNode.Name, Type = rootNode.Type, Parent = rootNode.Parent
                    }
                };
                final.Add(rootNode1);
                comboBoxItemSource = CovertToTree.CovertObjToTree(final, ref comboBoxTreeList);
            }
        }
Ejemplo n.º 8
0
        public static EquType Add(EquTypeVM item)
        {
            EquType dbItem = new EquType();

            dbItem.UpdateEquType(item);

            dbItem.Id      = item.Id;
            dbItem.Actived = item.Actived;

            dbItem.CreatedDate = DateTime.Now;
            dbItem.CreatedBy   = HttpContext.Current.User.Identity.Name;

            EquType model = RepositoryBase <EquType> .Add(dbItem);

            RepositoryBase <EquType> .SaveChanges();

            return(dbItem);
        }
Ejemplo n.º 9
0
 private void Modif(EquType t = EquType.Other)
 {
     if (A == 0 && B == 0)
     {
         throw new Exception("Главные коэффициенты оба равны 0!");
     }
     if (A <= 0 && B <= 0 && C <= 0)
     {
         A *= -1; B *= -1; C *= -1;
     }
     if (t == EquType.Other)
     {
         if (LineType == Type.Other)
         {
             GiveDivisionByNOD();
         }
     }
     else
     {
         double d = new Complex(A, B).Abs;
         A /= d; B /= d; C /= d;
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 生成设备json文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateEquJesonFile_Click(object sender, RoutedEventArgs e)
        {
            IList <EquType> equTypes = new List <EquType>();
            EquType         rootType = new EquType()
            {
                Id = "01", Code = "EquType", Name = "设备类型"
            };
            EquType dType = new EquType()
            {
                Id = "0101", Code = "Led", Name = "灯", ParentId = "01"
            };
            //EquType hdType = new EquType() { Id = "010101", Code = "RedLed", Name = "红灯", ParentId = "0101" };
            //EquType ldType = new EquType() { Id = "010102", Code = "GreenLed", Name = "绿灯", ParentId = "0101" };
            EquType hwType = new EquType()
            {
                Id = "0102", Code = "InfraredCorrelation", Name = "红外对射", ParentId = "01"
            };

            //dType.Child.Add(hdType);
            //dType.Child.Add(ldType);
            rootType.Child.Add(dType);
            rootType.Child.Add(hwType);
            equTypes.Add(rootType);
            string equTypeJsonStr = JsonConvert.SerializeObject(equTypes);

            IList <Equ> equs = new List <Equ>();
            Equ         zhd  = new Equ()
            {
                EquTypeId = "0101", Name = "左红绿灯", Id = "1", Code = "LeftLed"
            };
            Equ yhd = new Equ()
            {
                EquTypeId = "0101", Name = "右红绿灯", Id = "2", Code = "RightLed"
            };
            //Equ zhd = new Equ() { EquTypeId = "010101", Name = "左红灯", Id = "1", Code = "LeftRedLed" };
            //Equ yhd = new Equ() { EquTypeId = "010101", Name = "右红灯", Id = "2", Code = "RightRedLed" };
            //Equ zld = new Equ() { EquTypeId = "010102", Name = "左绿灯", Id = "3", Code = "LeftGreenLed" };
            //Equ yld = new Equ() { EquTypeId = "010102", Name = "右绿灯", Id = "4", Code = "RightGreenLed" };
            Equ zhw = new Equ()
            {
                EquTypeId = "0102", Name = "左红外", Id = "3", Code = "LeftInfraredCorrelation"
            };
            Equ yhw = new Equ()
            {
                EquTypeId = "0102", Name = "右红外", Id = "4", Code = "RightInfraredCorrelation"
            };
            Equ qhw = new Equ()
            {
                EquTypeId = "0102", Name = "前红外", Id = "5", Code = "AheadInfraredCorrelation"
            };
            Equ hhw = new Equ()
            {
                EquTypeId = "0102", Name = "后红外", Id = "6", Code = "BehindInfraredCorrelation"
            };

            equs.Add(zhd);
            equs.Add(yhd);
            //equs.Add(zld);
            //equs.Add(yld);
            equs.Add(zhw);
            equs.Add(yhw);
            equs.Add(qhw);
            equs.Add(hhw);
            string equJsonStr = JsonConvert.SerializeObject(equs);

            JesonOperateHelper.WriteJesonFile("EquTypeList.json", equTypeJsonStr);
            JesonOperateHelper.WriteJesonFile("EquList.json", equJsonStr);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Задать прямую проходящую через две точки
 /// </summary>
 /// <param name="p1"></param>
 /// <param name="p2"></param>
 public Line2D(Point p1, Point p2, EquType t = EquType.Other) : this(p2.y - p1.y, p1.x - p2.x, p1.y *(p2.x - p1.x) - p1.x * (p2.y - p1.y), t)
 {
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Задать прямую через коэффициенты уравнения из y=ax+b
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 public Line2D(double a, double b, EquType t = EquType.Other) : this(-a, 1, -b, t)
 {
 }
Ejemplo n.º 13
0
        public WjParaBase(EquipmentParameter basepara)
        {
            //lvf 2019年4月17日11:18:27  一直为null 报错
            if (basepara == null)
            {
                return;
            }


            //this.AreaId = basepara.AreaId;
            this.DateCreate     = basepara.DateCreate;
            this.DateUpdate     = basepara.DateUpdate;
            this.RtuArgu        = basepara.RtuArgu;
            this.RtuFid         = basepara.RtuFid;
            this.RtuGisX        = basepara.RtuGisX;
            this.RtuGisY        = basepara.RtuGisY;
            this.RtuId          = basepara.RtuId;
            this.RtuInstallAddr = basepara.RtuInstallAddr;
            this.RtuMapX        = basepara.RtuMapX;
            this.RtuMapY        = basepara.RtuMapY;
            this.RtuModel       = basepara.RtuModel;
            this.RtuName        = basepara.RtuName;
            this.RtuStateCode   = basepara.RtuStateCode;
            this.RtuRemark      = basepara.RtuRemark;
            this.RtuPhyId       = basepara.RtuPhyId;
            this.Idf            = basepara.Idf;
            this.RtuRealState   = basepara.RtuRealState;
            //添加地区 lvf 2019年5月6日09:20:23
            this.RtuRegion = basepara.RtuRegion;


            EquipmentsThatAttachToThisRtu = new List <int>();

            if (this.RtuId < 1000000)
            {
                this.EquipmentType = EquType.UnKnown;
            }
            else if (this.RtuId < 1099999)
            {
                this.EquipmentType = EquType.Rtu;
            }
            else if (this.RtuId < 1199999)
            {
                this.EquipmentType = EquType.Ldu;
            }
            else if (this.RtuId < 1299999)
            {
                this.EquipmentType = EquType.Esu;
            }
            else if (this.RtuId < 1399999)
            {
                this.EquipmentType = EquType.Mru;
            }
            else if (this.RtuId < 1499999)
            {
                this.EquipmentType = EquType.Lux;
            }
            else if (this.RtuId < 1599999)
            {
                this.EquipmentType = EquType.Slu;
            }
            else if (this.RtuId < 1699999)
            {
                this.EquipmentType = EquType.Leak;
            }
            else
            {
                this.EquipmentType = EquType.UnKnown;
            }
        }