Пример #1
0
 private void SaveEdit_Click(object sender, RoutedEventArgs e)
 {
     ComboBoxItem type = (ComboBoxItem)this.Etype.SelectedItem;
     if (this.Ename.Text.Equals(""))
     {
         JXMessageBox.Show(this, "设备名称不准为空!", MsgImage.Error);
         return;
     }
     if (type.Tag.ToString().Equals(""))
     {
         JXMessageBox.Show(this, "非法操作!", MsgImage.Error);
         return;
     }
     RoomClass rc = new RoomClass();
     int state = rc.updateEquipmentInformation(int.Parse(this.ID.Content.ToString()), this.Ename.Text,
          int.Parse(type.Tag.ToString()));
     if (state == BaseRequest.SUCCESS)
     {
         Room roomBean = RoomManagerBean.Room;
         EquipmentClass ec = new EquipmentClass();
         DataSet set = ec.getEquipmentInformationByRoom(int.Parse(roomBean.roomId.Text));
         roomBean.page.ShowPages(roomBean.roomEquipment, set, BaseRequest.PAGE_SIZE);
         JXMessageBox.Show(this, "编辑信息已保存.", MsgImage.Success);
         this.Close();
     }
     else
     {
         JXMessageBox.Show(this, "保存失败!", MsgImage.Error);
     }
 }
Пример #2
0
 private void Handle_Click(object sender, RoutedEventArgs e)
 {
     TextRange _Text = new TextRange(this.Information.Document.ContentStart, this.Information.Document.ContentEnd);
     if (_Text.Text.Length > 150)
     {
         JXMessageBox.Show(this, "处理说明只能输入150个字符,请检查!", MsgImage.Error);
         return;
     }
     if (_Text.Text.Length <3 || _Text.Text.Equals(""))
     {
         JXMessageBox.Show(this, "请输入警报处理说明!", MsgImage.Error);
         return;
     }
    
     int Aid = int.Parse(this.Aid.Text);
     MessageBox.Show("id>>" + Aid.ToString() + "   _Text.Text=" + _Text.Text);
     RoomClass rc=new RoomClass();
     int state = rc.doAlarmInformation(Aid,_Text.Text);
     if (state == BaseRequest.SUCCESS)
     {
         Alarm alarm = RoomManagerBean.Alarm;
         RoomClass _Rclass = new RoomClass();
         DataSet _Alarm_Set = _Rclass.queryAlarmList();
         alarm.page.ShowPages(alarm.alarmGrid, _Alarm_Set, BaseRequest.PAGE_SIZE);
         JXMessageBox.Show(this, "警报处理完成!", MsgImage.Success);
         this.Close();
     }
     else
     {
         JXMessageBox.Show(this, "系统异常,请联系管理员!", MsgImage.Error);
     }
 }
Пример #3
0
 private void Details_Click(object sender, RoutedEventArgs e)
 {
     RoomClass rc=new RoomClass();
     var a = this.alarmGrid.SelectedItem;
     var b = a as DataRowView;
     int _Aid = Convert.ToInt32(b.Row[0]);
     MySqlDataReader reader = rc.getHistoryAlarmImformation(_Aid);
     AlarmDetails ad = new AlarmDetails();
     TextRange _Text = new TextRange(ad.Information.Document.ContentStart, ad.Information.Document.ContentEnd);
     if (reader.Read())
     {
         ad.number.Text = reader["NUMBER"].ToString();
         ad.Ename.Text = reader["NAME"].ToString();
         ad.Etype.Text = reader["TYPE_NAME"].ToString();
         ad.Atype.Text = reader["ALARM_TYPE_NAME"].ToString();
         ad.room.Text = reader["ROOM_NAME"].ToString();
         ad.Handle_User.Text = reader["USER_NAME"].ToString();
         ad.Handle_Time.Text = reader["PROCESSING_TIME"].ToString();
         ad.Alarm_Time.Text = reader["ALARM_TIME"].ToString();
         _Text.Text = reader["REMARK"].ToString();
         ad.title.Content = reader["NUMBER"] + "  历史报警信息:";
     }
     
     ad.Owner = Window.GetWindow(this);
     ad.ShowDialog();
 }
Пример #4
0
 private  void diplayAlrm_Tick(object sender, EventArgs e)
 {
     MyTransaction.insertAlarm();
     Alarm alarm = RoomManagerBean.Alarm;
     RoomClass _Rclass = new RoomClass();
     DataSet _Alarm_Set = _Rclass.queryAlarmList();
     alarm.page.ShowPages(alarm.alarmGrid, _Alarm_Set, BaseRequest.PAGE_SIZE);
 }
Пример #5
0
        /// <summary>
        /// Kiểm tra xem có tồn tại phòng tương ứng với type và class hay ko?
        /// </summary>
        /// <param name="roomType"></param>
        /// <param name="roomClass"></param>
        /// <returns></returns>
        public bool RoomCheckExist(RoomTypex roomType, RoomClass roomClass)
        {
            ICriteria criteria = _session.OpenSession().CreateCriteria(typeof(Room));

            criteria.Add(Expression.Eq(Room.ROOMCLASS, roomClass))
            .Add(Expression.Eq(Room.ROOMTYPE, roomType))
            .Add(Expression.Eq(Room.DELETED, false));
            return(criteria.List().Count > 0);
        }
Пример #6
0
        private void diplayAlrm_Tick(object sender, EventArgs e)
        {
            MyTransaction.insertAlarm();
            Alarm     alarm      = RoomManagerBean.Alarm;
            RoomClass _Rclass    = new RoomClass();
            DataSet   _Alarm_Set = _Rclass.queryAlarmList();

            alarm.page.ShowPages(alarm.alarmGrid, _Alarm_Set, BaseRequest.PAGE_SIZE);
        }
Пример #7
0
        /// <summary>
        /// Kiểm tra xem có tồn tại phòng tương ứng với type và class hay ko?
        /// </summary>
        /// <param name="roomType"></param>
        /// <param name="roomClass"></param>
        /// <returns></returns>
        public bool RoomCheckExist(RoomTypex roomType, RoomClass roomClass)
        {
            ICriteria criteria = _session.OpenSession().CreateCriteria(typeof(Room));

            criteria.Add(Expression.Eq("RoomClass", roomClass))
            .Add(Expression.Eq("RoomType", roomType))
            .Add(Expression.Eq("Deleted", false));
            return(criteria.List().Count > 0);
        }
Пример #8
0
        protected void Add_click(object sender, EventArgs e)
        {
            RoomClass   rc = new RoomClass();
            room_master r  = new room_master();

            r.roomtype = type_tb.Text;
            r.roomcost = Int32.Parse(Cost_tb.Text);
            rc.addRoom(r);
            Response.Redirect("AdminViewRoom.aspx");
        }
Пример #9
0
 protected void rptRoomClasses_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.DataItem is RoomClass)
     {
         _currentClass = (RoomClass)e.Item.DataItem;
         Repeater rptRoomTypes = (Repeater)e.Item.FindControl("rptRoomTypes");
         rptRoomTypes.DataSource = Module.RoomTypexGetAll();
         rptRoomTypes.DataBind();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                RoomClass rc = new RoomClass();

                GridView1.DataSource = rc.viewRooms();
                GridView1.DataBind();
            }
        }
Пример #11
0
    private void ShowRoom(RoomClass room)
    {
        for (int i = 0; i < room.VariationIndex.Length; i++)
        {
            AllSegments[i].Select(room.VariationIndex[i]);
        }
        SetAltarSegment(room.AltarSegment, room.Symbol);

        currentRoomId = room.Id;
    }
Пример #12
0
        public CreateGroupRequest(string name, GroupType groupType, RoomClass roomClass, params int[] lightIds) : base(0, new List <int>(lightIds), roomClass)
        {
            if (!lightIds.Any() && groupType != GroupType.Room)
            {
                throw new ArgumentException("Only groups of type \"room\" can be created without any lights in them.");
            }

            _method = HttpMethod.Post;
            NewName = name;
            Type    = groupType;
        }
 protected void rptClass_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.DataItem is RoomClass)
     {
         Repeater rptTypes = (Repeater)e.Item.FindControl("rptTypes");
         _roomClass = e.Item.DataItem as RoomClass;
         // Sử dụng biến toàn cục _roomClass để check với tất cả các room type
         rptTypes.DataSource = AllRoomTypes;
         rptTypes.DataBind();
     }
 }
Пример #14
0
 public RoomClass(int number, RoomClass parent, int x, int y)
 {
     this.number    = number;
     this.parent    = parent;
     this.x         = x;
     this.y         = y;
     this.neighbors = new Dictionary <Direction, RoomClass>();
     foreach (Direction direction in Direction.GetValues(typeof(Direction)))
     {
         this.neighbors.Add(direction, null);
     }
 }
Пример #15
0
        /// <summary>
        /// Lấy về danh Room theo class và type
        /// </summary>
        /// <param name="cruise"></param>
        /// <param name="roomClass"></param>
        /// <param name="roomType"></param>
        /// <returns></returns>
        public IList RoomGetBy_ClassType(Cruise cruise, RoomClass roomClass, RoomTypex roomType)
        {
            ICriteria criteria = _session.OpenSession().CreateCriteria(typeof(Room));

            criteria.Add(Expression.Eq(Room.ROOMTYPE, roomType))
            .Add(Expression.Eq(Room.ROOMCLASS, roomClass));
            if (cruise != null)
            {
                criteria.Add(Expression.Eq("Cruise", cruise));
            }
            return(criteria.List());
        }
