Exemple #1
0
        public ActionResult GetAddPoint(string pointId, string userId)
        {
            pointId = "2";
            userId  = "1";
            int addpoint = new PointBLL().AddPoint(Convert.ToInt32(pointId), Convert.ToInt32(userId), DateTime.Now);

            return(this.Content("添加成功!"));
        }
        public static void InitDB()
        {
            if (IsInited)
            {
                return;
            }
            UserBLL.Add(new Model.DBUser()
            {
                OpenID = "0001", BranchID = "001", Name = "唐赞飞", NickName = "飞", IsManager = true
            });
            UserBLL.Add(new Model.DBUser()
            {
                OpenID = "0002", BranchID = "001", Name = "唐观文", NickName = "唐观文", IsManager = true
            });
            UserBLL.Add(new Model.DBUser()
            {
                OpenID = "0003", BranchID = "001", Name = "欧阳石光", NickName = "时光", IsManager = false
            });

            BranchBLL.Add(new Model.DBBranch()
            {
                ID = "001", MasterID = "0002", Name = "县委组织部第一支部"
            });

            PointBLL.Add(new Model.DBPoint()
            {
                ID = "001", Name = "县委组织部会议室", QrCode = "XWZZBHYS", WifiName = "556", WifiMac = "FF-FF-FF-FF"
            });
            PointBLL.Add(new Model.DBPoint()
            {
                ID = "002", Name = "翡翠湾社区", QrCode = "FCWSQ", WifiName = "TPLink368E", WifiMac = "FF-FF-FF-FF"
            });
            PointBLL.Add(new Model.DBPoint()
            {
                ID = "003", Name = "凯旋城", QrCode = "KXC", WifiName = "TPLink368E", WifiMac = "FF-FF-FF-FF"
            });
            IsInited = true;
        }
Exemple #3
0
        private void GetTreeList(string type, string areaId)
        {
            dt = new DataTable();
            GetTreeList();
            string x     = "";
            string y     = "";
            string title = "";
            string id    = "";

            DataRow[] dr = dt.Select("TYPE='" + type + "' and PID='" + areaId + "'");

            for (int i = 0; i < dr.Length; i++)
            {
                if (i == 0)
                {
                    PTreeNodes += "{id:'" + dr[i][0] + "',pId:'" + dr[i][2] + "',name:'" + dr[i][1] + "',t:'" + dr[i][4] + "',open:true},";
                    if (dr[i][5].ToString() != "")
                    {
                        x     += dr[i][5] + ",";
                        y     += dr[i][6] + ",";
                        title += "'" + dr[i][1] + "',";
                        id    += "'" + dr[i][0] + "',";
                    }
                }
                else
                {
                    PTreeNodes += "{id:'" + dr[i][0] + "',pId:'" + dr[i][2] + "',name:'" + dr[i][1] + "',t:'" + dr[i][4] + "'},";
                    if (dr[i][5].ToString() != "")
                    {
                        x     += dr[i][5] + ",";
                        y     += dr[i][6] + ",";
                        title += "'" + dr[i][1] + "',";
                        id    += "'" + dr[i][0] + "',";
                    }
                }
            }



            PTreeNodes = PTreeNodes.TrimEnd(',');
            x          = x.TrimEnd(',');
            y          = y.TrimEnd(',');
            title      = title.TrimEnd(',');
            id         = id.TrimEnd(',');

            DataTable dtp = fbll.GetPointCompanyByPeriodID(id);

            x     = "[" + x + "]";
            y     = "[" + y + "]";
            title = "[" + title + "]";

            double[] winval     = null;
            double[] powerval   = null;
            string[] winpoint   = null;
            string[] powerpoint = null;
            PointBLL po         = new PointBLL();

            if (dtp != null && dtp.Rows.Count > 0)
            {
                winval     = new double[dtp.Rows.Count];
                powerval   = new double[dtp.Rows.Count];
                winpoint   = new string[dtp.Rows.Count];
                powerpoint = new string[dtp.Rows.Count];

                for (int i = 0; i < dtp.Rows.Count; i++)
                {
                    winpoint[i]   = dtp.Rows[i][0].ToString();
                    powerpoint[i] = dtp.Rows[i][1].ToString();
                }

                winval   = po.GetPointVal(winpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));
                powerval = po.GetPointVal(powerpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));
            }


            object obj = new
            {
                treeNode = PTreeNodes,
                x        = x,
                y        = y,
                win      = winval,
                power    = powerval,
                title    = title
            };

            string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

            Response.Write(result);
            Response.End();
        }
