/// <summary> /// Delete Street Light Description from Database /// </summary> /// <param name="stltDesc"></param> private void DelStreetLightDescription(StreetLightDescription stltDesc) { string sqlStmt = "Delete From STLT_DESC_VL Where DESCRIPTION_ID={0}"; sqlStmt = string.Format(sqlStmt, stltDesc.DescriptionID); CommonUtil.Execute(sqlStmt); }
/// <summary> /// Update Street Light Description /// </summary> /// <param name="stltDesc"></param> private void UpdStreetLightDescription(StreetLightDescription stltDesc) { string sqlStmt = "Update STLT_DESC_VL set DESCRIPTION='{0}',MSLA_DATE=TO_DATE('{1}','MM/DD/YYYY') Where DESCRIPTION_ID={2}"; sqlStmt = string.Format(sqlStmt, stltDesc.DESCRIPTION, stltDesc.MSLA_Date.ToShortDateString(), stltDesc.DescriptionID); CommonUtil.Execute(sqlStmt); }
/// <summary> /// Insert Street Light Description /// </summary> /// <param name="stltDesc"></param> private void InsStreetLightDescription(StreetLightDescription stltDesc) { string sqlStmt = "Insert into STLT_DESC_VL(DESCRIPTION_ID,DESCRIPTION,MSLA_DATE) " + "values((select nvl(max(DESCRIPTION_ID),0)+1 from STLT_DESC_VL),'{0}',TO_DATE('{1}','MM/DD/YYYY'))"; sqlStmt = string.Format(sqlStmt, stltDesc.DESCRIPTION, stltDesc.MSLA_Date.ToShortDateString()); CommonUtil.Execute(sqlStmt); }
/// <summary> /// Persist Street Light Description into Database /// </summary> /// <param name="stltDesc"></param> public void SaveStreetLightDesc(StreetLightDescription stltDesc) { if (stltDesc.EntityState == EntityMode.Add) { InsStreetLightDescription(stltDesc); } if (stltDesc.EntityState == EntityMode.Update) { UpdStreetLightDescription(stltDesc); } if (stltDesc.EntityState == EntityMode.Delete) { DelStreetLightDescription(stltDesc); } }