Пример #16
0
    /**
     * Given a room from the List, find the furthest room from
     * that point.
     */
    public RoomClass GetFurthestRoomFromNode(RoomClass room)
    {
        // TODO - returns a random room. In the future, this will
        // use something like Djikstra's algorithm to find the
        // furthest node
        RoomClass farRoom = GetRandomRoom();

        while (room == farRoom)
        {
            farRoom = GetRandomRoom();
        }
        return(farRoom);
    }
        protected void rptRoomClass_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            {
                RoomClass roomClass = (RoomClass)e.Item.DataItem;

                #region -- Header --

                // Đối với header, thêm danh sách roomType thông thường
                using (Repeater rpt = e.Item.FindControl("rptRoomTypeHeader") as Repeater)
                {
                    if (rpt != null)
                    {
                        rpt.DataSource = Module.RoomTypexGetAll();
                        rpt.DataBind();
                    }
                }

                #endregion

                #region -- Item --

                #region RoomClass Id

                using (Label labelRoomClassId = e.Item.FindControl("labelRoomClassId") as Label)
                {
                    if (labelRoomClassId != null)
                    {
                        labelRoomClassId.Text = roomClass.Id.ToString();
                    }
                }

                #endregion

                //Đối với từng dòng
                using (Repeater rpt = e.Item.FindControl("rptRoomTypeCell") as Repeater)
                {
                    if (rpt != null)
                    {
                        // Gán sự kiện ItemDataBound (vì control trong Repeater không tự nhận hàm này)
                        rpt.ItemDataBound += RptRoomTypeItemDataBound;

                        IList roomTypeList = Module.RoomTypexGetAll();

                        rpt.DataSource = roomTypeList;
                        rpt.DataBind();
                    }
                }

                #endregion
            }
        }
Пример #18
0
    /**
     * Print all of the properties of the Room object
     */
    public override string ToString()
    {
        string roomString = string.Format("ID: {0}\n", this.number);

        roomString += (this.parent == null) ? string.Format("Parent: null\n") : string.Format("Parent: {0}\n", this.parent.number);
        roomString += string.Format("({0}, {1})\n", this.x, this.y);
        roomString += "Neighbors:\n";
        foreach (Direction direction in Direction.GetValues(typeof(Direction)))
        {
            RoomClass directionRoom = this.neighbors [direction];
            roomString += (directionRoom == null) ? string.Format("\t{0}: null\n", direction.ToString()) : string.Format("\t{0}: {1}\n", direction.ToString(), directionRoom.number);
        }
        return(roomString);
    }
        protected void RptRoomTypeItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RoomTypex rtype     = e.Item.DataItem as RoomTypex;
            RoomClass father    = (RoomClass)(((RepeaterItem)e.Item.Parent.Parent).DataItem);
            TextBox   txtSingle = (e.Item.Parent.Parent).FindControl("txtSingle") as TextBox;

            if (rtype != null)
            {
                #region RoomType Id

                using (Label labelRoomTypeId = e.Item.FindControl("labelRoomTypeId") as Label)
                {
                    if (labelRoomTypeId != null)
                    {
                        labelRoomTypeId.Text = rtype.Id.ToString();
                    }
                }

                #endregion

                TextBox textBoxPrice            = (TextBox)e.Item.FindControl("textBoxPrice");
                Label   labelSailsPriceConfigId = (Label)e.Item.FindControl("labelSailsPriceConfigId");

                //Kiểm tra xem có tồn tại room nào mà class và type là rtype và father ko?
                IList room = Module.RoomGetBy_ClassType(ActiveCruise, father, rtype);
                //Nếu có thì hiện giá
                if (room.Count > 0)
                {
                    Domain.SailsPriceConfig priceConfig = Module.SailsPriceConfigGet(Table, rtype, father);
                    //Module.SailsPriceConfigGetBy_RoomType_RoomClass_Trip(_trip,rtype,father,Option);
                    //Nếu có giá thì hiện
                    if (priceConfig != null)
                    {
                        labelSailsPriceConfigId.Text = priceConfig.Id.ToString();
                        textBoxPrice.Text            = priceConfig.NetPrice.ToString("####");
                        if (txtSingle != null)
                        {
                            txtSingle.Text = priceConfig.SpecialPrice.ToString("#,0.#");
                        }
                    }
                }
                //Nếu không tồn tại room thì để N/A
                else
                {
                    textBoxPrice.Enabled = false;
                    textBoxPrice.Text    = "N/A";
                }
            }
        }
Пример #20
0
        private void Alarm_History(object sender, RoutedEventArgs e)
        {
            if (saveDevice.Children != null)
            {
                saveDevice.Children.Clear();
            }
            HistoryAlarm alarm            = RoomManagerBean.HistoryAlarm;
            RoomClass    _Rclass          = new RoomClass();
            DataSet      _HistoryAlarmSet = _Rclass.queryHistoryAlarmList();

            alarm.page.ShowPages(alarm.alarmGrid, _HistoryAlarmSet, BaseRequest.PAGE_SIZE);
            saveDevice.Children.Add(alarm);
            alarm.SetValue(Grid.RowProperty, 0);
            alarm.SetValue(Grid.ColumnProperty, 0);
        }
Пример #21
0
 private void roomsTreeView()
 {
     RoomClass rc=new RoomClass();
     MySqlDataReader reader=rc.queryRoomsName();
     while(reader.Read())
     {
         TreeViewItem item = new TreeViewItem();
         //item.HeaderTemplate;
         item.Header=reader["ROOM_NAME"];
         item.Uid = reader["ID"].ToString();
         item.FontSize = 12;
         //item.Foreground = ;
         this.rooms.Items.Add(item);
     }
 }
        private void SaveEdit_Click(object sender, RoutedEventArgs e)
        {
            ComboBoxItem type = (ComboBoxItem)this.type.SelectedItem;

            if (this.Ename.Text.Equals(""))
            {
                JXMessageBox.Show(this, "设备名称不准为空!", MsgImage.Error);
                return;
            }
            if (this.ip.Text.Equals(""))
            {
                JXMessageBox.Show(this, "读写器IP不能为空!", MsgImage.Error);
                return;
            }
            if (this.port.Text.Equals(""))
            {
                JXMessageBox.Show(this, "读写器端口不能为空!", MsgImage.Error);
                return;
            }
            if ("".Equals(type.Tag.ToString()))
            {
                JXMessageBox.Show(this, "非法操作!", MsgImage.Error);
                return;
            }
            if (this.sweepTime.Text.Equals(""))
            {
                JXMessageBox.Show(this, "读写器扫描时间不为空!", MsgImage.Error);
                return;
            }
            RoomClass rc    = new RoomClass();
            int       state = rc.updateWriteAndReader(int.Parse(this.ID.Content.ToString()), this.Ename.Text, this.ip.Text, int.Parse(this.port.Text),
                                                      int.Parse(type.Tag.ToString()), float.Parse(this.sweepTime.Text.ToString()));

            if (state == BaseRequest.SUCCESS)
            {
                Room           roomBean = RoomManagerBean.Room;
                EquipmentClass ec       = new EquipmentClass();
                DataSet        set      = ec.getEquipmentInformationByRoom(int.Parse(roomBean.roomId.Text));
                roomBean.page.ShowPages(roomBean.roomEquipment, set, BaseRequest.PAGE_SIZE);

                JXMessageBox.Show(this, "编辑信息已保存.", MsgImage.Success);
                this.Close();
            }
            else
            {
                JXMessageBox.Show(this, "保存失败!", MsgImage.Error);
            }
        }
Пример #23
0
 protected void rptRoomClass_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.DataItem is RoomClass)
     {
         RoomClass item = e.Item.DataItem as RoomClass;
         if (item != null)
         {
             Repeater rptRoomType = e.Item.FindControl("rptRoomType") as Repeater;
             if (rptRoomType != null)
             {
                 rptRoomType.DataSource = Module.RoomTypexGetAll();
                 rptRoomType.DataBind();
             }
         }
     }
 }
Пример #24
0
        private void roomsTreeView()
        {
            RoomClass       rc     = new RoomClass();
            MySqlDataReader reader = rc.queryRoomsName();

            while (reader.Read())
            {
                TreeViewItem item = new TreeViewItem();
                //item.HeaderTemplate;
                item.Header   = reader["ROOM_NAME"];
                item.Uid      = reader["ID"].ToString();
                item.FontSize = 12;
                //item.Foreground = ;
                this.rooms.Items.Add(item);
            }
        }
Пример #25
0
    /// <summary>
    /// Gets whether the room class is considered safe. Safe rooms aren't counted to score, do not deplete power-ups, allow firing, or contain hazards
    /// </summary>
    /// <param name="class"></param>
    /// <returns></returns>
    public static bool IsSafeRoom(this RoomClass @class)
    {
        switch (@class)
        {
        case RoomClass.Inaccessible:
        case RoomClass.Starting:
        case RoomClass.Respite:
        case RoomClass.Transition:
        case RoomClass.Shop:
        case RoomClass.Secret:
            return(true);

        default:
            return(false);
        }
    }
Пример #26
0
        private NuimoLedMatrix MatrixForRoomClass(RoomClass roomClass)
        {
            switch (roomClass)
            {
            case RoomClass.LivingRoom:
                return(Icons.Couch);

            case RoomClass.Bedroom:
                return(Icons.Bed);

            case RoomClass.Hallway:
                return(Icons.Door);

            default:
                return(Icons.Home);
            }
        }
Пример #27
0
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(textBoxName.Text))
                {
                    if (RoomClassId > 0)
                    {
                        _roomClass = Module.RoomClassGetById(RoomClassId);
                    }
                    else
                    {
                        _roomClass       = new RoomClass();
                        _roomClass.Order = Module.RooomClassCount();
                    }
                    _roomClass.Cruise      = _cruise;
                    _roomClass.Name        = textBoxName.Text;
                    _roomClass.Description = textBoxDescription.Text;
                    if (ddlCruises.SelectedIndex > 0)
                    {
                        _roomClass.Cruise = Module.CruiseGetById(Convert.ToInt32(ddlCruises.SelectedValue));
                    }
                    else
                    {
                        _roomClass.Cruise = null;
                    }


                    if (RoomClassId < 0)
                    {
                        Module.Save(_roomClass);
                        RoomClassId = _roomClass.Id;
                    }
                    else
                    {
                        Module.Update(_roomClass);
                    }
                    GetDataSource();
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Error when buttonSubmit_Click in RoomTypexEdit", ex);
                ShowError(ex.Message);
            }
        }