Exemple #4
0
        private void GetMap(string id)
        {
            DataTable dtmap = new DataTable();

            dtmap = fbll.GetPointByPeriodID(id);
            double[] winval     = null;
            double[] powerval   = null;
            double[] stateval   = null;
            string[] winpoint   = null;
            string[] powerpoint = null;
            string[] statepoint = null;
            //标杆
            int[] flag = null;

            string x     = "";
            string y     = "";
            string title = "";
            //场站名称
            string periodName = string.Empty;

            if (dtmap != null && dtmap.Rows.Count > 0)
            {
                winval     = new double[dtmap.Rows.Count];
                powerval   = new double[dtmap.Rows.Count];
                stateval   = new double[dtmap.Rows.Count];
                winpoint   = new string[dtmap.Rows.Count];
                powerpoint = new string[dtmap.Rows.Count];
                statepoint = new string[dtmap.Rows.Count];
                flag       = new int[dtmap.Rows.Count];
                if (dtmap.Rows[0]["T_PERIODDESC"] != DBNull.Value)
                {
                    string name = dtmap.Rows[0]["T_PERIODDESC"].ToString();
                    if (name != "全部")
                    {
                        periodName = dtmap.Rows[0]["T_PERIODDESC"].ToString();
                    }
                    else
                    {
                        periodName = dtmap.Rows[0]["T_ORGDESC"] != DBNull.Value ? dtmap.Rows[0]["T_ORGDESC"].ToString() : string.Empty;
                    }
                }
                else
                {
                    periodName = dtmap.Rows[0]["T_ORGDESC"] != DBNull.Value ? dtmap.Rows[0]["T_ORGDESC"].ToString() : string.Empty;
                }
                for (int i = 0; i < dtmap.Rows.Count; i++)
                {
                    winpoint[i]   = dtmap.Rows[i][2].ToString();
                    powerpoint[i] = dtmap.Rows[i][1].ToString();
                    statepoint[i] = dtmap.Rows[i][3].ToString();
                    flag[i]       = dtmap.Rows[i][6] != DBNull.Value?int.Parse(dtmap.Rows[i][6].ToString()):0;

                    x     += dtmap.Rows[i][4] + ",";
                    y     += dtmap.Rows[i][5] + ",";
                    title += dtmap.Rows[i][0] != DBNull.Value ? "'" + dtmap.Rows[i][0] + "'," : "' ',";
                }

                x     = x.TrimEnd(',');
                y     = y.TrimEnd(',');
                title = title.TrimEnd(',');

                x     = "[" + x + "]";
                y     = "[" + y + "]";
                title = "[" + title + "]";

                PointBLL po = new PointBLL();
                winval   = po.GetPointVal(winpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));
                powerval = po.GetPointVal(powerpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));
                stateval = po.GetPointVal(statepoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));
            }

            object obj = new
            {
                id         = ids,
                x          = x,
                y          = y,
                win        = winval,
                power      = powerval,
                state      = stateval,
                title      = title,
                flag       = flag,
                periodName = periodName
            };

            string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

            Response.Write(result);
            Response.End();
        }
Exemple #5
0
        private void GetMap(string id)
        {
            DataTable dtmap = new DataTable();
            dtmap = fbll.GetPointByPeriodID(id);
            double[] winval = null;
            double[] powerval = null;
            double[] stateval = null;
            string[] winpoint = null;
            string[] powerpoint = null;
            string[] statepoint = null;
            string x = "";
            string y = "";
            string title = "";

            if (dtmap != null && dtmap.Rows.Count > 0)
            {
                winval = new double[dtmap.Rows.Count];
                powerval = new double[dtmap.Rows.Count];
                stateval = new double[dtmap.Rows.Count];
                winpoint = new string[dtmap.Rows.Count];
                powerpoint = new string[dtmap.Rows.Count];
                statepoint = new string[dtmap.Rows.Count];

                for (int i = 0; i < dtmap.Rows.Count; i++)
                {
                    winpoint[i] = dtmap.Rows[i][2].ToString();
                    powerpoint[i] = dtmap.Rows[i][1].ToString();
                    statepoint[i] = dtmap.Rows[i][3].ToString();
                    x += dtmap.Rows[i][4] + ",";
                    y += dtmap.Rows[i][5] + ",";
                    title += "'" + dtmap.Rows[i][0] + "',";
                }

                x = x.TrimEnd(',');
                y = y.TrimEnd(',');
                title = title.TrimEnd(',');

                x = "[" + x + "]";
                y = "[" + y + "]";
                title = "[" + title + "]";

                PointBLL po = new PointBLL();
                winval = po.GetPointVal(winpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));
                powerval = po.GetPointVal(powerpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));
                stateval = po.GetPointVal(statepoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));

            }

            object obj = new
            {
                x = x,
                y = y,
                win = winval,
                power = powerval,
                state = stateval,
                title = title
            };

            string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
            Response.Write(result);
            Response.End();
        }