/// <summary> /// 添加再研项目 /// </summary> /// <param name="researchprojects"></param> /// <returns></returns> public bool InsertResearch(ResearchProjects researchprojects) { var sql = "insert into ResearchProjects (ProjectName,ProjectIntroduction,StartingTime,EndTime,ProjectProgress,Projectcontent) values(@ProjectName,@ProjectIntroduction,@StartingTime,@EndTime,@ProjectProgress,@Projectcontent)"; var par = new SqlParameter() { ParameterName = "@ProjectName", SqlDbType = System.Data.SqlDbType.VarChar, Value = researchprojects.ProjectName }; var par2 = new SqlParameter() { ParameterName = "@ProjectIntroduction", SqlDbType = System.Data.SqlDbType.VarChar, Value = researchprojects.ProjectIntroduction }; var par3 = new SqlParameter() { ParameterName = "@StartingTime", SqlDbType = System.Data.SqlDbType.VarChar, Value = researchprojects.StartingTime }; var par4 = new SqlParameter() { ParameterName = "@EndTime", SqlDbType = System.Data.SqlDbType.VarChar, Value = researchprojects.EndTime }; var par5 = new SqlParameter() { ParameterName = "@ProjectProgress", SqlDbType = System.Data.SqlDbType.Text, Value = researchprojects.ProjectProgress }; var par6 = new SqlParameter() { ParameterName = "@Projectcontent", SqlDbType = System.Data.SqlDbType.Text, Value = researchprojects.Projectcontent }; return(_dbHelper.SavaData(sql, par, par2, par3, par4, par5, par6) > 0 ? true : false); }
public IActionResult UpdateResearch(ResearchProjects upresearch) { try { var list = _IResearch.UpdateResearch(upresearch); return(new JsonResult(new { result = 1, message = $"修改项目成功!", data = list }, new JsonSerializerSettings() { ContractResolver = new LowercaseContractResolver() })); } catch (Exception exc) { // _log.Log(NLog.LogLevel.Error, $"查询全部部门:{exc.Message}"); return(new JsonResult(new { result = 0, message = $"修改项目失败:{exc.Message}" })); } }
/// <summary> /// 修改在研项目信息 /// </summary> /// <param name="id">在研项目ID</param> /// <returns></returns> public bool UpdateResearch(ResearchProjects upresearch) { var sql = @"UPDATE ResearchProjects SET ProjectName=@ProjectName, ProjectIntroduction=@ProjectIntroduction, StartingTime=@StartingTime, EndTime=@EndTime, ProjectProgress=@ProjectProgress, Projectcontent=@Projectcontent WHERE ID=@id"; var par1 = new SqlParameter() { ParameterName = "@ProjectName", SqlDbType = System.Data.SqlDbType.VarChar, Value = upresearch.ProjectName }; var par2 = new SqlParameter() { ParameterName = "@ProjectIntroduction", SqlDbType = System.Data.SqlDbType.VarChar, Value = upresearch.ProjectIntroduction }; var par3 = new SqlParameter() { ParameterName = "@StartingTime", SqlDbType = System.Data.SqlDbType.VarChar, Value = upresearch.StartingTime }; var par4 = new SqlParameter() { ParameterName = "@EndTime", SqlDbType = System.Data.SqlDbType.VarChar, Value = upresearch.EndTime }; var par5 = new SqlParameter() { ParameterName = "@ProjectProgress", SqlDbType = System.Data.SqlDbType.VarChar, Value = upresearch.ProjectProgress }; var par6 = new SqlParameter() { ParameterName = "@Projectcontent", SqlDbType = System.Data.SqlDbType.Text, Value = upresearch.Projectcontent }; var par = new SqlParameter() { ParameterName = "@id", SqlDbType = System.Data.SqlDbType.Int, Value = upresearch.Id }; return(_dbHelper.SavaData(sql, par1, par2, par3, par4, par5, par6, par) > 0 ? true : false); }