Exemplo n.º 1
0
 public CreatureAI(Creature creature,
     string name,
     EnemySensor sensor,
     PlanService planService)
     : base(name, creature.Physics)
 {
     Movement = new CreatureMovement();
     GatherManager = new GatherManager(this);
     Blackboard = new Blackboard();
     Creature = creature;
     CurrentPath = null;
     DrawPath = false;
     PlannerTimer = new Timer(0.1f, false);
     LocalControlTimeout = new Timer(5, false);
     WanderTimer = new Timer(1, false);
     Creature.Faction.Minions.Add(this);
     DrawAIPlan = false;
     WaitingOnResponse = false;
     PlanSubscriber = new PlanSubscriber(planService);
     ServiceTimeout = new Timer(2, false);
     Sensor = sensor;
     Sensor.OnEnemySensed += Sensor_OnEnemySensed;
     Sensor.Creature = this;
     CurrentTask = null;
     Tasks = new List<Task>();
     Thoughts = new List<Thought>();
     IdleTimer = new Timer(15.0f, true);
     SpeakTimer = new Timer(5.0f, true);
     XPEvents = new List<int>();
 }
Exemplo n.º 2
0
 public Dwarf(CreatureStats stats, string allies, PlanService planService, Faction faction,  string name, ChunkManager chunks, GraphicsDevice graphics, ContentManager content, EmployeeClass workerClass, Vector3 position)
     : base(stats, allies, planService, faction, 
     new Physics( "A Dwarf", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), 
                 new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.0f, -0.25f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0)),
        chunks, graphics, content, name)
 {
     Initialize(workerClass);
 }
Exemplo n.º 3
0
 public NecromancerAI(Creature creature, string name, EnemySensor sensor, PlanService planService)
     : base(creature, name, sensor, planService)
 {
     Skeletons = new List<Skeleton>();
     MaxSkeletons = 5;
     SummonTimer = new Timer(5, false);
     WanderTimer = new Timer(1, false);
     AttackTimer = new Timer(3, false);
     SummonTimer.HasTriggered = true;
     AttackRange = 10;
 }
Exemplo n.º 4
0
        public OpenpayAPI( string api_key, string merchant_id,bool production = false)
        {
            this.httpClient = new OpenpayHttpClient(api_key, merchant_id, production);
            CustomerService = new CustomerService(this.httpClient);
            CardService = new CardService(this.httpClient);
            BankAccountService = new BankAccountService(this.httpClient);
            ChargeService = new ChargeService(this.httpClient);
            PayoutService = new PayoutService(this.httpClient);
            TransferService = new TransferService(this.httpClient);
            FeeService = new FeeService(this.httpClient);
            PlanService = new PlanService(this.httpClient);
            SubscriptionService = new SubscriptionService(this.httpClient);
			OpenpayFeesService = new OpenpayFeesService(this.httpClient);
			WebhooksService = new WebhookService (this.httpClient);
        }
        public AdminController()
        {
            IdentityContext     db        = new IdentityContext();
            UserStore <AppUser> userStore = new UserStore <AppUser>(db);//bir identity tablosu user ile ilgili işlemler

            userManager = new UserManager <AppUser>(userStore);
            RoleStore <AppRole> roleStore = new RoleStore <AppRole>(db);

            roleManager = new RoleManager <AppRole>(roleStore);

            _featuresService = new FeaturesService();
            _bannerService   = new BannerService();
            _worksService    = new WorksService();
            _planService     = new PlanService();
            _contactService  = new ContactService();
            _companyService  = new CompanyService();
        }
 private void deleteExamPlan()
 {
     try
     {
         string      ExamPlanID  = context.Request.Form.Get("ExamPlanID");
         PlanService planService = new PlanService();
         ExamPlan    examPlan    = planService.getExamPlanByID(ExamPlanID);
         examPlan.CouresSet = null;
         planService.save(examPlan);
         planService.del(examPlan);
         context.Response.Write("1");
     }
     catch (Exception e)
     {
         context.Response.Write("0");
     }
 }
