Пример #1
0
        /// <summary>
        /// Инизиализация контролов
        /// </summary>
        private void InitControls()
        {
            Controls = new List <Control>();

            Int32 stat_x = _firstPlayer.EnemyMap.Widht + _firstPlayer.Map.Widht + 25;

            _staticTitle = new Lable();

            _currentPlayerLable          = new Lable();
            _currentPlayerKilledLable    = new Lable();
            _currentPlayerLostLable      = new Lable();
            _currentPlayerShipCountLable = new Lable();

            _staticTitle.Location = new Core.Vector2D(stat_x, 0);

            _currentPlayerLable.Location          = new Core.Vector2D(2, _firstPlayer.Map.Height + 2);
            _currentPlayerKilledLable.Location    = new Core.Vector2D(stat_x, 2);
            _currentPlayerLostLable.Location      = new Core.Vector2D(stat_x, 3);
            _currentPlayerShipCountLable.Location = new Core.Vector2D(stat_x, 4);


            Controls.Add(_currentPlayerLable);
            Controls.Add(_currentPlayerShipCountLable);
            Controls.Add(_currentPlayerKilledLable);
            Controls.Add(_currentPlayerLostLable);
            Controls.Add(_staticTitle);
        }
Пример #2
0
        public override Operation check(string rule)
        {
            string[] words = rule.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            //определение переменной как ячейки таблицы
            if (words.Length > 0 && words[0] == "INITIAL")
            {
                string[] parameters = words[1].Split(new char[] { ',' }, StringSplitOptions.
                                                     RemoveEmptyEntries);
                Variable variable = new Variable(parameters[0].Remove(0, 2), "", parameters[1]);
                model.getState().variables.Add(variable);
                return(new InitialOperation(model));
            }
            //Для случая наличия метки
            if (words.Length > 1 && words[1] == "INITIAL")
            {
                Lable lable = new Lable(model.getState().newRules.Count, words[0]);//создание метки
                model.getState().lables.Add(lable);
                string[] parameters = words[2].Split(new char[] { ',' }, StringSplitOptions.
                                                     RemoveEmptyEntries);
                Variable variable = new Variable(parameters[0], "", parameters[1]);
                model.getState().variables.Add(variable);
                return(new InitialOperation(model));
            }

            return(null);
        }
Пример #3
0
        internal static List <Lable> GetShowIndexLables(int lableCount)
        {
            List <Lable>  list   = new List <Model.Lable>();
            StringBuilder sqlCmd = new StringBuilder("select * from Lable limit ");

            sqlCmd.Append(lableCount.ToString());
            sqlCmd.Append(" where IsDelete=0 and Enable=1 and IsShowIndex=1 order by IndexShowSort asc");
            using (var dr = MysqlHelper.ExcuteReader(sqlCmd.ToString()))
            {
                while (dr.Read())
                {
                    Lable data = new Lable()
                    {
                        LableId       = dr.GetInt32("LableId"),
                        LableName     = dr["LableName"].ToString(),
                        CreateBy      = dr.GetInt32("CreateBy"),
                        CreateTime    = dr.GetDateTime("CreateTime"),
                        Enable        = dr.GetBoolean("Enable"),
                        IndexShowSort = dr.GetInt32("IndexShowSort"),
                        IsShowIndex   = dr.GetBoolean("IsShowIndex"),
                        ModifyBy      = dr.GetInt32("ModifyBy"),
                        ModifyTime    = dr.GetDateTime("ModifyTime"),
                    };
                    list.Add(data);
                }
            }
            if (list.Count == 0)
            {
                list = null;
            }
            return(list);
        }
Пример #4
0
 public CardLabel(Lable lable)
 {
     this.lable = lable;
     this.Text  = lable.lable_text;
     this.BackgroundRGBColor = lable.background;
     this.ForegroundRGBColor = lable.foreground;
 }
Пример #5
0
        public async Task <ActionResult <Lable> > PostLable(Lable lable)
        {
            _context.lables.Add(lable);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLable", new { id = lable.Id }, lable));
        }
