Пример #1
0
    public void takeDamage(float dmg, Schools type)
    {
        if (stats.Defense == type)
        {
            stats.Health -= dmg / 2;
        }

        else if (stats.Defense == Schools.None || type == Schools.None)
        {
            stats.Health -= dmg;
        }

        else
        {
            stats.Health -= dmg;
        }

        if (stats.Health <= 0)
        {
            Die();
            ondeath.showDurability = false;
        }

        if (ondeath.showDurability == true)
        {
            showDurability();
        }

        damageSplash();

        if (GetComponent <PlayerController>())
        {
            FindObjectOfType <GameMaster>().UpdatePlayerHealth(stats.Health);
        }
    }
Пример #2
0
        public void Update()
        {
            SchoolDisplayModel exists = Schools.Where(x => x.Id == SelectedSchool.Id).FirstOrDefault();

            if (exists != null)
            {
                if (SelectedSchool != null && Schools.Count > 0)
                {
                    isUpdating = true;

                    SchoolModel e = new SchoolModel
                    {
                        Id         = SelectedSchool.Id,
                        SchoolName = _schoolName,
                        SchoolCode = _schoolCode,
                        Phone      = _phone,
                        Location   = _location
                    };

                    SqlDataAccess sql = new SqlDataAccess();
                    sql.UpdateData <SchoolModel>("dbo.spSchool_Update", e, "ADBData");

                    msg = $"School ({SelectedSchool.SchoolName}) was successfully updated.";
                    MessageBox.Show(msg, "School Updated");
                    Schools = new BindingList <SchoolDisplayModel>(GetAllSchools());
                    Clear();


                    isUpdating = false;

                    _events.PublishOnUIThread(new SchoolChangedEvent());
                }
            }
        }
Пример #3
0
        public static bool HasSchool(Mobile m)
        {
            if (m == null || !m.Alive || m.Backpack == null)
            {
                return(false);
            }

            if (m.Backpack.FindItemByType <MagicalFishFinder>() != null && Schools.ContainsKey(m.Map))
            {
                SchoolEntry entry = null;

                for (var index = 0; index < Schools[m.Map].Count; index++)
                {
                    var e = Schools[m.Map][index];

                    if (m.InRange(e.Location, SchoolRange))
                    {
                        entry = e;
                        break;
                    }
                }

                if (entry != null)
                {
                    entry.OnFish();
                    return(true);
                }
            }

            return(false);
        }
Пример #4
0
        public List <Schools> AddSchools(Schools school)
        {
            this.context?.tblSchool.Add(school);
            this.context?.SaveChanges();

            return(GetAllSchools());
        }
Пример #5
0
        public void Add()
        {
            isAdding = true;

            SchoolDisplayModel e = Schools.Where(x => x.SchoolName == SchoolName && x.SchoolCode == SchoolCode).FirstOrDefault();

            if (e == null)
            {
                SqlDataAccess sql = new SqlDataAccess();
                sql.SaveData <dynamic>("dbo.spSchool_Insert",
                                       new
                {
                    SchoolName = _schoolName,
                    SchoolCode = _schoolCode,
                    Phone      = _phone,
                    Location   = _location
                }, "ADBData");

                Schools = new BindingList <SchoolDisplayModel>(GetAllSchools());
                NotifyOfPropertyChange(() => Schools);
                Clear();

                _events.PublishOnUIThread(new SchoolChangedEvent());
            }
            else
            {
                msg = $"Error: An School named ({SelectedSchool.SchoolName}) already exist!!!";
                MessageBox.Show(msg, "Error");
            }

            isAdding = false;
        }
Пример #6
0
        public async void PostSchools()
        {
            using (var context = new PitalicaDbContext(_dbContextOptions))
            {
                var schoolsAPI = new SchoolsController(context);
                for (int i = 0; i < 10; ++i)
                {
                    Schools tmpSchool = new Schools
                    {
                        Name    = $"Skola { i + 1 }",
                        Address = new Addresses
                        {
                            CityName   = "Zagreb",
                            Country    = "Hrvatska",
                            StreetName = $"Ulica{ i }"
                        }
                    };

                    var result = await schoolsAPI.PostSchools(tmpSchool);

                    var badRequest = result as BadRequestObjectResult;

                    Assert.Null(badRequest); // Ako API ne vraca BadRequest, to znaci da je poziv uspjesan
                }
            }
        }