Exemplo n.º 7
0
 public OpenpayAPI(string api_key, string merchant_id, bool production = false)
 {
     this.httpClient     = new OpenpayHttpClient(api_key, merchant_id, production);
     CustomerService     = new CustomerService(this.httpClient);
     CardService         = new CardService(this.httpClient);
     BankAccountService  = new BankAccountService(this.httpClient);
     ChargeService       = new ChargeService(this.httpClient);
     PayoutService       = new PayoutService(this.httpClient);
     TransferService     = new TransferService(this.httpClient);
     FeeService          = new FeeService(this.httpClient);
     PlanService         = new PlanService(this.httpClient);
     SubscriptionService = new SubscriptionService(this.httpClient);
     OpenpayFeesService  = new OpenpayFeesService(this.httpClient);
     WebhooksService     = new WebhookService(this.httpClient);
     PayoutReportService = new PayoutReportService(this.httpClient);
     MerchantService     = new MerchantService(this.httpClient);
 }
Exemplo n.º 8
0
        public ActionResult ViewMyPlanDetailsDecision(string id)
        {
            PlanService ser   = new PlanService();
            var         plans = ser.GetPlanBySubjectId(id);

            //ViewData["Plan"] = plans;
            SetViewBag();

            if (HttpContext.Session.GetString("LoginName").ToLower() == "*****@*****.**" || id == "40ff5b91-3ce7-4122-a5de-3907f86c6630")
            {
                return(RedirectToAction("ViewMyPlanDetailsNursery", new { id }));
            }
            else
            {
                return(RedirectToAction("ViewMyPlanDetails", new { id }));
            }
        }
Exemplo n.º 9
0
        public ActionResult ViewMyPlan(string page, string success, string delete_success, string delete_error)
        {
            var plans = new List <PlanSummaryModel>();

            try
            {
                if (SessionIsNull())
                {
                    return(Redirect("/Home/Login?mustLogin=true&next=/Plan/ViewMyPlan"));
                }
                PlanService ser = new PlanService();
                SetViewBag();
                var employeeId = ViewBag.EmployeeId;
                if (ViewBag.RoleName == "Administrator")
                {
                    employeeId = "1";
                }
                int  _page    = 1;
                bool isParsed = int.TryParse(page, out _page);
                if (!isParsed || _page <= 0)
                {
                    _page = 1;
                }
                int nombre = ser.CountPlanSummaryByEmployeeId(employeeId);
                plans = ser.GetPlanSummaryByEmployeeId(employeeId, 10, _page, duration);
                ViewBag.pagination = new PageUtility().MakePagination(10, nombre, _page, "/Plan/ViewMyPlan?page=");
                if (!string.IsNullOrEmpty(success) && success.Equals("true"))
                {
                    ViewBag.success = "Saving with success!";
                }
                if (!string.IsNullOrEmpty(delete_success) && delete_success.Equals("true"))
                {
                    ViewBag.success = "Deleting with success!";
                }
                if (!string.IsNullOrEmpty(delete_error) && delete_error.Equals("true"))
                {
                    ViewBag.error = "An error has occured while deleting!";
                }
                return(View(plans));
            }
            catch (Exception)
            {
                ViewBag.error = "An error has occured!";
                return(View(plans));
            }
        }
 public ActionResult Create(PlanOfDeposit plan)
 {
     if (ModelState.IsValid)
     {
         try
         {
             PlanService.Create(Mapper.Map <PlanOfDeposit, PlanOfDepositModel>(plan));
             return(RedirectToAction("Index"));
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("", ex.Message);
             return(View(plan));
         }
     }
     return(View(plan));
 }
Exemplo n.º 11
0
        public async Task <StripeIdResponse> GetOrCreatePlanAsync(string planId, decimal amount, string interval, string productId)
        {
            try
            {
                var planService = new PlanService();
                var plan        = await planService.GetAsync(planId);

                return(new StripeIdResponse
                {
                    Id = plan.Id
                });
            }
            catch (StripeException)
            {
                return(await CreatePlanAsync(planId, amount, interval, productId));
            }
        }
Exemplo n.º 12
0
        public async Task ShowLastYearPlan()
        {
            try
            {
                var result = await PlanService.LastYearPlan(Plan.Id);

                if (result != null)
                {
                    lastYearPlan = result;
                }
            }
            catch (Exception ex)
            {
                loadFailed = true;
                Logger.LogWarning(ex, "There are no last year plan.");
            }
        }
