示例#1
0
        public ActionResult Create([Bind(Include = "Id,Title,Content,ClosingDate")] Posting posting, int[] skillsToAdd, int SchoolProgramId)
        {
            var whatis = SchoolProgramId;

            SchoolProgram sp = db.Programs.FirstOrDefault(x => x.Id == SchoolProgramId);
            //posting needs a school program
            var     userId  = User.Identity.GetUserId();
            Company company = db.Companies.Find(userId);

            if (userId == null)
            {
                return(RedirectToAction("MessagePage", "Home", new MessageCarrier {
                    message = "You must be signed in as a company to submit a new job posting", actn = "Index", ctrller = "Home"
                }));
            }


            posting.PostingDate   = DateTime.Now;
            posting.SchoolProgram = sp;
            foreach (int skillId in skillsToAdd)
            {
                Skill skill = db.Skills.Find(skillId);
                posting.Skills.Add(skill);
            }

            if (ModelState.IsValid)
            {
                company.Postings.Add(posting);
                db.SaveChanges();
                return(RedirectToAction("Details", new { id = posting.Id }));
            }

            return(View(posting));
        }
示例#2
0
 protected SchoolProgramViewData(SchoolProgram schoolProgram)
 {
     Id          = schoolProgram.Id;
     Code        = schoolProgram.Code;
     Name        = schoolProgram.Name;
     Description = schoolProgram.Description;
     StateCode   = schoolProgram.StateCode;
     SIFCode     = schoolProgram.SIFCode;
     NCESCode    = schoolProgram.NCESCode;
     IsActive    = schoolProgram.IsActive;
     IsSystem    = schoolProgram.IsSystem;
 }
 public SchoolProgram Get(int id)
 {
     if (!(bool)HttpContext.Current.Application["Updating"])
     {
         IIndexablePresenter <SchoolProgram> presenter = (IIndexablePresenter <SchoolProgram>)HttpContext.Current.Application["ProgramPresenter"];
         IEnumerable <SchoolProgram>         result    = presenter.GetItemsFromIDs(presenter.GetIDMatches("id:" + id, null, null));
         SchoolProgram first = result.FirstOrDefault <SchoolProgram>();
         first.Description = first.Description.Replace("|", "<br />");
         first.Description = CodeRegex.Replace(first.Description, delegate(Match match)
         {
             return("<span class='courseCode' onclick='searchCourseCode(this)'>" + match.Value + "</span>");
         });
         return(first);
     }
     return(null);
 }
        static void Main(string[] args)
        {
            SchoolProgram sp = new SchoolProgram();

            sp.AddStudent("Deepak Acharya", 1);
            sp.AddStudent("H Sharath Achar", 1);
            sp.AddStudent("Akash Deep", 2);
            sp.AddStudent("Preetham D Bangera", 1);
            foreach (var item in sp._roster)
            {
                Console.WriteLine(item.Key);
                foreach (var item1 in item.Value)
                {
                    Console.WriteLine(item1);
                }
            }
            Console.ReadLine();
        }