Пример #7
0
        public async Task <IActionResult> Edit(int id, [Bind("SchoolId,SName")] Schools schools)
        {
            if (id != schools.SchoolId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(schools);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SchoolsExists(schools.SchoolId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(schools));
        }
Пример #8
0
        private async Task <PublicJWTViewModel> PublicGenerateJwtToken(string email, IdentityUser user)
        {
            var claims = new List <Claim>
            {
                new Claim(JwtRegisteredClaimNames.Sub, email),
                new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
                new Claim(ClaimTypes.NameIdentifier, user.Id)
            };

            var key     = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["JwtKey"]));
            var creds   = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
            var expires = DateTime.Now.AddDays(Convert.ToDouble(_configuration["JwtExpireDays"]));

            var token = new JwtSecurityToken(
                _configuration["JwtIssuer"],
                _configuration["JwtIssuer"],
                claims,
                expires: expires,
                signingCredentials: creds
                );

            ApplicationUser appuser = _ApplicationDbContext.Users.Where(u => u.Email == email).FirstOrDefault();

            var userSec = (from a in _userManager.Users
                           join b in _ApplicationDbContext.UserRoles on a.Id equals b.UserId
                           join c in _ApplicationDbContext.Roles on b.RoleId equals c.Id
                           where a.Email == email
                           select new PublicUserViewModel()
            {
                AccessFailedCount = a.AccessFailedCount,
                ConcurrencyStamp = a.ConcurrencyStamp,
                Email = a.Email,
                EmailConfirmed = a.EmailConfirmed,
                FirstName = a.FirstName,
                Id = a.Id,
                LastName = a.LastName,
                LockoutEnabled = a.LockoutEnabled,
                NormalizedEmail = a.NormalizedEmail,
                NormalizedUserName = a.NormalizedUserName,
                PasswordHash = a.PasswordHash,
                PhoneNumber = a.PhoneNumber,
                PhoneNumberConfirmed = a.PhoneNumberConfirmed,
                SecurityStamp = a.SecurityStamp,
                TwoFactorEnabled = a.TwoFactorEnabled,
                UserName = a.UserName,
                Role = c.Name,
                SchoolCode = a.SchoolCode
            }).FirstOrDefault();


            var tt = new JwtSecurityTokenHandler().WriteToken(token);

            Schools school = _ApplicationDbContext.Schools.Where(m => m.SchoolId2.ToString() == userSec.SchoolCode).FirstOrDefault();

            //return new JWTViewModel() { Token = new JwtSecurityTokenHandler().WriteToken(token), UserID = token.Subject, ValidTo = token.ValidTo, IsValid = true } ;//new JwtSecurityTokenHandler().WriteToken(token);
            return(new PublicJWTViewModel()
            {
                Token = new JwtSecurityTokenHandler().WriteToken(token), UserID = appuser.Email, ValidTo = token.ValidTo, IsValid = true, Role = userSec.Role, SchoolCode = appuser.SchoolCode, School = school.Name
            });                                                                                                                                                                                                                                                 //new JwtSecurityTokenHandler().WriteToken(token);
        }
Пример #9
0
        public async Task <IActionResult> Register(Schools Schools)
        {
            var SchoolsWithSameName = _dbContext.Schools.SingleOrDefault(u => u.SchoolName == Schools.SchoolName);

            if (SchoolsWithSameName != null)
            {
                return(BadRequest("School with this name already exists"));
            }
            var SchoolsObj = new Schools
            {
                SchoolID        = Guid.NewGuid(),
                Active          = Schools.Active,
                Address         = Schools.Address,
                CityID          = Schools.CityID,
                EmailID         = Schools.EmailID,
                LocationMAP     = Schools.LocationMAP,
                NoofSubscribers = Schools.NoofSubscribers,
                Phone1          = Schools.Phone1,
                Phone2          = Schools.Phone2,
                RegionID        = Schools.RegionID,
                SchoolName      = Schools.SchoolName
            };

            _dbContext.Schools.Add(SchoolsObj);
            await _dbContext.SaveChangesAsync();

            return(StatusCode(StatusCodes.Status201Created));
        }
