public bool Add() { string guid = Guid.NewGuid().ToString(); string strSql = "insert into TAB_Base_Site (strSiteGUID,strSiteNumber,strSiteName,nSiteEnable,strSiteIP,nSiteJob,strStationGUID,strAreaGUID,strWorkShopGUID,strTMIS) " + " values (@strSiteGUID,@strSiteNumber,@strSiteName,@nSiteEnable,@strSiteIP,@nSiteJob,@strStationGUID,@strAreaGUID,@strWorkShopGUID,@strTMIS);" + "insert into TAB_Base_Site_Limit(strSiteGUID,nJobID,nJobLimit)(select @strSiteGUID,@nSiteJob,nLimitID from TAB_System_Job_Limit)"; SqlParameter[] sqlParams = { new SqlParameter("strSiteGUID", guid), new SqlParameter("strSiteNumber", strSiteNumber), new SqlParameter("strSiteName", strSiteName), new SqlParameter("nSiteEnable", nSiteEnable), new SqlParameter("strSiteIP", strSiteIP), new SqlParameter("nSiteJob", nSiteJob), new SqlParameter("strStationGUID", strStationGUID), new SqlParameter("strWorkShopGUID", strWorkShopGUID), new SqlParameter("strAreaGUID", strAreaGUID), new SqlParameter("strTMIS", strTMIS) }; bool bflag = SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams) > 0; //更新管理端IP Base_Site_Additional.InsertOrUpdate(guid, strConfirmIP); return(bflag); }
public bool Update() { string strSql = @"update TAB_Base_Site set strSiteNumber=@strSiteNumber,nSiteEnable=@nSiteEnable,strSiteName=@strSiteName,strSiteIP=@strSiteIP, nSiteJob=@nSiteJob,strStationGUID=@strStationGUID,strAreaGUID=@strAreaGUID,strWorkShopGUID=@strWorkShopGUID,strTMIS=@strTMIS where strSiteGUID=@strSiteGUID"; SqlParameter[] sqlParams = { new SqlParameter("strSiteGUID", strSiteGUID), new SqlParameter("strSiteNumber", strSiteNumber), new SqlParameter("strSiteName", strSiteName), new SqlParameter("nSiteEnable", nSiteEnable), new SqlParameter("strSiteIP", strSiteIP), new SqlParameter("nSiteJob", nSiteJob), new SqlParameter("strStationGUID", strStationGUID), new SqlParameter("strWorkShopGUID", strWorkShopGUID), new SqlParameter("strAreaGUID", strAreaGUID), new SqlParameter("strTMIS", strTMIS) }; bool bflag = (SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams) > 0); Base_Site_Additional.InsertOrUpdate(strSiteGUID, strConfirmIP); return(bflag); }