public static void Insert(CBE.ModuleCBE module) { try { string spName = Constants.oraclePackagePrefix + "Module_Insert"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_module_name", DbType.String, module.ModuleName, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_is_gui_visible", DbType.Int32, module.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; } }
private static CBE.ModuleCollection ConvertDataTableToCollection(DataTable dt) { try { CBE.ModuleCollection modules = new CBE.ModuleCollection(); for (int i = 0; i < dt.Rows.Count; i++) { CBE.ModuleCBE module = new CBE.ModuleCBE(); if (dt.Rows[i]["MODULE_ID"] != DBNull.Value) { module.ModuleId = Convert.ToInt32(dt.Rows[i]["MODULE_ID"]); } if (dt.Rows[i]["MODULE_NAME"] != DBNull.Value) { module.ModuleName = Convert.ToString(dt.Rows[i]["MODULE_NAME"]); } if (dt.Rows[i]["IS_GUI_VISIBLE"] != DBNull.Value) { module.IsGuiVisible = Convert.ToInt32(dt.Rows[i]["IS_GUI_VISIBLE"]); } if (dt.Rows[i]["MODULE_URL"] != DBNull.Value) { module.ModuleUrl = Convert.ToString(dt.Rows[i]["MODULE_URL"]); } if (dt.Rows[i]["ICON"] != DBNull.Value) { module.Icon = Convert.ToString(dt.Rows[i]["ICON"]); } modules.Add(module); } return(modules); } catch (Exception ex) { throw ex; } }
public static CBE.ModuleCBE GetModuleById(CBE.ModuleCBE module) { try { CBE.ModuleCollection modules = new CBE.ModuleCollection(); string spName = Constants.oraclePackagePrefix + "Module_GetById"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_module_id", DbType.Int32, module.ModuleId, ParameterDirection.Input)); DataSet ds = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName); DataTable dt = ds.Tables[tableName]; modules = ConvertDataTableToCollection(dt); return(modules[0]); } catch (Exception ex) { throw ex; } }