Пример #6
0
        public async Task <IActionResult> PutLable(int id, Lable lable)
        {
            if (id != lable.Id)
            {
                return(BadRequest());
            }

            _context.Entry(lable).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #7
0
        public override Operation check(string rule)
        {
            string[] words = rule.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (words.Length > 0 && words[0] == "ASSIGN")
            {
                string[] param = words[1].Split(new char[] { ',' },
                                                StringSplitOptions.RemoveEmptyEntries);
                parameters    = new string[2];
                parameters[0] = param[0];
                parameters[1] = param[1];
                return(new AssignOperation(param[0], param[1], model));
            }
            //Для случая наличия метки
            if (words.Length > 1 && words[1] == "ASSIGN")
            {
                Lable lable = new Lable(model.getState().newRules.Count, words[0]);//создание метки
                model.getState().lables.Add(lable);
                string[] param = words[2].Split(new char[] { ',' }, StringSplitOptions.
                                                RemoveEmptyEntries);
                parameters    = new string[2];
                parameters[0] = param[0];
                parameters[1] = param[1];
                return(new AssignOperation(param[0], param[1], model));
            }

            return(null);
        }
Пример #8
0
 public CardLabel(string Text, string BackgroundRGBColor, string ForegroundRGBColor)
 {
     this.Text = Text;
     this.BackgroundRGBColor = BackgroundRGBColor;
     this.ForegroundRGBColor = ForegroundRGBColor;
     lable = new Lable(Text, BackgroundRGBColor, ForegroundRGBColor, DataProgram.Room.room_id);
     DataLable.AddLable(lable);
 }
Пример #9
0
        public int DeleteLable(int LableId)
        {
            Lable lable  = _context.Lable.Find(LableId);
            var   result = _context.Lable.Remove(lable);

            _context.SaveChanges();
            return(result.Entity.LableId);
        }
Пример #10
0
        public Lable AddLable(int AccountId, int NoteId, Lable lable)
        {
            lable.NoteId = NoteId;
            var result = _context.Lable.Add(lable);

            _context.SaveChanges();
            return(result.Entity);
        }
Пример #11
0
        public async Task <Lable> CreateLableForRent(int MoviesId, int MovieStudioId)
        {
            var lable = new Lable();


            var asd = await lable.GetEtikettData(_context, MoviesId, MovieStudioId);

            var XmlLable = lable.CreateLabel(lable);

            return(XmlLable);
        }
Пример #12
0
 public void AddLableClick()
 {
     try
     {
         Lable nLable = new Lable(_iGenreLableAdd.LableAdd);
         nLable.Create();
         _iGenreLableAdd.ShowSuccessMessage();
     }
     catch
     {
         _iGenreLableAdd.ShowErrorMessage();
     }
 }
Пример #13
0
        /// <summary>
        /// В методе игрок создает флот и размещает его на крате
        /// </summary>
        /// <param name="Player">Игрок</param>
        private void PlayerCreateFleet(IActor Player)
        {
            //очистка игровой консоли
            _gameConsole.Clean();

            Player.EnemyMap.IsCellsVisible = false;
            Player.Map.IsCellsVisible      = true;

            //создание меток с текстом-подсказкой
            Lable firstLine  = new Lable($"Создание и размещение подлодок - #");
            Lable secondLine = new Lable($"Примен: a1 v, где а1 - позиция, v - верикально, если это параметр не указан, то корабль");
            Lable thirdLine  = new Lable($"создастся горизонтально");

            //размешение меток в консоле
            firstLine.Location  = new Core.Vector2D(0, _firstPlayer.Map.Height + 2);
            secondLine.Location = new Core.Vector2D(0, _firstPlayer.Map.Height + 3);
            thirdLine.Location  = new Core.Vector2D(0, _firstPlayer.Map.Height + 4);

            //добавление их на консоль
            Controls.Add(firstLine);
            Controls.Add(secondLine);
            Controls.Add(thirdLine);

            try
            {
                CreateShips(Player, 4, "s");

                firstLine.Text = "Создание и размещение крейсера - ##";
                CreateShips(Player, 3, "c");

                firstLine.Text = "Создание и размещение эсминца - ###";
                CreateShips(Player, 2, "cr");

                DrawControls();
                firstLine.Text = "Создание и размещение линкора - ####";
                ShipBase ship = CreateShip(Player.Map, "b " + _gameConsole.Input());
                Player.Map.AddShipToMap(ship);
                Player.Fleet.AddShipeToFleet(ship);

                Player.Map.Draw();
            }
            catch (Exception ex)
            {
                _gameConsole.AddString(ex.Message);
            }

            //удаление меток с консоли
            Controls.Remove(firstLine);
            Controls.Remove(secondLine);
            Controls.Remove(thirdLine);
        }
Пример #14
0
        /// <summary>
        /// 标签详细信息-暂时不需要此项功能
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        // GET: Lables/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Lable lable = db.Lable.Find(id);

            if (lable == null)
            {
                return(HttpNotFound());
            }
            return(View(lable));
        }