Exemplo n.º 13
0
 public StripePaymentGateway(ProductService productService, CustomerService customerService, PlanService planService,
                             CardService cardService, InvoiceService invoiceService, CouponService couponService, IMapper mapper, RefundService refundService,
                             SubscriptionService subscriptionService, InvoiceItemService invoiceItemService,
                             IOptions <AppSettings> appSettings)
 {
     _productService      = productService;
     _mapper              = mapper;
     _planService         = planService;
     _appSettings         = appSettings.Value;
     _cardService         = cardService;
     _invoiceService      = invoiceService;
     _customerSer         = customerService;
     _couponService       = couponService;
     _refundService       = refundService;
     _subscriptionService = subscriptionService;
     _invoiceItemService  = invoiceItemService;
 }
Exemplo n.º 14
0
        private async Task <StripeIdResponse> CreatePlanAsync(string planId, decimal amount, string interval, string productId)
        {
            var planService = new PlanService();
            var plan        = await planService.CreateAsync(new PlanCreateOptions
            {
                Id       = planId,
                Amount   = ConvertToStripePrice(amount),
                Interval = interval,
                Product  = productId,
                Currency = BreedConsts.Currency
            });

            return(new StripeIdResponse
            {
                Id = plan.Id
            });
        }
Exemplo n.º 15
0
        private async void RunPlanungCommandExecute()
        {
            if (!CanRunPlanungCommandExecute())
            {
                return;
            }

            if (SelectedArbeitswoche.PlanungProMitarbeiterListe.Any(x => x.HasPlanzeitenEntries))
            {
                var dlg = _msg.ShowYesNo("Wollen Sie eine neue Planung durchführen?", CustomDialogIcons.Question);
                if (dlg == CustomDialogResults.No)
                {
                    return;
                }
            }

            IsBusy = true;

            try
            {
                var woche = SelectedArbeitswoche.MapViewmodelToArbeitswoche();

                await Task.Run(() => PlanService.ErstelleWochenplan(woche, woche.Mitarbeiter));

                var neu = woche.MapArbeitswocheToViewmodel();

                ArbeitswochenCollection.Remove(SelectedArbeitswoche);
                ArbeitswochenCollection.Add(neu);
                SelectedArbeitswoche = neu;

                ArbeitswocheVorschau.Refresh();

                SelectedPlanungswocheMitarbeiterItem = SelectedArbeitswoche.PlanungProMitarbeiterListe.First();

                FocusToBindingPath = nameof(ArbeitswocheVorschau);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Fehler beim Ausführen der Planung.{Environment.NewLine}{ex.GetAllErrorMessages()}");
            }
            finally
            {
                IsBusy = false;
                CommandManager.InvalidateRequerySuggested();
            }
        }
Exemplo n.º 16
0
        public async Task CanGetPlan()
        {
            DbContextOptions <VacationDbContext> options = new DbContextOptionsBuilder <VacationDbContext>()
                                                           .UseInMemoryDatabase("CanGetActivityInCity")
                                                           .Options;

            using (VacationDbContext context = new VacationDbContext(options))
            {
                PlanService service = new PlanService(context);

                City testCity = new City();
                testCity.ID          = 1;
                testCity.Name        = "Seattle";
                testCity.Description = "Test";
                testCity.ImageURL    = "test.url";
                testCity.Hot         = 0;
                testCity.InUSA       = 1;
                testCity.Price       = 3;
                context.City.Add(testCity);
                await context.SaveChangesAsync();

                Hotel testHotel = new Hotel();
                testHotel.CityID = 1;
                testHotel.Name   = "Seattle Hotel";
                testHotel.Price  = 3;

                context.Hotel.Add(testHotel);
                await context.SaveChangesAsync();

                Activity testActivity = new Activity();
                testActivity.CityID         = 1;
                testActivity.Name           = "Seattle Strolling";
                testActivity.Outdoors       = 1;
                testActivity.FamilyFriendly = 0;

                context.Activity.Add(testActivity);
                await context.SaveChangesAsync();

                Plan result = await service.GetPlan("1,0,3,0,1");

                Assert.Equal("Seattle", result.City.Name);
                Assert.Equal("Seattle Hotel", result.Hotel.Name);
                Assert.Equal("Seattle Strolling", result.Activity.Name);
            }
        }
        public ActionResult ViewDepartment(string page, string success, string error, string delete_success, string delete_error)
        {
            var departments = new List <NodeModel>();

            try
            {
                if (SessionIsNull())
                {
                    return(Redirect("/Home/Login?mustLogin=true&next=/Department/ViewDepartment"));
                }
                PlanService ser      = new PlanService();
                int         _page    = 1;
                bool        isParsed = int.TryParse(page, out _page);
                if (!isParsed || _page <= 0)
                {
                    _page = 1;
                }
                departments = ser.ViewNodeByNodeType("25da3697-59f4-11e9-8ceb-fb681531b90a", 10, _page);
                int nombre = ser.CountLevel("25da3697-59f4-11e9-8ceb-fb681531b90a");
                ViewBag.pagination = new PageUtility().MakePagination(10, nombre, _page, "/Department/ViewDepartment?page=");
                if (!string.IsNullOrEmpty(success) && success.Equals("true"))
                {
                    ViewBag.success = "Saving with success!";
                }
                if (!string.IsNullOrEmpty(error) && error.Equals("true"))
                {
                    ViewBag.error = "An error has occured!";
                }
                if (!string.IsNullOrEmpty(delete_success) && delete_success.Equals("true"))
                {
                    ViewBag.success = "Deleting with success!";
                }
                if (!string.IsNullOrEmpty(delete_error) && delete_error.Equals("true"))
                {
                    ViewBag.error = "An error has occured while deleting!";
                }
                SetViewBag();
                ViewData["Department"] = departments;
            }
            catch (Exception)
            {
                ViewBag.error = "An error has occured!";
            }
            return(View(departments));
        }
