public IActionResult AddSchool(SchoolModel school)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest("İstek geçerli değil."));
                }
                using (UnitOfWork uow = new UnitOfWork())
                {
                    var control = uow.GetRepository <SchoolModel>().Get(x => x.SchoolName.Equals(school.SchoolName));

                    switch (control)
                    {
                    case null:
                        uow.GetRepository <SchoolModel>().Add(school);
                        return(uow.SaveChanges() > 0 ? Ok(school) : StatusCode(424, "Beklenmeyen hata gerçekleşti."));

                    default:
                        return(Conflict("Okul adı daha önceden bulunmaktadır."));
                    }
                }
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
        public IActionResult EditSchool(SchoolModel school)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest("İstek geçerli değil."));
                }
                using (UnitOfWork uow = new UnitOfWork())
                {
                    var schoolModel   = uow.GetRepository <SchoolModel>();
                    var schoolControl = schoolModel.GetAll(x => x.Id.Equals(school.Id));

                    if (schoolControl != null)
                    {
                        uow.GetRepository <SchoolModel>().Update(school);
                    }

                    return(uow.SaveChanges() > 0 ? Ok(school) : StatusCode(424, "Beklenmeyen bir hata oluştu."));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(StatusCode(500, e.Message));
            }
        }
示例#3
0
        private static void AddSchool(Resume resume, SchoolModel schoolModel)
        {
            var school = new School
            {
                Id             = schoolModel.Id.Value,
                CompletionDate = GetCompletionDate(schoolModel),
                Degree         = schoolModel.Degree,
                Major          = schoolModel.Major,
                Institution    = schoolModel.Institution,
                City           = schoolModel.City,
                Description    = schoolModel.Description,
            };

            if (resume.Schools == null)
            {
                resume.Schools = new List <School> {
                    school
                }
            }
            ;
            else
            {
                resume.Schools.Add(school);
            }
        }
示例#4
0
        public HttpResponseMessage PutSchool(int id, School schoolEntity)
        {
            if (id <= 0)
            {
                var errResponse = this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                                   "The id of the school must be positive");
                return(errResponse);
            }

            try
            {
                var entity = this.schoolRepository.Update(id, schoolEntity);

                var response = this.Request.CreateResponse(
                    HttpStatusCode.OK, SchoolModel.CreateFromSchoolEntity(entity));
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = entity.SchoolId }));

                return(response);
            }
            catch (DbUpdateConcurrencyException)
            {
                var errResponse = this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError,
                                                                   "The school could not be updated because of a concurrency problem");

                return(errResponse);
            }
            catch (NullReferenceException)
            {
                var errResponse = this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                                   string.Format("A School entity with id={0} does not exist in the Database", id));

                return(errResponse);
            }
        }
示例#5
0
        // POST api/Students
        public HttpResponseMessage PostStudent(SchoolModel schoolModel)
        {
            DbSchoolRepository schoolRepository = this.allRepositories.GetSchoolRepository();

            School school = new School()
            {
                Name     = schoolModel.Name,
                Location = schoolModel.Location
            };

            schoolRepository.Add(school);

            SchoolModel createdSchoolModel = new SchoolModel()
            {
                Id       = school.Id,
                Name     = school.Name,
                Location = school.Location
            };

            var response     = Request.CreateResponse <SchoolModel>(HttpStatusCode.Created, createdSchoolModel);
            var resourceLink = Url.Link("DefaultApi", new { id = createdSchoolModel.Id });

            response.Headers.Location = new Uri(resourceLink);
            return(response);
        }
示例#6
0
        public string SubmitSurvey(int schoolID)
        {
            string               results    = string.Empty;
            List <string>        resultList = new List <string>();
            JavaScriptSerializer js         = new JavaScriptSerializer();

            try
            {
                SurveyRepository repo = new SurveyRepository();
                SchoolModel      data = repo.SubmitSurvey(schoolID);

                if (data != null)
                {
                    resultList.Add("Success");
                }
                else
                {
                    resultList.Add("Error when saving Submitting Survey");
                }
            }
            catch (Exception ex)
            {
                resultList.Add(string.Format("Error - {0}", ex.Message));
            }

            results = js.Serialize(resultList);
            return(results);
        }