Пример #15
0
 private void addLabelButton_Click(object sender, EventArgs e)
 {
     try
     {
         string temp = lableBox.Text;
         Lable nLable = new Lable(temp);
         nLable.Create();
         MessageBox.Show("Done!^_^", "TheResult");
     }
     catch
     {
         MessageBox.Show("Something bad has happened!", "Whoops!");
     }
 }
Пример #16
0
        static MessageBox()
        {
            _text = new Lable();
            _location
                = new Vector2D(
                      Console.WindowWidth / 2 - _text.Widht,
                      Console.WindowHeight / 2 - _text.Height);



            _width  = 30;
            _height = 10;
            InitControls();
            _body = InitBody(_width, _height);
        }
Пример #17
0
        public About(Compound gui)
            : base(gui, new Rectangle(32, 32, 480, 240), new DisplayCaption("About CStari"), new List <Atom>())
        {
            string aboutCaption = "CStari: " + Core.VersionNumber + "\n\n" +
                                  "Bryon Vandiver ([email protected]): Code\n" +
                                  "Kevin Horton: Public Domain Information\n" +
                                  "Dan Boris: Public Domain Information\n" +
                                  "Steve Wright: Stella Programmer's Guide";

            Add(new StaticImage(gui, new Rectangle(16, 16, 128, 128), aboutIcon));

            about = new Lable(gui, new Rectangle(140, 16, 340, 200), aboutCaption, Alignment.CENTER, Color.White, DisplaySettings.captionFont);

            Add(about);
        }
