// GET: /Instructor/
        public ActionResult Index(int?id, int?courseID)
        {
            var viewModel = new InstructorIndexDataViewModel();

            viewModel.Instructors = _instructorRepository.Get()
                                    .OrderBy(i => i.LastName)
                                    .Select(x => _mapper.Map <Instructor, InstructorViewModel>(x));

            if (id != null)
            {
                ViewBag.InstructorID = id.Value;
                viewModel.Courses    = viewModel
                                       .Instructors
                                       .Single(i => i.Id == id.Value)
                                       .Courses;
            }

            if (courseID != null)
            {
                ViewBag.CourseID = courseID.Value;
                var selectedCourse = viewModel.Courses.Single(x => x.Id == courseID);
                viewModel.Enrollments = selectedCourse.Enrollments;
            }

            return(View(viewModel));
        }
Example #2
0
 public InstructorDto Get(int id)
 {
     using (_instructorRepository)
     {
         return(_instructorRepository.Get(id).ConvertToInstructorDto());
     }
 }
 // add a course with courId to the course list of the instructor with InId
 public int AddCourseToInstructor(int InId, int courId)
 {
     using (TransactionScope tran = new TransactionScope()) {
         var ins    = Instructors.Get(InId);
         var course = Courses.Get(courId);
         if (ins == null || course == null)
         {
             tran.Complete();
             return(-1);
         }
         ins.Courses.Add(course);
         //Complete();
         tran.Complete();
         return(0);
     }
 }
        public Instructor Delete(int id)
        {
            Instructor Instructor = IInstructorRepository.Get(id);

            return(IInstructorRepository.Delete(Instructor));

            // trebuie sa sterg si din tabelele de legatura
            // deci facem controllere si pt songAlbum si artitAlbum
        }