示例#7
0
        private void SaveSchoolDetail()
        {
            schoolModel = new SchoolModel
            {
                SchoolID          = string.IsNullOrWhiteSpace(hdnSchoolID.Text) ? null : (long?)Convert.ToInt64(hdnSchoolID.Text),
                SchoolName        = txtSchoolName.Text,
                Address           = txtAddress.Text,
                PhoneNo           = txtPhoneNo.Text,
                ESTD              = string.IsNullOrWhiteSpace(txtESTD.Text) ? null : txtESTD.Text,
                AffiliationNo     = string.IsNullOrWhiteSpace(txtAffiliationNo.Text) ? null : txtAffiliationNo.Text,
                SchoolNo          = string.IsNullOrWhiteSpace(txtSchoolNo.Text) ? null : txtSchoolNo.Text,
                IsReAdmission     = chkReAdmission.Checked == true ? true : false,
                ReAdmissionAmount = string.IsNullOrWhiteSpace(txtReAdmissionAmount.Text) ? null : (Int32?)Convert.ToInt32(txtReAdmissionAmount.Text),
                SchoolLogo        = _schoolLogoBytes,
                FormTextLine1     = string.IsNullOrWhiteSpace(txtline1.Text) ? null : txtline1.Text,
                FormTextLine2     = string.IsNullOrWhiteSpace(txtline2.Text) ? null : txtline2.Text,
                FormTextLine3     = string.IsNullOrWhiteSpace(txtline3.Text) ? null : txtline3.Text
            };
            schoolSetting = new SchoolSetting();
            short result = schoolSetting.SaveSchoolDetails(schoolModel);

            switch (result)
            {
            case 1:
                MessageBox.Show("Record Successfully Saved.", "School Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;

            case -1:
                MessageBox.Show("Error: Please Contact To Admin.", "School Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;
            }
        }
示例#8
0
        /// <summary>
        /// Get list of Schools
        /// Filter by School_Type_Id
        /// </summary>
        /// <param name="provinceId"></param>
        /// <returns></returns>
        public ActionResult FilterFromSchooltypeAjax(string SchoolTypeId)
        {
            //Use to generate VEP Search Reports
            //Session["SearchProvinceId"] = provinceId;

            if (String.IsNullOrEmpty(SchoolTypeId))
            {
                SchoolTypeId = "-1";
            }

            var schoolModel = new SchoolModel();
            var schoolList  = schoolModel.GetListOfSchools(int.Parse(SchoolTypeId));

            var result = (from x in schoolList

                          select new
            {
                id = x.School_Id,
                name = x.School_Name
            })

                         .ToList();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#9
0
        private School _populateValues(School entity, SchoolModel model)
        {
            if (null == entity)
            {
                entity                = new School();
                entity.EmailId        = model.EmailId;
                entity.OrganizationId = model.OrganizationId;
                entity.BranchName     = model.BranchName;

                entity.CreatedDate  = DateTime.Now;
                entity.ModifiedDate = DateTime.Now;
            }
            entity.Address1      = model.Address1;
            entity.Address2      = model.Address2;
            entity.City          = model.City;
            entity.ContactPerson = model.ContactPerson;
            entity.Country       = model.Country;
            entity.Description   = model.Description;
            entity.ModifiedDate  = DateTime.Now;
            entity.Phone         = model.Phone;
            entity.State         = model.State;
            entity.ThemeId       = model.ThemeId;
            entity.Title         = model.Title;
            entity.Twitter       = model.Twitter;
            entity.FaceBookUrl   = model.FaceBookUrl;
            entity.LinkedIn      = model.LinkedIn;
            entity.IsActive      = model.IsActive;

            return(entity);
        }
示例#10
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());
                }
            }
        }