Пример #18
0
        public Disassembler(Compound gui, Atari a)
            : base(gui, new Rectangle(32, 32, 395 + 32 + 16, 208 + 36 + 32), new DisplayCaption("Disassembler"), new List <Atom>())
        {
            atari = a;

            List <DisplayCaption> radioList = new List <DisplayCaption>();

            radioList.Add(new DisplayCaption("Cartridge"));
            radioList.Add(new DisplayCaption("RIOT"));

            followPC = true;

            // Create other thingers here

            Add(new CheckBox(gui, new Rectangle(0, 0, 128, 16), new DisplayCaption("Follow PC"), followPC, follow));
            Add(new CheckBox(gui, new Rectangle(0, 20, 128, 16), new DisplayCaption("Dump Trace"), false, atari.setTrace));
            Add(scrollBar = new Scroll(gui, new Rectangle(395 + 16, 0, 16, 208), new Range(0, 0), addressChanged));

            Add(address     = new Lable(gui, new Rectangle(128, 0, 44, 208), "", Alignment.RIGHT, Color.Black, DisplaySettings.fixedPointFont));
            Add(instruction = new Lable(gui, new Rectangle(176, 0, 136, 208), "", Alignment.LEFT, Color.White, DisplaySettings.fixedPointFont));
            Add(data        = new Lable(gui, new Rectangle(316, 0, 79, 208), "", Alignment.LEFT, Color.LightBlue, DisplaySettings.fixedPointFont));

            Add(modEdit = new EditBox(gui, new Rectangle(304, 215, 64, 20), "", null));

            Add(new Radio(gui, new Rectangle(0, 40, 100, 16), radioList, baseChanged));
            Add(PCLable = new Lable(gui, new Rectangle(40, 84, 80, 16), "", Alignment.LEFT, Color.Black, DisplaySettings.fixedPointFont));
            Add(ALable  = new Lable(gui, new Rectangle(40, 104, 80, 16), "", Alignment.LEFT, Color.Black, DisplaySettings.fixedPointFont));
            Add(XLable  = new Lable(gui, new Rectangle(40, 124, 80, 16), "", Alignment.LEFT, Color.Black, DisplaySettings.fixedPointFont));
            Add(YLable  = new Lable(gui, new Rectangle(40, 144, 80, 16), "", Alignment.LEFT, Color.Black, DisplaySettings.fixedPointFont));
            Add(SLable  = new Lable(gui, new Rectangle(40, 164, 80, 16), "", Alignment.LEFT, Color.Black, DisplaySettings.fixedPointFont));
            Add(PLable  = new Lable(gui, new Rectangle(40, 184, 80, 16), "", Alignment.LEFT, Color.Black, DisplaySettings.fixedPointFont));
            Add(new Lable(gui, new Rectangle(0, 84, 32, 16), "PC", Alignment.RIGHT, Color.White, DisplaySettings.fixedPointFont));
            Add(new Lable(gui, new Rectangle(0, 104, 32, 16), "A", Alignment.RIGHT, Color.White, DisplaySettings.fixedPointFont));
            Add(new Lable(gui, new Rectangle(0, 124, 32, 16), "X", Alignment.RIGHT, Color.White, DisplaySettings.fixedPointFont));
            Add(new Lable(gui, new Rectangle(0, 144, 32, 16), "Y", Alignment.RIGHT, Color.White, DisplaySettings.fixedPointFont));
            Add(new Lable(gui, new Rectangle(0, 164, 32, 16), "S", Alignment.RIGHT, Color.White, DisplaySettings.fixedPointFont));
            Add(new Lable(gui, new Rectangle(0, 184, 32, 16), "P", Alignment.RIGHT, Color.White, DisplaySettings.fixedPointFont));
            Add(new Button(gui, new Rectangle(0, 212, 48, 26), new DisplayCaption("Run"), atari.run));
            Add(new Button(gui, new Rectangle(52, 212, 48, 26), new DisplayCaption("Stop"), atari.stop));
            Add(new Button(gui, new Rectangle(104, 212, 48, 26), new DisplayCaption("Step"), step));
            Add(new Button(gui, new Rectangle(156, 212, 72, 26), new DisplayCaption("Jump To"), jumpTo));
            Add(new Button(gui, new Rectangle(232, 212, 64, 26), new DisplayCaption("Run To"), runTo));

            focusAddress = atari.m_PC;

            baseChanged(0);
        }
 public ActionResult ArticleEdit(FormCollection collection)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             string  Article_ID = collection["Article_ID"];
             Article article    = db.Article.Where(x => x.Article_ID.ToString() == Article_ID).FirstOrDefault();
             article.Article_Title    = collection["Article_Title"];
             article.Article_Content  = collection["editor"];
             article.Article_Abstract = collection["Article_Abstract"];
             string type      = collection["ArticleType_ID"].Trim() + "-" + collection["inputForum_Name"].Trim();
             int    ATypeID   = db.ArticleType.Where(x => x.ArticleType_Name == type).Select(x => x.ArticleType_ID).FirstOrDefault();
             var    array     = collection["biaoqian"].Split(',');
             string LableText = ",";
             int    lableid;
             foreach (var xa in array)
             {
                 if (db.Lable.Where(x => x.Lable_Text == xa).Count() > 0)
                 {
                 }
                 else
                 {
                     Lable lable = new Lable {
                         Lable_Text = xa, Lable_Remark = collection["Article_Title"] + "新增", Lable_CreatDT = DateTime.Now
                     };
                     db.Lable.Add(lable);
                     db.SaveChanges();
                 }
                 lableid    = db.Lable.Where(x => x.Lable_Text == xa).Select(x => x.Lable_ID).FirstOrDefault();
                 LableText += lableid + ",";
             }
             article.ArticleType_ID  = ATypeID;
             article.Lable_ID        = LableText;
             db.Entry(article).State = EntityState.Modified;
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(Content("<script>alert('修改成功" + type + "需要编译?');</script>"));
         }
         catch (DataException)
         {
             dbContextTransaction.Rollback();
             ModelState.AddModelError("", "无法保存更改。再试一次,如果问题仍然存在,请参见系统管理员。");
             return(Content("<script>alert('修改失败');</script>"));
         }
     }
 }
Пример #20
0
        public override void Render()
        {
            foreach (GLPrimitive oPrimitive in m_lPrimitives)
            {
                oPrimitive.Render();
            }

            if (RenderChildren == true)
            {
                foreach (SceenElement oElement in m_lChildren)
                {
                    oElement.Render();
                }
            }

            Lable.Render();
        }