示例#5
0
        public static bool SaveProgramWithOtherSchoolYear(Guid OldCurrentSchoolYearId, Guid CurrentSchoolYearId, Guid SchoolId, System.Data.Common.DbTransaction tran, DayCareDataContext dbold)
        {
            DayCareDataContext db = dbold;

            db.Transaction = tran;
            SchoolProgram           DBSchoolProgram           = null;
            SchoolProgramFeesDetail DBSchoolProgramFeesDetail = null;

            try
            {
                /* Guid currentschoolyearid = (from sy in db.SchoolYears
                 *                           where sy.CurrentId.Equals(true) && sy.SchoolId.Equals(SchoolId)
                 *                           select sy.Id).SingleOrDefault(); */

                Guid currentschoolyearid = CurrentSchoolYearId;

                List <Guid> lstProgram = (from sp in db.SchoolPrograms
                                          where sp.SchoolYearId.Equals(OldCurrentSchoolYearId) && sp.Active.Equals(true) &&
                                          !(from sp1 in db.SchoolPrograms
                                            where sp1.SchoolYearId.Equals(currentschoolyearid)
                                            select sp1.ProgUniqueId).Contains(sp.ProgUniqueId)
                                          select sp.Id).ToList();


                ProgClassRoom DBProgClassRoom = null;
                foreach (Guid ProgramId in lstProgram)
                {
                    //try
                    //{
                    SchoolProgram DBSchoolProgramOld = db.SchoolPrograms.FirstOrDefault(i => i.Id.Equals(ProgramId));
                    if (DBSchoolProgramOld != null)
                    {
                        DBSchoolProgram = new SchoolProgram();
                        //DBSchoolProgram = DBSchoolProgramOld;
                        DBSchoolProgram.Id                   = Guid.NewGuid();
                        DBSchoolProgram.Title                = DBSchoolProgramOld.Title;
                        DBSchoolProgram.Comments             = DBSchoolProgramOld.Comments;
                        DBSchoolProgram.Active               = DBSchoolProgramOld.Active;
                        DBSchoolProgram.IsPrimary            = DBSchoolProgramOld.IsPrimary;
                        DBSchoolProgram.CreatedById          = DBSchoolProgramOld.CreatedById;
                        DBSchoolProgram.LastModifiedById     = DBSchoolProgramOld.LastModifiedById;
                        DBSchoolProgram.ProgUniqueId         = DBSchoolProgramOld.ProgUniqueId;
                        DBSchoolProgram.SchoolYearId         = CurrentSchoolYearId;
                        DBSchoolProgram.CreatedDateTime      = DateTime.Now;
                        DBSchoolProgram.LastModifiedDatetime = DateTime.Now;
                        db.SchoolPrograms.InsertOnSubmit(DBSchoolProgram);
                        db.SubmitChanges();


                        //Automatic add to progclassroom change on 28-Aug-2012 by Akash
                        List <Guid> lstProgClass = (from pcr in db.ProgClassRooms
                                                    where pcr.Active.Equals(true) && pcr.SchoolProgramId.Equals(ProgramId)
                                                    select pcr.ClassRoomId).ToList();

                        foreach (Guid ClassroomId in lstProgClass)
                        {
                            DBProgClassRoom    = new ProgClassRoom();
                            DBProgClassRoom.Id = Guid.NewGuid();
                            DBProgClassRoom.SchoolProgramId      = DBSchoolProgram.Id;
                            DBProgClassRoom.ClassRoomId          = ClassroomId;
                            DBProgClassRoom.Active               = true;
                            DBProgClassRoom.CreatedDateTime      = DateTime.Now;
                            DBProgClassRoom.LastModifiedDatetime = DateTime.Now;
                            DBProgClassRoom.CreatedById          = DBSchoolProgramOld.CreatedById;
                            DBProgClassRoom.LastModifiedById     = DBSchoolProgramOld.LastModifiedById;
                            db.ProgClassRooms.InsertOnSubmit(DBProgClassRoom);
                            db.SubmitChanges();
                        }
                    }

                    var lstDBSchoolProgramFeesDetailOld = db.SchoolProgramFeesDetails.Where(i => i.SchoolProgramId.Equals(ProgramId));
                    if (lstDBSchoolProgramFeesDetailOld != null)
                    {
                        foreach (SchoolProgramFeesDetail objSchoolProgramFeesDetails in lstDBSchoolProgramFeesDetailOld)
                        {
                            DBSchoolProgramFeesDetail    = new SchoolProgramFeesDetail();
                            DBSchoolProgramFeesDetail.Id = Guid.NewGuid();
                            //DBSchoolProgramFeesDetail = objSchoolProgramFeesDetails;
                            DBSchoolProgramFeesDetail.SchoolProgramId      = DBSchoolProgram.Id;
                            DBSchoolProgramFeesDetail.Fees                 = objSchoolProgramFeesDetails.Fees;
                            DBSchoolProgramFeesDetail.FeesPeriodId         = objSchoolProgramFeesDetails.FeesPeriodId;
                            DBSchoolProgramFeesDetail.EffectiveYearDate    = objSchoolProgramFeesDetails.EffectiveYearDate;
                            DBSchoolProgramFeesDetail.EffectiveMonthDay    = objSchoolProgramFeesDetails.EffectiveMonthDay;
                            DBSchoolProgramFeesDetail.EffectiveWeekDay     = objSchoolProgramFeesDetails.EffectiveWeekDay;
                            DBSchoolProgramFeesDetail.CreatedById          = objSchoolProgramFeesDetails.CreatedById;
                            DBSchoolProgramFeesDetail.LastModifiedById     = objSchoolProgramFeesDetails.LastModifiedById;
                            DBSchoolProgramFeesDetail.CreatedDateTime      = DateTime.Now;
                            DBSchoolProgramFeesDetail.LastModifiedDatetime = DateTime.Now;
                            db.SchoolProgramFeesDetails.InsertOnSubmit(DBSchoolProgramFeesDetail);
                            db.SubmitChanges();
                        }
                    }
                    //}
                    //catch
                    //{ }
                }
                return(true);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clSchoolYear, "SaveProgramWithOtherSchoolYear", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(false);
            }
        }