Exemplo n.º 18
0
        public ActionResult ViewMyPlanDetailsNurseryPrint(string id)
        {
            PlanService ser       = new PlanService();
            var         planModel = ser.GetPlanById(id);
            var         plans     = ser.GetWeeklyPlanBySubjectAndEmployee(planModel.SubjectId, planModel.EmployeeIds, planModel.Term, planModel.Week, planModel.Duration);

            //ViewData["Plan"] = plans;
            SetViewBag();

            if (planModel.NodeDepartmentId != "f67af242-1f0a-4bae-9152-39d30e9e6c6b")
            {
                return(View("ViewMyPlanDetailsNurseryPrint", plans));
            }
            else
            {
                return(View("ViewMyPlanDetailsNurseryPrint", plans));
            }
        }
Exemplo n.º 19
0
 public JsonResult ViewSubjectByLevel(string levelId)
 {
     try
     {
         PlanService ser      = new PlanService();
         var         subjects = ser.ViewSubjectByLevel(levelId);
         ViewData["Subject"] = new List <SubjectModel>()
         {
             new SubjectModel()
         };
         //SetViewBag();
         return(Json(subjects));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public JsonResult ViewSubjectByLevel(string levelId)
 {
     try
     {
         PlanService ser      = new PlanService();
         var         subjects = ser.ViewSubjectByLevel(levelId);
         ViewData["Subject"] = new List <SubjectModel>()
         {
             new SubjectModel()
         };
         ViewBag.LoginName = HttpContext.Session.GetString("LoginName");
         return(Json(subjects));
     }
     catch (System.Exception)
     {
         return(null);
     }
 }
Exemplo n.º 21
0
 /// <summary>
 /// Adds specified plan to stripe if it doesn't exist
 /// </summary>
 private static async Task AddPlan(PlanService planService, StripeList <Stripe.Plan> plans, Models.Plan plan, string productId)
 {
     if (!plans.Any(x => x.Nickname.Equals(plan.Name)))
     {
         await planService.CreateAsync(new PlanCreateOptions
         {
             Nickname = plan.Name,
             Amount   = plan.PricePerUnit,
             Metadata = plan.Metadata,
             Product  = new PlanProductOptions()
             {
                 Id = productId
             },
             Interval = plan.Interval.ToString().ToLower(),
             Currency = plan.PlanCurrency.ToString().ToLower(),
         });
     }
 }
        public async Task <StripeIdResponse> GetPlanAsync(string planId)
        {
            try
            {
                var planService = new PlanService();
                var plan        = await planService.GetAsync(planId);

                return(new StripeIdResponse
                {
                    Id = plan.Id
                });
            }
            catch (StripeException exception)
            {
                Logger.Error(exception.Message, exception);
                return(new StripeIdResponse());
            }
        }
Exemplo n.º 23
0
        public ActionResult RemoveFile(string id, string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return(new OpActionResult(Utility.OpResult.Fail("传参数为空!")));
            }
            if (Attachments != null)
            {
                var obj = Attachments.FirstOrDefault(o => o.NewName == name);
                if (obj != null)
                {
                    Attachments.Remove(obj);
                    return(new OpActionResult(Utility.OpResult.Success()));
                }
            }
            var op = PlanService.RemoveFile(id, name);

            return(new OpActionResult(op));
        }
Exemplo n.º 24
0
        private async Task <List <O365Task> > GetO365TasksAsync(GraphServiceClient graphService, Plan plan)
        {
            var tasks = await PlanService.GetTasksAsync(plan);

            var result = new List <O365Task>();

            foreach (var item in tasks)
            {
                var task = new O365Task
                {
                    Title        = item.title,
                    AssignedTo   = !string.IsNullOrEmpty(item.assignedTo) ? (await graphService.Users[item.assignedTo].Request().GetAsync()).DisplayName : "",
                    AssignedBy   = !string.IsNullOrEmpty(item.assignedBy) ? (await graphService.Users[item.assignedBy].Request().GetAsync()).DisplayName : "",
                    AssignedDate = item.assignedDateTime.HasValue ? item.assignedDateTime.Value.DateTime.ToLocalTime().ToString() : ""
                };
                result.Add(task);
            }
            return(result);
        }
        //[HttpGet]
        public ActionResult ViewEmployee(string name, string page, string success, string delete_success, string delete_error)
        {
            var employee = new List <EmployeeModel>();

            try
            {
                if (SessionIsNull())
                {
                    return(Redirect("/Home/Login?mustLogin=true&&next=/Employee/ViewEmployee?name=" + name + "&page=" + page));
                }
                PlanService ser      = new PlanService();
                int         _page    = 1;
                bool        isParsed = int.TryParse(page, out _page);
                if (!isParsed || _page <= 0)
                {
                    _page = 1;
                }
                employee = ser.GetAllEmployees(name, 10, _page);
                int nombre = ser.CountAllEmployees(name);
                ViewBag.name       = name;
                ViewBag.pagination = new PageUtility().MakePagination(10, nombre, _page, "/Employee/ViewEmployee?name=" + name + "&page=");
                ViewBag.Roles      = new SelectList(new PlanService().GetRoles(), "Id", "Name");

                SetViewBag();
                if (!string.IsNullOrEmpty(success) && success.Equals("true"))
                {
                    ViewBag.success = "Saving with success!";
                }
                if (!string.IsNullOrEmpty(delete_success) && delete_success.Equals("true"))
                {
                    ViewBag.success = "Deleting with success!";
                }
                if (!string.IsNullOrEmpty(delete_error) && delete_error.Equals("true"))
                {
                    ViewBag.error = "An error has occured while deleting!";
                }
            }
            catch (System.Exception)
            {
                ViewBag.error = "An error has occured!";
            }
            return(View(employee));
        }
Exemplo n.º 26
0
        public IActionResult Index(Plan plan)
        {
            var            planService = new PlanService();
            List <Plan>    plans       = null;
            var            json        = HttpContext.Request.Cookies["user"];
            User           loginuser   = JsonConvert.DeserializeObject <User>(json);
            int            proid       = (int)loginuser.relation.Proid;
            List <Project> projects    = null;

            if (loginuser.relation.Eid == 1)
            {
                projects = projectService.GetAll();
                if (plan.Proid > 0)
                {
                    plans = planService.QueryByProid((int)plan.Proid);
                }
                else if (plan.Pname == null)
                {
                    plans = planService.GetAll();
                }
                else
                {
                    plans = planService.GetPlans(0, plan.Pname);
                }
            }
            else
            {
                projects = projectService.QueryById(proid);
                if (plan.Pname == null)
                {
                    plans = planService.QueryByProid(proid);
                }
                else
                {
                    plans = planService.GetPlans(proid, plan.Pname);
                }
            }


            ViewData["projects"] = projects;
            ViewData["plans"]    = plans;
            return(View());
        }
 public ActionResult Edit(string id)
 {
     try
     {
         if (SessionIsNull())
         {
             return(Redirect("/Home/Login?mustLogin=true&next=/Blog/Edit?id=" + id));
         }
         PlanService ser   = new PlanService();
         BlogModel   model = ser.ViewBlogById(id);
         SetViewBag();
         ViewBag.title = "Edit news";
         return(View("Blog", model));
     }
     catch (Exception)
     {
         return(View("Blog"));
     }
 }
Exemplo n.º 28
0
        public ActionResult ViewPlan(string page, string success, string delete_success, string delete_error)
        {
            var plans = new List <PlanModel>();

            try
            {
                if (SessionIsNull())
                {
                    return(Redirect("/Home/Login?mustLogin=true&next=/Plan/ViewPlan"));
                }
                PlanService ser      = new PlanService();
                int         _page    = 1;
                bool        isParsed = int.TryParse(page, out _page);
                if (!isParsed || _page <= 0)
                {
                    _page = 1;
                }
                plans = ser.ViewPlan(10, _page);
                int nombre = ser.CountPlan();
                ViewBag.pagination = new PageUtility().MakePagination(10, nombre, _page, "/Plan/ViewPlan?page=");
                ViewData["Plan"]   = plans;
                SetViewBag();
                if (!string.IsNullOrEmpty(success) && success.Equals("true"))
                {
                    ViewBag.success = "Saving with success!";
                }
                if (!string.IsNullOrEmpty(delete_success) && delete_success.Equals("true"))
                {
                    ViewBag.success = "Deleting with success!";
                }
                if (!string.IsNullOrEmpty(delete_error) && delete_error.Equals("true"))
                {
                    ViewBag.error = "An error has occured while deleting!";
                }
                return(View(plans));
            }
            catch (Exception)
            {
                ViewBag.error = "An error has occured!";
                return(View(plans));
            }
        }
Exemplo n.º 29
0
 public JsonResult DeleteFile(string id)
 {
     try
     {
         Attachments x = new PlanService().DeleteFile(id);
         if (x != null)
         {
             TryDeleteFileServer(x);
             return(Json(new { status = 1, message = "File deleted!" }));
         }
         else
         {
             return(Json(new { status = 0, message = "Deleting failed!" }));
         }
     }
     catch (Exception)
     {
         return(Json(new { status = 0, message = "Deleting failed!" }));
     }
 }
Exemplo n.º 30
0
        public IActionResult Detail(int pid)
        {
            var            json      = HttpContext.Request.Cookies["user"];
            User           loginuser = JsonConvert.DeserializeObject <User>(json);
            List <Project> projects  = null;

            if (loginuser.relation.Eid == 1)
            {
                projects = projectService.GetAll();
            }
            else
            {
                projects = projectService.QueryById((int)loginuser.relation.Proid);
            }
            ViewData["projects"] = projects;
            var planSerVice = new PlanService();
            var plan        = planSerVice.Show(pid);

            return(View(plan));
        }
 public void SetViewBag()
 {
     try
     {
         PlanService service  = new PlanService();
         var         elements = service.GetElementList(HttpContext.Session.GetString("RoleId"));
         ViewBag.Elements   = elements;
         ViewBag.LoginName  = HttpContext.Session.GetString("LoginName");
         ViewBag.FirstName  = HttpContext.Session.GetString("FirstName");
         ViewBag.LastName   = HttpContext.Session.GetString("LastName");
         ViewBag.RoleName   = HttpContext.Session.GetString("RoleName");
         ViewBag.RoleId     = HttpContext.Session.GetString("RoleId");
         ViewBag.EmployeeId = HttpContext.Session.GetString("EmployeeId");
         //ViewBag.Menus = service
     }
     catch (Exception)
     {
         SetDefaultError();
     }
 }
 public ActionResult Edit(string id)
 {
     try
     {
         if (SessionIsNull())
         {
             return(Redirect("/Home/Login?mustLogin=true&next=/Department/Edit?id=" + id));
         }
         PlanService ser   = new PlanService();
         NodeModel   model = ser.GetNodeById(id);
         SetViewbagForNodeType();
         SetViewBag();
         return(View("Department", model));
     }
     catch (Exception)
     {
         ViewBag.error = "An error has occured!";
         return(View("Department"));
     }
 }
 public IActionResult SaveEmployee(EmployeeModel employee)
 {
     try
     {
         PlanService ser    = new PlanService();
         int         result = ser.SaveEmployeeUserRole(employee);
         SetViewBag();
         if (result == 1)
         {
             return(Redirect("/Employee/ViewEmployee?success=true"));
         }
         else
         {
             return(Redirect("/Employee/Employee?error=true"));
         }
     }
     catch (System.Exception)
     {
         return(Redirect("/Employee/Employee?error=true"));
     }
 }
Exemplo n.º 34
0
 public IActionResult SaveLesson(LessonModel lesson)
 {
     try
     {
         PlanService ser    = new PlanService();
         int         result = ser.SaveLesson(lesson);
         SetViewBag();
         if (result == 1)
         {
             return(Redirect("/Lesson/ViewLesson?success=true"));
         }
         else
         {
             return(Redirect("/Lesson/Lesson?error=true"));
         }
     }
     catch (Exception)
     {
         return(Redirect("/Lesson/Lesson?error=true"));
     }
 }
Exemplo n.º 35
0
 public Elf(CreatureStats stats, string allies, PlanService planService, Faction faction, ComponentManager manager, string name, ChunkManager chunks, GraphicsDevice graphics, ContentManager content, Vector3 position)
     : base(stats, allies, planService, faction, new Physics("elf", manager.RootComponent, Matrix.CreateTranslation(position), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.0f, -0.25f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0)),
          chunks, graphics, content, name)
 {
     Initialize();
 }