Пример #21
0
        public override Operation check(string rule)
        {
            string[] words = rule.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (words.Length > 0 && words[0] == "ENTER")
            {
                string[] param = words[1].Split(new char[] { ',' }, StringSplitOptions.
                                                RemoveEmptyEntries);
                if (param.Count() == 2)
                {
                    return(new EnterOperation(param[0], int.Parse(param[1]), model));
                }
                if (param.Count() == 1)
                {
                    return(new EnterOperation(words[1], model));
                }
                if (param.Count() > 2)
                {
                    throw new IncorrectFormatOperation("Incorrect format modeling operation" +
                                                       "enter");
                }
            }
            //Для случая наличия метки
            if (words.Length > 1 && words[1] == "ENTER")
            {
                Lable lable = new Lable(model.getState().newRules.Count, words[0]);//создание метки
                model.getState().lables.Add(lable);
                string[] param = words[2].Split(new char[] { ',' }, StringSplitOptions.
                                                RemoveEmptyEntries);
                if (param.Count() == 2)
                {
                    return(new EnterOperation(param[0], int.Parse(param[1]), model));
                }
                if (param.Count() == 1)
                {
                    return(new EnterOperation(words[2], model));
                }
                if (param.Count() > 2)
                {
                    throw new IncorrectFormatOperation("Incorrect format modeling operation" +
                                                       "enter");
                }
            }

            return(null);
        }
Пример #22
0
        /// <summary>
        ///  Метод создает корабль изходя из пользовательского ввода
        ///  Пример:
        ///  b a1 v;
        ///  Метод создаст вертикально напревленный линкор на карте на координатах a1
        /// </summary>
        /// <param name="map">Карта, где будет размещене корабль</param>
        /// <param name="playersInput">строка из которой создается корабль</param>
        /// <returns>Корабль</returns>
        private ShipBase CreateShip(Map map, string playersInput)
        {
            string shipType          = playersInput.Split(' ')[0];
            string position_from_str = playersInput.Split(' ')[1];
            bool   isVectical        = (playersInput.Contains('v')) ? true : false;

            ShipBase ship = CreateShipFromString(shipType);

            ship.IsVertical = isVectical;

            Vector2D position_vec = GetShipPositionOnMap(map, position_from_str);

            ship.Location = position_vec;
            map.Shipes.ForEach(s =>
            {
                while (s.IsShipInFov(ship) || !map.CanBePlace(ship))
                {
                    Lable firstLine = new Lable
                    {
                        Text     = $"Введите позицию корабля снова!!!!!",
                        Location = new Core.Vector2D(0, _firstPlayer.Map.Height + 2)
                    };
                    Controls.Add(firstLine);
                    DrawControls();
                    position_vec = GetShipPositionOnMap(map, _gameConsole.Input());
                    Controls.Remove(firstLine);
                    ship.Location = position_vec;
                }

                //if (s.Location.X == position_vec.X && s.Location.Y == position_vec.Y)
                //{
                //    Int32 offset = 1 + s.Size;
                //    if ((position_vec.X + offset + s.Size)  < map.Widht)
                //        position_vec.X += offset;
                //    else if((position_vec.Y + offset + s.Size) < map.Height)
                //    {
                //        position_vec.X = 1;
                //        position_vec.Y += offset - 1;
                //    }
                //}
            });

            ship.Location = position_vec;

            return(ship);
        }
