/// <summary> /// 添加团队 /// </summary> /// <param name="t"></param> /// <returns></returns> public bool InsertTeam(Team t) { try { string sql = "insert into team (Name,Position,WorkDate,ShenQing,Image1,Image2,TeamProduce) values(?name,?position,?workdate,?shenqing,?image1,?image2,?TeamProduce)"; MySqlParameter[] pars = { new MySqlParameter("?name", t.Name), new MySqlParameter("?position", t.Position), new MySqlParameter("?workdate", t.WorkDate), new MySqlParameter("?shenqing", t.ShenQing), new MySqlParameter("?image1", t.Image1), new MySqlParameter("?image2", t.Image2), new MySqlParameter("?TeamProduce", t.TeamProduce) }; MySqlDB.nonquery(sql, CommandType.Text, pars); string sql2 = "select TeamID from team ORDER BY TeamID desc LIMIT 1"; int teamid = MySqlDB.scalar(sql2, CommandType.Text, null); string sql3 = "insert into arearelation (TeamID,AreaID) values(?teamid,?areaid)"; MySqlParameter[] pars3 = { new MySqlParameter("?teamid", teamid), new MySqlParameter("?areaid", t.AreaID) }; MySqlDB.nonquery(sql3, CommandType.Text, pars3); return(true); } catch (Exception ex) { return(false); } }
/// <summary> /// 修改成功案例 /// </summary> /// <returns></returns> public int UpdateAnLi(JiaJiModels.Anli model, int teamid) { try { //查出关系表中的内容 string sql = "select * from successful_relation where SRelationID=" + model.SRelationID + ""; int successid = Convert.ToInt32(MySqlDB.GetDataTable(sql, CommandType.Text, null).Rows[0][1]); string teamidsql = "select count(1) from team_anli where SuccessID=" + successid + " "; int countteam = MySqlDB.scalar(teamidsql, CommandType.Text, null); sql = "update successful set SuccessTitle='" + model.SuccessTitle + "',SuccessContent='" + model.SuccessContent + "',SuccessDate='" + model.SuccessDate + "' where SuccessID=" + successid + "; "; if (countteam > 0) { sql += "update team_anli set team_anli.TeamID=" + teamid + " where SuccessID=" + successid + ";"; } else { sql += "insert into team_anli(TeamID,SuccessID) VALUES(" + teamid + "," + successid + ");"; } sql += "update successful_relation set StudentID=" + model.StudentID + " where SuccessID=" + successid + " "; int he = MySqlDB.nonquery(sql, CommandType.Text, null); return(he); } catch (Exception ex) { return(0); } }
/// <summary> /// 判断用户名和密码 /// </summary> /// <param name="adname"></param> /// <param name="adpwd"></param> /// <returns></returns> public int NamePwdIsExist(string adname, string adpwd) { try { string sql = "select count(1) from adlogin where AdName='" + adname + "' and AdPwd='" + adpwd + "' "; int h = MySqlDB.scalar(sql, CommandType.Text, null); return(h); } catch (Exception ex) { return(0); } }