Exemplo n.º 36
0
 public BirdAI(Creature creature, string name, EnemySensor sensor, PlanService planService)
     : base(creature, name, sensor, planService)
 {
 }
Exemplo n.º 37
0
 public PlanController()
 {
     _planService = new PlanService();
 }
Exemplo n.º 38
0
 public Creature(CreatureStats stats,
     string allies,
     PlanService planService,
     Faction faction,
     Physics parent,
     ChunkManager chunks,
     GraphicsDevice graphics,
     ContentManager content,
     string name)
     : base(parent.Manager, name, parent, stats.MaxHealth, 0.0f, stats.MaxHealth)
 {
     Buffs = new List<Buff>();
     IsOnGround = true;
     Physics = parent;
     Stats = stats;
     Chunks = chunks;
     Graphics = graphics;
     Content = content;
     Faction = faction;
     PlanService = planService;
     Allies = allies;
     Controller = new PIDController(Stats.MaxAcceleration, Stats.StoppingForce * 2, 0.0f);
     JumpTimer = new Timer(0.2f, true);
     Status = new CreatureStatus();
     IsHeadClear = true;
     NoiseMaker = new NoiseMaker();
     OverrideCharacterMode = false;
     SelectionCircle = new SelectionCircle(Manager, Physics)
     {
         IsVisible = false
     };
 }