Пример #28
0
        protected void rptRoomType_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is RoomTypex)
            {
                RoomTypex    rtype           = e.Item.DataItem as RoomTypex;
                RoomClass    rclass          = ((RepeaterItem)((e.Item.Parent).Parent)).DataItem as RoomClass;
                Label        label_RoomClass = e.Item.FindControl("label_RoomClass") as Label;
                Label        label_RoomType  = e.Item.FindControl("label_RoomType") as Label;
                Label        label_Avaliable = e.Item.FindControl("label_Avaliable") as Label;
                DropDownList ddlSelect       = e.Item.FindControl("ddlSelect") as DropDownList;
                if (rclass != null && rtype != null && label_Avaliable != null && label_RoomClass != null &&
                    label_RoomType != null && ddlSelect != null)
                {
                    label_RoomClass.Text = rclass.Name;
                    label_RoomType.Text  = rtype.Name;
                    int roomCount = Module.RoomCount(rclass, rtype, null, _startDate, _trip.NumberOfDay);
                    if (roomCount < 0)
                    {
                        e.Item.Visible = false;
                        return;
                    }
                    if (roomCount == 0)
                    {
                        ddlSelect.Visible = false;
                    }

                    if (rtype.Id != SailsModule.TWIN)
                    {
                        label_Avaliable.Text = string.Format("{0} room(s)", roomCount);
                        for (int i = 0; i <= roomCount; i++)
                        {
                            ddlSelect.Items.Add(new ListItem(string.Format("{0} room", i), i.ToString()));
                        }
                    }
                    else
                    {
                        label_Avaliable.Text = string.Format("{0} room(s) ({1} person)", roomCount / 2, roomCount);
                        for (int i = 0; i <= roomCount; i++)
                        {
                            ddlSelect.Items.Add(new ListItem(string.Format("{0} person", i), i.ToString()));
                        }
                    }
                }
            }
        }
Пример #29
0
    public void GenerateRoom(RoomClass roomToGenerate, RoomClass.ExitClass requiredExit)
    {
        if (roomToGenerate == null)
        {
            roomToGenerate = CreateRoom();
        }

        if (roomToGenerate.Generated)
        {
            return;
        }

        List <int> availableSegments = Enumerable.Range(0, 6).ToList();
        List <int> availableExits    = Enumerable.Range(0, 10).ToList();

        if (requiredExit != null)
        {
            availableExits.Remove(requiredExit.Id);
            availableSegments.Remove(exitToSegment[requiredExit.Id]);
        }

        GenerateAltarSegment(availableSegments, availableExits, roomToGenerate);

        var numExits = Mathf.Min(Random.Range(1, 4), availableSymbols.Count);

        GenerateExits(requiredExit, numExits, availableSegments, availableExits, roomToGenerate);

        GenerateNoExits(availableSegments, roomToGenerate);

        roomToGenerate.Generated = true;

        foreach (var exit in roomToGenerate.Exits)
        {
            var newRoom = Rooms.Find(x => x.Id == exit.Target.RoomId);
            GenerateRoom(newRoom, new RoomClass.ExitClass()
            {
                Id     = exit.Target.ExitId,
                Target = new RoomClass.ExitClass.TargetClass()
                {
                    ExitId = exit.Id,
                    RoomId = roomToGenerate.Id
                }
            });
        }
    }
Пример #30
0
    private RoomClass CreateRoom()
    {
        var newRoom = new RoomClass();
        var newId   = Random.Range(0, int.MaxValue);

        while (Rooms.Any(x => x.Id == newId))
        {
            newId = Random.Range(0, int.MaxValue);
        }

        newRoom.Id = newId;

        newRoom.Symbol = availableSymbols[Random.Range(0, availableSymbols.Count)];
        availableSymbols.Remove(newRoom.Symbol);

        Rooms.Add(newRoom);

        return(newRoom);
    }
Пример #31
0
 // makes the doors leading to this room a certain type (incomplete: missing lock)
 void changeSurroundingDoors(int x, int y, RoomClass thisroom)
 {
     if (thisroom.adjacentNorth)
     {
         room[x, y + 1].frameSouth = thisroom.frameNorth;
     }
     if (thisroom.adjacentSouth)
     {
         room[x, y - 1].frameNorth = thisroom.frameSouth;
     }
     if(thisroom.adjacentEast)
     {
         room[x + 1, y].frameWest = thisroom.frameEast;
     }
     if (thisroom.adjacentWest)
     {
         room[x - 1, y].frameEast = thisroom.frameWest;
     }
 }
Пример #32
0
    // Use this for initialization
    void Start()
    {
        if (Instance != null)
        {
            Destroy(Instance.gameObject);
        }
        Instance = this;
        AdventureController.Instance.BindMe(this);

        Hero = Instantiate(AdventureController.Instance.Hero);
        AdventureController.Instance.Hero = Hero;
        DontDestroyOnLoad(Hero.gameObject);

        Room = AdventureController.Instance.Map.Compartments[AdventureController.Instance.PlayerCompartmentNumber] as RoomClass;
        BackgroundSprites = new System.Collections.Generic.List<GameObject>();

        HeroGameObject = Hero.gameObject;

        BackgroundSprites.Add(CreateGameObjectBySprite(Room.Background));

        for (int i = 0; i < 2; i++)
        {
            Dices.Add(Instantiate(d8DicePrefab));
            Dices[i].ResetPosition();
        }

        if (Room.Type == FloodedTempleRoomType.Training)
        {
            isFighting = true;
            isExploring = false;
            Fight = new FightInfo();
            Fight.Hero = Hero;
            Fight.Enemy = GameObject.Instantiate(Room.Enemy);
            StartCoroutine(WriteForTime(MainMessageText, "FIGHT!", 1f));
            StartCoroutine(WriteForTime(MainMessageText, "FIGHT!", 1f));
        }
        else
        {
            isFighting = false;
            isExploring = true;
        }
    }
Пример #33
0
 private void Add_Type(object sender, RoutedEventArgs e)
 {
     string type = this.typeName.Text;
     RoomClass rc = new RoomClass();
     int state = rc.addType(type);
     if (state == BaseRequest.SUCCESS)
     {
         JXMessageBox.Show(this, "添加类别成功!",MsgImage.Success);
         RoomManagerBean.DeviceClass.page.ShowPages(RoomManagerBean.DeviceClass.deviceData, rc.queryType(), BaseRequest.PAGE_SIZE);
         this.Close();
     }
     else if (state == BaseRequest.HAS)
     {
         JXMessageBox.Show(this, "已有该类别!", MsgImage.Error);
     }
     else
     {
         JXMessageBox.Show(this, "未知错误,请联系管理员!", MsgImage.Error);
     }
 }
Пример #34
0
 private void Edit_DeviceClass(object sender, RoutedEventArgs e)
 {
     EditDeviceClass editDeviceClass =new EditDeviceClass();
     // MessageBox.Show(add_Equ.Children.Contains(equipmentDetails).ToString());
     RoomClass rc = new RoomClass();
     var a = this.deviceData.SelectedItem;
     var b = a as DataRowView;
     int typeId = Convert.ToInt32(b.Row[0]);
     MySqlDataReader reader = rc.getTypeInfor(typeId);
     
     if (reader.Read())
     {
         editDeviceClass.typeName.Text = reader["TYPE_NAME"].ToString();
         editDeviceClass.createUser.Content = reader["CREATE_USER"];
         editDeviceClass.createTime.Content = Convert.ToDateTime(reader["CREATE_TIME"]).ToString(BaseRequest.DATE_MS_FORMAT);
         editDeviceClass.id.Content = reader["ID"];
     }
     editDeviceClass.Owner = Window.GetWindow(this);
     editDeviceClass.ShowDialog();
 }
Пример #35
0
        private void Edit_DeviceClass(object sender, RoutedEventArgs e)
        {
            EditDeviceClass editDeviceClass = new EditDeviceClass();
            // MessageBox.Show(add_Equ.Children.Contains(equipmentDetails).ToString());
            RoomClass       rc     = new RoomClass();
            var             a      = this.deviceData.SelectedItem;
            var             b      = a as DataRowView;
            int             typeId = Convert.ToInt32(b.Row[0]);
            MySqlDataReader reader = rc.getTypeInfor(typeId);

            if (reader.Read())
            {
                editDeviceClass.typeName.Text      = reader["TYPE_NAME"].ToString();
                editDeviceClass.createUser.Content = reader["CREATE_USER"];
                editDeviceClass.createTime.Content = Convert.ToDateTime(reader["CREATE_TIME"]).ToString(BaseRequest.DATE_MS_FORMAT);
                editDeviceClass.id.Content         = reader["ID"];
            }
            editDeviceClass.Owner = Window.GetWindow(this);
            editDeviceClass.ShowDialog();
        }
Пример #36
0
 //警报处理
 private void Treatment_Click(object sender, RoutedEventArgs e)
 {
     var a = this.alarmGrid.SelectedItem;
     var b = a as DataRowView;
     int _Aid = Convert.ToInt32(b.Row[0]);
     RoomClass rc = new RoomClass();
     MySqlDataReader reader = rc.getAlarmInformation(_Aid);
     TreatmentAlarm ta = new TreatmentAlarm();
     if(reader.Read())
     {
         ta.Aid.Text = reader["ALARM_ID"].ToString();
         ta.number.Text = reader["NUMBER"].ToString();
         ta.Etype.Text = reader["TYPE_NAME"].ToString();
         ta.Atype.Text = reader["ALARM_TYPE_NAME"].ToString();
         ta.Room.Text = reader["ROOM_NAME"].ToString();
         ta.Time.Text = reader["ALARM_TIME"].ToString();
     }
     ta.Owner = Window.GetWindow(this);
     ta.ShowDialog();
 }
Пример #37
0
        private void Add_Rooms(object sender, RoutedEventArgs e)
        {
            RoomBean bean = new RoomBean();

            if (this.roomName.Text.Equals(""))
            {
                MessageBox.Show("请输入机房名!");
                return;
            }
            RoomClass rc = new RoomClass();

            bean.RoomName = this.roomName.Text;
            if (!this.belongs.Text.Equals(""))
            {
                bean.Belongs = this.belongs.Text;
            }
            if (!this.purpose.Text.Equals(""))
            {
                bean.Purpose = this.purpose.Text;
            }
            if (!this.floor.Text.Equals(""))
            {
                bean.Floor = this.floor.Text;
            }
            int state = rc.AddRoom(bean);

            if (state == BaseRequest.HAS)
            {
                MessageBox.Show("已存在该机房名!");
            }
            else if (state == BaseRequest.SUCCESS)
            {
                MessageBox.Show("操作成功!");
                this.addRooms.Visibility = Visibility.Hidden;
                RoomManagerBean.AddRoom.page.ShowPages(RoomManagerBean.AddRoom.roomDate, rc.queryRoomsList(), BaseRequest.PAGE_SIZE);
            }
            else
            {
                MessageBox.Show("系统异常,请连管理员!");
            }
        }