Пример #10
0
 public override void SaveContent()
 {
     Schools.SaveToJson();
     Groups.SaveToJson();
     Students.SaveToJson();
     Staff.SaveToJson();
 }
Пример #11
0
 public override void LoadLocalContent()
 {
     Schools.LoadFromJson();
     Groups.LoadFromJson();
     Students.LoadFromJson();
     Staff.LoadFromJson();
 }
Пример #12
0
        private void GUI_Load(object sender, EventArgs e)
        {
            cbSchools.DataSource    = new BindingSource(Schools.GetSchools(), null);
            cbSchools.DisplayMember = "Value";
            cbSchools.ValueMember   = "Key";
            cbSchools.SelectedIndex = 0;
            cbSchools.ResetText();
            //to reset selected value
            cbSchools.SelectedIndex = -1;

            prevHET = Program.HEALTHEVENTTYPE2;

            Dictionary <string, string> hetItems = new Dictionary <string, string>();

            hetItems.Add("Add Dependent", HealthEventType.AddDependent);
            hetItems.Add("Delete Dependent", HealthEventType.DeleteDependent);
            hetItems.Add("Cancel Coverage", HealthEventType.CancelCoverage);
            hetItems.Add("Change Health Plan", HealthEventType.ChangeHealthPlan);
            hetItems.Add("Dependent Address Change", HealthEventType.DependentAddressChange);
            hetItems.Add("Change Premium Payment Method", HealthEventType.ChangePremiumPaymentMethod);
            hetItems.Add("New Enrollment", HealthEventType.NewEnrollment);
            hetItems.Add("Open Enrollment", HealthEventType.OpenEnrollment);
            hetItems.Add("Continued Enrollment", HealthEventType.ContinuedEnrollment);
            hetItems.Add("Update Enrollment", HealthEventType.UpdateEnrollment);
            hetItems.Add("COBRA New Enrollment", HealthEventType.COBRANewEnrollment);
            cbEnroll.DataSource    = new BindingSource(hetItems, null);
            cbEnroll.DisplayMember = "Key";
            cbEnroll.ValueMember   = "Value";
        }
        public async Task <Schools> GetJson(IHttpClientFactory clientFactory)
        {
            Schools schoolList = null;

            ErrorString = "";
            var client = clientFactory.CreateClient("school");

            try
            {
                // gets cast exception
                schoolList = await client.GetFromJsonAsync <Schools>("");

                ErrorString = null;
            }
            catch (System.InvalidCastException ex)
            {
                ErrorString = $"Invalid Cast Exception getting our schools: { ex.Message }";
            }
            catch (Exception ex)
            {
                ErrorString = $"Exception getting our schools: { ex.Message }";
            }

            return(schoolList);
        }
Пример #14
0
        public async Task <ActionResult <Schools> > PostSchools(Schools schools)
        {
            _context.Schools.Add(schools);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSchools", new { id = schools.SchoolId }, schools));
        }
