public Rules(Plan selectedPlan) { InitializeComponent(); _selectedPlan = selectedPlan; FillGrid(); FillDdlSubjectType(); FillDdlSemester(); FillDdlSubject(); }
public Subjects(Plan plan) { InitializeComponent(); lblDepartament.Text = plan.Departament.Name; lblFaculty.Text = plan.Faculty.Name; this.plan = plan; FillWithInstitutes(); FillWithSemesters(); FillWithSubjectTypes(); FillWithSpecializations(); ShowButtonsToolTips(); }
public EditSubject(Plan plan, SubjectEdit subject) { InitializeComponent(); this.plan = plan; this.subject = subject; lblDepartament.Text = plan.Departament.Name; lblFaculty.Text = plan.Faculty.Name; FillWithInstitutes(); FillWithSemesters(); FillWithSubjectTypes(); FillWithSpecializations(); tbSubjectName.Text = subject.Name; cbInstitute.SelectedItem.Value = subject.Institute; Semester sem = SemesterController.Instance.GetSemester(subject.SemesterId); cbSemester.SelectedItem.Value = sem == null ? "B³¹d" : sem.Name; seEcts.Value = Convert.ToDecimal(subject.Ects); ckbxExam.Checked = subject.IsExam; foreach (NewSubjectTypeData nst in subject.SubjectTypes) { SubjectType st = SubjectTypeController.Instance.GetSubjectType(nst.SubjectTypeId); for (int i = 0; i < dgSubjectTypes.Rows.Count; i++) { if (dgSubjectTypes.Rows[i].Cells["subjectType"].Value.ToString().Equals(st.Name)) dgSubjectTypes.Rows[i].Cells["hours"].Value = nst.Hours.ToString(); } } if (subject.Specializations != null) { foreach (SpecializationDataEdit sde in subject.Specializations) { Specialization s = SpecializationController.Instance.GetSpecialization(sde.SpecializationId); dgSpecializations.Rows.Add(s.Name, sde.IsGenereal, sde.IsElective); if(sde.IsGenereal) dgSpecializations.Rows[dgSpecializations.Rows.Count - 1].Cells["elective"].ReadOnly = true; } } else dgSpecializations.Enabled = false; cbElective.Checked = subject.IsElective; cbGeneral.Checked = subject.IsGeneral; ShowButtonsToolTips(); }
public PlanInfo(Plan plan) { InitializeComponent(); lblName.Text = plan.Name; lblFaculty.Text = plan.Faculty.Name; lblDepartament.Text = plan.Departament.Name; lblSemStart.Text = plan.SemesterStart.HasValue ? plan.SemesterStart.Value.ToString() : ""; lblSemEnd.Text = plan.SemesterEnd.HasValue ? plan.SemesterEnd.Value.ToString() : ""; lblYearStart.Text = plan.YearStart.HasValue ? plan.YearStart.Value.Year.ToString() : ""; lblYearEnd.Text = plan.YearEnd.HasValue ? plan.YearEnd.Value.Year.ToString() : ""; lblMandatory.Text = plan.IsMandatory ? "Tak" : "Nie"; lblArchieved.Text = plan.IsArchiewed ? "Tak" : "Nie"; tbReview.Text = plan.Review; ShowButtonsToolTips(); }
public PlanEdit(Plan plan) { InitializeComponent(); this.LoadedPlan = plan; lblDepartament.Text = LoadedPlan.Departament.Name; lblFaculty.Text = LoadedPlan.Faculty.Name; lblName.Text = LoadedPlan.Name; tbReview.Text = LoadedPlan.Review; cbMandatory.Checked = LoadedPlan.IsMandatory; CheckMandatory(LoadedPlan.IsMandatory); FillWithYears(LoadedPlan.YearStart.HasValue? LoadedPlan.YearStart.Value.Year : 0, LoadedPlan.YearEnd.HasValue? LoadedPlan.YearEnd.Value.Year : 0); ShowButtonsToolTips(); }
public void AddPlan(NewPlan plan) { if (plan != null) { Plan toAdd = new Plan() { DepartamentID = plan.DepartamentId, FacultyID = plan.FacultyId, IsMandatory = false, Name = plan.Name, SemesterEnd = plan.SemesterEnd, SemesterStart = plan.SemesterStart, StudiesTypeID = plan.StudiesTypeId, LastEditUserID = plan.LastEditedUserId }; SPDatabase.DB.Plans.AddObject(toAdd); SPDatabase.DB.SaveChanges(); } }
private void btnAddPlan_Click(object sender, EventArgs e) { lblValidation.Text = string.Empty; int departamentId = 0; Departament dep = null; if (cbDepartament.Items.Count > 0) dep = DepartamentController.Instance.GetDepartament(cbDepartament.SelectedItem.ToString()); if(dep != null) departamentId = dep.DepartamentID; int facultyId = 0; Faculty fac = null; if(cbFaculty.Items.Count > 0) fac = FacultyController.Instance.GetFaculty(cbFaculty.SelectedItem.ToString()); if (fac != null) facultyId = fac.FacultyID; int studiesTypeId = 0; StudiesType st = null; if (cbStudiesType.Items.Count > 0) st = StudiesTypeController.Instance.GetStudiesType(cbStudiesType.SelectedItem.ToString()); if (st != null) studiesTypeId = st.StudiesTypeID; int semStart = 0; int semEnd = 0; int.TryParse(tbSemStart.Text, out semStart); int.TryParse(tbSemEnd.Text, out semEnd); NewPlan plan = new NewPlan() { Name = tbPlanName.Text, // YearStart = tbYearStart.Value, // YearEnd = tbYearEnd.Value, DepartamentId = departamentId, FacultyId = facultyId, StudiesTypeId = studiesTypeId, SemesterStart = semStart, SemesterEnd = semEnd, LastEditedUserId = loggedUser.UserID }; if (PlanController.Instance.AddPlan(plan)) { RadMessageBox.Show("Plan zosta³ dodany", "Info", MessageBoxButtons.OK, RadMessageIcon.Info); added = true; addedPlan = PlanController.Instance.GetPlan(tbPlanName.Text); Clear(); this.Close(); } else { string msg = string.Empty; foreach (string error in plan.Errors) msg = msg + error + "\n"; lblValidation.Text = msg; } }
public void EditPlan(Plan plan) { if (plan != null) SPDatabase.DB.SaveChanges(); }
public XmlPlan(Plan plan) { LoadedPlan = plan; }
public ValidateRules(Plan selectedPlan) { InitializeComponent(); _selectedPlan = selectedPlan; fillGrid(); }
/// <summary> /// Deprecated Method for adding a new object to the Plans EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPlans(Plan plan) { base.AddObject("Plans", plan); }
/// <summary> /// Create a new Plan object. /// </summary> /// <param name="planID">Initial value of the PlanID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="isMandatory">Initial value of the IsMandatory property.</param> /// <param name="departamentID">Initial value of the DepartamentID property.</param> /// <param name="facultyID">Initial value of the FacultyID property.</param> /// <param name="studiesTypeID">Initial value of the StudiesTypeID property.</param> /// <param name="lastEditUserID">Initial value of the LastEditUserID property.</param> /// <param name="isArchiewed">Initial value of the IsArchiewed property.</param> public static Plan CreatePlan(global::System.Int32 planID, global::System.String name, global::System.Boolean isMandatory, global::System.Int32 departamentID, global::System.Int32 facultyID, global::System.Int32 studiesTypeID, global::System.Int32 lastEditUserID, global::System.Boolean isArchiewed) { Plan plan = new Plan(); plan.PlanID = planID; plan.Name = name; plan.IsMandatory = isMandatory; plan.DepartamentID = departamentID; plan.FacultyID = facultyID; plan.StudiesTypeID = studiesTypeID; plan.LastEditUserID = lastEditUserID; plan.IsArchiewed = isArchiewed; return plan; }
private void btnEditSubject_Click(object sender, EventArgs e) { if (LoadedPlan != null) { SubjectEdit ns = CreateSubjectEditFromGrid(); if (ns != null) { if (new EditSubject(LoadedPlan, ns).ShowDialog() == DialogResult.Yes) { LoadedPlan = PlanController.Instance.GetPlan(LoadedPlan.PlanID); LoadPlanToGrid(LoadedPlan, false); } } } }
private void btnDeleteSubject_Click(object sender, EventArgs e) { if (LoadedPlan != null) { SubjectEdit ns = CreateSubjectEditFromGrid(); if (SubjectController.Instance.DeleteSubject(ns)) { LoadedPlan = PlanController.Instance.GetPlan(LoadedPlan.PlanID); LoadPlanToGrid(LoadedPlan, false); } } }
private void LoadPlanToGrid(Plan LoadedPlan, bool archive) { RadGridView grid = null; if (!archive) grid = btnVerify; else grid = gridArchievePlan; if(!archive) lblPlanData.Text = "Plan: " + LoadedPlan.Name + " Wydzia³: " + LoadedPlan.Departament.Name + " Kierunek: " + LoadedPlan.Faculty.Name + " Studia: " + LoadedPlan.StudiesType.Name; else lblArchievedPlanData.Text = "Plan: " + LoadedPlan.Name + " Wydzia³: " + LoadedPlan.Departament.Name + " Kierunek: " + LoadedPlan.Faculty.Name + " Studia: " + LoadedPlan.StudiesType.Name; grid.Rows.Clear(); grid.EnableSorting = false; if (LoadedPlan.SubjectsDatas != null) { foreach (SubjectsData sd in LoadedPlan.SubjectsDatas) { grid.Rows.Add(null, null); grid.Rows[grid.Rows.Count - 1].Cells["subjectName"].Value = sd.Subject.Name; grid.Rows[grid.Rows.Count - 1].Cells["semester"].Value = sd.Semester.Name; grid.Rows[grid.Rows.Count - 1].Cells["ects"].Value = sd.Ects.ToString(); grid.Rows[grid.Rows.Count - 1].Cells["isExam"].Value = sd.IsExam; grid.Rows[grid.Rows.Count - 1].Cells["isGeneral"].Value = sd.IsGeneral; grid.Rows[grid.Rows.Count - 1].Cells["isElective"].Value = sd.IsElective; grid.Rows[grid.Rows.Count - 1].Cells["institute"].Value = sd.Institute == null ? "Brak" : sd.Institute.Name; if (sd.SpecializationDataID > 0) { string value = sd.SpecializationsData.Specialization.Name; if (sd.SpecializationsData.IsElective) value += " Obieralny"; else if (sd.SpecializationsData.IsGeneral) value += " Obowi¹zkowy"; grid.Rows[grid.Rows.Count - 1].Cells["specialization"].Value = value; } foreach (SubjectTypesData st in sd.SubjectTypesDatas) { grid.Rows[grid.Rows.Count - 1].Cells[st.SubjectType.Name].Value = st.Hours.ToString(); } } } grid.EnableSorting = true; }
public bool EditPlan(Plan LoadedPlan) { try { this.repository.EditPlan(LoadedPlan); return true; } catch (Exception) { return false; } }