Пример #38
0
        //编辑新添加设备
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            EditEquipments  edit     = new EditEquipments();
            var             a        = this.comingGrild.SelectedItem;
            var             b        = a as DataRowView;
            int             _Eid     = Convert.ToInt32(b.Row[0]);
            EquipmentClass  _Eclass  = new EquipmentClass();
            RoomClass       room     = new RoomClass();
            MySqlDataReader reader   = _Eclass.editNewEquipment(_Eid);
            ComboBox        rooms    = edit.roomBox;
            ComboBoxItem    roomItem = new ComboBoxItem();

            if (reader.Read())
            {
                edit.ID.Content     = reader["ID"];
                edit.numberStr.Text = reader["NUMBER"].ToString();
                edit.Ename.Text     = reader["NAME"].ToString();
                edit.Etype.Content  = reader["TYPE_NAME"];
                roomItem.Content    = reader["ROOM_NAME"];
                roomItem.Tag        = reader["RID"];
                roomItem.IsSelected = true;
                rooms.Items.Add(roomItem);
                edit.UserName.Content   = reader["USER_NAME"];
                edit.CreateTime.Content = Convert.ToDateTime(reader["STORAGE_TIME"]).ToString(BaseRequest.DATE_TIME_FORMAT);
            }

            MySqlDataReader roomReader = room.queryRoomsName();

            while (roomReader.Read())
            {
                if (!reader["RID"].ToString().Equals(roomReader["ID"].ToString()))
                {
                    roomItem         = new ComboBoxItem();
                    roomItem.Content = roomReader["ROOM_NAME"];
                    roomItem.Tag     = roomReader["ID"];
                    rooms.Items.Add(roomItem);
                }
            }
            edit.Owner = Window.GetWindow(this);
            edit.ShowDialog();
        }
Пример #39
0
        private void Add_Type(object sender, RoutedEventArgs e)
        {
            string    type  = this.typeName.Text;
            RoomClass rc    = new RoomClass();
            int       state = rc.addType(type);

            if (state == BaseRequest.SUCCESS)
            {
                JXMessageBox.Show(this, "添加类别成功!", MsgImage.Success);
                RoomManagerBean.DeviceClass.page.ShowPages(RoomManagerBean.DeviceClass.deviceData, rc.queryType(), BaseRequest.PAGE_SIZE);
                this.Close();
            }
            else if (state == BaseRequest.HAS)
            {
                JXMessageBox.Show(this, "已有该类别!", MsgImage.Error);
            }
            else
            {
                JXMessageBox.Show(this, "未知错误,请联系管理员!", MsgImage.Error);
            }
        }
Пример #40
0
        //警报处理
        private void Treatment_Click(object sender, RoutedEventArgs e)
        {
            var             a      = this.alarmGrid.SelectedItem;
            var             b      = a as DataRowView;
            int             _Aid   = Convert.ToInt32(b.Row[0]);
            RoomClass       rc     = new RoomClass();
            MySqlDataReader reader = rc.getAlarmInformation(_Aid);
            TreatmentAlarm  ta     = new TreatmentAlarm();

            if (reader.Read())
            {
                ta.Aid.Text    = reader["ALARM_ID"].ToString();
                ta.number.Text = reader["NUMBER"].ToString();
                ta.Etype.Text  = reader["TYPE_NAME"].ToString();
                ta.Atype.Text  = reader["ALARM_TYPE_NAME"].ToString();
                ta.Room.Text   = reader["ROOM_NAME"].ToString();
                ta.Time.Text   = reader["ALARM_TIME"].ToString();
            }
            ta.Owner = Window.GetWindow(this);
            ta.ShowDialog();
        }
Пример #41
0
 private void Edit_DeviceClass(object sender, RoutedEventArgs e)
 {
     int id = (int)this.id.Content;
     string name = this.typeName.Text;
     if (name.Equals(""))
     {
         JXMessageBox.Show(this,"请输入类别名称!",MsgImage.Error);
         return;
     }
     RoomClass rc = new RoomClass();
     int state = rc.saveEditType(id, name);
     if (state == BaseRequest.SUCCESS)
     {
         JXMessageBox.Show(this,"编辑设备类别信息成功!",MsgImage.Success);
         RoomManagerBean.DeviceClass.page.ShowPages(RoomManagerBean.DeviceClass.deviceData, rc.queryType(), BaseRequest.PAGE_SIZE);
         this.Close();
     }
     else
     {
         JXMessageBox.Show(this, "未知错误,请联系管理员!", MsgImage.Error);
     }
 }
Пример #42
0
 private void Sava_Edit(object sender, RoutedEventArgs e)
 {
     if (this.roomName.Text.Equals(""))
     {
         MessageBox.Show("请输入机房名称!");
         return;
     }
     RoomBean bean = new RoomBean();
     RoomClass rc=new RoomClass();
     bean.RoomName = this.roomName.Text;
     bean.Floor = this.floor.Text;
     bean.Purpose = this.purpose.Text;
     bean.Belongs = this.belongs.Text;
     bean.Id = (int)this.roomId.Content;
     int state=rc.saveEditRoom(bean);
     if (state == BaseRequest.SUCCESS)
     {
         MessageBox.Show("操作成功!");
         this.edit_room.Visibility = Visibility.Hidden;
         RoomManagerBean.AddRoom.page.ShowPages(RoomManagerBean.AddRoom.roomDate, rc.queryRoomsList(), BaseRequest.PAGE_SIZE);
     }
 }
Пример #43
0
 private void Details_Click(object sender, RoutedEventArgs e)
 {
     RoomClass rc = new RoomClass();
     var a = this.historyEquipment.SelectedItem;
     var b = a as DataRowView;
     int _Eid = Convert.ToInt32(b.Row[0]);
     MySqlDataReader reader=rc.queryHistoryEquipmentInformation(_Eid);
     HistoryEquipmentDetails _Details = new HistoryEquipmentDetails();
     if (reader.Read())
     {
         _Details.number.Text = reader["NUMBER"].ToString();
         _Details.name.Text=reader["NAME"].ToString();
         _Details.type.Text = reader["TYPE_NAME"].ToString();
         _Details.room.Text = reader["ROOM_NAME"].ToString();
         _Details.takeUser.Text = reader["TAKE_NAME"].ToString();
         _Details.takeTime.Text = Convert.ToDateTime(reader["TAKE_TIME"]).ToString(BaseRequest.DATE_MS_FORMAT);
         _Details.userName.Text = reader["USER_NAME"].ToString();
         _Details.time.Text = Convert.ToDateTime(reader["STORAGE_TIME"]).ToString(BaseRequest.DATE_MS_FORMAT);
     }
     _Details.Owner = Window.GetWindow(this);
     _Details.ShowDialog();
 }
Пример #44
0
	/// <summary>
	/// Create a group for a list of lights
	/// </summary>
	/// <param name="lights">List of lights in the group</param>
	/// <param name="name">Optional name</param>
	/// <param name="roomClass">for room creation the room class has to be passed, without class it will get the default: "Other" class.</param>
	/// <returns></returns>
	public async Task<string> CreateGroupAsync(IEnumerable<string> lights, string name = null, RoomClass? roomClass = null)
    {
      CheckInitialized();

      if (lights == null)
        throw new ArgumentNullException(nameof(lights));

			CreateGroupRequest jsonObj = new CreateGroupRequest();
      jsonObj.Lights = lights;

      if (!string.IsNullOrEmpty(name))
        jsonObj.Name = name;

	  if(roomClass.HasValue)
	  {
		jsonObj.Class = roomClass.Value;
		jsonObj.Type = GroupType.Room;
	  }

      string jsonString = JsonConvert.SerializeObject(jsonObj, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });

      HttpClient client = await GetHttpClient().ConfigureAwait(false);
      //Create group with the lights we want to target
      var response = await client.PostAsync(new Uri(String.Format("{0}groups", ApiBase)), new JsonContent(jsonString)).ConfigureAwait(false);
      var jsonResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

      HueResults groupResult = DeserializeDefaultHueResult(jsonResult);

      if (groupResult.Count > 0 && groupResult[0].Success != null && !string.IsNullOrEmpty(groupResult[0].Success.Id))
      {
        return groupResult[0].Success.Id.Replace("/groups/", string.Empty);
      }

      if (groupResult.HasErrors())
        throw new Exception(groupResult.Errors.First().Error.Description);

      return null;

    }
Пример #45
0
 private void Add_Rooms(object sender, RoutedEventArgs e)
 {
     RoomBean bean=new RoomBean();
     if (this.roomName.Text.Equals(""))
     {
         MessageBox.Show("请输入机房名!");
         return;
     }
     RoomClass rc = new RoomClass();
     bean.RoomName = this.roomName.Text;
     if (!this.belongs.Text.Equals("")) bean.Belongs = this.belongs.Text;
     if (!this.purpose.Text.Equals("")) bean.Purpose = this.purpose.Text;
     if (!this.floor.Text.Equals("")) bean.Floor = this.floor.Text;
     int state=rc.AddRoom(bean);
     if (state == BaseRequest.HAS) MessageBox.Show("已存在该机房名!");
     else if (state == BaseRequest.SUCCESS)
     {
         MessageBox.Show("操作成功!");
         this.addRooms.Visibility = Visibility.Hidden;
         RoomManagerBean.AddRoom.page.ShowPages(RoomManagerBean.AddRoom.roomDate, rc.queryRoomsList(), BaseRequest.PAGE_SIZE);
     }
     else MessageBox.Show("系统异常,请连管理员!");
 }
