private bool DeleteSite(tInput oInput, ILambdaContext context, ref SqlConnection oSqlConnection) { SqlCommand sqlComm; string strQuery; try { strQuery = " Update Site Set " + " Deleted = 1 " + " Where " + " SiteID = @SiteID "; sqlComm = oSqlConnection.CreateCommand(); sqlComm.CommandText = strQuery; SqlParameter sqlParamSiteID = new SqlParameter("@SiteID", SqlDbType.Int); sqlParamSiteID.Value = oInput.SiteID; sqlComm.Parameters.Add(sqlParamSiteID); sqlComm.ExecuteNonQuery(); sqlComm.Dispose(); } catch (Exception ex) { context.Logger.LogLine("UpdateSite Ex " + ex.Message); return(false); } return(true); }
private bool InsertSite(tInput oInput, ILambdaContext context, ref SqlConnection oSqlConnection) { SqlCommand sqlComm; string strQuery; try { strQuery = " INSERT INTO Site (SiteID, SiteKey, SiteName ) Values (@SiteID, @SiteKey, @SiteName ) "; sqlComm = oSqlConnection.CreateCommand(); sqlComm.CommandText = strQuery; SqlParameter sqlParamSiteID = new SqlParameter("@SiteID", SqlDbType.Int); sqlParamSiteID.Value = oInput.SiteID; sqlComm.Parameters.Add(sqlParamSiteID); SqlParameter sqlParamSiteKey = new SqlParameter("@SiteKey", SqlDbType.NVarChar); sqlParamSiteKey.Value = oInput.SiteKey; sqlComm.Parameters.Add(sqlParamSiteKey); SqlParameter sqlParamSiteName = new SqlParameter("@SiteName", SqlDbType.NVarChar); sqlParamSiteName.Value = oInput.SiteName; sqlComm.Parameters.Add(sqlParamSiteName); sqlComm.ExecuteNonQuery(); sqlComm.Dispose(); } catch (Exception ex) { context.Logger.LogLine("InsertSite Ex " + ex.Message); return(false); } return(true); }