Пример #23
0
        public override Operation check(string rule)
        {
            string[] words = rule.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            //определение переменной как ячейки таблицы
            if (words.Length > 0 && words[0] == "GENERATE")
            {
                //здесь не все параметры считываются, например, время начальной задержки вообще
                //пропущено, так как для курсовой это не требуется, если понадобится, изменить
                //этот if
                string[] parameters = words[1].Split(new char[] { ',' }, StringSplitOptions.
                                                     RemoveEmptyEntries);
                //далее третьим параметром указывается время до следующей транзакции, в данном
                //случае оно равно нулю, по причине, описанной выше
                //но далее в программе оно используется, при модернизации вместо нуля нужно будет
                //просто указать считанный параметр, которого сейчас нет
                TranzactionsGenerator tranzactions_generator = new TranzactionsGenerator((
                                                                                             int.Parse(parameters[0]) - int.Parse(parameters[1])), (int.
                                                                                                                                                    Parse(parameters[0]) + int.Parse(parameters[1])), 0, model.getState().
                                                                                         newRules.Count, int.Parse(parameters[2]));
                model.getState().tranzation_generators.Add(tranzactions_generator);
                return(new GenerateOperation(model));
            }
            //Для случая наличия метки
            if (words.Length > 1 && words[1] == "GENERATE")
            {
                Lable lable = new Lable(model.getState().newRules.Count, words[0]);//создание метки
                model.getState().lables.Add(lable);
                //здесь не все параметры считываются, например, время начальной задержки вообще
                //пропущено, так как для курсовой это не требуется, если понадобится, изменить
                //этот if
                string[] parameters = words[2].Split(new char[] { ',' }, StringSplitOptions.
                                                     RemoveEmptyEntries);
                //далее третьим параметром указывается время до следующей транзакции, в данном
                //случае оно равно нулю, по причине, описанной выше но далее в программе оно
                //используется, при модернизации вместо нуля нужно будет просто указать
                //считанный параметр, которого сейчас нет
                TranzactionsGenerator tranzactions_generator = new TranzactionsGenerator((int.
                                                                                          Parse(parameters[0]) - int.Parse(parameters[1])), (int.Parse(parameters[0]) +
                                                                                                                                             int.Parse(parameters[1])), 0, model.getState().newRules.Count, int.
                                                                                         Parse(parameters[2]));
                model.getState().tranzation_generators.Add(tranzactions_generator);
                return(new GenerateOperation(model));
            }

            return(null);
        }
Пример #24
0
        public int DeleteConfirmed(int id)
        {
            var state = 0;

            try
            {
                Lable lable = db.Lable.Find(id);
                db.Lable.Remove(lable);
                db.SaveChanges();
                state = 0;
            }
            catch (DataException)
            {
                state = 5;
                ModelState.AddModelError("", "无法保存更改。再试一次,如果问题仍然存在,请参见系统管理员。");
            }
            return(state);
        }
Пример #25
0
        public override Operation check(string rule)
        {
            string[] words = rule.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (words.Length > 0 && words[0] == "TERMINATE")
            {
                return(new TerminateOperation(model));
            }
            //Для случая наличия метки
            if (words.Length > 1 && words[1] == "TERMINATE")                        //Для случая существования метки
            {
                Lable lable = new Lable(model.getState().newRules.Count, words[0]); //создание метки
                model.getState().lables.Add(lable);
                return(new TerminateOperation(model));
            }

            return(null);
        }
Пример #26
0
        public ActionResult Create([Bind(Include = "Lable_ID,Lable_CreatDT,Lable_Remark,Lable_Text")] Lable lable)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Lable.Add(lable);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError("", "无法保存更改。再试一次,如果问题仍然存在,请参见系统管理员。");
            }

            return(View(lable));
            //return RedirectToAction("Index", lable);
        }
Пример #27
0
        public override Operation check(string rule)
        {
            string[] words = rule.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (words.Length > 1 && words[1] == "STORAGE")
            {
                Storage storage = new Storage(words[0], int.Parse(words[2]));
                model.getState().storages.Add(storage);
                return(new StorageOperation(model));
            }
            //Для случая наличия метки
            if (words.Length > 2 && words[2] == "STORAGE")
            {
                Lable lable = new Lable(model.getState().newRules.Count, words[0]);//создание метки
                model.getState().lables.Add(lable);
                Storage storage = new Storage(words[1], int.Parse(words[3]));
                model.getState().storages.Add(storage);
                return(new StorageOperation(model));
            }

            return(null);
        }
Пример #28
0
        private static string WriteLableInfo(Lable lable)
        {
            StringBuilder stringBuilder = new StringBuilder();

            AddComma(lable.TestCaseName, stringBuilder);
            AddComma(lable.TestQuestion, stringBuilder);
            AddComma(lable.IsReference, stringBuilder);
            AddComma(lable.ReferenceImage, stringBuilder);
            AddComma(lable.NameUser, stringBuilder);
            AddComma(lable.SurnameUser, stringBuilder);
            AddComma(lable.PathImage.Split('/')[0], stringBuilder);
            AddComma(lable.PathImage.Split('/')[1], stringBuilder);
            //AddComma(lable.EmailUser, stringBuilder);
            AddComma(lable.Description, stringBuilder);
            AddComma(lable.TotalValue, stringBuilder);
            AddComma(string.Format("{0:0.00}", lable.lable), stringBuilder);
            //HttpContext.Current.Response.Write(stringBuilder.ToString());
            //HttpContext.Current.Response.Write(Environment.NewLine);

            return(stringBuilder.ToString());
        }
