internal async Task UpdateIntroduction_InvalidAsync(Introduction update)
        {
            using (var context = Storage.CreateContext())
            {
                try
                {
                    var api = Storage.CreatePrivateController(context);
                    api.ControllerContext = await ControllerContextCreator.CreateValid(context, null);

                    var updateResponse =
                        (
                            await api.SaveIntroductionAsync(update) as JsonResult
                        ).Value as ExecutionResult <Introduction>;

                    GenericChecks.CheckFail(updateResponse);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    context.FlushData();
                }
            }
        }
Exemple #2
0
        public ActionResult Index(string id = "")
        {
            string userGuid = string.Empty;

            if (string.IsNullOrWhiteSpace(id))
            {
                userGuid = LoginHelper.UserGuid;
            }
            else
            {
                userGuid = id;
            }
            var userService = new UserService();
            var user        = userService.GetLoginUserAvatar(userGuid);

            if (user == null && string.IsNullOrEmpty(id))
            {
                return(RedirectToAction("Index", "Login"));
            }
            if (user.iCount > 0)
            {
                user.Star = (int)Math.Round(user.iSum / Convert.ToDouble(user.iCount), 0);
            }
            else
            {
                user.Star = 0;
            }
            Introduction duction = new Introduction();

            duction = userService.GetLoginIntroduction(userGuid);
            ViewBag.Introduction = duction;
            return(View(user));
        }
Exemple #3
0
 private void MessageServer_MessageReceived(Message message, System.Net.IPEndPoint endPoint)
 {
     if (message is FileMessage)
     {
         var fileMessage = message as FileMessage;
         filesList.Add(fileMessage.ID, null);
         if (fileMessage.ID > lastFileIndex)
         {
             lastFileIndex = fileMessage.ID;
         }
     }
     if (message is Introduction)
     {
         Introduction intro = new Introduction
         {
             Name = Name
         };
         SendMessage(intro);
     }
     if (message is FileRequest)
     {
         var        fileRequest = message as FileRequest;
         var        file        = filesList[fileRequest.ID];
         FileSender fileSender  = new FileSender(fileRequest.RecieverEndPoint.ToIPEndPoint());
         fileSender.SendFile(file);
     }
     else
     {
         MessageReceived?.Invoke(message);
     }
 }
Exemple #4
0
 public void displayIntro(string title, Introduction intro)
 {
     setTextFieldsForIntro(title, intro.getFirstLine(), intro.getSecondLine());
     PCcontrolsImage.enabled = false;
     canvas.SetActive(true);
     StartCoroutine(startIntroTextFadeInAnimation());
 }
 public void PrivateNavigateTo()
 {
     this.Driver.Navigate().GoToUrl("https://docs.microsoft.com/en-us/dotnet/csharp/");
     DotNetCoreGuide.Click();
     Docker.Click();
     Introduction.Click();
 }
Exemple #6
0
 public HomeRoute(INotificationService notificationService)
 {
     this.notificationService = notificationService;
     RouteConfig.Title        = "Introduction";
     RouteConfig.Icon         = PackIconKind.Home;
     Model = new Introduction();
 }
Exemple #7
0
 /// <summary>Sets the starting quest to be active</summary>
 public void OnIntroFinish(Introduction introduction)
 {
     if (!startQuest.IsActive && !startQuest.IsCompleted)
     {
         startQuest.SetActive(true);
     }
 }
Exemple #8
0
        public JsonResult AddMyDescription(string userGuid, string description)
        {
            ResultModel result = new ResultModel()
            {
                errorCode = 500, errorMes = ""
            };

            try
            {
                Introduction duction = new Introduction();
                duction.UserGuid    = userGuid;
                duction.Description = description;
                duction.CreateTime  = DateTime.Now;
                var userService = new UserService();
                int i           = userService.CreateIntroductionToUser(duction);
                if (i > 0)
                {
                    result.errorCode = 200;
                    result.errorMes  = "ok";
                }
                else
                {
                    result.errorCode = 300;
                    result.errorMes  = "no";
                }
            }
            catch (Exception e)
            {
                result.errorCode = 400;
                result.errorMes  = e.Message;
            }
            return(Json(result));
        }