示例#11
0
        public Message <SchoolModel> Post([FromBody] SchoolModel schoolModel)
        {
            try
            {
                var schoolEntity = _mapper.Map <School>(schoolModel);

                _repository.Insert(schoolEntity);
                _repository.Save();

                return(new Message <SchoolModel>()
                {
                    IsSuccess = true,
                    ReturnMessage = "OK",
                    StatusCode = 200,
                    Data = schoolModel
                });
            }
            catch (Exception ex)
            {
                _logger.LogError("Error on Inserting School", ex);

                return(new Message <SchoolModel>()
                {
                    IsSuccess = false,
                    ReturnMessage = "Error",
                    StatusCode = 404,
                    Data = schoolModel
                });
            }
        }
        public short SaveSchoolDetails(SchoolModel schoolModel)
        {
            short result;

            try
            {
                using (SqlService sqlService = new SqlService(ConnectionString.ConnectionStrings))
                {
                    sqlService.AddParameter("@SchoolID", schoolModel.SchoolID);
                    sqlService.AddParameter("@SchoolName", schoolModel.SchoolName);
                    sqlService.AddParameter("@Address", schoolModel.Address);
                    sqlService.AddParameter("@PhoneNo", schoolModel.PhoneNo);
                    sqlService.AddParameter("@ESTD", schoolModel.ESTD);
                    sqlService.AddParameter("@AffiliationNo", schoolModel.AffiliationNo);
                    sqlService.AddParameter("@SchoolNo", schoolModel.SchoolNo);
                    sqlService.AddParameter("@SchoolLogo", schoolModel.SchoolLogo);
                    sqlService.AddParameter("@IsReAdmission", schoolModel.IsReAdmission);
                    sqlService.AddParameter("@ReAdmissionAmount", schoolModel.ReAdmissionAmount);
                    sqlService.AddParameter("@FormTextLine1", schoolModel.FormTextLine1);
                    sqlService.AddParameter("@FormTextLine2", schoolModel.FormTextLine2);
                    sqlService.AddParameter("@FormTextLine3", schoolModel.FormTextLine3);
                    sqlService.AddOutputParameter("@Result", SqlDbType.SmallInt);
                    sqlService.ExecuteSPNonQuery("dbo.USP_SaveSchoolDetails");
                    result = (short)sqlService.Parameters["@Result"].Value;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
示例#13
0
        private SchoolModel PrepareSchoolModel(School school)
        {
            SchoolModel schoolTemp = new SchoolModel();

            schoolTemp.Id        = school.Id;
            schoolTemp.Name      = school.Name;
            schoolTemp.Address   = school.Address;
            schoolTemp.Code      = school.Code;
            schoolTemp.EIN       = school.EIN;
            schoolTemp.Email     = school.Email;
            schoolTemp.Mobile    = school.Mobile;
            schoolTemp.Phone     = school.Phone;
            schoolTemp.UpazilaId = school.UpazilaId;
            if (schoolTemp.UpazilaId > 0)
            {
                schoolTemp.UpazilaName = school.Upazila.Name;
                schoolTemp.DistrictId  = school.Upazila.DistrictId;
                if (schoolTemp.DistrictId > 0)
                {
                    schoolTemp.DistrictName = school.Upazila.District.Name;
                    schoolTemp.DivisionId   = school.Upazila.District.DivisionId;
                    if (schoolTemp.DivisionId > 0)
                    {
                        schoolTemp.DivisionName = school.Upazila.District.Division.Name;
                    }
                }
            }
            if (school.IsActive != null)
            {
                schoolTemp.IsActive = school.IsActive.Value;
            }
            return(schoolTemp);
        }
 public void CreateNewContactOnThankQ <T>(BaseModel model)
 {
     if (typeof(T).Equals(new SchoolModel().GetType()))
     {
         SchoolModel school = (SchoolModel)model;
         if (school.Event.IsSameContact)
         {
             school.Event.GroupCoordinator.SerialNumber = PostJsonData_NewContact <SchoolModel>(school, CONTACTTYPE.INDIVIDUAL, INDIVISUALTYPE.GROUPCOORDINATOR).Trim('"');
             school.Event.Invoice.SerialNumber          = school.Event.GroupCoordinator.SerialNumber;
         }
         else
         {
             school.Event.GroupCoordinator.SerialNumber = PostJsonData_NewContact <SchoolModel>(school, CONTACTTYPE.INDIVIDUAL, INDIVISUALTYPE.GROUPCOORDINATOR).Trim('"');
             school.Event.Invoice.SerialNumber          = PostJsonData_NewContact <SchoolModel>(school, CONTACTTYPE.INDIVIDUAL, INDIVISUALTYPE.INVOICEE).Trim('"');
         }
     }
     else if (typeof(T).Equals(new AdultModel().GetType()))
     {
         AdultModel adult = (AdultModel)model;
         adult.Event.GroupCoordinator.SerialNumber = PostJsonData_NewContact <AdultModel>(adult, CONTACTTYPE.INDIVIDUAL, INDIVISUALTYPE.GROUPCOORDINATOR).Trim('"');
         if (adult.Event.IsInvoiceOnly)
         {
             adult.Event.Invoice.SerialNumber = PostJsonData_NewContact <AdultModel>(adult, CONTACTTYPE.INDIVIDUAL, INDIVISUALTYPE.INVOICEE).Trim('"');
         }
     }
     else if (typeof(T).Equals(new UniversityModel().GetType()))
     {
         UniversityModel uni = (UniversityModel)model;
         uni.Event.GroupCoordinator.SerialNumber = PostJsonData_NewContact <UniversityModel>(uni, CONTACTTYPE.INDIVIDUAL, INDIVISUALTYPE.GROUPCOORDINATOR).Trim('"');
         uni.Event.Invoice.SerialNumber          = PostJsonData_NewContact <UniversityModel>(uni, CONTACTTYPE.INDIVIDUAL, INDIVISUALTYPE.INVOICEE).Trim('"');
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                UserVerificationRepository _repo = new UserVerificationRepository();
                SchoolModel data = _repo.GetSchoolByID(SchoolID);

                if (data != null)
                {
                    hdfSchoolID.Value                 = SchoolID.ToString();
                    lblSchoolName.InnerText           = data.Name;
                    lblSchoolLevel.InnerText          = data.Level;
                    lblEMISNo.InnerText               = data.EMISNo;
                    lblEducationalDistrict.InnerText  = data.DistrictName;
                    lblRelationWithState.InnerText    = data.RelationWithState;
                    lblEmailAddress.InnerText         = data.PrincipalEmailAddress;
                    lblPrincipalName.InnerText        = data.PrincipalName;
                    lblPrincipalIDNo.InnerText        = data.PrincipalIdentityNo;
                    lblPrincipalCellphoneNo.InnerText = data.PrincipalMobileNo;
                    lblPrincipalPersalNo.InnerText    = data.PrincipalPersalNo;

                    Session["CurrentUser"] = data.PrincipalName;
                }
            }
        }
示例#16
0
        /// <summary>
        /// Render partial view for Initial Identification Page
        /// </summary>
        /// <param name="bookType">The type of booking School / Adult / University</param>
        /// <returns>Partial view with Model</returns>
        public PartialViewResult InitialIdentification(string bookType)
        {
            ViewBag.rootUrl = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));
            if (bookType.Equals(TOURCATEGORY.SCHOOL))
            {
                Session["idList"] = new List <int>();
                SchoolModel school = new SchoolModel();
                school.SubjectList = jsonDataController.GetJsonData_SubjectAreaList();
                school.YearList    = jsonDataController.GetJsonData_YearGroupList();
                school.type        = bookType;

                return(PartialView(CONSTVALUE.PARTIAL_VIEW_SCHOOL_FOLDER + "_SchoolVisit.cshtml", school));
            }
            else if (bookType.Equals(TOURCATEGORY.ADULT))
            {
                AdultModel adult = new AdultModel();
                adult.type        = bookType;
                adult.ProgramList = jsonDataController.GetJsonData_EventNameList(TOURCATEGORY.ADULT);
                return(PartialView(CONSTVALUE.PARTIAL_VIEW_ADULT_FOLDER + "_AdultVisit.cshtml", adult));
            }
            else if (bookType.Equals(TOURCATEGORY.UNIVERSITY))
            {
                UniversityModel uni = new UniversityModel();
                uni.type        = bookType;
                uni.ProgramList = jsonDataController.GetJsonData_EventNameList(TOURCATEGORY.UNIVERSITY);
                return(PartialView(CONSTVALUE.PARTIAL_VIEW_UNIVERSITY_FOLDER + "_UniVisit.cshtml", uni));
            }
            // Return page not found
            return(null);
        }
示例#17
0
        public HttpResponseMessage PostSchool(School schoolEntity)
        {
            if (schoolEntity == null || schoolEntity.Name == null || schoolEntity.Location == null)
            {
                var errResponse =
                    this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "The school is invalid");

                return(errResponse);
            }

            try
            {
                var entity = this.schoolRepository.Add(schoolEntity);

                var response = this.Request.CreateResponse(
                    HttpStatusCode.Created, SchoolModel.CreateFromSchoolEntity(schoolEntity));
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = entity.SchoolId }));

                return(response);
            }
            catch (DbUpdateConcurrencyException)
            {
                var errResponse = this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError,
                                                                   "The school could not be added because of a concurrency problem");
                return(errResponse);
            }
        }