示例#6
0
        protected override void Seed(MITT_Intern_2019_10_10.Models.ApplicationDbContext context)
        {
            var db = context;

            var roleStore   = new RoleStore <IdentityRole>(db);
            var roleManager = new RoleManager <IdentityRole>(roleStore);

            IdentityRole admin = new IdentityRole {
                Name = "Admin"
            };
            IdentityRole student = new IdentityRole {
                Name = "Student"
            };
            IdentityRole company = new IdentityRole {
                Name = "Company"
            };
            IdentityRole teacher = new IdentityRole {
                Name = "Teacher"
            };


            if (!context.Roles.Any(r => r.Name == "Admin"))
            {
                roleManager.Create(admin);
                roleManager.Create(student);
                roleManager.Create(company);
                roleManager.Create(teacher);
            }

            var softwareDev = new SchoolProgram()
            {
                Title = "Software Developer"
            };

            var js = new Skill()
            {
                Name = "Javascript"
            };
            var react = new Skill()
            {
                Name = "React.js"
            };
            var html5 = new Skill()
            {
                Name = "HTML5"
            };
            var sass = new Skill()
            {
                Name = "SASS"
            };
            var ajax = new Skill()
            {
                Name = "AJAX"
            };

            db.Skills.AddOrUpdate(s => s.Name,
                                  new Skill()
            {
                Name = "CSS3"
            },
                                  new Skill()
            {
                Name = "Git"
            },
                                  new Skill()
            {
                Name = "ASP.NET C#"
            },
                                  new Skill()
            {
                Name = "MVC"
            },
                                  new Skill()
            {
                Name = "Unit Testing"
            },
                                  new Skill()
            {
                Name = "Bash"
            },
                                  new Skill()
            {
                Name = "Linux"
            },
                                  new Skill()
            {
                Name = "Node.js"
            },
                                  new Skill()
            {
                Name = "Front-End"
            },
                                  new Skill()
            {
                Name = "Back-End"
            },
                                  new Skill()
            {
                Name = "SQL"
            },
                                  new Skill()
            {
                Name = "Python"
            },
                                  new Skill()
            {
                Name = "DevOps"
            }
                                  );

            if (!context.Users.Any(u => u.UserName == "KyleE"))
            {
                var store       = new UserStore <ApplicationUser>(db);
                var usermanager = new ApplicationUserManager(store);


                var kyle = new Student()
                {
                    UserName = "******", Email = "*****@*****.**", FirstName = "Kyle", LastName = "Elyk"
                };
                usermanager.Create(kyle, "Password1!");
                usermanager.Create(new Student()
                {
                    UserName = "******", Email = "*****@*****.**", FirstName = "Julien", LastName = "Martel"
                }, "Password1!");
                usermanager.Create(new Student()
                {
                    UserName = "******", Email = "*****@*****.**", FirstName = "Farc", LastName = "As"
                }, "Password1!");
                usermanager.Create(new Student()
                {
                    UserName = "******", Email = "*****@*****.**", FirstName = "Studfour", LastName = "FourLastName"
                }, "Password1!");

                var company1 = new Company()
                {
                    UserName = "******", Email = "*****@*****.**"
                };

                var thisoneworks = usermanager.Create(new Company()
                {
                    UserName = "******", Email = "CompanyEmail"
                }, "Password1!");

                usermanager.Create(company1, "Password1!");
                usermanager.Create(new Company()
                {
                    UserName = "******", Email = "*****@*****.**"
                }, "Password1!");

                var bold = new Company()
                {
                    UserName = "******", Email = "*****@*****.**"
                };

                usermanager.Create(bold, "Password1!");

                var post = new Posting()
                {
                    Title         = "Front-end Javasript dev wanted",
                    PostingDate   = DateTime.Now,
                    ClosingDate   = DateTime.Now.AddDays(60),
                    Content       = "we are looking for a javascriot dev that likes to work in fron-end. Hopefully they will also like react. Looking for a stduent ike blah bah bha bkha bha bkab blah blah blahbh sdjfojsdufs jsdfuisdf i foims oi osd do you know dflksdf kf pofdnf",
                    SchoolProgram = softwareDev,
                };

                post.Skills.Add(js);
                post.Skills.Add(react);
                post.Skills.Add(html5);
                post.Skills.Add(sass);
                post.Skills.Add(ajax);

                bold.Postings.Add(post);

                bold.Roles.Add(new IdentityUserRole {
                    RoleId = company.Id
                });
                kyle.Roles.Add(new IdentityUserRole {
                    RoleId = student.Id
                });
            }
            db.Programs.AddOrUpdate(x => x.Title,
                                    new SchoolProgram()
            {
                Title = "Culinary"
            },
                                    new SchoolProgram()
            {
                Title = "Automotive"
            }
                                    );


            db.SaveChanges();
        }