Exemple #9
0
        void Assign(Introduction introduction, IntroductionResource introductionResource)
        {
            introduction.Id = introductionResource.Id;

            if (introductionResource.Title != null)
            {
                introduction.Title = introductionResource.Title;
            }

            if ((introductionResource.MapPositions != null) && introduction.MapPositions == null)
            {
                introduction.MapPositions = new List <MapPosition>();

                foreach (MapPositionResource mapPositionResource in introductionResource.MapPositions)
                {
                    MapPosition newMapPosition = Convert(mapPositionResource);
                    introduction.MapPositions.Add(newMapPosition);
                    newMapPosition.Introduction = introduction;
                }
            }

            if ((introductionResource.DisplayObjects != null) && introduction.DisplayObjects == null)
            {
                introduction.DisplayObjects = new List <DisplayObject>();

                foreach (DisplayObjectResource displayObjectResource in introductionResource.DisplayObjects)
                {
                    DisplayObject newDisplayObject = Convert(displayObjectResource);
                    introduction.DisplayObjects.Add(newDisplayObject);
                    newDisplayObject.Introduction = introduction;
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            var clickedButton = (sender as Button);

            panelMain.Controls.Clear(true);
            Control newControl;
            var     str = clickedButton.Text;

            switch (str)
            {
            case "INTRODUCTION": newControl = new Introduction(); break;

            case "CONTENT": newControl = new Content(); break;

            case "CUSTOM PAINT": newControl = new CustomPaint(); break;

            default: newControl = new Introduction(); break;
            }

            newControl.Dock = DockStyle.Fill;
            panelMain.Controls.Add(newControl);

            //Paint selection button color
            foreach (Button item in panelLinks.Controls)
            {
                item.Image = null;
            }

            clickedButton.Image = _menuButtonImage;
            //clickedButton.FlatAppearance.MouseOverBackColor = Color.Red;
        }
        static void Main(string[] args)
        {
            SoundPlayer IntroSound = new SoundPlayer(@".\Sound\introSound.wav");

            IntroSound.Play();
            //workflow
            bool        playAgain = false;
            IntroScreen introShip = new IntroScreen();

            introShip.IntroscreenBattle();
            IntroSound.Stop();

            do
            {
                Player       p1     = new Player();
                Player       p2     = new Player();
                Introduction _intro = new Introduction();
                _intro.StartUpMenu(p1, p2);
                Game playGame = new Game();
                playGame.PlayerTurn(p1, p2);
                Console.WriteLine("\n\tWould you like to play again?(Y/N)");
                string YesNo = Console.ReadLine();
                if (YesNo.ToUpper() == "Y")
                {
                    playAgain = true;
                }
                else
                {
                    playAgain = false;
                }
            } while (playAgain);
            Console.WriteLine("\n\tThank you for playing!");
            Console.ReadLine();
        }
Exemple #12
0
        internal async Task GetIntroduction_Test(Introduction expected)
        {
            using (var context = Storage.CreateContext())
            {
                try
                {
                    var api      = Storage.CreatePublicController(context);
                    var response =
                        (
                            await api.GetIntroductionAsync() as JsonResult
                        ).Value as ExecutionResult <Introduction>;

                    GenericChecks.CheckSucceed(response);
                    Compare(expected, response.Data);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    context.FlushData();
                }
            }
        }
Exemple #13
0
        public ActionResult EditIntroduction(Introduction introduction)
        {
            if (introduction == null)
            {
                SetFailedNotification("Có lỗi xảy ra. Vui lòng thử lại");
                return(RedirectToAction("Index"));
            }

            if (!ModelState.IsValid)
            {
                foreach (var item in ModelState.Values)
                {
                    SetFailedNotification(item.Value.ToString());
                }
                return(View("EditIntroduction", introduction));
            }

            if (_layoutRepository.SaveIntroduction(introduction))
            {
                SetSuccessNotification("Cập nhật thông tin công ty thành công");
            }
            else
            {
                SetFailedNotification("Cập nhật thông tin không thành công. Xin thử lại");
            }

            return(RedirectToAction("Introduction", "Home"));
        }
        private static void CheckBeforeUpdate(DataModel.Introduction dbItem, Introduction introduction)
        {
            if (dbItem.Version != introduction.Version)
            {
                throw new InconsistencyException
                      (
                          string.Format(Resources.TextMessages.ItemWasAlreadyChanged, introduction.GetType().Name)
                      );
            }

            foreach (var item in dbItem.ExternalUrls)
            {
                var updated = introduction.ExternalUrls?.FirstOrDefault(x => x.Id == item.ExternalUrlId);

                if (updated == null)
                {
                    continue;
                }

                if (item.ExternalUrl.Version != updated.Version)
                {
                    throw new InconsistencyException
                          (
                              string.Format(Resources.TextMessages.ItemWasAlreadyChanged, updated.GetType().Name)
                          );
                }
            }
        }
        public ActionResult Update(Introduction model)
        {
            if (ModelState.IsValid)
            {
                var obj = ServiceFactory.IntroductionManager.Get(new Introduction {
                    IntroductionId = model.IntroductionId
                });
                if (obj != null)
                {
                    try
                    {
                        model.IntroductionShortName = model.IntroductionName.ToUrlSegment(250).ToLower();
                        ServiceFactory.IntroductionManager.Update(model, obj);

                        return(RedirectToAction("Search", "Introduction"));
                    }
                    catch (Exception)
                    {
                        //throw;
                    }
                }
            }
            ViewBag.IsEdit = true;
            return(View(model));
        }
        public void Update(Introduction @new, Introduction old)
        {
            var item = @new;

            item.IntroductionId = old.IntroductionId;
            var comm = this.GetCommand("sp_IntroductionUpdate");

            if (comm == null)
            {
                return;
            }
            comm.AddParameter <int>(this.Factory, "IntroductionId", item.IntroductionId);
            comm.AddParameter <string>(this.Factory, "IntroductionName", item.IntroductionName);
            comm.AddParameter <string>(this.Factory, "IntroductionShortName", item.IntroductionShortName);
            comm.AddParameter <string>(this.Factory, "IntroductionImage", item.IntroductionImage);
            comm.AddParameter <string>(this.Factory, "IntroductionBackground", item.IntroductionBackground);
            comm.AddParameter <string>(this.Factory, "IntroductionDescription", item.IntroductionDescription);
            comm.AddParameter <string>(this.Factory, "IntroductionTitle", item.IntroductionTitle);
            comm.AddParameter <string>(this.Factory, "IntroductionBanner", item.IntroductionBanner);
            comm.AddParameter <string>(this.Factory, "IntroductionBody", item.IntroductionBody);
            comm.AddParameter <bool>(this.Factory, "IsActive", item.IsActive);
            comm.AddParameter <int>(this.Factory, "OrderNo", item.OrderNo);

            comm.SafeExecuteNonQuery();
            //throw new NotImplementedException();
        }
Exemple #17
0
        void Assign(Game game, GameResource GameResource)
        {
            game.Id = GameResource.Id;

            if (GameResource.Description != null)
            {
                game.Description = GameResource.Description;
            }

            if (GameResource.Name != null)
            {
                game.Name = GameResource.Name;
            }

            if (GameResource.Limit != null)
            {
                game.Limit = new TimeSpan(0, (int)GameResource.Limit, 0);
            }

            if (GameResource.PlayingTime != null)
            {
                game.PlayingTime = new TimeSpan(0, (int)GameResource.PlayingTime, 0);
            }

            if ((GameResource.Introduction != null) && game.Introduction == null)
            {
                Introduction newIntro = Convert(GameResource.Introduction);
                game.Introduction = newIntro;
                newIntro.Game     = game;
            }

            if ((GameResource.Stops != null) && game.Stops == null)
            {
                game.Stops = new List <Stop>();

                foreach (StopResource stopResource in GameResource.Stops)
                {
                    var newStop = Convert(stopResource);
                    game.Stops.Add(newStop);
                    newStop.PartOfGame = game;
                }
            }

            if ((GameResource.Owners != null) && game.Owners == null)
            {
                game.Owners = new List <User>();

                foreach (UserResourceForFullGame userResource in GameResource.Owners)
                {
                    var newUser = Convert(userResource);
                    game.Owners.Add(newUser);
                    if (newUser.Games == null)
                    {
                        newUser.Games = new List <Game>();
                    }
                    newUser.Games.Add(game);
                }
            }
        }
Exemple #18
0
    public static void Explain(this Introduction runnable, TextWriter writer)
    {
        writer.WriteLine(@"
- Each sample is contained in a runnable class
- Extension methods are used to hide non important details
- `Thread(s)` view will show the last used thread to render the console also refered to as the `main` thread
");
    }
Exemple #19
0
 public override void Start()
 {
     score           = new Score();
     player.isFreeze = true;
     introduction    = GetComponent <Introduction>();
     conclusion      = GetComponent <Conclusion>();
     base.Start();
 }
Exemple #20
0
        public IntroductionTests()
        {
            var serviceCollection = new ServiceCollection();

            ConsoleTestServices.ConfigureServices(serviceCollection);
            _serviceProvider = serviceCollection.BuildServiceProvider(true);
            _introduction    = _serviceProvider.GetService <Introduction>();
        }
        public ActionResult DeleteConfirme(string id)
        {
            Introduction introduces = db.introduction.Find(id);

            db.introduction.Remove(introduces);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #22
0
        private void Refresh(int roleID)
        {
            Role role = roleManager.GetRole(roleID);

            if (role != null)
            {
                for (int i = 0; i < txts.Length; i++)
                {
                    if (txts[i] != null)
                    {
                        string name = roleProperties[i].Name;

                        switch (name)
                        {
                        case "Forces":
                        case "Status":
                            txts[i].text = role.GetType().GetProperty(name).GetValue(role, null).ToString();
                            break;

                        case "Name":
                            string FamilyName, Name;
                            FamilyName   = role.GetType().GetProperty("FamilyName").GetValue(role, null).ToString();
                            Name         = role.GetType().GetProperty("Name").GetValue(role, null).ToString();
                            txts[i].text = string.Format("{0} {1}", FamilyName, Name);
                            break;

                        default:
                            string str = role.GetType().GetProperty(name).GetValue(role, null).ToString();
                            string Msg = Introduction.getMsg(role.GetType(), System.AttributeTargets.Property, name);

                            txts[i].text = string.Format("{0} :{1} ", Msg, str);
                            break;
                        }
                    }
                }
                if (role.PicturePath != null)
                {
                    try
                    {
                        var path = Application.dataPath + role.PicturePath;

                        Picture.texture = FileHelper.LoadTexture2D(path, 270, 180);
                    }
                    catch (FileNotFoundException)
                    {
                        userDefault();
                    }
                }
                else
                {
                    userDefault();
                }
            }
            else
            {
                Debug.LogError("role == null");
            }
        }
Exemple #23
0
        public IntroductionEntity Update(EmployeeEntity EmployeeEntity, Guid IntroductionId, IntroductionEntity IntroductionEntity)
        {
            IntroductionEntity.Id = IntroductionId;
            Introduction Introduction = new Introduction(IntroductionEntity);

            UnitOfWork.IntroductionRepository.AddOrUpdate(Introduction);
            UnitOfWork.Complete();
            return(Get(EmployeeEntity, Introduction.Id));
        }
Exemple #24
0
        public ActionResult AddIntruction(IntroductionType type = IntroductionType.LichSu)
        {
            IIntroductionService introducSrv = IoC.Resolve <IIntroductionService>();
            Introduction         model       = introducSrv.Query.Where(p => p.Type == type).FirstOrDefault() ?? new Introduction();

            model.Type   = type;
            model.Active = true;
            return(View(model));
        }
        public bool SaveIntroduction(Introduction introduction)
        {
            var param = new SqlServerParameter();

            param.Add_Parameter("@_MainContent", introduction.MainContent);

            var data = _database.ExecuteScalar <int>("Introduction_Save", param, ExecuteTypeEnum.StoredProcedure);

            return(data == 1);
        }
Exemple #26
0
 public ActionResult Index(Introduction introduction)
 {
     if (ModelState.IsValid)
     {
         introduction.ID = 1;
         db.Entry(introduction).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(introduction));
 }
Exemple #27
0
 private void OnEnter(GameObject g)
 {
     isHover = true;
     if (isHover == true && thisTxtAttribute == null)
     {
         GameObject mainUI = GameObject.Find("MainUI");
         thisTxtAttribute = Instantiate(txtAttribute, Input.mousePosition, new Quaternion(0, 0, 0, 0), mainUI.transform);
         thisTxtAttribute.transform.Find("txt").GetComponent <Text>().text =
             Introduction.getMsg(typeof(Role), System.AttributeTargets.Property, g.name);
     }
 }
        private void Merge(DataModel.Introduction dbItem, Introduction newItem)
        {
            dbItem.Title             = newItem.Title;
            dbItem.Content           = newItem.Content;
            dbItem.PosterDescription = newItem.PosterDescription;
            dbItem.PosterUrl         = newItem.PosterUrl;
            dbItem.Version++;


            Merge(dbItem, newItem.ExternalUrls);
        }
        public void Remove(Introduction item)
        {
            var comm = this.GetCommand("sp_IntroductionDelete");

            if (comm == null)
            {
                return;
            }
            comm.AddParameter <int>(this.Factory, "IntroductionId", item.IntroductionId);
            comm.SafeExecuteNonQuery();
            //throw new NotImplementedException();
        }
 internal static Abstractions.Model.Introduction ToIntroduction(Introduction item)
 {
     return(new Abstractions.Model.Introduction
     {
         Content = item.Content,
         Title = item.Title,
         PosterDescription = item.PosterDescription,
         PosterUrl = item.PosterUrl,
         Version = item.Version,
         ExternalUrls = ToExternalUrl(item.ExternalUrls)
     });
 }
 public Tutorial()
 {
     Start();
     introduction = new Introduction(AssetManager.Instance.GetCampaignAndSurviveModeAssets().IntroductionChapter_01);
 }
 public Level_01()
 {
     Start();
     introduction = new Introduction(AssetManager.Instance.GetCampaignAndSurviveModeAssets().IntroductionChapter_01);
     whiteBackground = new FadeBackground(1);
 }