/// <summary> /// Edit author object to database /// </summary> /// <param name="obj">ATTAuthor object</param> /// <returns>return bool</returns> public static bool EditAuthor(ATTAuthor obj, Previlege pobj) { string EditSP; EditSP = "SP_EDIT_AUTHOR"; //Preparing oracle parameter with value OracleParameter[] paramArray = new OracleParameter[2]; paramArray[0] = Utilities.GetOraParam(":p_AUTHOR_ID", obj.AuthorID, OracleDbType.Int64, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam(":p_AUTHOR_NAME", obj.AuthorName, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection getConn = new GetConnection(); try { OracleConnection DBConn = getConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " update Author."); } SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, EditSP, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { getConn.CloseDbConn(); } }
/// <summary> /// /// </summary> /// <param name="ObjMT"></param> /// <returns></returns> public static bool AddMaterialType(ATTMaterialType objMT, Previlege pobj) { string InsertSQL; InsertSQL = "SP_ADD_MATERIAL_TYPE"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " add Material Type."); } OracleParameter[] paramArray = new OracleParameter[4]; paramArray[0] = Utilities.GetOraParam(":p_MATERIAL_ID", "0", OracleDbType.Int16, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam(":p_MATERIAL_TYPE_NAME", objMT.MaterialTypeName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_MATERIAL_DESCRIPTION", objMT.MaterialDescription, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[3] = Utilities.GetOraParam(":p_MATERIAL_ENTRY_BY", objMT.MaterialEntryBy, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, InsertSQL, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
public static bool UpdateMaterialCategory(ATTMaterialCategory objMC, Previlege pobj) { string UpdateSQL; UpdateSQL = "SP_EDIT_MATERIAL_CATEGORY"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " update Material Category."); } OracleParameter[] paramArray = new OracleParameter[3]; paramArray[0] = Utilities.GetOraParam(":p_CATEGORY_ID", objMC.CategoryID, OracleDbType.Int16, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam(":p_CATEGORY_NAME", objMC.CategoryName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_CATEGORY_DESCRIPTION", objMC.CategoryDescription, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, UpdateSQL, paramArray); return(true); } catch (Exception ex) { throw (ex); } finally { GetConn.CloseDbConn(); } }
//Update public static bool UpdatePublisherType(ATTPublisher objPT, Previlege pobj) { string UpdateSQL = "SP_EDIT_PUBLISHER"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " update Publisher."); } OracleParameter[] paramArray = new OracleParameter[3]; paramArray[0] = Utilities.GetOraParam("p_PUBLISHER_ID", objPT.PublisherID, OracleDbType.Int16, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam("p_PUBLISHER_NAME", objPT.PublisherName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam("p_PUBLISHER_ADDRESS", objPT.PublisherAddress, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, UpdateSQL, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
public static bool AddPublisher(ATT.ATTPublisher objATT, Previlege pobj) { string InsertSQL; InsertSQL = "SP_ADD_PUBLISHER"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " add Publisher."); } OracleParameter[] paramArray = new OracleParameter[4]; paramArray[0] = Utilities.GetOraParam(":p_PUBLISHER_ID", objATT.PublisherID, OracleDbType.Int64, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam(":P_PUBLISHER_NAME", objATT.PublisherName, OracleDbType.NVarchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":P_PUBLISHER_ADDRESS", objATT.PublisherAddress, OracleDbType.NVarchar2, ParameterDirection.Input); paramArray[3] = Utilities.GetOraParam(":p_ENTRY_BY", objATT.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, InsertSQL, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
//Editing existing record public static bool UpdateLanguageType(ATTLookupLanguage objLT, Previlege pobj) { string UpdateSQL = "SP_EDIT_LANGUAGE"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " update Language."); } OracleParameter[] paramArray = new OracleParameter[2]; paramArray[0] = Utilities.GetOraParam("p_LANG_ID", objLT.LookupLanguageID, OracleDbType.Int16, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam("p_LANG_ID", objLT.LookupLanguageName, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, UpdateSQL, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
public static bool AddLibrary(ATTLibrary obj, Previlege pobj) { string SQL; SQL = "SP_ADD_LIBRARY"; OracleParameter[] paramArray = new OracleParameter[5]; paramArray[0] = Utilities.GetOraParam(":p_LIBRARY_ID", obj.LibraryID, OracleDbType.Int64, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam(":p_ORG_ID", obj.OrgID, OracleDbType.Int64, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_LIBRARY_NAME", obj.LibraryName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[3] = Utilities.GetOraParam(":p_LOCATION", obj.Location, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[4] = Utilities.GetOraParam(":p_ENTRY_BY", obj.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " add Libaray."); } SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, SQL, paramArray); obj.LibraryID = int.Parse(paramArray[0].Value.ToString()); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
public static bool AddCurrency(ATTCurrency obj, Previlege pobj) { string InsertSP; InsertSP = "SP_ADD_CURRENCY"; OracleParameter[] paramArray = new OracleParameter[3]; paramArray[0] = Utilities.GetOraParam(":p_CURRENCY_ID", obj.CurrencyID, OracleDbType.Int64, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam(":p_CURRENCY_NAME", obj.CurrencyName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_ENTRY_BY", obj.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection getConn = new GetConnection(); try { OracleConnection DBConn = getConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " add Currency."); } SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, InsertSP, paramArray); obj.CurrencyID = int.Parse(paramArray[0].Value.ToString()); return(true); } catch (Exception ex) { throw ex; } finally { getConn.CloseDbConn(); } }
public static long AddLibraryMaterial(ATTLibraryMaterial obj, Previlege pobj) { string InsertSP; OracleParameter[] paramArray; if (obj.Action == "A") { InsertSP = "SP_ADD_LIBRARY_MATERIAL"; paramArray = new OracleParameter[18]; paramArray[17] = Utilities.GetOraParam(":p_ENTRY_BY", obj.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); } else { InsertSP = "SP_EDIT_LIBRARY_MATERIAL"; paramArray = new OracleParameter[17]; } paramArray[0] = Utilities.GetOraParam(":p_ORG_ID", obj.OrgID, OracleDbType.Int64, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam(":p_LIBRARY_ID", obj.LibraryID, OracleDbType.Int64, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_L_MATERIAL_ID", obj.LMaterialID, OracleDbType.Decimal, ParameterDirection.InputOutput); paramArray[3] = Utilities.GetOraParam(":p_MT_ID", obj.LibraryMaterialType, OracleDbType.Int64, ParameterDirection.Input); paramArray[4] = Utilities.GetOraParam(":p_CATEGORY_ID", obj.LibraryMaterialCategory, OracleDbType.Int64, ParameterDirection.Input); paramArray[5] = Utilities.GetOraParam(":p_CALL_NO", obj.CallNo, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[6] = Utilities.GetOraParam(":p_CORPORATE_BODY", obj.CorporateBody, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[7] = Utilities.GetOraParam(":p_TITLE", obj.Title, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[8] = Utilities.GetOraParam(":p_SERIES_STATE", obj.SeriesStatement, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[9] = Utilities.GetOraParam(":p_NOTE", obj.Note, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[10] = Utilities.GetOraParam(":p_BRD_SUBJECT_HEADING", obj.BoardSubjectHeading, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[11] = Utilities.GetOraParam(":p_GEO_DESC", obj.GeoDescription, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[12] = Utilities.GetOraParam(":p_LANG_ID", obj.LanguageID, OracleDbType.Int64, ParameterDirection.Input); paramArray[13] = Utilities.GetOraParam(":p_PHY_DESC", obj.PhysicalDescription, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[14] = Utilities.GetOraParam(":p_PUBLISHER_ID", obj.PublisherID, OracleDbType.Int64, ParameterDirection.Input); paramArray[15] = Utilities.GetOraParam(":p_CONTENT_FILE", obj.ContentFile, OracleDbType.Blob, ParameterDirection.Input); paramArray[16] = Utilities.GetOraParam(":p_FILE_TYPE", obj.CFileType, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection GetConn = new GetConnection(); OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); string modeName = ""; if (obj.Action == "A") { modeName = "add"; } else if (obj.Action == "M") { modeName = "update"; } if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " " + modeName + " Library Material."); } OracleTransaction Tran = DBConn.BeginTransaction(); try { SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, InsertSP, paramArray); obj.LMaterialID = long.Parse(paramArray[2].Value.ToString()); DLLLibraryMaterialKeyword.AddLibraryMaterialKeyword(obj.LstLMKeyword, obj.LMaterialID, Tran); DLLLibraryMaterialAuthor.AddLibraryMaterialAuthor(obj.LstLMAuthor, obj.LMaterialID, Tran); Tran.Commit(); return(obj.LMaterialID); } catch (Exception ex) { Tran.Rollback(); throw ex; } finally { GetConn.CloseDbConn(); } }