Пример #46
0
        //编辑设备信息
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            RoomClass rc=new RoomClass();
            var a = this.roomEquipment.SelectedItem;
            var b = a as DataRowView;
            int _Eid = Convert.ToInt32(b.Row[0]);
            int _TypeId = Convert.ToInt32(b.Row[1]);
            MySqlDataReader reader;
            if (_TypeId == 4)
            {
                reader = rc.getWriteAndReaderInformation(_Eid);
                if (reader.Read())
                {
                    EditWriteAndReader ear = new EditWriteAndReader();
                    ear.ID.Content = reader["READER_WRITER_ID"];
                    ear.numberStr.Text =reader["NUMBER"].ToString();
                    ear.Ename.Text = reader["NAME"].ToString();
                    ear.Etype.Text = reader["TYPE_NAME"].ToString();
                    ear.room.Text = reader["ROOM_NAME"].ToString();
                    ear.ip.Text = reader["IP"].ToString();
                    ear.port.Text = reader["PORT"].ToString();
                    ear.antenenSum.Text = reader["ANTENNA_SUM"].ToString();
                    if (int.Parse(reader["TYPE"].ToString()) == 0)
                    {
                        ear.type.SelectedIndex = 0;

                    }
                    else
                    {
                        ear.type.SelectedIndex = 1;
                    }
                    ear.sweepTime.Text = reader["SWEEP_TIME"].ToString();
                    ear.userName.Text = reader["USER_NAME"].ToString();
                    ear.createTime.Text = reader["CREATE_TIME"].ToString();
                    ear.Owner = Window.GetWindow(this);
                    ear.ShowDialog();
                }

            }
            else
            {
                 reader = rc.getEquipmentInfo(_Eid);
                if (reader.Read())
                {
                    EditEquipment ed = new EditEquipment();
                    ed.ID.Content = reader["ID"];
                    ed.numberStr.Text = reader["NUMBER"].ToString();
                    ed.Ename.Text = reader["NAME"].ToString();
                    //ed.Etype.Text = reader["TYPE_NAME"].ToString();
                    int status = int.Parse(reader["WORK_STATUS"].ToString());
                    if (status == 1)
                    {
                        ed.status.Text = "入库中";
                    }
                    else if (status == 0)
                    {
                        ed.status.Text = "正常使用";
                    }
                    else if (status == 15)
                    {
                        ed.status.Text = "保修中";
                    }
                    ed.room.Text = reader["ROOM_NAME"].ToString();
                    if (int.Parse(reader["POWER_SOURCE"].ToString()) == 0)
                    {
                        ed.powerSource.Text = "开";
                        //ed.powerSource.Foreground = Brush.TransformProperty;
                    }
                    else
                    {
                        ed.powerSource.Text = "关";
                    }
                    ed.userName.Text = reader["USER_NAME"].ToString();
                    ed.time.Text = reader["STORAGE_TIME"].ToString();
                    reader = rc.getTypeList();
                    ComboBox types = ed.Etype;
                    ComboBoxItem TypeItems;
                    while (reader.Read())
                    {
                        if (int.Parse(reader["ID"].ToString()) != 4)
                        {
                            TypeItems = new ComboBoxItem();
                            TypeItems.Content = reader["TYPE_NAME"];
                            TypeItems.Tag = reader["ID"];
                            if (int.Parse(reader["ID"].ToString()) == _TypeId)
                                TypeItems.IsSelected = true;
                            types.Items.Add(TypeItems);
                        }
                    }
                    
                    ed.Owner = Window.GetWindow(this);
                    ed.ShowDialog();
                }
            }
        }
Пример #47
0
        //编辑新添加设备
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            EditEquipments edit = new EditEquipments();
            var a = this.comingGrild.SelectedItem;
            var b = a as DataRowView;
            int _Eid = Convert.ToInt32(b.Row[0]);
            EquipmentClass _Eclass = new EquipmentClass();
            RoomClass room = new RoomClass();
            MySqlDataReader reader = _Eclass.editNewEquipment(_Eid);
            ComboBox rooms = edit.roomBox;
            ComboBoxItem roomItem = new ComboBoxItem();
            if (reader.Read())
            {
                edit.ID.Content = reader["ID"];
                edit.numberStr.Text = reader["NUMBER"].ToString();
                edit.Ename.Text = reader["NAME"].ToString();
                edit.Etype.Content = reader["TYPE_NAME"];
                roomItem.Content = reader["ROOM_NAME"];
                roomItem.Tag = reader["RID"];
                roomItem.IsSelected = true;
                rooms.Items.Add(roomItem);
                edit.UserName.Content = reader["USER_NAME"];
                edit.CreateTime.Content = Convert.ToDateTime(reader["STORAGE_TIME"]).ToString(BaseRequest.DATE_TIME_FORMAT);
            }

            MySqlDataReader roomReader = room.queryRoomsName();
            while (roomReader.Read())
            {
                if (!reader["RID"].ToString().Equals(roomReader["ID"].ToString()))
                {
                    roomItem = new ComboBoxItem();
                    roomItem.Content = roomReader["ROOM_NAME"];
                    roomItem.Tag = roomReader["ID"];
                    rooms.Items.Add(roomItem);
                }
            }
            edit.Owner = Window.GetWindow(this);
            edit.ShowDialog();
        }
Пример #48
0
    public void createRoom(int x, int y, RoomClass room)
    {
        x *= 60;
        y *= 36;
        thisDungeon = GameObject.Find("Dungeon");
        if(thisDungeon == null)
        {
            createDungeon();
        }

        // Create GameObject Holder
        GameObject thisRoom = (GameObject)Instantiate(RoomHolder, new Vector3(x, y, 0), Quaternion.identity);
        thisRoom.name = "Room (" + x / 60 + ", " + y / 36 + ")";
        thisRoom.transform.SetParent(thisDungeon.transform);

        NetworkServer.Spawn(thisRoom);

        // Create the floor
        GameObject thisFloor;
        if (room.floor == RoomClass.FloorType.normal)
        {
            thisFloor = (GameObject)Instantiate(floor[0], new Vector3(x,y,0),Quaternion.identity);
        }
        else if (room.floor == RoomClass.FloorType.first)
        {
            thisFloor = (GameObject)Instantiate(floor[1], new Vector3(x, y, 0), Quaternion.identity);
        }
        else if (room.floor == RoomClass.FloorType.boss)
        {
            thisFloor = (GameObject)Instantiate(floor[2], new Vector3(x, y, 0), Quaternion.identity);
        }
        else if (room.floor == RoomClass.FloorType.dark)
        {
            thisFloor = (GameObject)Instantiate(floor[3], new Vector3(x, y, 0), Quaternion.identity);
        }
        else if (room.floor == RoomClass.FloorType.secret)
        {
            thisFloor = (GameObject)Instantiate(floor[4], new Vector3(x, y, 0), Quaternion.identity);
        }
        else
        {
            thisFloor = (GameObject)Instantiate(floor[5], new Vector3(x, y, 0), Quaternion.identity);
            Debug.Log("floor Exception -> " + room.floor.ToString());
        }
        showValues(room, thisFloor.GetComponent<Text>());
        thisFloor.name = room.floor.ToString();
        thisFloor.transform.SetParent(thisRoom.transform);
        NetworkServer.Spawn(thisFloor);

        if (room.status == RoomClass.Status.empty || room.status == RoomClass.Status.blocked)
            return;

        // Create the walls, the doors and the frames
        GameObject thisNorthWall, thisNorthBorder;
        GameObject thisSouthWall, thisSouthBorder;
        GameObject thisEastWall, thisEastBorder;
        GameObject thisWestWall, thisWestBorder;

        // North
        if (room.adjacentNorth)
        {
            thisNorthWall = (GameObject)Instantiate(wallHorizontalWithDoor, new Vector3(x, y + 16, 0), Quaternion.identity);
            if (room.frameNorth == RoomClass.DoorFrame.wood)
            {
                thisNorthBorder = (GameObject)Instantiate(doorFrame[0], new Vector3(x, y + 16, 0), Quaternion.identity);
            }
            else if (room.frameNorth == RoomClass.DoorFrame.bones)
            {
                thisNorthBorder = (GameObject)Instantiate(doorFrame[1], new Vector3(x, y + 16, 0), Quaternion.identity);
            }
            else if (room.frameNorth == RoomClass.DoorFrame.gold)
            {
                thisNorthBorder = (GameObject)Instantiate(doorFrame[2], new Vector3(x, y + 16, 0), Quaternion.identity);
            }
            else if (room.frameNorth == RoomClass.DoorFrame.none)
            {
                thisNorthBorder = (GameObject)Instantiate(doorFrame[3], new Vector3(x, y + 16, 0), Quaternion.identity);
            }
            else if (room.frameNorth == RoomClass.DoorFrame.spikes)
            {
                thisNorthBorder = (GameObject)Instantiate(doorFrame[4], new Vector3(x, y + 16, 0), Quaternion.identity);
            }
            else
            {
                thisNorthBorder = (GameObject)Instantiate(doorFrame[5], new Vector3(x, y + 16, 0), Quaternion.identity);
                Debug.Log("northBorder Exception -> " + room.frameNorth.ToString());
            }
                thisNorthBorder.transform.SetParent(thisRoom.transform);
                NetworkServer.Spawn(thisNorthBorder);
        }
        else {
            thisNorthWall = (GameObject)Instantiate(wallHorizontal, new Vector3(x, y + 16, 0), Quaternion.identity);
        }

        // South
        if (room.adjacentSouth)
        {
            thisSouthWall = (GameObject)Instantiate(wallHorizontalWithDoor, new Vector3(x, y - 16, 0), Quaternion.identity);
            if (room.frameSouth == RoomClass.DoorFrame.wood)
            {
                thisSouthBorder = (GameObject)Instantiate(doorFrame[0], new Vector3(x, y - 16, 0), Quaternion.identity);
            }
            else if (room.frameSouth == RoomClass.DoorFrame.bones)
            {
                thisSouthBorder = (GameObject)Instantiate(doorFrame[1], new Vector3(x, y - 16, 0), Quaternion.identity);
            }
            else if (room.frameSouth == RoomClass.DoorFrame.gold)
            {
                thisSouthBorder = (GameObject)Instantiate(doorFrame[2], new Vector3(x, y - 16, 0), Quaternion.identity);
            }
            else if (room.frameSouth == RoomClass.DoorFrame.none)
            {
                thisSouthBorder = (GameObject)Instantiate(doorFrame[3], new Vector3(x, y - 16, 0), Quaternion.identity);
            }
            else if (room.frameSouth == RoomClass.DoorFrame.spikes)
            {
                thisSouthBorder = (GameObject)Instantiate(doorFrame[4], new Vector3(x, y - 16, 0), Quaternion.identity);
            }
            else
            {
                thisSouthBorder = (GameObject)Instantiate(doorFrame[5], new Vector3(x, y - 16, 0), Quaternion.identity);
                Debug.Log("southBorder Exception -> " + room.frameSouth.ToString());
            }
            thisSouthBorder.transform.SetParent(thisRoom.transform);
            NetworkServer.Spawn(thisSouthBorder);
        }
        else {
            thisSouthWall = (GameObject)Instantiate(wallHorizontal, new Vector3(x, y - 16, 0), Quaternion.identity);
        }

        // East
        if (room.adjacentEast)
        {
            thisEastWall = (GameObject)Instantiate(wallVerticalWithDoor, new Vector3(x + 28, y, 0), Quaternion.identity);
            if (room.frameEast == RoomClass.DoorFrame.wood)
            {
                thisEastBorder = (GameObject)Instantiate(doorFrame[0], new Vector3(x + 28, y, 0), Quaternion.identity);
            }
            else if (room.frameEast == RoomClass.DoorFrame.bones)
            {
                thisEastBorder = (GameObject)Instantiate(doorFrame[1], new Vector3(x + 28, y, 0), Quaternion.identity);
            }
            else if (room.frameEast == RoomClass.DoorFrame.gold)
            {
                thisEastBorder = (GameObject)Instantiate(doorFrame[2], new Vector3(x + 28, y, 0), Quaternion.identity);
            }
            else if (room.frameEast == RoomClass.DoorFrame.none)
            {
                thisEastBorder = (GameObject)Instantiate(doorFrame[3], new Vector3(x + 28, y, 0), Quaternion.identity);
            }
            else if (room.frameEast == RoomClass.DoorFrame.spikes)
            {
                thisEastBorder = (GameObject)Instantiate(doorFrame[4], new Vector3(x + 28, y, 0), Quaternion.identity);
            }
            else
            {
                thisEastBorder = (GameObject)Instantiate(doorFrame[5], new Vector3(x + 28, y, 0), Quaternion.identity);
                Debug.Log("southBorder Exception -> " + room.frameEast.ToString());
            }
            thisEastBorder.transform.SetParent(thisRoom.transform);
            NetworkServer.Spawn(thisEastBorder);
        }
        else {
            thisEastWall = (GameObject)Instantiate(wallVertical, new Vector3(x + 28, y, 0), Quaternion.identity);
        }
        // West
        if (room.adjacentWest)
        {
            thisWestWall = (GameObject)Instantiate(wallVerticalWithDoor, new Vector3(x - 28, y, 0), Quaternion.identity);
            if (room.frameWest == RoomClass.DoorFrame.wood)
            {
                thisWestBorder = (GameObject)Instantiate(doorFrame[0], new Vector3(x - 28, y, 0), Quaternion.identity);
            }
            else if (room.frameWest == RoomClass.DoorFrame.bones)
            {
                thisWestBorder = (GameObject)Instantiate(doorFrame[1], new Vector3(x - 28, y, 0), Quaternion.identity);
            }
            else if (room.frameWest == RoomClass.DoorFrame.gold)
            {
                thisWestBorder = (GameObject)Instantiate(doorFrame[2], new Vector3(x - 28, y, 0), Quaternion.identity);
            }
            else if (room.frameWest == RoomClass.DoorFrame.none)
            {
                thisWestBorder = (GameObject)Instantiate(doorFrame[3], new Vector3(x - 28, y, 0), Quaternion.identity);
            }
            else if (room.frameWest == RoomClass.DoorFrame.spikes)
            {
                thisWestBorder = (GameObject)Instantiate(doorFrame[4], new Vector3(x - 28, y, 0), Quaternion.identity);
            }
            else
            {
                thisWestBorder = (GameObject)Instantiate(doorFrame[5], new Vector3(x - 28, y, 0), Quaternion.identity);
                Debug.Log("southBorder Exception -> " + room.frameWest.ToString());
            }
            thisWestBorder.transform.SetParent(thisRoom.transform);
            NetworkServer.Spawn(thisWestBorder);
        }
        else {
            thisWestWall = (GameObject)Instantiate(wallVertical, new Vector3(x - 28, y, 0), Quaternion.identity);
        }

        // Place them inside the Holder
        // walls
        thisNorthWall.transform.SetParent(thisRoom.transform);
        thisSouthWall.transform.SetParent(thisRoom.transform);
        thisEastWall.transform.SetParent(thisRoom.transform);
        thisWestWall.transform.SetParent(thisRoom.transform);
        // doors

        // frames

        //NetworkServer.Spawn(thisNorthWall);
        //NetworkServer.Spawn(thisSouthWall);
        //NetworkServer.Spawn(thisEastWall);
        //NetworkServer.Spawn(thisWestWall);
    }
