public ActionResult ActivityDetails(int id, HttpPostedFileBase Image, int kullaniciId) { if ((Session["EnterID"] != null) || (Session["EnterID"] != null)) { PlatformContext db = new PlatformContext(); int AvtivityId = (from b in db.Activities where b.ActivityId == id select b.ActivityId).FirstOrDefault(); int KullaniciId = (from b in db.Activities where b.UserId == kullaniciId select b.UserId).FirstOrDefault(); ViewBag.Id = id; ViewBag.KullaniciId = KullaniciId; Activity Activities = (from a in db.Activities where a.ActivityId == id & a.UserId == kullaniciId select a).FirstOrDefault(); return(View(Activities)); } else { return(RedirectToAction("Index", "User", new { error = "Etkinlik Ayrıntılarını Görmek İçin Giriş Yapmalısınız" })); } }
public static void FloodFill(PlatformContext context, Point location, TilePlacement placement) { if (!FloodFillValid(context, location, placement)) { return; } var queue = new Queue <Point>(); var set = new HashSet <Point>(); queue.Enqueue(location); set.Add(location); while (queue.Any()) { var point = queue.Dequeue(); placement.Stamp(context, context.TileToWorld(point)); foreach (var test in FloodFillTestPoints) { var next = point + test; if (!set.Contains(next) && FloodFillValid(context, next, placement)) { queue.Enqueue(next); set.Add(next); } } } }
public void Stamp(PlatformContext context, Vector2 world) { if (context.IsInBounds(world)) { this.StampImpl(context, world); } }
protected override void StampImpl(PlatformContext context, Vector2 world) { var light = this.Current.Clone(); light.RelativePosition = world; context.AttachLightSource(light); }
/// <summary>Create a temporary game instance for the unpacker.</summary> /// <param name="platform">The platform-specific context.</param> /// <param name="contentPath">The absolute path to the content folder to import.</param> private static GameRunner CreateTemporaryGameInstance(PlatformContext platform, string contentPath) { var foregroundColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGray; try { GameRunner game = new GameRunner(); GameRunner.instance = game; if (platform.Is(Platform.Windows)) { game.Content.RootDirectory = contentPath; MethodInfo startGameLoop = typeof(GameRunner).GetMethod("StartGameLoop", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); if (startGameLoop == null) { throw new InvalidOperationException("Can't locate game method 'StartGameLoop' to initialise internal game instance."); } startGameLoop.Invoke(game, new object[0]); } else { game.RunOneFrame(); } return(game); } finally { Console.ForegroundColor = foregroundColor; Console.WriteLine(); } }
public void Clear(PlatformContext context, Vector2 world) { if (context.IsInBounds(world)) { this.ClearImpl(context, world); } }
public override void DrawDebug(PlatformContext context, Vector2 world, Renderer renderer, FontTemplate font, Vector2 position) { var s = new StringBuilder(); s.AppendLine($"Current tile : "); s.AppendLine($"{this.layer} "); font.DrawString(renderer.Screen, position, s.ToString(), Color.White); var size = font.Font.MeasureString(s.ToString()); this.Current.Draw(renderer.Screen, new Vector2(size.X + position.X, position.Y), new Vector2(2f, 2f), Color.White, context.BlockStore); if (context.IsInBounds(world)) { var tilePos = context.WorldToTile(world); var tileTopLeft = context.TileToWorld(tilePos); this.Current.Draw(renderer.World, tileTopLeft, Vector2.One, Color.White, context.BlockStore); renderer.World.DrawRectangle(tileTopLeft, new Size2(context.BlockStore.TileSize, context.BlockStore.TileSize), Color.White); var tileText = new StringBuilder(); var cell = context.Map[tilePos]; var flags = context.GetFlags(tilePos); tileText.AppendLine($" Position: {tilePos}"); tileText.AppendLine($" Foreground: " + string.Join(",", cell.Foreground.Select(t => t.DebugString))); tileText.AppendLine($" Background: " + string.Join(",", cell.Background.Select(t => t.DebugString))); tileText.AppendLine($" Block: " + (cell.Block == null ? "null" : cell.Block.DebugString)); tileText.AppendLine($" Flags: " + flags); font.DrawString(renderer.Screen, new Vector2(position.X, position.Y + 200), tileText.ToString(), Color.Wheat); } }
protected override void StampImpl(PlatformContext context, Vector2 world) { var spawn = this.Current.Clone(); spawn.World = world; context.Spawn.Add(spawn); }
public App() { AppDomain.CurrentDomain.UnhandledException += (s, e) => { X1LogHelper.HandlerGlobalException(e.ExceptionObject as Exception, s); }; PlatformContext.Init("Desktop"); }
public async Task <IHttpActionResult> LoadEmployeeAndDependentsAccumulations(Employer employer, int cchId) { using (var ctx = new PlatformContext()) { var pEmployerId = new SqlParameter("@employerId", employer.Id); var pCchId = new SqlParameter("@cchId", cchId); await ctx.Database.ExecuteSqlCommandAsync("exec CCH_FrontEnd2.dbo.[270_CallConsoleApp] @EmployerID, @CCHID", pEmployerId, pCchId); } return(Ok()); }
public Entity ContextMenu(PlatformContext context, Vector2 world) { if (!context.IsInBounds(world)) { return(null); } var contextMenu = new Panel(new Vector2(900, 1000)); contextMenu.ClearChildren(); this.ContextMenuImpl(contextMenu, context, world); return(contextMenu); }
public ActionResult Create(string name, DateTime date, DateTime StartTime, DateTime FinishTime, HttpPostedFileBase Image, string Content, string Address, int Kontejyan) { if ((Session["EnterID"] != null) || (Session["EnterID"] != null)) { PlatformContext db = new PlatformContext(); string klasor = Server.MapPath("/Uploads/Activity/"); Image.SaveAs(klasor + Image.FileName); Activity activity = new Activity(); activity.Address = Address; activity.Title = name; activity.StartTime = StartTime; activity.FinishTime = FinishTime; activity.Date = date; activity.CountryId = (int)Session["CountryId"]; activity.Content = Content; activity.ImageURL = "/Uploads/Activity/" + Image.FileName; activity.UserId = (int)Session["EnterID"]; activity.NumberofParticipations = Kontejyan; if (ModelState.IsValid) { try { db.Activities.Add(activity); try { db.SaveChanges(); } catch (DbUpdateException ex1) { var b = ex1.InnerException; } } catch (DbEntityValidationException ex) { var a = ex.EntityValidationErrors; } return(RedirectToAction("Index", new { error = "Kaydınız oluşmutur.Yetkili kişi tarafından onaylandıktan sonra görünecektir" })); } //ViewBag.PossibleParents = db.Activities.ToList(); return(View()); } else { return(RedirectToAction("Index", "User")); } }
public void copySkills() { PlatformContext db = new PlatformContext(); List <PlatformSkill> PlatformSkills = db.Skills.ToList(); AutoMapper.Mapper.Initialize(cfg => cfg.AddProfile <MapProfile>()); List <Skill> skills = AutoMapper.Mapper.Map <List <PlatformSkill>, List <Skill> >(PlatformSkills); for (int i = 0; i < skills.Count; i++) { AddOrModify(skills[i]); } }
public override void DrawDebug(PlatformContext context, Vector2 world, Renderer renderer, FontTemplate font, Vector2 position) { if (context.IsInBounds(world)) { var tilePos = context.WorldToTile(world); var tileTopLeft = context.TileToWorld(tilePos); Light.DrawDebug(renderer, world, this.Current.Colour); renderer.World.DrawRectangle(tileTopLeft, new Size2(context.BlockStore.TileSize, context.BlockStore.TileSize), new Color(1f, 1f, 1f, 0.5f)); var tileText = new StringBuilder(); tileText.AppendLine($" Position: {world} ({tilePos})"); font.DrawString(renderer.Screen, new Vector2(position.X, position.Y + 200), tileText.ToString(), Color.Wheat); } }
public ActionResult Index(string Search) { PlatformContext db = new PlatformContext(); var activity = from m in db.Activities select m; if (!String.IsNullOrEmpty(Search)) { activity = activity.Where(a => a.Title.Contains(Search)); } return(View(activity.ToList())); //return View(db.Activities.ToList()); }
protected override void ContextMenuImpl(Entity parent, PlatformContext context, Vector2 world) { var tilePos = context.WorldToTile(world); var cell = context.Map[tilePos]; var background = new Panel(new Vector2(0, 256), skin: PanelSkin.Simple, anchor: Anchor.AutoCenter); var label = new Label("Background:", Anchor.TopCenter); background.AddChild(label); var backgroundPicker = new TilePicker(context.BlockStore, cell.Background, new Vector2(0, 128), Anchor.BottomCenter, overflow: false); backgroundPicker.OnItemClick += (e, tile) => { backgroundPicker.RemoveChild(e); cell.Background.Remove(tile); }; background.AddChild(backgroundPicker); parent.AddChild(background); var foreground = new Panel(new Vector2(0, 256), skin: PanelSkin.Simple, anchor: Anchor.AutoCenter); label = new Label("Foreground:", Anchor.TopCenter); foreground.AddChild(label); var foregroundPicker = new TilePicker(context.BlockStore, cell.Foreground, new Vector2(0, 128), Anchor.BottomCenter, overflow: false); foreground.AddChild(foregroundPicker); parent.AddChild(foreground); var blocking = new Panel(new Vector2(0, 256), skin: PanelSkin.Simple, anchor: Anchor.AutoCenter); label = new Label("Block:", Anchor.TopCenter); blocking.AddChild(label); var blocks = cell.Block == null ? new ITile[0] : new[] { cell.Block }; var blockingPicker = new TilePicker(context.BlockStore, blocks, new Vector2(0, 128), Anchor.BottomCenter, overflow: false); blocking.AddChild(blockingPicker); parent.AddChild(blocking); var button = new Button("Clear", anchor: Anchor.BottomCenter); button.OnClick += (e) => { context.Map[tilePos].Background.Clear(); context.Map[tilePos].Foreground.Clear(); context.Map[tilePos].Block = null; }; parent.AddChild(button); }
// GET: Panel/Profile public ActionResult Index(int?id, int?PersonID) { PlatformContext db = new PlatformContext(); User User = Db.Users.Find(id); if (PersonID != null) { User User2 = Db.Users.Find(PersonID); User2.Score = User2.Score + 1;//yardım ettiği kişi sayısı arttırılıyor Db.Entry(User2).State = System.Data.Entity.EntityState.Modified; Db.SaveChanges(); return(RedirectToAction("Index", "Home")); } ViewBag.CountryName = (Db.Countries.Where(x => x.CountryId == User.CountryNo).Select(x => x.CountryName)).FirstOrDefault(); return(View(User)); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { PlatformContext.Init("iOS"); Rg.Plugins.Popup.Popup.Init(); Xamarin.Auth.Presenters.XamarinIOS.AuthenticationConfiguration.Init(); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); var ignore = typeof(SvgCachedImage); global::Xamarin.Forms.Forms.Init(); AiForms.Layouts.LayoutsInit.Init(); //need to write here LoadApplication(new App()); return(base.FinishedLaunching(app, options)); }
// GET: Panel/Profile public ActionResult Index(int?id, int?PersonID) {//profilde ilk kişinin profiline gidiliyor id ile daha sonra puan verilirse kişiye kişinin id si tekrar alınıyor person id ile yardım ettiği kişi sayısı arttırılıyor PlatformContext db = new PlatformContext(); User User = Db.Users.Find(id); if (PersonID != null) { User User2 = Db.Users.Find(PersonID); User2.Score = User2.Score + 1;//yardım ettiği kişi sayısı arttırılıyor Db.Entry(User2).State = System.Data.Entity.EntityState.Modified; Db.SaveChanges(); return(RedirectToAction("Index", "Home")); } ViewBag.CountryName = (Db.Countries.Where(x => x.CountryId == User.CountryNo).Select(x => x.CountryName)).FirstOrDefault();//profilinde ülkeside çıksın diye aldım return(View(User)); }
public UnitOfWork( PlatformContext context, IBrandRepository brandRepository, IUserRepository userRepository, ITestRepository testRepository, ITestTypeRepository testTypeRepository, IProfileRepository profileRepository, IUserTestRepository userTestRepository) { BrandRepository = brandRepository; UserRepository = userRepository; TestRepository = testRepository; TestTypeRepository = testTypeRepository; ProfileRepository = profileRepository; UserTestRepository = userTestRepository; _context = context; }
protected override void ClearImpl(PlatformContext context, Vector2 world) { var tilePos = context.WorldToTile(world); var toRemove = new List <Light>(); foreach (var light in context.LightSources) { var lightTilePos = context.WorldToTile(light.AbsolutePosition); if (lightTilePos == tilePos) { toRemove.Add(light); } } foreach (var light in toRemove) { context.RemoveLightSource(light); } }
//[HttpPost] public JsonResult AcceptDeny(int id, int sonuc) { PlatformContext db = new PlatformContext(); Activity a = new Activity(); int kullaniciId = (int)Session["EnterID"]; if (sonuc == 1) { var update = db.Activities.FirstOrDefault(x => x.ActivityId == id); var u = db.Users.Find(kullaniciId); update.Participants.Add(u); update.Participation = true; db.Entry(update).State = EntityState.Modified; db.SaveChanges(); //a.Participation = true; //a.ActivityId = id; //a.UserId = kullaniciId; return(Json(a)); } else { //a.Participation = false; //a.ActivityId = id; //a.UserId = kullaniciId; string message = ""; try { //DB Update işlemleri yapılacak //var update = db.Activities.Where(x => x.ActivityId == id); var update = db.Activities.FirstOrDefault(x => x.ActivityId == id && x.UserId == kullaniciId); update.Participation = false; db.SaveChanges(); message = "Success"; } catch (Exception ex) { message = "Error"; } return(Json(message)); //kim hangi etkinliğe katılıyor oonu onu bul onun üsütnden calış } }
protected override void OnCreate(Bundle bundle) { try { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); SetupViewComponents(); //Since the only way to connect to a terminal/pinpad from an Android Phone/Tablet is over Bluetooth, we use the BluetoothDeviceConnectionChannel. //It has the same implementation as SerialDeviceConnectionChannel(both implement IBCDeviceConnectionChannel) from the console sample but uses only Bluetooth to connect to the device. _channel = new BluetoothDeviceConnectionChannel(_deviceAddress); //The BCDeviceManager is the same as in the console sample _device = new BCDeviceManager(_channel); //You can listen to errors form the device only, just wire up this event _device.OnError += DeviceManagerOnError; //The same platform initialization as in console PlatformContext.Initialize(this, _customerId, _appId, _appSecret, _device, PIEnvironment.Dev); _progressDialog = ProgressDialog.Show(this, "PI", "Logging in...", true); //Login works the same way as console sample _token = PlatformContext.GetService <IAuthService>().Login(); //Wire up the transaction flow events _transactionOrchestrator = PlatformContext.GetService <ITransactionOrchestrator>(); _transactionOrchestrator.OnError += TransactionOrchestratorOnError; _transactionOrchestrator.OnProgressChanged += TransactionOrchestratorOnProgressChanged; _transactionOrchestrator.OnTransactionFinished += TransactionOrchestratorOnTransactionFinished; _transactionOrchestrator.OnDataRequested += TransactionOrchestratorOnDataRequested; } catch (Exception ex) { Helpers.Alert(this, "PI - OnCreate - Error", ex.Message, false); } finally { if (_progressDialog.IsShowing) { _progressDialog.Dismiss(); } } }
protected override void ClearImpl(PlatformContext context, Vector2 position) { var cell = context.Map[context.WorldToTile(position)]; switch (this.layer) { case TileStencil.Layer.Background: cell.Background.Clear(); break; case TileStencil.Layer.Foreground: cell.Foreground.Clear(); break; case TileStencil.Layer.Blocking: cell.Block = null; break; } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; PlatformContext.Init("UWP"); Xamarin.Auth.Presenters.UWP.AuthenticationConfiguration.Init(); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); var ignore = typeof(SvgCachedImage); Rg.Plugins.Popup.Popup.Init(); Xamarin.Forms.Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
public ActionResult ActivityDetails(int id, int kullaniciId) { PlatformContext db = new PlatformContext(); int AvtivityId = (from b in db.Activities where b.ActivityId == id select b.ActivityId).FirstOrDefault(); int KullaniciId = (from b in db.Activities where b.UserId == kullaniciId select b.UserId).FirstOrDefault(); ViewBag.Id = id; ViewBag.KullaniciId = KullaniciId; Activity Activities = (from a in db.Activities where a.ActivityId == id & a.UserId == kullaniciId select a).FirstOrDefault(); return(View(Activities)); }
public ActionResult Create() { //int id = (int) Session["CountryId"]; if ((Session["EnterID"] != null) || (Session["EnterID"] != null)) { PlatformContext db = new PlatformContext(); ViewBag.Ukeler = db.Activities.ToList(); //ViewBag.PossibleParents = db.Activities.ToList(); return(View()); } else { return(RedirectToAction("Index", "User", new { error = "Etkinlik oluşturmak için Girş Yapmanız Gerekmektedir." })); } }
private static bool FloodFillValid(PlatformContext context, Point location, TilePlacement placement) { if (!context.IsInBounds(location)) { return(false); } var cell = context.Map[location]; switch (placement.Layer) { case TileStencil.Layer.Background: return(!cell.Background.Any()); case TileStencil.Layer.Foreground: return(!cell.Foreground.Any()); case TileStencil.Layer.Blocking: return(cell.Block == null); } return(true); }
private async Task LoadEmployeeAndDependentsAccumulationsAsync(int employerId, int cchId) { // Retrieve employee dependents var employer = EmployerCache.Employers.FirstOrDefault(e => e.Id == employerId); var repository = new Employee.Data.V2.EmployeeRepository(); var dispatcher = new EmployeeDispatcher(repository); var members = await dispatcher.GetEmployeeDependentsAsync(employer, cchId); using (var ctx = new PlatformContext()) { foreach (var member in members) { var pEmployerId = new SqlParameter("@EmployerID", employerId); var pCchId = new SqlParameter("@CCHID", member.CchId); ctx.Database.ExecuteSqlCommand("EXEC CCH_FrontEnd2.dbo.[270_CallConsoleApp] @EmployerID, @CCHID", pEmployerId, pCchId); } } Dispose(); }
public ActionResult Index(string error, int?countryId) { Session["TopFive"] = Repository.ScoreViewListFill(); PlatformContext db = new PlatformContext(); var u = db.Activities.Find(countryId); Session["TopFive"] = Repository.ScoreViewListFill(); if (Session["CountryId"] == null && (int)Session["ChooseCountry"] == 0) { ViewBag.Activities = db.Activities.Where(x => x.CountryId == 4).ToList(); } else if ((int)Session["ChooseCountry"] != 0) { int IdCountry = (int)Session["ChooseCountry"]; ViewBag.Activities = db.Activities.Where(x => x.CountryId == IdCountry).ToList(); } else { int IdC = (int)Session["CountryId"]; ViewBag.Activities = db.Activities.Where(x => x.CountryId == IdC).ToList(); } ViewBag.aaa = "Etkinlikler"; ViewBag.error = error; // select count(*) //from activities where Participation = 0 //group by Participation return(View()); //return View(db.Activities.ToList()); }