public async Task <ActionResult> UpdateCollege(int id, [FromBody] CollegeForUpdateDto college) { if (college == null) { return(BadRequest()); } if (college.Description == college.Name) { ModelState.AddModelError("Description", "The provided description should be different from the name."); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Colleges oldCollegeEntity = await _studyRouteRepository.GetCollegeById(id, false); if (oldCollegeEntity == null) { return(NotFound()); } _mapper.Map(college, oldCollegeEntity); if (!await _studyRouteRepository.Save()) { return(StatusCode(500, "A problem happened while handling your request.")); } return(NoContent()); }
public async Task <ActionResult> DeleteCollege(int id) { if (!await _studyRouteRepository.CollegeExists(id)) { return(NotFound()); } Colleges collegeToDelete = await _studyRouteRepository.GetCollegeById(id, false); if (collegeToDelete == null) { return(NotFound()); } //foreach (var program in collegeToDelete.Programs) //{ // _studyRouteRepository.DeleteProgram(program); //} //collegeToDelete.Programs = new List<Programs>(); _studyRouteRepository.DeleteCollege(collegeToDelete); if (!await _studyRouteRepository.Save()) { return(StatusCode(500, "A problem happened while handling your request.")); } return(NoContent()); }
protected void UpdateCollege() { try { string Photo; Colleges colleges = new Colleges(); colleges.CollegeId = Convert.ToInt32(ddl_ModifyCollege.SelectedValue); colleges.CollegeName = txt_ModifyCollgeTitle.Text; colleges.CollegeEstablish = Convert.ToDateTime(txt_ModifyCollegeEstablish.Text); colleges.CollegeLocation = txt_ModifyCollgeAddress.Text; colleges.CollegeWebSite = txt_ModifyCollegeWebsite.Text; colleges.CollegeAbout = txt_ModifyCollegeAbout.Text; if (fu_ModifyCollegeLogo.HasFile) { string extension = Path.GetExtension(fu_ModifyCollegeLogo.FileName); Photo = "~/Files/Colleges/" + DateTime.Now.Ticks.ToString() + extension; fu_ModifyCollegeLogo.SaveAs(Server.MapPath(Photo)); colleges.CollegeLogo = Photo; } colleges.CollegeShow = cb_Modify.Checked; college = new College(); if (college.UpdateCollege(colleges) == true) { lbl_NewDepartment.Text = "Successful update New Department...."; } } catch (Exception ex) { lbl_NewDepartment.Text = ex.Message; } }
protected void SaveCollege() { try { Colleges colleges = new Colleges(); string Photo; if (fu_NewCollegeLogo.HasFile) { string extension = Path.GetExtension(fu_NewCollegeLogo.FileName); Photo = "~/Files/Colleges/" + DateTime.Now.Ticks.ToString() + extension; fu_NewCollegeLogo.SaveAs(Server.MapPath(Photo)); colleges.CollegeLogo = Photo; } colleges.CollegeName = txt_NewcollegeTitle.Text; colleges.CollegeEstablish = Convert.ToDateTime(txt_NewCollegeEstablish.Text); colleges.CollegeLocation = txt_NewCollegeAddress.Text; colleges.CollegeAbout = txt_NewCollegeAbout.Text; colleges.CollegeWebSite = txt_NewCollegeWebsite.Text; colleges.CollegeShow = cb_NewCollegeShow.Checked; College college = new College(); if (college.NewCollege(colleges) == true) { lbl_NewCollege.Text = "Successful saved ..."; } } catch (Exception ex) { lbl_NewCollege.Text = ex.Message; } }
/// <summary> /// 学院信息添加方法 /// </summary> /// <param name="t">实体</param> /// <returns>bool 是否添加成功true成功,false失败</returns> public bool Add(Colleges t) { try { return(sugar.Insertable <Colleges>(t).ExecuteCommand() > 0); } catch (Exception ex) { ErrorLog.WriteLog(ex); return(false); } }
private College ValidateParameters(string college, string degree, int semester) { if (Colleges.GetCollege(college) == null || Degrees.GetDegree(degree) == null) { if (semester != 1 || semester != 2 || semester != 3) { return(null); } } return(new College { Name = Colleges.GetCollege(college), Degree = Degrees.GetDegree(degree), Semester = semester, Session = "2017/2018" }); }
public List <Colleges> GetColleges() { List <Colleges> list = new List <Colleges>(); var parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@CollegeID", 0); DataSet ds = SqlHelper.FillDataSet(ConfigurationManager.RdConnectionString, "Get_Colleges", parameters); foreach (DataRow dr in ds.Tables[0].Rows) { Colleges model = new Colleges(); model.CollegeId = (int)dr["CollegeID"]; model.CollegeName = dr["CollegeName"].ToString(); list.Add(model); } return(list); }
protected void DeleteDepartment() { try { Colleges colleges = new Colleges(); colleges.DepartmentId = Convert.ToInt32(ddl_DeleteDept.SelectedValue); college = new College(); if (college.DeleteDepartment(colleges) == true) { lbl_ModifyField.Text = "Successful delete New Department...."; } } catch (Exception ex) { lbl_ModifyField.Text = ex.Message; } }
protected void DeleteField() { try { Colleges colleges = new Colleges(); colleges.FieldID = Convert.ToInt32(ddl_DeleteField.SelectedValue); college = new College(); if (college.DeleteField(colleges) == true) { lbl_DeleteField.Text = "Successful delete New Subject...."; } } catch (Exception ex) { lbl_DeleteField.Text = ex.Message; } }
async Task LoadItemsAsync() { try { IsBusy = true; //Eto na yung GetStringAsync natin sa HttpClient var colleges = await Client.GetTable <College>().ReadAsync(); Colleges.ReplaceRange(colleges); } catch (Exception ex) { await _pageDialog.DisplayAlertAsync("Error", ex.Message, "Ok"); } finally { IsBusy = false; } }
protected void UpdateField() { try { Colleges colleges = new Colleges(); colleges.FieldID = Convert.ToInt32(ddl_ModifyField.SelectedValue); colleges.FieldTitle = txt_ModifyFieldTitle.Text; colleges.FieldAbout = txt_ModifyFieldAbout.Text; college = new College(); if (college.UpdateField(colleges) == true) { lbl_ModifyField.Text = "Successful update New Field...."; } } catch (Exception ex) { lbl_ModifyField.Text = ex.Message; } }
protected void SaveDepartment() { try { Colleges colleges = new Colleges(); colleges.DepartmentName = txt_NewDepartmentTitle.Text; colleges.DepartmentAbout = txt_NewDepartmentAbout.Text; colleges.CollegeId = Convert.ToInt32(ddl_NewDepartmentCollege.SelectedValue); college = new College(); if (college.NewDepartment(colleges) == true) { lbl_NewDepartment.Text = "Successful saved New Department...."; } } catch (Exception ex) { lbl_NewDepartment.Text = ex.Message; } }
protected void UpdateDepartment() { try { Colleges colleges = new Colleges(); colleges.DepartmentId = Convert.ToInt32(ddl_ModufyDepartment.SelectedValue); colleges.DepartmentName = txt_ModifyDeptTitle.Text; colleges.DepartmentAbout = txt_ModifyDeptAbout.Text; college = new College(); if (college.UpdateDepartment(colleges) == true) { lbl_NewDepartment.Text = "Successful update New Department...."; } } catch (Exception ex) { lbl_NewDepartment.Text = ex.Message; } }
protected void SaveSubject() { try { Colleges colleges = new Colleges(); colleges.FieldTitle = txt_NewFieldTitle.Text; colleges.FieldAbout = txt_NewFieldAbout.Text; colleges.DepartmentId = Convert.ToInt32(ddl_NewFieldDepartment.SelectedValue); college = new College(); if (college.NewField(colleges) == true) { lbl_NewField.Text = "Successful saved New Department...."; } } catch (Exception ex) { lbl_NewField.Text = ex.Message; } }
public bool NewField(Colleges cg) { return(colleges.newfield(cg)); }
//----------------------------------------------------- //------ Update Colleges , Departments , Fields ------- public bool UpdateCollege(Colleges college) { return(colleges.updatecollege(college)); }
public bool UpdateDepartment(Colleges college) { return(colleges.updatedepartment(college)); }
public bool Add(Colleges model) { return(college_BLL.Add(model)); }
/// <summary> /// 学院信息修改方法 /// </summary> /// <param name="t">实体</param> /// <returns>bool 是否修改成功true成功,false失败</returns> public bool Update(Colleges m) { return(college_DAL.Update(m)); }
public void DeleteCollege(Colleges college) { _context.Colleges.Remove(college); }
public async Task AddCollege(Colleges college) { await _context.Colleges.AddAsync(college); }
//-----------Delete public bool DeleteCollege(Colleges college) { return(colleges.deletecollege(college)); }
public bool NewDepartment(Colleges cg) { return(colleges.newdepartment(cg)); }
public bool DeleteDepartment(Colleges college) { return(colleges.deletedepartment(college)); }
public bool DeleteField(Colleges college) { return(colleges.deletefield(college)); }
/// <summary> /// 学院信息添加方法 /// </summary> /// <param name="t">实体</param> /// <returns>bool 是否添加成功true成功,false失败</returns> public bool Add(Colleges m) { return(college_DAL.Add(m)); }
public bool UpdateField(Colleges college) { return(colleges.updatefield(college)); }
//-------- New College ,Department , Field ------ public bool NewCollege(Colleges cg) { return(colleges.newcollege(cg)); }
// Step 1 = get saved User information public Wizard() { this.SelectedQuarter = new Quarter(); this.myQuarters = new Quarters(); this.myCourses = new Courses(); this.UserSettings = new UserSettings(); if (!File.Exists(UserSettings.PathandFileName)) { if (UserSettings.Domain.ToLower(CultureInfo.CurrentCulture) == "yvcc") { UserSettings.CollegeAbbreviation = YVC.Key; } else { GetCollege(); } WriteUserSettingsToXML(); // Write us Version does not exist } // get the XML file version XMLFileVersionConfiguration XMLFileVersionConfiguration = new XMLFileVersionConfiguration(UserSettings); UserSettings.Version = XMLFileVersionConfiguration.CheckVersion(); if (UserSettings.Version == "") { UserSettings.Version = "1"; } // Load All configuration data //UserConfiguration UserConfiguration = new UserConfiguration(UserSettings); ReadFromXML(); // Select College Colleges = new Colleges(); this.SelectedCollege = Colleges.FindCollege(UserSettings.CollegeAbbreviation); if (SelectedCollege == null) { if (UserSettings.Domain.ToLower() == "yvcc") { UserSettings.CollegeAbbreviation = YVC.Key; } else { GetCollege(); } this.SelectedCollege = Colleges.FindCollege(UserSettings.CollegeAbbreviation); this.WebAssignSettings.Institution = SelectedCollege.WebAssignInstitution; } // do I need to upgrade the xml file? if (UserSettings.Version == "1") { UserSettings.Version = "2"; // upgrade it File.Delete(UserSettings.PathandFileName); // Adjust the Filename as they currently contain the Path and Filename ExcelClassSettings.SaveFileName = Path.GetFileName(ExcelClassSettings.SaveFileName); ExcelClassSettings.TemplateFileName = Path.GetFileName(ExcelClassSettings.TemplateFileName); WriteToXML(); } //debugging code //Courses.AddTestData(); //ExcelClassSettings.Export = true; //ExcelRollSettings.Export = false; //ExcelRollSettings.ExportLab = false; //ExportExcel(); CurrentCompletedStep = WizardStep.Creation; }