Пример #49
0
    void showValues(RoomClass room, Text theText)
    {
        theText.text = "status: " + room.status.ToString() + '\n' +
                                                "type: " + room.type.ToString() + '\n' +
                                                "floor: " + room.floor.ToString() + '\n' +
                                                "Numbre of adj rooms: " + room.adjacentRooms().ToString() + '\n' + '\n' +

                                                "lockNorth: " + room.lockNorth.ToString() + '\n' +
                                                "lockSouth: " + room.lockSouth.ToString() + '\n' +
                                                "lockEast: " + room.lockEast.ToString() + '\n' +
                                                "lockWest: " + room.lockWest.ToString() + '\n' + '\n' +

                                                "frameNorth: " + room.frameNorth.ToString() + '\n' +
                                                "frameSouth: " + room.frameSouth.ToString() + '\n' +
                                                "frameEast: " + room.frameEast.ToString() + '\n' +
                                                "frameWest: " + room.frameWest.ToString() + '\n' + '\n' +

                                                "adjacentNorth: " + room.adjacentNorth.ToString() + '\n' +
                                                "adjacentSouth: " + room.adjacentSouth.ToString() + '\n' +
                                                "adjacentEast: " + room.adjacentEast.ToString() + '\n' +
                                                "adjacentWest: " + room.adjacentWest.ToString() + '\n';
    }
Пример #50
0
        private void Equipment_Details(object sender, RoutedEventArgs e)
        {
            RoomClass rc = new RoomClass();
            var a = this.equipment.SelectedItem;
            var b = a as DataRowView;
            int _Eid = Convert.ToInt32(b.Row[0]);
            int _TypeId = Convert.ToInt32(b.Row[1]);
            MySqlDataReader reader;
            if (_TypeId == 4)//如果设备类型等于4,则为读写器
            {
                reader = rc.getWriteAndReaderInformation(_Eid);
                if (reader.Read())
                {
                    WriteAndReaderInfo war = new WriteAndReaderInfo();
                    war.number.Text =reader["NUMBER"].ToString();
                    war.Ename.Text = reader["NAME"].ToString();
                    war.Etype.Text = reader["TYPE_NAME"].ToString();
                    war.room.Text = reader["ROOM_NAME"].ToString();
                    war.ip.Text = reader["IP"].ToString();
                    war.port.Text = reader["PORT"].ToString();
                    war.antenenSum.Text = reader["ANTENNA_SUM"].ToString();
                    if (int.Parse(reader["TYPE"].ToString()) == 0)
                    {
                        war.type.Text = "门禁读写器";

                    }
                    else
                    {
                        war.type.Text = "室内读写器";
                    }
                    war.sweepTime.Text = reader["SWEEP_TIME"].ToString() + " 秒";
                    war.userName.Text = reader["USER_NAME"].ToString();
                    war.createTime.Text = reader["CREATE_TIME"].ToString();
                    war.Owner = Window.GetWindow(this);
                    war.ShowDialog();
                }
            }
            else
            {
                reader = rc.getEquipmentInfo(_Eid);
                if (reader.Read())
                {
                    EquipmentsDetails ed = new EquipmentsDetails();
                    ed.number.Text = reader["NUMBER"].ToString();
                    ed.Ename.Text = reader["NAME"].ToString();
                    ed.Etype.Text = reader["TYPE_NAME"].ToString();
                    int status = int.Parse(reader["WORK_STATUS"].ToString());
                    if (status == 1)
                    {
                        ed.status.Text = "入库中";
                    }
                    else if (status == 0)
                    {
                        ed.status.Text = "正常使用";
                    }
                    else if (status == 15)
                    {
                        ed.status.Text = "保修中";
                    }
                    ed.room.Text = reader["ROOM_NAME"].ToString();
                    if (int.Parse(reader["POWER_SOURCE"].ToString()) == 0)
                    {
                        ed.powerSource.Text = "开";
                        //ed.powerSource.Foreground = Brush.TransformProperty;
                    }
                    else
                    {
                        ed.powerSource.Text = "关";
                    }
                    ed.userName.Text = reader["USER_NAME"].ToString();
                    ed.time.Text = reader["STORAGE_TIME"].ToString();
                    ed.Owner = Window.GetWindow(this);
                    ed.ShowDialog();
                }
            }
        }
Пример #51
0
 private Sprite SetRoomFurniture(RoomClass room)
 {
     if (room.Type == FloodedTempleRoomType.Shop)
     {
         return FT_Furniture.GetRandomShopFurniture();
     }
     else if (room.Type == FloodedTempleRoomType.Rest)
     {
         return FT_Furniture.GetRandomRestFurniture();
     }
     else if (room.Type == FloodedTempleRoomType.Training)
     {
         return FT_Furniture.GetRandomTrainingFurniture();
     }
     return null;
 }
Пример #52
0
 void setupRoomsArray()
 {
     room = new RoomClass[max_x, max_y];
     for (int i = 0; i< max_x; i++)
     {
         for(int j = 0; j < max_y; j++)
         {
             room[i,j] = new RoomClass();
             room[i, j].status = RoomClass.Status.empty;
             if (i == 0 || i == max_x - 1 || j == 0 || j == max_y - 1)
             {
                 room[i, j].status = RoomClass.Status.blocked;
                 room[i, j].adjacentEast = true;
                 room[i, j].adjacentNorth = true;
             }
         }
     }
 }