Exemplo n.º 39
0
        /// <summary>
        /// Called when the PlayState is entered from the state manager.
        /// </summary>
        public override void OnEnter()
        {
            // If the game should reset, we initialize everything
            if(ShouldReset)
            {
                Screenshots = new List<Screenshot>();
                PreSimulateTimer.Reset(3);
                ShouldReset = false;

                Preload();

                Game.Graphics.PreferMultiSampling = GameSettings.Default.AntiAliasing > 1;

                // This is some grossness which tries to apply the current graphics settings
                // to the GPU.
                try
                {
                    Game.Graphics.ApplyChanges();
                }
                catch(NoSuitableGraphicsDeviceException exception)
                {
                    Console.Error.WriteLine(exception.Message);
                }

                Game.Graphics.PreparingDeviceSettings -= GraphicsPreparingDeviceSettings;
                Game.Graphics.PreparingDeviceSettings += GraphicsPreparingDeviceSettings;
                PlanService = new PlanService();

                LoadingThread = new Thread(Load);
                LoadingThread.Start();
            }

            // Otherwise, we just unpause everything and re-enter the game.
            HasStarted = true;
            if(ChunkManager != null)
            {
                ChunkManager.PauseThreads = false;
            }

            if(Camera != null)
                Camera.LastWheel = Mouse.GetState().ScrollWheelValue;
            base.OnEnter();
        }
Exemplo n.º 40
0
 public PlanHandler(PlanService service, PlanMapper mapper)
 {
     this.service = service;
     this.mapper = mapper;
 }