Пример #29
0
        public override Operation check(string rule)
        {
            string[] words = rule.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (words.Length > 1 && words[1] == "VARIABLE")
            {
                Variable variable = new Variable(words[0], words[2], "");
                model.getState().variables.Add(variable);
                return(new VariableOperation(model));
            }
            //Для случая наличия метки
            if (words.Length > 2 && words[2] == "VARIABLE")
            {
                Lable lable = new Lable(model.getState().newRules.Count, words[0]);//создание метки
                model.getState().lables.Add(lable);
                Variable variable = new Variable(words[1], words[3], "");
                model.getState().variables.Add(variable);
                return(new VariableOperation(model));
            }

            return(null);
        }
Пример #30
0
        //[ValidateAntiForgeryToken]
        public int Edit(string Lable_Remark, string Lable_Text, string inputLable_ID)
        {
            var state = 0;

            try
            {
                int id = int.Parse(inputLable_ID.Trim());
                if (Lable_Remark.Trim() == "" || Lable_Text.Trim() == "")
                {
                    state = 1;
                }
                else
                if (db.Lable.Where(x => x.Lable_Text == Lable_Text.Trim()).Count() > 0)
                {
                    state = 2;
                }
                else
                {
                    Lable lable = new Lable {
                        Lable_ID = id, Lable_Remark = Lable_Remark.Trim(), Lable_Text = Lable_Text.Trim(), Lable_CreatDT = DateTime.Now
                    };
                    db.Entry(lable).State = EntityState.Modified;
                    db.SaveChanges();
                    state = 0;
                }
                //if (ModelState.IsValid)
                //{
                //    db.Entry(lable).State = EntityState.Modified;
                //    db.SaveChanges();
                //    return RedirectToAction("Index");
                //}
            }
            catch (DataException)
            {
                state = 5;
                ModelState.AddModelError("", "无法保存更改。再试一次,如果问题仍然存在,请参见系统管理员。");
            }
            return(state);
        }
Пример #31
0
        public override Operation check(string rule)
        {
            string[] words = rule.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (words.Length > 0 && words[0] == "SEIZE")
            {
                Device device = new Device(words[1]);
                model.getState().devices.Add(device);
                return(new SeizeOperation(words[1], model));
            }
            //Для случая наличия метки
            if (words.Length > 1 && words[1] == "SEIZE")
            {
                Lable lable = new Lable(model.getState().newRules.Count, words[0]);//создание метки
                model.getState().lables.Add(lable);
                Device device = new Device(words[2]);
                model.getState().devices.Add(device);
                return(new SeizeOperation(words[2], model));
            }

            return(null);
        }
Пример #32
0
    public DayButton()
    {
        _ButtonText = new Lable
        {
            Text = EventName
        }
        insideGrid = new Grid
        {
            VerticalOptions   = LayoutOptions.FillAndExpand,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            RowSpacing        = 0,

            RowDefinitions =
            {
                new RowDefinition {
                    Height = GridLength.Auto
                }                                                        //0
            },
            ColumnDefinitions =
            {
                new ColumnDefinition {
                    Width = GridLength.Star
                }                                                          //0
            }
        };

        //Add your elements to the grid
        insideGrid.Children.Add(_ButtonText, 0, 1, 0, 1)

        //Set the grid as the content of this view
        Content = insideGrid;



        _buttonTap = new TapGestureRecognizer();
        this.GestureRecognizers.Add(_buttonTap);
        _buttonTap.Tapped += ButtonClicked;
    }