Пример #53
0
    public void GenerateMap()
    {
        Map = new DungeonMap();
        int roomCount = Random.Range(Constants.FT_RoomCountMax, Constants.FT_RoomCountMin);
        for(int i=0; i < roomCount; i++)
        {
            RoomClass room = new RoomClass();
            room.Background = RoomSprites[Random.Range(0, RoomSprites.Length - 1)];
            room.Type = RoomTypes[Random.Range(0, RoomTypes.Length - 1)];
            room.Furniture = SetRoomFurniture(room);
            if (room.Type == FloodedTempleRoomType.Shop)
            {
                for(int j=0; j < Constants.FT_ItemsPerShop; j++)
                {
                    room.ActiveItems.Add(ItemCollection.GetRandomItem());
                }
            }
            else if (room.Type == FloodedTempleRoomType.Rest)
            {
                room.ActiveItems.Add(new FakeAltar());
            }
            else if (room.Type == FloodedTempleRoomType.Training)
            {
                room.Enemy = FT_EnemyCollection.GetRandomEnemy();
            }
            Map.Compartments.Add(room);

            if (i < roomCount - 1)
            {
                PassageClass passage = new PassageClass();
                passage.Tiles = new PassageTile[Random.Range(Constants.FT_PassageTileLengthMin, Constants.FT_PassageTileLengthMax)];
                AbActiveItem[] activeItems = new AbActiveItem[passage.Tiles.Length * 4];

                //#todo generate doors
                activeItems[1] = new FakeAltar();
                //activeItems[1].Action = previous;
                activeItems[activeItems.Length-2] = new FakeAltar();
                //activeItems[activeItems.Length-2].Action = next;

                for (int j = 3; j < activeItems.Length-2; j++)
                {
                    if (Random.Range(1, 100) <= Constants.FT_AltarChance)
                    {
                        activeItems[j] = FT_AltarCollection.GetRandomAltar();
                        j += Constants.FT_SameEventsMinDistance - 1;
                    }
                }
                AbEnemy[] enemies = new AbEnemy[passage.Tiles.Length * 4];
                for (int j = 2; j < enemies.Length; j++)
                {
                    if (Random.Range(1, 100) <= Constants.FT_AltarChance)
                    {
                        if (activeItems[j]!=null)
                        {
                            enemies[j-1] = FT_EnemyCollection.GetRandomEnemy();
                        }
                        else
                        {
                            enemies[j] = FT_EnemyCollection.GetRandomEnemy();
                        }
                        j += Constants.FT_SameEventsMinDistance - 1;
                    }
                }
                for (int j = 0; j < passage.Tiles.Length; j++)
                {
                    PassageTile passageTile = new PassageTile();
                    passageTile.Background = PassageSprites[Random.Range(0, PassageSprites.Length - 1)];

                    for(int k = 0; k < Constants.FT_EventSlotsPerPassageTile; k++)
                    {
                        passageTile.ActiveItems[k] = activeItems[j * 4 + k];
                    }
                    for (int k = 0; k < Constants.FT_EventSlotsPerPassageTile; k++)
                    {
                        passageTile.Enemies[k] = enemies[j * 4 + k];
                    }

                    passage.Tiles[j] = passageTile;
                }

                Map.Compartments.Add(passage);
            }
        }
    }
Пример #54
0
 private void Search_Equipment(object sender, RoutedEventArgs e)
 {
     //int type=int.Parse(this.type.SelectedValue.ToString());
     ComboBoxItem item = (ComboBoxItem)this.type.SelectedItem;
     EquipmentBean bean = new EquipmentBean();
     if (!item.Tag.ToString().Equals(""))
     {
         bean.Type = (int)item.Tag;
         
     }
     bean.Number = this.number.Text;
     RoomClass rc = new RoomClass();
    
     DataSet equipmentSet = rc.queryEquipmentList(bean);
     //MessageBox.Show("===" + equipmentSet.Tables[0].Rows.Count);
     //if (equipmentSet.Tables[0].Rows.Count == 0)
     //{
     //    JXMessageBox.Show(Window.GetWindow(this), "搜索记录为空!", MsgImage.Exclamation);
     //}
     RoomManagerBean.EquipmentList.page.ShowPages(RoomManagerBean.EquipmentList.equipment, equipmentSet, BaseRequest.PAGE_SIZE);
     
 }
Пример #55
0
 private void Alarm_History(object sender, RoutedEventArgs e)
 {
     if (saveDevice.Children != null) saveDevice.Children.Clear();
     HistoryAlarm alarm = RoomManagerBean.HistoryAlarm;
     RoomClass _Rclass = new RoomClass();
     DataSet _HistoryAlarmSet = _Rclass.queryHistoryAlarmList();
     alarm.page.ShowPages(alarm.alarmGrid, _HistoryAlarmSet, BaseRequest.PAGE_SIZE);
     saveDevice.Children.Add(alarm);
     alarm.SetValue(Grid.RowProperty, 0);
     alarm.SetValue(Grid.ColumnProperty, 0);
 }
Пример #56
0
        //录入设备
        private void Add_NewEquipment(object sender, RoutedEventArgs e)
        {
            AddEquipment add = new AddEquipment(); ;
            EquipmentClass equip = new EquipmentClass();
            RoomClass room = new RoomClass();
            MySqlDataReader roomReader = room.queryRoomsName();
            MySqlDataReader typeReader = room.getTypeList();
            MySqlDataReader reader = equip.getMaxId();
            if (reader.Read())
            {
                // ReaderAndWriterConnection EpcNumber = new ReaderAndWriterConnection();
                int i = 1;
                if (reader["ID"].ToString().Equals("") || reader["ID"] == null)
                {

                    add.ID.Content = i;

                    add.numberStr.Text = ReaderAndWriterConnection.getEPCCode(i);

                }
                else
                {
                    add.ID.Content = reader["ID"];
                    add.numberStr.Text = ReaderAndWriterConnection.getEPCCode(int.Parse(reader["ID"].ToString()));

                }
            }
            ComboBox rooms = add.roomBox;
            ComboBoxItem check = new ComboBoxItem();
            check.Content = "请选择...";
            check.Tag = "";
            check.IsSelected = true;
            rooms.Items.Add(check);
            while (roomReader.Read())
            {
                check = new ComboBoxItem();
                check.Content = roomReader["ROOM_NAME"];
                check.Tag = roomReader["ID"];
                rooms.Items.Add(check);
            }
            ComboBox types = add.typeBox;
            ComboBoxItem checkType = new ComboBoxItem();
            checkType.Content = "请选择...";
            checkType.Tag = "";
            checkType.IsSelected = true;
            types.Items.Add(checkType);
            while (typeReader.Read())
            {
                if (int.Parse(typeReader["ID"].ToString()) == 4)
                {
                    continue;
                }
                else
                {
                    ComboBoxItem TypeItems = new ComboBoxItem();
                    TypeItems.Content = typeReader["TYPE_NAME"];
                    TypeItems.Tag = typeReader["ID"];
                    types.Items.Add(TypeItems);
                }
            }
            add.Owner = Window.GetWindow(this);
            add.ShowDialog();
        }
Пример #57
0
    public void GenerateMap()
    {
        Map = new DungeonMap();
        int roomCount = Random.Range(Constants.FT_RoomCountMax, Constants.FT_RoomCountMin);
        bool isRestExists = false;
        bool isTrainingExists = false;
        bool isShopExists = false;
        for (int i=0; i < roomCount; i++)
        {
            RoomClass room = new RoomClass();
            if (Map.Compartments.Count == 0)
            {
                room.Type = FloodedTempleRoomTypes.Start;
                room.Background = StartRoomSprite;
                room.Furniture = SetRoomFurniture(room);
                Map.Compartments.Add(room);
            }
            else if (Map.Compartments.Count == (roomCount - 1) * 2)
            {
                room.Type = FloodedTempleRoomTypes.Final;
                room.Background = FinalRoomSprite;
                room.Furniture = SetRoomFurniture(room);
                room.ActiveItems.Add(FT_AltarCollection.TheRivenMaskAltar);
                room.Enemy = FT_EnemyCollection.DDTheRock;
                Map.Compartments.Add(room);
            }
            else
            {
                do
                {
                    room.Type = MinorRoomTypes[Random.Range(0, MinorRoomTypes.Length)];
                } while (!(room.Type == FloodedTempleRoomTypes.Training && !isTrainingExists || room.Type == FloodedTempleRoomTypes.Shop && !isShopExists
                || room.Type == FloodedTempleRoomTypes.Rest && !isRestExists || isTrainingExists && isShopExists && isRestExists));
                if (room.Type == FloodedTempleRoomTypes.Training)
                {
                    isTrainingExists = true;
                }
                else if(room.Type == FloodedTempleRoomTypes.Shop)
                {
                    isShopExists = true;
                }
                else if (room.Type == FloodedTempleRoomTypes.Rest)
                {
                    isRestExists = true;
                }
                room.Background = MinorRoomSprites[(int)room.Type-1];
                room.Furniture = SetRoomFurniture(room);
                if (room.Type == FloodedTempleRoomTypes.Shop)
                {
                    for (int j = 0; j < Random.Range(1, Constants.FT_ItemsPerShop); j++)
                    {
                        room.ActiveItems.Add(ItemCollection.GetRandomItem());
                    }
                }
                else if (room.Type == FloodedTempleRoomTypes.Rest)
                {
                    room.ActiveItems.Add(FT_AltarCollection.RestRoomAltar);
                }
                else if (room.Type == FloodedTempleRoomTypes.Training)
                {
                    room.Enemy = FT_EnemyCollection.GetRandomMinorBoss();
                }
                Map.Compartments.Add(room);
            }
            if (i < roomCount - 1)
            {
                PassageClass passage = new PassageClass();
                passage.Tiles = new PassageTile[Random.Range(Constants.FT_PassageMinTileLength, Constants.FT_PassageMaxTileLength+1)];
                AbActiveItem[] activeItems = new AbActiveItem[passage.Tiles.Length * 4];

                for (int j = 3; j < activeItems.Length-2; j++)
                {
                    if ((j%Constants.FT_EventSlotsPerPassageTile==2 || j % Constants.FT_EventSlotsPerPassageTile == 3) && Random.Range(1, 100) <= Constants.FT_AltarChance)
                    {
                        activeItems[j] = FT_AltarCollection.GetRandomAltar();
                        j += Constants.FT_SameEventsMinDistance - 1;
                    }
                }
                AbEnemy[] enemies = new AbEnemy[passage.Tiles.Length * 4];

                if (i == 0)
                {
                    enemies[2] = FT_EnemyCollection.TutorialTurtle;
                }
                for (int j = 2; j < enemies.Length; j++)
                {
                    if (i == 0)
                    {
                        j += Constants.FT_SameEventsMinDistance - 1;
                    }
                    else
                    {
                        if (j % Constants.FT_EventSlotsPerPassageTile != 0 && Random.Range(1, 100) <= Constants.FT_EnemyChance)
                        {
                            if (activeItems[j] != null)
                            {
                                enemies[j - 1] = FT_EnemyCollection.GetRandomTrashEnemy();
                            }
                            else
                            {
                                enemies[j] = FT_EnemyCollection.GetRandomTrashEnemy();
                            }
                            j += Constants.FT_SameEventsMinDistance - 1;
                        }
                    }
                }
                for (int j = 0; j < passage.Tiles.Length; j++)
                {
                    PassageTile passageTile = new PassageTile();
                    passageTile.Background = PassageSprites[Random.Range(0, PassageSprites.Length)];

                    for(int k = 0; k < Constants.FT_EventSlotsPerPassageTile; k++)
                    {
                        passageTile.ActiveItems[k] = activeItems[j * 4 + k];
                    }
                    for (int k = 0; k < Constants.FT_EventSlotsPerPassageTile; k++)
                    {
                        passageTile.Enemies[k] = enemies[j * 4 + k];
                    }

                    passage.Tiles[j] = passageTile;
                }

                Map.Compartments.Add(passage);
            }
        }
    }