Пример #15
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name,District,Mascot,Colors,SchoolLogo,SchoolTypeId,Active,DtCreated,CreatedBy,DtModified,ModifiedBy")] Schools schools)
        {
            if (id != schools.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(schools);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SchoolsExists(schools.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SchoolTypeId"] = new SelectList(_context.SchoolTypes, "Id", "CreatedBy", schools.SchoolTypeId);
            return(View(schools));
        }
Пример #16
0
        public void PopulateStats(DateTime start, DateTime end, Schools school)
        {
            ioschools.DB.students_discipline[] rows;
            using (var repository = new Repository())
            {
                rows = repository.GetDisciplines()
                       .Where(x => x.created >= start &&
                              x.created <= end &&
                              x.user.classes_students_allocateds
                              .Count(y => y.school_class.schoolid == (int)school && y.year == start.Year) != 0).ToArray();
            }

            foreach (DisciplineType entry in Enum.GetValues(typeof(DisciplineType)))
            {
                var enumvalue = (int)entry;
                var stat      = new ConductStatistic
                {
                    name           = entry.ToDescriptionString(),
                    totalIncidents = rows.Count(x => x.type.HasValue && x.type.Value == enumvalue),
                    totalStudents  = rows.Where(x => x.type.HasValue && x.type.Value == enumvalue)
                                     .GroupBy(x => x.studentid).Count()
                };

                if (entry.IsMerit())
                {
                    merits.Add(stat);
                }
                else
                {
                    demerits.Add(stat);
                }
            }
        }
Пример #17
0
    public Schools GetSchool(int SchoolId)
    {
        Schools School = new Schools();

        using (var Con = new SqlConnection(GC.ConnectionString))
        {
            Con.Open();

            Query = "Select * from SchoolsView where id ='" + SchoolId + "'";

            using (var Com = new SqlCommand(Query, Con))
            {
                Reader = Com.ExecuteReader();

                while (Reader.Read())
                {
                    SchoolInformation Sku = new SchoolInformation();

                    Sku.SchoolId           = Convert.ToInt32(Reader["id"].ToString());
                    Sku.SchoolName         = Reader["sch_name"].ToString();
                    Sku.Moto               = Reader["Moto"].ToString();
                    Sku.RegistrationNumber = Reader["sch_reg_no"].ToString();

                    School.Info = Sku;
                }

                Com.Dispose();
            }

            Con.Close();
        }

        return(School);
    }
Пример #18
0
        public void initialize()
        {
            var client = new Client(System.Configuration.ConfigurationManager.AppSettings["API_TOKEN"]);

            school = client.school(System.Configuration.ConfigurationManager.AppSettings["SCHOOL_ID"]);
            client = null;
        }
Пример #19
0
        public IActionResult Schools()
        {
            APIHandler webHandler = new APIHandler();
            Schools    schools    = webHandler.GetSchools();;

            return(View(schools));
        }
Пример #20
0
        public void CheckUpdate(Mobile m)
        {
            if (Schools.ContainsKey(m.Map))
            {
                SchoolEntry entry = Schools[m.Map].FirstOrDefault(e => m.InRange(e.Location, SchoolRange));

                if (entry != null)
                {
                    m.SendLocalizedMessage(1152647); // Fish are schooling right here!
                    return;
                }

                entry = Schools[m.Map].FirstOrDefault(e => m.InRange(e.Location, MessageRange));

                if (entry != null)
                {
                    m.SendLocalizedMessage(1152638, GetDirectionString(Utility.GetDirection(m, entry.Location))); // The fish finder pulls you to the ~1_DIRECTION~.
                }
                else
                {
                    m.SendLocalizedMessage(1152637); // The fish finder shows you nothing.
                }
            }
            else
            {
                m.SendLocalizedMessage(1152637); // The fish finder shows you nothing.
            }
        }
Пример #21
0
    public Students(int UserID)
    {
        int SchholID = 0;

        using (var con = new SqlConnection(GC.ConnectionString))
        {
            con.Open();

            Query = "Select * from StudentsView where User_id='" + UserID + "'";

            using (var com = new SqlCommand(Query, con))
            {
                Reader = com.ExecuteReader();

                while (Reader.Read())
                {
                    ID                 = Convert.ToInt32(Reader["Id"].ToString());
                    FirstName          = Reader["FirstName"].ToString();
                    LastName           = Reader["LastName"].ToString();
                    Age                = Convert.ToInt32(Reader["Age"].ToString());
                    RegistrationNumber = Reader["RegistrationNumber"].ToString();
                    SchholID           = Convert.ToInt32(Reader["School_id"].ToString());

                    School = new Schools().GetSchool(SchholID);
                }
            }

            con.Close();
        }

        Classes = new Classes().GetStudentClasses(ID);
    }
Пример #22
0
        public async Task <IActionResult> PutSchools([FromRoute] int id, [FromBody] Schools schools)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != schools.SchoolId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #23
0
        /// <summary>
        /// Method to receive data from API end point as a collection of objects
        ///
        /// JsonConvert parses the JSON string into classes
        /// </summary>
        /// <returns></returns>
        public Schools GetSchools()
        {
            string NATIONAL_PARK_API_PATH = BASE_URL + "/schools?id=201177";
            string parksData = "";

            Schools schools = null;

            httpClient.BaseAddress = new Uri(NATIONAL_PARK_API_PATH);

            // It can take a few requests to get back a prompt response, if the API has not received
            //  calls in the recent past and the server has put the service on hibernation
            try
            {
                HttpResponseMessage response = httpClient.GetAsync(NATIONAL_PARK_API_PATH).GetAwaiter().GetResult();
                if (response.IsSuccessStatusCode)
                {
                    parksData = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                }

                if (!parksData.Equals(""))
                {
                    // JsonConvert is part of the NewtonSoft.Json Nuget package
                    schools = JsonConvert.DeserializeObject <Schools>(parksData);
                }
            }
            catch (Exception e)
            {
                // This is a useful place to insert a breakpoint and observe the error message
                Console.WriteLine(e.Message);
            }

            return(schools);
        }
Пример #24
0
 public LernsiegViewModel Init(LernsiegContext db)
 {
     this.db        = db;
     Schools        = db.Schools.ToList();
     SelectedSchool = Schools.First();
     return(this);
 }
Пример #25
0
        public async Task <IActionResult> LaghvInvoice()
        {
            try
            {
                string  mobile = HttpContext.Session.GetString("OFSlMobile");
                Schools iUser  = (from s in _context.Schools
                                  where s.Mobile == mobile
                                  select s).FirstOrDefault();

                var order = (from s in _context.Store_Orders
                             where s.Active == true && s.School_Id == iUser.Id && s.OrderStep < 2
                             select s).ToList();

                if (order != null)
                {
                    foreach (var or in order)
                    {
                        or.Active = false;
                    }
                    await _context.SaveChangesAsync();
                }
                else
                {
                    return(Json(new { result = "مشکلی پیش آمده است" }));
                }
                return(Json(new { result = 1 }));
            }
            catch (Exception ex)
            {
                return(Json(new { result = ex.ToString() }));
            }
        }
    public IEnumerator RequestSchools(Action <List <School> > setAction, string location)
    {
        #region www handling
        WWWForm form = new WWWForm();
        form.AddField("schoolLocation", location);
        WWW www = new WWW(baseURL + "SchoolFinder.php", form);
        onLoading.Raise();
        yield return(www);

        #endregion

        // check for errors
        if (checkError(www))
        {
            #region json handling
            Schools       schoolArray = new Schools();
            List <School> answer      = new List <School>();
            schoolArray = JsonUtility.FromJson(www.text, typeof(Schools)) as Schools;
            foreach (var item in schoolArray.schools)
            {
                answer.Add(item);
            }
            #endregion
            setAction(answer);
        }
    }
        public async Task <IActionResult> Edit(int id, [Bind("SchoolId,Name,AddressId")] Schools school)
        {
            if (id != school.SchoolId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(school);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SchoolExists(school.SchoolId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddressId"] = new SelectList(_context.Addresses, "AddressId", "AddressId", school.AddressId);
            return(View(school));
        }
        public async Task <Schools> Get()
        {
            Schools schoolList = null;

            try
            {
                schoolList = await GetData();

                if ((schoolList.schools == null) || (schoolList.schools.Length == 0))
                {
                    schoolList = await GetJson();
                    await UpdateData(schoolList);
                }

                if (schoolList.schools != null)
                {
                    schoolList.CurrentIndex = 0;
                    schoolList.MaxIndex     = schoolList.schools.Length;
                    schoolList.MaxPage      = MaxPage;
                }
            }
            catch (Exception ex)
            {
                ErrorString = $"Exception getting our schools: { ex.Message }";
                _logger.LogError(ErrorString);
            }

            return(schoolList);
        }
        public async Task <Schools> GetData(ISchoolsDataService dataService,
                                            int startIndex,
                                            int maxIndex)
        {
            Schools           schoolList = new Schools();
            List <SchoolItem> schools;
            int index        = 0;
            int indexCounter = 0;
            int schoolCount;

            ErrorString = "";

            try
            {
                schools = await dataService.GetSchoolsAsync();

                MaxListCount = schools.Count;
                if (maxIndex == 0)
                {
                    schoolCount = schools.Count;
                }
                else if (maxIndex > schools.Count)
                {
                    schoolCount = schools.Count;
                }
                else
                {
                    schoolCount = maxIndex;
                }
                schoolList.schools = null;
                if (schools.Count > 0)
                {
                    schoolList.schools = new SchoolItem[schoolCount];
                }

                foreach (SchoolItem school in schools)
                {
                    if (((indexCounter++ >= startIndex) && (index < maxIndex)) || (maxIndex == 0))
                    {
                        SchoolItem newSchool = new SchoolItem
                        {
                            Id     = school.Id,
                            name   = school.name,
                            street = school.street,
                            city   = school.city,
                            state  = school.state,
                            zip    = school.zip
                        };
                        schoolList.schools[index++] = newSchool;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorString = $"Exception getting our schools database: { ex.Message }";
            }

            return(schoolList);
        }
Пример #30
0
        public ActionResult ExportStats(Schools school, int year)
        {
            var stats = new ECAStatistic {
                school = school, year = year
            };

            stats.CalculateStats(repository);

            var ms = new MemoryStream();

            using (var fs =
                       new FileStream(
                           AppDomain.CurrentDomain.BaseDirectory + "/Content/templates/NPOITemplate.xls",
                           FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
                var          sheet            = templateWorkbook.CreateSheet(school.ToString());

                // create fonts
                var boldStyle = templateWorkbook.CreateCellStyle();
                var boldFont  = templateWorkbook.CreateFont();
                boldFont.Boldweight = (short)FontBoldWeight.BOLD;
                boldStyle.SetFont(boldFont);

                var rowcount = 0;
                var row      = sheet.CreateRow(rowcount++);

                // show general stats first
                var namecell = row.CreateCell(0);
                namecell.SetCellValue("Name");
                namecell.CellStyle = boldStyle;
                var malecell = row.CreateCell(1);
                malecell.SetCellValue("Male");
                malecell.CellStyle = boldStyle;
                var femalecell = row.CreateCell(2);
                femalecell.SetCellValue("Female");
                femalecell.CellStyle = boldStyle;

                foreach (var entry in stats.entries.OrderBy(x => x.name))
                {
                    row = sheet.CreateRow(rowcount++);
                    row.CreateCell(0).SetCellValue(entry.name);
                    row.CreateCell(1).SetCellValue(entry.male);
                    row.CreateCell(2).SetCellValue(entry.female);
                }

                // resize
                sheet.AutoSizeColumn(0);
                sheet.AutoSizeColumn(1);
                sheet.AutoSizeColumn(2);

                // delete first sheet
                templateWorkbook.RemoveSheetAt(0);
                templateWorkbook.Write(ms);
            }

            // return created file path);
            return(File(ms.ToArray(), "application/vnd.ms-excel", string.Format("Statistics_ECA_{0}_{1}.xls", school, year)));
        }
Пример #31
0
        private void UpdateFilterList(Schools selected, ToolStripMenuItem menu)
        {
            if (_filters.Contains(selected))
            {
                _filters.Remove(selected);
            }
            else
            {
                _filters.Add(selected);
            }

            updateMenuItem(menu);

            RefreshList();
        }
Пример #32
0
partial         void OnSchoolChanging( Schools value );
Пример #33
0
    // Use this for initialization
    void Start () {
        instance = this;
        var dimensional = new School(School.Type.dimensional, "School of dimensional things") { TermProgressSpeed = 0.3f };
        var colonization = new School(School.Type.colonization, "Colonization ministry") {TermProgressSpeed = 0.1f };
        var space = new School(School.Type.space, "Colonization ministry") {
                                    TermProgressSpeed = 0.2f,
                                    LeedsTo = {dimensional, colonization },
                                    Requirements = {Requirement(ResourceType.Iron, 2600000000000900L),
                                                        Requirement(ResourceType.Coal, 540000000000000L),
                                                        Requirement(ResourceType.Electricity, 160000000000000000L),
                                                        Requirement(ResourceType.Silicon, 160000000000000L)}
        };
        var vehicles = new School(School.Type.vehicles, "Cars and stuff ltd") {
                                        TermProgressSpeed = 0.1f,
                                        LeedsTo = { space },
                                        Requirements = {Requirement(ResourceType.Iron, 260000000900L),
                                                        Requirement(ResourceType.Coal, 54000000000L),
                                                        Requirement(ResourceType.Electricity, 16000000000000L),
                                                        Requirement(ResourceType.Silicon, 16000000000L)}
        };

        var ai = new School(School.Type.ai, "Online univeristy") { TermProgressSpeed = 0.1f };
        var cyborgs = new School(School.Type.cyborgs, "School of cybornetics") {
                                    TermProgressSpeed = 0.15f,
                                    LeedsTo = { ai },
                                        Requirements = {Requirement(ResourceType.Electricity, 160000000000000L),
                                        Requirement(ResourceType.Silicon, 1600000000000L)
                                    }
        };

        var machines = new School(School.Type.machines, "Machineries") {
                                        TermProgressSpeed = 0.4f,
                                        LeedsTo = { cyborgs, vehicles },
                                        Requirements = { Requirement(ResourceType.Iron, 19000000000L),
                                                        Requirement(ResourceType.Coal, 4300000000000L),
                                                        Requirement(ResourceType.Electricity, 16000000000L),
                                                        Requirement(ResourceType.Silicon, 160000000L)}
        };
        var water = new School(School.Type.water, "Block: Water") {
                                    TermProgressSpeed = 0.25f,
                                    LeedsTo = { machines },
                                    Requirements = { Requirement(ResourceType.Iron, 20000000), Requirement(ResourceType.Coal, 8000000000), Requirement(ResourceType.Tree, 3600000000) }
        };

        var rocks = new School(School.Type.rocks, "Geology and stone things") {TermProgressSpeed = 0.1f };
        var buildings = new School(School.Type.buildings, "Tall block development") {TermProgressSpeed = 0.1f };
        var earth = new School(School.Type.earth, "Block: Earth") {
            TermProgressSpeed = 0.1f,
            LeedsTo = { rocks, buildings },
            Requirements = { Requirement(ResourceType.Stone, 2000000), Requirement(ResourceType.Coal, 6000000), Requirement(ResourceType.Tree, 4300000) }
        };

        var roundThings = new School(School.Type.roundThings, "School of round things") {
                                        TermProgressSpeed = 0.16f,
                                        LeedsTo = { water, earth },
                                        Requirements = { Requirement(ResourceType.Tree, 20000), Requirement(ResourceType.Stone, 50000) }
        };


        var computers = new School(School.Type.computers, "Silicon university") { TermProgressSpeed = 0.1f };
        var electricity = new School(School.Type.electricity, "Ark university") {
                                        TermProgressSpeed = 0.64f,
                                        LeedsTo = { computers },
                                        Requirements = { Requirement(ResourceType.Silicon, 100000),
                                                        Requirement(ResourceType.Iron, 200000000),
                                                        Requirement(ResourceType.Electricity, 53000000) }
        };

        var arts = new School(School.Type.arts, "Art schoool") { TermProgressSpeed = 0.1f };
        var fire = new School(School.Type.fire, "Block Fire") {
            TermProgressSpeed = 0.5f,
            LeedsTo = { arts, electricity },
            Requirements = { Requirement(ResourceType.Iron, 4000),
                             Requirement(ResourceType.Tree, 10000)}
        };

        var philosphy = new School(School.Type.philosphy, "Thinking university") { TermProgressSpeed = 0.1f };
        var wind = new School(School.Type.wind, "Block: Wind") {
                                    TermProgressSpeed = 0.23f,
                                    LeedsTo = { philosphy },
                                    Requirements = { Requirement(ResourceType.Stone, 500) }
        };

        var nonRoundThings = new School(School.Type.nonRoundThings, "Nonround university") {
                                            TermProgressSpeed = 0.12f,
                                            LeedsTo = { fire, wind },
                                            Requirements = { Requirement(ResourceType.Tree, 1000) }
        };

        currentSchools.Add(roundThings);
        currentSchools.Add(nonRoundThings);

        float startDegrees = 360.0f / currentSchools.Count;

        for(int a = 0; a < currentSchools.Count; ++a) {
            currentSchools[a].Rotation = Quaternion.Euler(0, 0, startDegrees * a + 45);
            currentSchools[a].Spawn(SchoolPrefab, transform);
        }
    }