示例#7
0
        public Program2()
        {
            List <Person> People = new List <Person>();
            string        Name;
            int           Age;
            int           Id;
            SchoolProgram Program = SchoolProgram.Undeclared;
            int           counter = 1;
            string        input;
            bool          stillGoing;

            do
            {
                Console.WriteLine("1) Student\n2) Teacher\n3) Exit");
                input = Console.ReadLine();
                if (input != "3")
                {
                    stillGoing = true;
                    Console.WriteLine("Name: ");
                    Name = Console.ReadLine();
                    Console.WriteLine("Age: ");
                    Age = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("ID: ");
                    Id = Convert.ToInt32(Console.ReadLine());

                    foreach (SchoolProgram sp in Enum.GetValues(typeof(SchoolProgram)))
                    {
                        Console.WriteLine($"{counter}) {sp}");
                        counter++;
                    }
                    counter = 1;
                    int choice = Convert.ToInt32(Console.ReadLine());
                    foreach (SchoolProgram sp in Enum.GetValues(typeof(SchoolProgram)))
                    {
                        if ((choice - 1) == (int)sp)
                        {
                            Program = sp;
                        }
                    }

                    switch (input)
                    {
                    case "1":
                    {
                        Student student = new Student
                        {
                            Name    = Name,
                            Age     = Age,
                            Id      = Id,
                            Program = Program
                        };
                        Console.WriteLine("Credits Earned: ");
                        student.Credit = Convert.ToInt32(Console.ReadLine());
                        People.Add(student);
                        break;
                    }

                    case "2":
                    {
                        Teacher teacher = new Teacher
                        {
                            Name    = Name,
                            Age     = Age,
                            Id      = Id,
                            Program = Program
                        };
                        Console.WriteLine("Years of Service");
                        teacher.Tenure = Convert.ToInt32(Console.ReadLine());
                        People.Add(teacher);
                        break;
                    }
                    }
                }
                else
                {
                    stillGoing = false;
                }
            } while (stillGoing);

            foreach (Person p in People)
            {
                Console.WriteLine(p.Display());
            }
        }
示例#8
0
 public static SchoolProgramViewData Create(SchoolProgram schoolProgram)
 {
     return(new SchoolProgramViewData(schoolProgram));
 }