示例#18
0
        public JsonResult IsSchoolName_Available(SchoolModel schoolModel)
        {
            int id;

            int.TryParse(schoolModel.SchoolId, out id);
            if (!_repository.SchoolNameExists(schoolModel.Name, id))
            {
                return(Json(true));
            }

            string suggestedUID = String.Format(CultureInfo.InvariantCulture,
                                                "{0} is not available.", schoolModel.Name);

            for (int i = 1; i < 100; i++)
            {
                string altCandidate = schoolModel.Name + i.ToString();
                if (!_repository.SchoolNameExists(altCandidate, id))
                {
                    suggestedUID = String.Format(CultureInfo.InvariantCulture,
                                                 "{0} is not available. Try {1}.", schoolModel.Name, altCandidate);
                    break;
                }
            }
            return(Json(suggestedUID));
        }
 public SchoolModel InsertOrUpdate(SchoolModel schoolModel)
 {
     if (schoolModel.Id > 0)
     {
         var find = dbcontext.Schools.Find(schoolModel.Id);
         if (find != null)
         {
             var mappedSchool = mapper.Map <SchoolModel, SchoolInfo>(schoolModel, find);
             dbcontext.Schools.Update(mappedSchool);
             dbcontext.SaveChanges();
             return(schoolModel);
         }
         else
         {
             return(null);
         }
     }
     else
     {
         var mappedApplication = mapper.Map <SchoolInfo>(schoolModel);
         dbcontext.Schools.Add(mappedApplication);
         dbcontext.SaveChanges();
         return(schoolModel);
     }
 }
