private static CBE.SubmoduleCollection ConvertDataTableToCollection(DataTable dt) { try { CBE.SubmoduleCollection submodules = new CBE.SubmoduleCollection(); for (int i = 0; i < dt.Rows.Count; i++) { CBE.SubmoduleCBE submodule = new CBE.SubmoduleCBE(); if (dt.Rows[i]["SUBMODULE_ID"] != DBNull.Value) { submodule.SubModuleId = Convert.ToInt32(dt.Rows[i]["SUBMODULE_ID"]); } if (dt.Rows[i]["MODULE_ID"] != DBNull.Value) { submodule.ModuleId = Convert.ToInt32(dt.Rows[i]["MODULE_ID"]); } if (dt.Rows[i]["SUBMODULE_NAME"] != DBNull.Value) { submodule.SubModuleName = Convert.ToString(dt.Rows[i]["SUBMODULE_NAME"]); } if (dt.Rows[i]["IS_GUI_VISIBLE"] != DBNull.Value) { submodule.IsGuiVisible = Convert.ToInt32(dt.Rows[i]["IS_GUI_VISIBLE"]); } if (dt.Rows[i]["SUBMODULE_URL"] != DBNull.Value) { submodule.SubmoduleUrl = Convert.ToString(dt.Rows[i]["SUBMODULE_URL"]); } if (dt.Rows[i]["ICON"] != DBNull.Value) { submodule.Icon = Convert.ToString(dt.Rows[i]["ICON"]); } submodules.Add(submodule); } return(submodules); } catch (Exception ex) { throw ex; } }
public static CBE.SubmoduleCBE GetSubModuleById(CBE.SubmoduleCBE submodule) { try { CBE.SubmoduleCollection submodules = new CBE.SubmoduleCollection(); string spName = Constants.oraclePackagePrefix + "SubModule_GetById"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_submodule_id", DbType.Int32, submodule.SubModuleId, ParameterDirection.Input)); submodules = ConvertDataTableToCollection(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName).Tables[tableName]); return(submodules[0]); } catch (Exception ex) { throw ex; } }
public static void Update(CBE.SubmoduleCBE submodule) { try { string spName = Constants.oraclePackagePrefix + "SubModule_Update"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_submodule_id", DbType.Int32, submodule.SubModuleId, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_module_id", DbType.Int32, submodule.ModuleId, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_submodule_name", DbType.String, submodule.SubModuleName, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_is_gui_visible", DbType.Int32, submodule.IsGuiVisible, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_transfer_status", DbType.Int32, (int)VaaaN.MLFF.Libraries.CommonLibrary.Constants.TransferStatus.NotTransferred, ParameterDirection.Input)); VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.ExecuteNonQuery(command); } catch (Exception ex) { throw ex; } }