Пример #33
0
        // add artist and album
        private void addButton_Click(object sender, EventArgs e)
        {
            try
               {
                string artistName = artistTBox.Text;

                if (artistName == "")
                {
                   Exception ex = new Exception("Please, insert artist's name!");
                   throw ex;
                }

                string gName = genreBox.Text;
                Genre gID = Genre.GetGenreID(gName);
                Artist findartist = Artist.CheckArtist(artistName);

                Artist artist = new Artist();

                if (findartist == null)
                {
                    artist = new Artist(artistName, gID);
                    artist.Create();
                    artist = Artist.CheckArtist(artistName);
                }
                else
                {
                    artist = Artist.CheckArtist(artistName);
                }
                string y = yearBox.Text;

                YearTable year = YearTable.GetYearID(y);

                if (year == null)
                {
                    year = new YearTable(y);
                    year.Create();
                    year = YearTable.GetYearID(y);
                }
                else
                {
                    year = YearTable.GetYearID(y);
                }

                string l = lableBox.Text;
                Lable lable = Lable.GetLableID(l);

                if (lable == null)
                {
                    lable = new Lable(l);
                    lable.Create();
                    lable = Lable.GetLableID(l);
                }
                else
                {
                    lable = Lable.GetLableID(l);
                }

                string af = formatBox.Text;
                AlbumFormat format = AlbumFormat.GetFormatID(af);

                if (format == null)
                {
                    format = new AlbumFormat(af);
                    format.Create();
                    format = AlbumFormat.GetFormatID(af);
                }
                else
                {
                    format = AlbumFormat.GetFormatID(af);
                }

                string alname = albumTBox.Text;

                Album album = new Album(alname, artist, year, lable, format);
                album.Create();

                album = Album.GetAlbumID(alname);

                string[] tracklist = tracklistTBox.Lines;

                TrackList tl;

                for (int i = 0; i < tracklist.Length; ++i)
                {
                    string tnum = "00";
                    string tname = "";
                    string tempp = "";
                    bool whitespace = false;
                    for (int j = 0; j < tracklist[i].Length; ++j)
                    {
                        if (tracklist[i][j] == ' ' && !whitespace)
                        {
                            whitespace = true;
                            tnum = tempp;
                            tempp = "";
                        }
                        else
                        {
                            tempp += tracklist[i][j];
                        }
                    }
                    tname = tempp;
                    tl = new TrackList(tname, tnum, album);
                    tl.Create();
                }

                MessageBox.Show("Done!^_^", "TheResult");
              }
              catch
              {
             MessageBox.Show("Something bad has happened!", "Whoops!");
              }
        }
Пример #34
0
        public void AddButtClick()
        {
            try
            {
                if (_addMusicControl.ArtistAdd == "")
                {
                    Exception ex = new Exception("Please, insert artist's name!");
                    throw ex;
                }

                Genre gId = Genre.GetGenreID(_addMusicControl.GenreAdd);
                Artist findartist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                Artist artist;

                if (findartist == null)
                {
                    artist = new Artist(_addMusicControl.ArtistAdd, gId);
                    artist.Create();
                    artist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                }
                else
                {
                    artist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                }

                YearTable year = YearTable.GetYearID(_addMusicControl.YearAdd);

                if (year == null)
                {
                    year = new YearTable(_addMusicControl.YearAdd);
                    year.Create();
                    year = YearTable.GetYearID(_addMusicControl.YearAdd);
                }
                else
                {
                    year = YearTable.GetYearID(_addMusicControl.YearAdd);
                }

                Lable lable = Lable.GetLableId(_addMusicControl.LableAdd);

                if (lable == null)
                {
                    lable = new Lable(_addMusicControl.LableAdd);
                    lable.Create();
                    lable = Lable.GetLableId(_addMusicControl.LableAdd);
                }
                else
                {
                    lable = Lable.GetLableId(_addMusicControl.LableAdd);
                }

                AlbumFormat format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);

                if (format == null)
                {
                    format = new AlbumFormat(_addMusicControl.FormatAdd);
                    format.Create();
                    format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);
                }
                else
                {
                    format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);
                }

                Album album = new Album(_addMusicControl.AlbumAdd, artist, year, lable, format);
                album.Create();
                album = Album.GetAlbumId(_addMusicControl.AlbumAdd);
                TrackList tl;

                for (int i = 0; i < _addMusicControl.TrackListAdd.Length; ++i)
                {
                    string tnum = "00";
                    string tname = "";
                    string tempp = "";
                    bool whitespace = false;
                    for (int j = 0; j < _addMusicControl.TrackListAdd[i].Length; ++j)
                    {
                        if (_addMusicControl.TrackListAdd[i][j] == ' ' && !whitespace)
                        {
                            whitespace = true;
                            tnum = tempp;
                            tempp = "";
                        }
                        else
                        {
                            tempp += _addMusicControl.TrackListAdd[i][j];
                        }
                    }
                    tname = tempp;
                    tl = new TrackList(tname, tnum, album);
                    tl.Create();
                }
                _addMusicControl.ShowSuccessMessage();
            }
            catch
            {
                _addMusicControl.ShowErrorMessage();
            }
        }