Пример #58
0
        //设备管理功能选择
        private void Choice(object sender, RoutedEventArgs e)
        {
            TreeViewItem assets = ((sender as TreeView).SelectedItem as TreeViewItem);
            //MessageBox.Show(assets.Uid.ToString());
            string assetsName = assets.Uid.ToString();
            if (assetsName == null || "".Equals(assetsName))
            {
                roomGrid.Children.Clear();
            }
            if (roomGrid.Children != null) roomGrid.Children.Clear();

            // ==================================================================================

            if (assetsName.Equals("Elist"))
            {
                EquipmentList equipment = RoomManagerBean.EquipmentList;
                RoomClass rc = new RoomClass();
                EquipmentBean bean = new EquipmentBean();
                
                DataSet equipmentSet = rc.queryEquipmentList(bean);
                DataSet typeSet = rc.queryType();
                ComboBox box = RoomManagerBean.EquipmentList.type;
                if (box.HasItems) box.Items.Clear();
                ComboBoxItem boxItem = new ComboBoxItem();
                boxItem.Content = "请选择...";
                boxItem.Tag = "";
                boxItem.IsSelected = true;
                box.Items.Add(boxItem);
                //RoomManagerBean.DeviceClass.selectType.SelectedValuePath = "";
                if (typeSet.Tables.Count > 0)
                {
                    DataRowCollection drc = typeSet.Tables[0].Rows;

                    for (int i = 0; i < drc.Count; i++)
                    {
                        DataRow dr = drc[i];
                        int typeId = (int)dr["ID"];
                        string typeName = dr["TYPE_NAME"].ToString();

                        ComboBoxItem boxItems = new ComboBoxItem();
                        boxItems.Content = typeName;
                        boxItems.Tag = typeId;
                        box.Items.Add(boxItems);
                        //MessageBox.Show("typeId=" + typeId + " typeName=" + boxItems.Tag);
                    }
                    //MessageBox.Show("===" + equipmentSet.Tables.Count);
                    RoomManagerBean.EquipmentList.page.ShowPages(RoomManagerBean.EquipmentList.equipment, equipmentSet, BaseRequest.PAGE_SIZE);
                    roomGrid.Children.Add(equipment);
                    equipment.SetValue(Grid.RowProperty, 0);
                    equipment.SetValue(Grid.ColumnProperty, 0);
                }
            }
                else if (assetsName.Equals("Report"))
                {
                    Statement statement = RoomManagerBean.Statement;
                    roomGrid.Children.Add(statement);
                    statement.SetValue(Grid.RowProperty, 0);
                    statement.SetValue(Grid.ColumnProperty, 0);
                }
                else if (assetsName.Equals("Inventory"))
                {
                    RoomClass rc = new RoomClass();
                    DataSet stockSet = rc.queryInventory();
                    RoomManagerBean.DeviceList.page.ShowPages(RoomManagerBean.DeviceList.stock, stockSet, BaseRequest.PAGE_SIZE);
                    DeviceList deviceList = RoomManagerBean.DeviceList;
                    roomGrid.Children.Add(deviceList);
                    deviceList.SetValue(Grid.RowProperty, 0);
                    deviceList.SetValue(Grid.ColumnProperty, 0);
                }
                else if (assetsName.Equals("Category"))
                {
                    DeviceClass deviceClass = RoomManagerBean.DeviceClass;
                    RoomClass room = new RoomClass();
                    QueryUser query = new QueryUser();

                    //query.Account = UserManagerBean.AddUser.queryAccount.Text;
                    //query.UserName = UserManagerBean.AddUser.queryName.Text;
                     DataSet set = room.queryType();
                    
                     RoomManagerBean.DeviceClass.page.ShowPages(RoomManagerBean.DeviceClass.deviceData, set, BaseRequest.PAGE_SIZE);
                   
                    roomGrid.Children.Add(deviceClass);
                    deviceClass.SetValue(Grid.RowProperty, 0);
                    deviceClass.SetValue(Grid.ColumnProperty, 0);
                }
            else if (assetsName.Equals("HistoryEquipment"))
            {
                HistoryEquipment he = RoomManagerBean.HistoryEquipment;
                RoomClass rc = new RoomClass();
                DataSet set = rc.queryHistoryEquipment();
                he.page.ShowPages(he.historyEquipment, set, BaseRequest.PAGE_SIZE);
                roomGrid.Children.Add(he);
                he.SetValue(Grid.RowProperty, 0);
                he.SetValue(Grid.ColumnProperty, 0);
            }
            
            }
Пример #59
0
        private void Report_Click(object sender, RoutedEventArgs e)
        {
            
                if (this.pathText.Text.Equals(""))
                {
                    JXMessageBox.Show(this, "文件名与保存路径不能为空!", MsgImage.Error);
                    return;
                }
                bool b=false;
                FileBean bean = new FileBean();
                if (this.reportWord.IsChecked == true)
                {
                    bean.FontSize = int.Parse(this.wordfont.Text);
                    bean.Color = this.wordColor.Background;
                    bean.Width = int.Parse(this.wordWidth.Text);
                    bean.Height = int.Parse(this.wordHeight.Text);
                }
                else if (this.reportExcel.IsChecked == true)
                {
                    //bean.FontSize = int.Parse(this.excelFont.Text);
                    //bean.Color = this.ExcelColor.Background;
                    //bean.Width = int.Parse(this.excelWidth.Text);
                    //bean.Height = int.Parse(this.excelHeight.Text);
                    string path=@""+this.pathText.Text;
                    RoomClass rc = new RoomClass();
                    DataSet dataSet = rc.queryHistoryAlarmList();
                    b=ExportFile.DataSetToExcel(path);
                   
                }
                else if (this.reportPdf.IsChecked == true)
                {
                    //bean.FontSize = int.Parse(this.pdfFont.Text);
                    float fontSize = float.Parse(this.pdfFont.Text);
                    //bean.Color = this.pdfColor.Background;
                    Brush color = this.pdfColor.Background;
                    //bean.Width = int.Parse(this.pdfWidh.Text);
                    //bean.Height = int.Parse(this.pdfheight.Text);
                    string title = "历史报警表";
                    string path = @"" + this.pathText.Text;
                   
                       // RoomClass rc = new RoomClass();
                    DataSet dataSet = MySqlHelper.GetDataSet(MySqlHelper.Conn, CommandType.Text, ExportFileSql.sql);
                    b= ExportFile.ConvertDataTableToPDF(dataSet.Tables[0], path, title,color, fontSize, null);
                }
                else if (this.reportHtml.IsChecked == true)
                {
                   //bean.FontSize = int.Parse(this.htmlFont.Text);
                   // bean.Color = this.htmlColor.Background;
                   // bean.Width = int.Parse(this.htmlWidth.Text);
                    //string fontColor = this.htmlColor.Background.ToString();
                    //System.Windows.MessageBox.Show(fontColor);
                    string path = @"" + this.pathText.Text;
                    //bean.Height = int.Parse(this.htmlHeight.Text);
                    //RoomClass rc = new RoomClass();
                    DataSet dataSet = MySqlHelper.GetDataSet(MySqlHelper.Conn, CommandType.Text, ExportFileSql.sql);
                    string title = "历史报警数据";
                    b = ExportFile.MakeHtml(path, dataSet, title, this.htmlColor.Background, int.Parse(this.htmlFont.Text));

                }
                if (b == true)
                {
                    JXMessageBox.Show(this, "文件成功导出!", MsgImage.Success);
                }
                else
                {
                    JXMessageBox.Show(this, "文件导出失败!", MsgImage.Error);
                }
            }
Пример #60
0
 private void Add_ReaderAndWrite(object sender, RoutedEventArgs e)
 {
     AddReaderWrider rw = new AddReaderWrider();
     EquipmentClass ec = new EquipmentClass();
     RoomClass rc = new RoomClass();
     MySqlDataReader roomReader = rc.queryRoomsName();
     ComboBox rooms = rw.roomBox;
     ComboBoxItem roomItem = new ComboBoxItem();
     roomItem.Content = "请选择...";
     roomItem.Tag = "";
     roomItem.IsSelected = true;
     rooms.Items.Add(roomItem);
     while (roomReader.Read())
     {
         roomItem = new ComboBoxItem();
         roomItem.Content = roomReader["ROOM_NAME"];
         roomItem.Tag = roomReader["ID"];
         rooms.Items.Add(roomItem);
     }
     MySqlDataReader reader = ec.getWriderMaxId();
     if (reader.Read())
     {
         if ("".Equals(reader["ID"].ToString()) || reader["ID"] == null)
         {
             int _Ecode = 100000;
             rw.number.Text = "100000";
             rw.numberStr.Text = ReaderAndWriterConnection.getEPCCode(_Ecode);
         }
         else
         {
             rw.number.Text = reader["ID"].ToString();
             rw.numberStr.Text = ReaderAndWriterConnection.getEPCCode(int.Parse(reader["ID"].ToString()));
         }
     }
     rw.Owner = Window.GetWindow(this);
     rw.ShowDialog();
 }