示例#20
0
        public List <SchoolModel> checkSchool(string City, int IdDance)
        {
            List <SchoolEntity> lee = ((SchoolRepository)_schoolRepository).getAllSchoolsByCriteria(City, IdDance);

            if (lee != null)
            {
                List <SchoolModel> lem = new List <SchoolModel>();
                foreach (SchoolEntity item in lee)
                {
                    SchoolModel sm = new SchoolModel();
                    sm.Name         = item.Name; //Nom de l'ecole
                    sm.Website      = item.Website;
                    sm.NameLocation = item.NameLocation;
                    sm.Number       = item.Number;
                    sm.Street       = item.Street;
                    sm.City         = item.City;
                    sm.Country      = item.Country;
                    sm.Department   = item.Department;
                    sm.Postalcode   = item.Postalcode;
                    sm.LinkGoogle   = item.LinkGoogle;
                    lem.Add(sm);
                }

                return(lem);
            }
            else
            {
                return(null);
            }
        }
        public ActionResult Edit(int?id)
        {
            if (!Request.IsAuthenticated || HttpContext.Session["userLoggedIn"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            School school = db.Schools.Find(id);

            if (school == null)
            {
                return(HttpNotFound());
            }
            SchoolModel schoolModel = new SchoolModel();

            schoolModel.School_id = school.School_id;
            schoolModel.Name      = school.Name;
            schoolModel.Address   = school.Address;
            schoolModel.Phone     = school.Phone;
            schoolModel.Contact   = school.Contact;
            return(View(schoolModel));
        }
        public void TestAddCorrectSchool()
        {
            bool isItemAdded = false;
            var  repository  = Mock.Create <IRepository <School> >();

            var schoolModel = new SchoolModel()
            {
                Name     = "PMG",
                Location = "Sofia"
            };
            var schoolEntity = new School()
            {
                Id       = 1,
                Name     = schoolModel.Name,
                Location = schoolModel.Location
            };

            Mock.Arrange(() => repository.Add(Arg.IsAny <School>()))
            .DoInstead(() => isItemAdded = true)
            .Returns(schoolEntity);

            var controller = new SchoolController(repository);

            SetupController.Create(controller, "post", "school");

            var result = controller.PostSchool(schoolEntity);

            Assert.IsTrue(result.IsSuccessStatusCode);
            Assert.IsTrue(isItemAdded);
        }
示例#23
0
        public Teacher ShowTeacherRecord(int id)
        {
            TeacherModel teacherModel = _schoolManagementDbContext.teachers.Find(id);

            Teacher teacher = new Teacher();

            teacher.TeacherId = teacherModel.TeacherId;
            teacher.Name      = teacherModel.Name;
            teacher.SubjectId = teacherModel.SubjectId;
            teacher.SchoolId  = teacherModel.SchoolId;

            SchoolModel schoolModel = _schoolManagementDbContext.schools.Find(teacherModel.SchoolId);

            teacher.school          = new School();
            teacher.school.SchoolId = schoolModel.SchoolId;
            teacher.school.Name     = schoolModel.Name;
            teacher.school.Address  = schoolModel.Address;

            SubjectModel subjectModel = _schoolManagementDbContext.subjects.Find(teacherModel.SubjectId);

            teacher.subject             = new Subject();
            teacher.subject.SubjectId   = subjectModel.SubjectId;
            teacher.subject.SubjectName = subjectModel.SubjectName;

            return(teacher);
        }
示例#24
0
        public List <Teacher> ShowTeachers()
        {
            List <TeacherModel> teacherModels = _schoolManagementDbContext.teachers.ToList();

            List <Teacher> teachers = new List <Teacher>();

            foreach (var item in teacherModels)
            {
                Teacher teacher = new Teacher();

                teacher.TeacherId = item.TeacherId;
                teacher.Name      = item.Name;
                teacher.SubjectId = item.SubjectId;
                teacher.SchoolId  = item.SchoolId;

                SchoolModel schoolModel = _schoolManagementDbContext.schools.Find(item.SchoolId);
                teacher.school          = new School();
                teacher.school.SchoolId = schoolModel.SchoolId;
                teacher.school.Name     = schoolModel.Name;
                teacher.school.Address  = schoolModel.Address;

                SubjectModel subjectModel = _schoolManagementDbContext.subjects.Find(item.SubjectId);
                teacher.subject             = new Subject();
                teacher.subject.SubjectId   = subjectModel.SubjectId;
                teacher.subject.SubjectName = subjectModel.SubjectName;

                teachers.Add(teacher);
            }

            return(teachers);
        }
示例#25
0
        public string GetSchoolByEMISNo(string emisNo)
        {
            string results          = string.Empty;
            JavaScriptSerializer js = new JavaScriptSerializer();

            try
            {
                UserVerificationRepository _repo = new UserVerificationRepository();
                SchoolModel data = _repo.GetSchoolByEMISNo(emisNo);

                if (data != null)
                {
                    if (data.IsSurveySubmitted)
                    {
                        throw new Exception("Survey Already Submitted to the GDE.");
                    }

                    //  string encryptedData = HttpContext.Current.Server.UrlEncode(EncryptionHelper.EncryptData(data.ID.ToString()));

                    string encryptedData = CryptorEngine.Encrypt(data.ID.ToString());

                    results = js.Serialize(new { School = data, Data = encryptedData });
                }
            }
            catch (Exception ex)
            {
                results = js.Serialize(string.Format("Error - {0}", ex.Message));
            }

            return(results);
        }
        public JsonResult GetAllSchoolByUserPermission(int id)
        {
            List <SchoolModel> schoolVMList = new List <SchoolModel>();

            int userId            = UserSession.GetUserIdFromSession();
            var userPermissionObj = this.userPermissionService.GetUserPermissionByUserId(userId).Where(x => x.UpazilaId == id || x.UpazilaId == 0);
            var schoolAll         = userPermissionObj.Where(x => x.SchoolId == 0);
            IEnumerable <School> schoolListObj = null;

            if (schoolAll.Count() > 0)
            {
                schoolListObj = schoolService.GetAllSchool().Where(x => x.UpazilaId == id);
            }
            else
            {
                var schoolIds = userPermissionObj.Select(x => x.SchoolId);
                schoolListObj = schoolService.GetAllSchool().Where(x => schoolIds.Contains(x.Id));
            }

            foreach (var school in schoolListObj.Where(x => x.IsActive == true && x.Id > 0))
            {
                SchoolModel schoolTemp = new SchoolModel();
                schoolTemp.Id   = school.Id;
                schoolTemp.Name = school.Name;

                schoolVMList.Add(schoolTemp);
            }

            return(Json(schoolVMList, JsonRequestBehavior.AllowGet));
        }
示例#27
0
        public SchoolModel GetSchoolBasicInfo(long schoolInfoId)
        {
            SchoolModel schoolModel = new SchoolModel();

            try
            {
                if (schoolInfoId > 0)
                {
                    schoolModel = _schoolService.GetSchoolBasicInfoById(schoolInfoId);
                    //if (schoolModel != null && !string.IsNullOrEmpty(schoolModel.SchoolBasicInfoModel.SchoolTypeIds))
                    //{
                    //    var intArr = (schoolModel.SchoolBasicInfoModel.SchoolTypeIds.Split('|'));
                    //    schoolModel.SchoolBasicInfoModel.SchoolTypeIdList = intArr.Select(c => int.Parse(c)).ToList();
                    //}
                }
                else
                {
                    throw new Exception("SchoolInfoId is required!!");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(schoolModel);
        }
示例#28
0
        public void CreateNewSchoolModel(SchoolModel school)
        {
            var schoolRecord = Services.ContentService.CreateContent("Creating another booking for " + school.SchoolName, school.MainBookingID, "School");

            Services.ContentService.SaveAndPublishWithStatus(schoolRecord);
            school.Id = schoolRecord.Id;

            schoolRecord.SetValue("recordId", school.Id);
            schoolRecord.SetValue("mainBookingID", school.MainBookingID);
            schoolRecord.SetValue("schoolSerialNumber", school.SerialNumber);
            schoolRecord.SetValue("nameOfSchool", school.SchoolName);
            schoolRecord.SetValue("year", school.Year);
            schoolRecord.SetValue("preferredDateSchool", school.PreferredDate);
            schoolRecord.SetValue("subjectArea", school.SubjectArea);
            schoolRecord.SetValue("numberOfStudents", school.StudentsNumber);
            schoolRecord.SetValue("numberOfStaff", school.StaffNumber);

            schoolRecord.SetValue("groupCoordinatorSerialNumber", school.Event.GroupCoordinator.SerialNumber);
            schoolRecord.SetValue("title", school.Event.GroupCoordinator.Title);
            schoolRecord.SetValue("firstName", school.Event.GroupCoordinator.FirstName);
            schoolRecord.SetValue("surename", school.Event.GroupCoordinator.SureName);
            schoolRecord.SetValue("email", school.Event.GroupCoordinator.Email);
            schoolRecord.SetValue("mobile", school.Event.GroupCoordinator.Mobile);
            schoolRecord.SetValue("daytimeNumber", school.Event.GroupCoordinator.DaytimeNumber);

            schoolRecord.SetValue("invoiceeSerialNumber", school.Event.Invoice.SerialNumber);
            schoolRecord.SetValue("invoiceTitle", school.Event.Invoice.Title);
            schoolRecord.SetValue("invoiceFirstName", school.Event.Invoice.FirstName);
            schoolRecord.SetValue("invoiceSurename", school.Event.Invoice.SureName);
            schoolRecord.SetValue("invoiceEmail", school.Event.Invoice.Email);
            Services.ContentService.Save(schoolRecord);
        }
示例#29
0
        public bool Update(SchoolModel entity)
        {
            try
            {
                var currentEntity = _dbContext.Set <SchoolModel>().AsQueryable().FirstOrDefault(x => x.SchoolId == entity.SchoolId);
                if (currentEntity == null)
                {
                    return(false);
                }

                currentEntity.SchoolName      = entity.SchoolName;
                currentEntity.SchoolAddress1  = entity.SchoolAddress1;
                currentEntity.SchoolAddress2  = entity.SchoolAddress2;
                currentEntity.SchoolWebsite   = entity.SchoolWebsite;
                currentEntity.SchoolPostCode  = entity.SchoolPostCode;
                currentEntity.SchoolTelephone = entity.SchoolTelephone;

                if (entity.ImageFileUrl != null)
                {
                    currentEntity.ImageFileUrl.Url = entity.ImageFileUrl.Url;
                }

                return(true);
            }
            catch (Exception ex)
            {
                LogException(ex);
                throw ex;
            }
        }
示例#30
0
        private void EditSchoolForm_Load(object sender, EventArgs e)
        {
            // load town combobox
            TownComboBox.DataSource    = managingSchoolService.GetAllTown();
            TownComboBox.DisplayMember = "TownName";
            TownComboBox.ValueMember   = "Id";

            // load village combobox
            VillageComboBox.DataSource    = managingSchoolService.GetAllVillageByTownId(int.Parse(TownComboBox.SelectedValue.ToString()));
            VillageComboBox.DisplayMember = "VillageName";
            VillageComboBox.ValueMember   = "Id";

            // load blankCerttype
            BlankCertTypeComboBox.DataSource    = managingBlankCertTypeService.GetAllBlankCertType();
            BlankCertTypeComboBox.DisplayMember = "Name";
            BlankCertTypeComboBox.ValueMember   = "Id";

            SchoolModel schoolModel = managingSchoolService.GetSingleSchoolById(_schoolId);

            SchoolNameTextBox.Text              = schoolModel.SchoolName;
            AddressTextBox.Text                 = schoolModel.Address;
            PhoneNumberTextBox.Text             = schoolModel.PhoneNumber;
            FaxTextBox.Text                     = schoolModel.Fax;
            Representative.Text                 = schoolModel.Representative;
            ProvinceTextBox.Text                = schoolModel.Province;
            NoteRichTextBox.Text                = schoolModel.Note;
            TownComboBox.SelectedValue          = schoolModel.TownId;
            VillageComboBox.SelectedValue       = schoolModel.VillageId;
            BlankCertTypeComboBox.SelectedValue = schoolModel.BlankCertTypeId;
        }
示例#31
0
        //public static ResourceManager language;
        static void Main(string[] args)
        {
            //ResourceManager rm = new ResourceManager("English.resx", Assembly.GetExecutingAssembly()); // learn what this is - reflection

            Console.WriteLine(Language.welcome_message);

            SchoolModel school = new SchoolModel();
            SchoolController schoolController = new SchoolController(school);

            /* ROOT OF ALL MENU */
            MenuItem generate = new MenuItem(Language.generate_students_teachers_and_classes, null, null);
            MenuItem show     = new MenuItem(Language.show, null, null);
            MenuItem actions = new MenuItem(Language.actions, null, null);
            MenuItem[] rootItems = { generate,show, actions };
            MenuCollection root = new MenuCollection(rootItems, null);

            /* Generate Methods for generate */
            MenuItem generateTeachers = new MenuItem(Language.generate_teachers,null, () => { schoolController.generateTeachersToQueue();});
            MenuItem generateStudents = new MenuItem(Language.generate_students, null, () => { schoolController.generateStudentsToQueue(); });
            MenuItem execute = new MenuItem(Language.execute,null, () => { schoolController.execute();});
            MenuItem[] generateMenuItems = {generateTeachers, generateStudents, execute};
            MenuCollection generateStudentTeachersAndClasses = new MenuCollection(generateMenuItems,root); // yet null, we need construct it

            /* Generate Methods for show */
            MenuItem showAllClasses = new MenuItem(Language._class, null, schoolController.showAllClasses);
            MenuItem showAllTeachers = new MenuItem(Language.teachers , null, schoolController.showAllTeachers);
            MenuItem showAllStudents = new MenuItem(Language.students, null, schoolController.showAllStudents);
            MenuItem showAllStudentsSortedByName = new MenuItem(Language.all_teachers_by_name, null, schoolController.showAllStudentsSortedByFirstName);
            MenuItem showAllTeachersRegex = new MenuItem(Language.show_all_teachers_matching_regex, null, schoolController.searchThroughTeachersRegex);

            MenuItem[] presentation = { showAllClasses, showAllTeachers, showAllStudents, showAllStudentsSortedByName, showAllTeachersRegex };
            MenuCollection showMenuCollection = new MenuCollection(presentation, root);

            /* Generate Methods for action */

            /*MenuItem addClass = new MenuItem(Language,addClass, null, schoolController.hireTEacher);
            MenuItem removeClass = new MenuItem(Language.remove_class, null, schoolController.hireTEacher);
            */

            MenuItem addTeacher = new MenuItem(Language.hire_teacher, null, schoolController.hireTeacher);
            MenuItem layOffTeacher = new MenuItem(Language.lay_off_teacher, null, schoolController.laOffTeacher);

            /*
            MenuItem addStudent = new MenuItem(Language.admit_student, null, schoolController.deleteTeacher);
            MenuItem layOffStudent = new MenuItem(Language.lay_off_student, null, schoolController.deleteTeacher);
            */
            MenuItem[] actionsMenuItems = { addTeacher, layOffTeacher };
            MenuCollection actionsMenuCollection = new MenuCollection(actionsMenuItems, root);  // ASK ABOUT STYLE   mainMenu actions  --or-- mainMenu actionsMainMenu

            generate.subMenu = generateStudentTeachersAndClasses;  // link rootITEM to the sub menu...
            show.subMenu = showMenuCollection;
            actions.subMenu = actionsMenuCollection;

            MenuCollectionController mCC = new MenuCollectionController(root);
            mCC.interact();
        }
示例#32
0
 protected override void ExecuteTest()
 {
     service = new SchoolService(schoolInformationRepository);
     actualModel = service.Get(new SchoolRequest() { SchoolId = schoolId0 });
 }
        protected void bindData()
        {
            //strDateFrom = (String)ViewState["DateFrom"];
            //strDateTo = (String)ViewState["DateTo"];
            strDateFrom = drpDateFrom.SelectedItem.Text.ToString();
            strDateTo=drpDateTo.SelectedItem.Text.ToString();
            var schoolList = new List<int>();
            strSQL = "select sum(views) as 'Views',sum(visits) as 'Logins',County_Name as 'CountyName',CountyID,'" + strDateFrom + "' as 'DF','" + strDateTo + "' as 'DT' from Con_ViewUsage  where ConSysID=" + ConSysID;
            if ((strDateFrom != "") && (strDateTo != "") && (strDateFrom != null) && (strDateTo != null))
            { strSQL += " and Month>='" + strDateFrom + "' and Month<'" + strDateTo + "' "; }
            strSQL += " group by County_Name,CountyID";
            dtViewsPerCounty = CCLib.Common.DataAccess.GetDataTable(strSQL);
            strSQL2 = "select sum(views) as 'Views',sum(visits) as 'Logins',County_Name as 'CountyName',CountyID,'" + strDateFrom + "' as 'DF','" + strDateTo + "' as 'DT',SchoolID from Con_ViewUsage  where ConSysID=" + ConSysID;
            strSQL2 += " group by County_Name,CountyID,SchoolID";
            dtViewsPerCounty2 = CCLib.Common.DataAccess.GetDataTable(strSQL2);

            string distinctSchoolGroup = string.Empty;
            string strDistinctSchoolSql = "select distinct(SchoolID),CountyID,County_Name as CountyName,'" + strDateFrom + "' as 'DF','" + strDateTo + "' as 'DT' from Con_ViewUsage where consysid=" + ConSysID;
            if ((strDateFrom != "") && (strDateTo != "") && (strDateFrom != null) && (strDateTo != null))
            { strDistinctSchoolSql += " and Month>='" + strDateFrom + "' and Month<'" + strDateTo + "' "; }

            var dtDistinctSchool = CCLib.Common.DataAccess.GetDataTable(strDistinctSchoolSql);
            for(var i=0;i<dtDistinctSchool.Rows.Count;i++)
            {
                schoolList.Add(int.Parse(dtDistinctSchool.Rows[i]["SchoolID"].ToString()));
                distinctSchoolGroup += dtDistinctSchool.Rows[i]["SchoolID"] + "&ids=";
            }
            if(distinctSchoolGroup !="")
            { distinctSchoolGroup = distinctSchoolGroup.Substring(0, distinctSchoolGroup.Length -5);}

            var usageStatsForSchoolGroup = new List<UsageStatsModel>();
            var value = new AuthenticationHeaderValue("AuthKey", ConfigurationManager.AppSettings["AuthKey"]);
            var cachekey = RemoteCacheProvider.Instance.CreateKey("GetUsagesForGroupOfSchoolsNA",
                                                                  ConSysID, strDateFrom, strDateTo,schoolList.Count);
            var model = new SchoolModel();
            model.SchoolIds = schoolList;
            model.Consysid = int.Parse(ConSysID);
            model.TempTableName = "TempSchoolListNA";
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(ConfigurationManager.AppSettings["UriPath"]);
                client.DefaultRequestHeaders.Authorization = value;
                var response2 = client.PostAsJsonAsync("api/usagestats/SchoolList", model).Result;

                if (response2.IsSuccessStatusCode)
                {
                    var cachedData = RemoteCacheProvider.Instance.GetCache<UsageStatsModel>(cachekey);
                    if (cachedData == null)
                    {

                        var response =
                            client.GetAsync("api/usagestats/GetUsagesForGroupOfSchoolsNA?consysid=" +
                                            ConSysID + "&startdate=" + strDateFrom + "&enddate=" +
                                            strDateTo).Result;
                        if (response.IsSuccessStatusCode)
                        {
                            Task<string> data = response.Content.ReadAsStringAsync();
                            usageStatsForSchoolGroup =
                                (JsonConvert.DeserializeObject<List<UsageStatsModel>>(data.Result));
                            if (usageStatsForSchoolGroup.Count > 0)
                            {
                                RemoteCacheProvider.Instance.AddToCache<List<UsageStatsModel>>(cachekey,
                                                                                               usageStatsForSchoolGroup);
                            }
                        }
                    }
                    else
                    {
                        usageStatsForSchoolGroup = cachedData;
                    }

                }
            }
            DataColumn[] keyColumns = new DataColumn[1];
            keyColumns[0] = dtViewsPerCounty2.Columns["SchoolID"];
            dtViewsPerCounty2.PrimaryKey = keyColumns;
            if (usageStatsForSchoolGroup != null)
            {
                foreach (var item in usageStatsForSchoolGroup)
                {
                    var dr = dtViewsPerCounty2.Select("SchoolID ='" + item.SchoolID + "'");
                    if (dr != null)
                    {
                        item.CountyID =
                            int.Parse(dr[0]["CountyID"].ToString());
                        item.CountyName = dr[0]["CountyName"].ToString();
                    }
                }
            }
            for (var i = 0; i < dtViewsPerCounty.Rows.Count; i++)
            {
                var item = new UsageStatsModel();
                if (usageStatsForSchoolGroup != null && usageStatsForSchoolGroup.Count > 0)
                {
                    item = usageStatsForSchoolGroup.Find(a => a.CountyID.ToString().Equals(dtViewsPerCounty.Rows[i]["CountyID"].ToString()));
                }
                if (item != null)
                {
                    dtViewsPerCounty.Rows[i]["Views"] = int.Parse(dtViewsPerCounty.Rows[i]["Views"].ToString()) +
                                                        item.Views;
                    //dtViewsPerCounty.Rows[i]["Logins"] = int.Parse(dtViewsPerCounty.Rows[i]["Logins"].ToString()) +
                    //                                     item.Logins;
                    dtViewsPerCounty.Rows[i]["Logins"] = int.Parse(dtViewsPerCounty.Rows[i]["Logins"].ToString());
                    dtViewsPerCounty.AcceptChanges();
                }
            }

            if (dtViewsPerCounty.Rows.Count == 0)
            {
                if (usageStatsForSchoolGroup != null && usageStatsForSchoolGroup.Count != 0)
                {
                    foreach (var item in usageStatsForSchoolGroup)
                    {
                        var dr = dtDistinctSchool.Select("SchoolID ='" + item.SchoolID + "'");
                        if (dr != null)
                        {
                            item.CountyName = dr[0]["CountyName"].ToString();
                            item.CountyID = int.Parse(dr[0]["CountyID"].ToString());
                            item.DF =dr[0]["DF"].ToString();
                            item.DT = dr[0]["DT"].ToString();
                        }
                    }
                }
                gvCounties.DataSource = usageStatsForSchoolGroup;
                gvCounties.DataBind();
            }
            else
            {
                gvCounties.DataSource = dtViewsPerCounty;
                gvCounties.DataBind();
            }
            totalSumViews = 0;
            totalSumLogins = 0;
            for (int i = 0; i < dtViewsPerCounty.Rows.Count; i++)
            {
                totalSumViews += int.Parse(dtViewsPerCounty.Rows[i]["Views"].ToString());
                totalSumLogins += int.Parse(dtViewsPerCounty.Rows[i]["Logins"].ToString());
            }
            //strSQL = "select sum(views) as 'allViews',sum(visits) as 'allLogins' from Con_ViewUsage where ConSysID=" + ConSysID;
            //if ((strDateFrom != "") && (strDateTo != "") && (strDateFrom != null) && (strDateTo != null))
            //{ strSQL += " and Month>='" + strDateFrom + "' and Month<'" + strDateTo + "' "; }

            //dtTotalViews = CCLib.Common.DataAccess.GetDataTable(strSQL);
        }
示例#34
0
 public SchoolController(SchoolModel school)
 {
     this.school = school;
 }