Example #5
0
        private void BtnGenerate_Click(object sender, EventArgs e)
        {
            var info = _candidateRepository.Get(_info.FirstName, _info.LastName);

            if (info == null)
            {
                Helper.Logger.Error($"Podaci o kandidatu: {_info.FirstName} {_info.LastName} ne mogu biti nadjeni");
                MessageBox.Show($"Podaci o kandidatu: {_info.FirstName} {_info.LastName} ne mogu biti nadjeni");
                Close();

                return;
            }

            var exam = new ExamInfo
            {
                Id       = Guid.NewGuid().ToString("N"),
                Category = txtCategory.Text.Trim(),
                TakenOn  = dtpTakenOn.Value,
                IncludesTrafficRegulationsTest = chxIncludesTrafficRegulationTest.Checked,
                IncludesFirstAidTest           = chxIncludesFirstAidTest.Checked,
                IncludesDrivingTest            = chxIncludesDrivingTest.Checked,
                Day        = cbxExamDay.SelectedItem.ToString(),
                Location   = txtLocation.Text.Trim(),
                Instructor = _instructorRepository.Get(cbxInstructors.SelectedItem.ToString())
            };

            info.Exams.Add(exam);

            Helper.CreateExamForm(Helper.GetPdfTemplateLocation(), _info, exam);

            _candidateRepository.Update(info);


            SharedViewLogic.LoadCandidatesTree(_treeCandidates, _candidateRepository);

            var selectedNode = _treeCandidates.Nodes.Find(info.LastName.First().ToString(), false).FirstOrDefault();

            SharedViewLogic.LoadCandidatesGrid(_dgvCandidates, selectedNode?.Nodes ?? (IEnumerable)Enumerable.Empty <TreeNode>());
            SharedViewLogic.LoadExamHistory(info.Exams ?? Enumerable.Empty <ExamInfo>(), _dgvExamHistory);

            Close();
        }
        public void Put(int id, InstructorDTO value)
        {
            Instructor model = IInstructorRepository.Get(id);

            if (value.LastName != null)
            {
                model.LastName = value.LastName;
            }
            if (value.FirstName != null)
            {
                model.FirstName = value.FirstName;
            }

            IInstructorRepository.Update(model);

            //trebuie sa putem face update si la lista de instructori si sali de fitness

            //trebuie sa putem face update si la lista de artisti si cantece


            if (value.SpecializationId != null) // song -> specialization
            {
                IEnumerable <InstructorSpecialization> MyInstructorSpecializations = IInstructorSpecializationRepository.GetAll().Where(x => x.InstructorId == id);
                foreach (InstructorSpecialization MyInstructorSpecialization in MyInstructorSpecializations)
                {
                    IInstructorSpecializationRepository.Delete(MyInstructorSpecialization);
                }
                for (int i = 0; i < value.SpecializationId.Count; i++)
                {
                    InstructorSpecialization InstructorSpecialization = new InstructorSpecialization()
                    {
                        InstructorId     = model.Id,
                        SpecializationId = value.SpecializationId[i]
                    };
                    IInstructorSpecializationRepository.Create(InstructorSpecialization);
                }
            }
        }
        public InstructorDetailsDTO Get(int id)
        {
            Instructor           Instructor   = IInstructorRepository.Get(id);
            InstructorDetailsDTO MyInstructor = new InstructorDetailsDTO()
            {
                LastName  = Instructor.LastName,
                FirstName = Instructor.FirstName
            };

            IEnumerable <InstructorSpecialization> MyInstructorSpecializations = IInstructorSpecializationRepository.GetAll().Where(x => x.InstructorId == Instructor.Id);

            if (MyInstructorSpecializations != null)
            {
                List <string> SpecializationNameList = new List <string>();
                foreach (InstructorSpecialization MyInstructorSpecialization in MyInstructorSpecializations)
                {
                    Specialization MySpecialization = ISpecializationRepository.GetAll().SingleOrDefault(x => x.Id == MyInstructorSpecialization.SpecializationId);
                    SpecializationNameList.Add(MySpecialization.Name);
                }
                MyInstructor.SpecializationName = SpecializationNameList;
            }
            return(MyInstructor);
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strInstructorId = string.Empty;
                phWriteComment.Visible = false;

                strInstructorId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                if (GlobalMethods.ValueIsNull(strInstructorId).Length > 0)
                {
                    strInstructorId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                }

                #region Category Dropdown
                List <clsCategory> lstCategory = new List <clsCategory>();
                lstCategory = CategoryDAL.SelectDynamicCategory("(ACRDCategory = 'Instructor Accreditations')", "ACRDCatID");
                if (lstCategory != null)
                {
                    if (lstCategory.Count > 0)
                    {
                        dropInstructCategory.Items.Add(new ListItem(
                                                           String.Format("{0}", SQLHelper.TrimAndReplaceEOF("Select a Category")), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt("0".ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                        for (int i = 0; i < lstCategory.Count; i++)
                        {
                            dropInstructCategory.Items.Add(new ListItem(
                                                               String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].CatTitle.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].ACRDCatID.ToString()))));
                            // String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].CatTitle.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt(lstCategory[i].ACRDCatID.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                        }
                    }
                }
                #endregion


                #region Getting all the Comments by Application Id.
                StringBuilder strMessenger = new StringBuilder("");
                List <clsInstructor_Comment> lstComments = new List <clsInstructor_Comment>();
                lstComments = Instructor_CommentDAL.SelectDynamicInstructor_Comment("InstructorId = " + strInstructorId + "", "InstructorCommentId");
                if (lstComments != null)
                {
                    if (lstComments.Count > 0)
                    {
                        for (int i = 0; i < lstComments.Count; i++)
                        {
                            strMessenger.Append(GlobalMethods.Messenger(lstComments[i].CreatedBy.ToString(), Convert.ToDateTime(lstComments[i].CreatedDate).ToLongDateString(), lstComments[i].Comment.ToString()).ToString());
                        }
                    }
                }
                pnlComments.Controls.Add(new LiteralControl(strMessenger.ToString()));
                #endregion

                #region Checking if this is AssignedToMe Action
                bool IsAssignedToMe = false;

                var pendingApps = _instructorRepository.PendingApps();

                if (pendingApps.Select(x => x.Id).Contains(Convert.ToInt32(strInstructorId)))
                {
                    // Means this needs Assigned To Me button.
                    IsAssignedToMe         = true;
                    phWriteComment.Visible = false;
                }

                #endregion

                var obj = _instructorRepository.Get(int.Parse(strInstructorId));
                if (obj != null)
                {
                    lblContractorApp.Text = obj.Instructor_FName + " " + obj.Instructor_LName;
                    lblContactInfo.Text   = obj.TP_Contact_FName + " " + obj.TP_Contact_LName + " / " + obj.Instructor_Phone;

                    txtLName.Text                       = obj.Instructor_LName;
                    txtSuffix.Text                      = obj.Instructor_Suffix;
                    txtFName.Text                       = obj.Instructor_FName;
                    txtMName.Text                       = obj.Instructor_MName;
                    txtAddress_1.Text                   = obj.Instructor_Address_Line_1;
                    txtCity_1.Text                      = obj.Instructor_City;
                    txtState_1.Text                     = obj.Instructor_State;
                    txtZipCode_1.Text                   = obj.Instructor_ZipCode;
                    txtAddress_2.Text                   = obj.Instructor_Address_Line_2;
                    txtCity_2.Text                      = obj.Instructor_City_2;
                    txtState_2.Text                     = obj.Instructor_State_2;
                    txtZipcode_2.Text                   = obj.Instructor_ZipCode_2;
                    txtPhone.Text                       = obj.Instructor_Phone;
                    txtEmailAddress.Text                = obj.Instructor_Email;
                    txtDOB.Text                         = obj.Instructor_DOB.FromByteArray();
                    txtSSNO.Text                        = obj.Instructor_SSN.FromByteArray();
                    txtInstructTP.Text                  = obj.TP_Name;
                    txtInstructAcctNum.Text             = obj.TP_AcctNumber;
                    txtInstructContFN.Text              = obj.TP_Contact_FName;
                    txtInstructContLN.Text              = obj.TP_Contact_LName;
                    txtInstructContPhone.Text           = obj.TP_Telephone;
                    txtInstructContAddress.Text         = obj.TP_Address_Line_1;
                    txtInstructContCity.Text            = obj.TP_City;
                    txtInstructContState.Text           = obj.TP_State;
                    txtInstructContZipcode.Text         = obj.TP_ZipCode;
                    txtACCID.Text                       = obj.AccreditationID;
                    txtAccreditationExpirationDate.Text = obj.AccreditationExpirationDate.HasValue ? obj.AccreditationExpirationDate.Value.ToShortDateString() : "";
                    txtNewInitTrainingCard.Text         = obj.NewInitialTCard;
                    txtNewInitStartDate.Text            = obj.NewIT_StartDates.HasValue ? obj.NewIT_StartDates.Value.ToShortDateString() : "";
                    txtNewInitEndDate.Text              = obj.NewIT_EndDates.HasValue ? obj.NewIT_EndDates.Value.ToShortDateString() : "";
                    txtRenewalTrainingCard.Text         = obj.RenewalTCard;
                    txtRenewalStartDate.Text            = obj.RenewalLT_StartDates.HasValue ? obj.RenewalLT_StartDates.Value.ToShortDateString() : "";
                    txtRenewalEndDate.Text              = obj.RenewalLT_EndDates.HasValue ? obj.RenewalLT_EndDates.Value.ToShortDateString() : "";
                    if (obj.NewInstructors_URL != null)
                    {
                        var url = obj.NewInstructors_URL.Split('\\')[1];
                        lkuploadNewInstructors.Text        = url;
                        lkuploadNewInstructors.NavigateUrl = obj.NewInstructors_URL;
                    }
                    txtNewRenewAcctNum.Text        = obj.NewRenewal_InspecTech_AcctNumber;
                    txtNewRenewAcctExpireDate.Text = obj.NewRenewal_InspecTech_AcctExpiration;
                    if (obj.NewInspectorTechnInstructors_URL != null)
                    {
                        var url = obj.NewInspectorTechnInstructors_URL.Split('\\')[1];
                        lkuploadNewInspectorTech.Text        = url;
                        lkuploadNewInspectorTech.NavigateUrl = obj.NewInspectorTechnInstructors_URL;
                    }
                    chkIAgree.Checked                  = obj.Agreed == 1;
                    lblSignedBy.Text                   = obj.Instructor_FName + " " + obj.Instructor_LName;
                    lblDateSigned.Text                 = Convert.ToDateTime(obj.CreatedDate).ToLongDateString();
                    dropIsRenewal.SelectedValue        = obj.IsRenewal.ToString();
                    dropInstructCategory.SelectedValue = obj.ACRDCatID.ToString();

                    #region Getting all the Case files.
                    StringBuilder strMessengerUpload = new StringBuilder("");

                    foreach (var each in obj.Files.OrderByDescending(x => x.Id))
                    {
                        strMessengerUpload.Append(GlobalMethods.UploadedFiles(each.CreatedBy.ToString(), Convert.ToDateTime(each.CreatedDate).ToLongDateString(), each.FileLocation.ToString()).ToString());
                    }
                    pnlUploads.Controls.Add(new LiteralControl(strMessengerUpload.ToString()));
                    #endregion
                }

                string strEnContractId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(obj.Id.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                if (IsAssignedToMe)
                {
                    GlobalMethods.DisableControls(this.Page);
                    btnAddCourse.Visible = false;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-primary2 open-AssignedToMe' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Assigned to Me</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }
                else
                {
                    phWriteComment.Visible = true;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-success open-Approve' title='Approve Application' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Approve</a>&nbsp;<a class='btn btn-danger open-Disapprove' href='#' title='Reject Application' data-id='" + strEnContractId + "' data-toggle='modal' >Reject</a>&nbsp;<a class='btn btn-primary open-Hold' href='#' title='Put Application On Hold' data-id='" + strEnContractId + "' data-toggle='modal' >On Hold</a>&nbsp;<a class='btn btn-primary open-Deficient' href='#' title='Application status is Deficient' data-id='" + strEnContractId + "' data-toggle='modal' >Deficient</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "MDE_InstructorApps.aspx?InstructApps=active") + "</div>"));
                }

                #region Making all the fields disabled.
                GlobalMethods.DisableControl_CheckBoxByID(chkIAgree);
                GlobalMethods.DisableControl_DropDownByID(dropInstructCategory);
                GlobalMethods.DisableControl_DropDownByID(dropIsRenewal);
                #endregion
            }
        }
Example #9
0
 // GET: /Department/Create
 public ActionResult Create()
 {
     ViewBag.InstructorID = new SelectList(_instructorRepository.Get(), "Id", "FullName");
     return(View());
 }