//methods public bool Add_Update_UserRole(sec_UserRoleRepo roles) { try { //Get connectoin var app = new AppSettings(); con = app.GetConnection(); var param = new DynamicParameters(); param.Add(name: "p_UserRoleId", value: roles.UserRoleId, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_UserRoleName", value: roles.UserRoleName.ToUpper(), dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_UserRoleDesc", value: roles.UserRoleDesc, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_UserRoleStatus", value: roles.UserRoleStatus, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_MakerId", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "p_MakeDate", value: GlobalValue.Scheme_Today_Date, dbType: DbType.Date, direction: ParameterDirection.Input); int result = con.Execute(sql: "mix_sec_UserRole", param: param, commandType: CommandType.StoredProcedure); if (result != 0) { return(true); } else { return(false); } } catch (Exception ex) { throw ex; } finally { if (con.State == ConnectionState.Open) { con.Close(); if (con != null) { con = null; } } } }
public bool Add_Update_UserRole_NotInUse(sec_UserRoleRepo roles) { //int i = 0; var app = new AppSettings(); using (OracleConnection conp = new OracleConnection(app.conString())) { try { conp.Open(); using (OracleCommand cmdadd = new OracleCommand()) { cmdadd.Connection = conp; cmdadd.CommandType = CommandType.StoredProcedure; cmdadd.CommandText = "mix_sec_UserRole"; cmdadd.Parameters.Add(":p_UserRoleId", OracleDbType.Varchar2, ParameterDirection.Input).Value = roles.UserRoleId; cmdadd.Parameters.Add(":p_UserRoleName", OracleDbType.Varchar2, ParameterDirection.Input).Value = roles.UserRoleName; cmdadd.Parameters.Add(":p_UserRoleDesc", OracleDbType.Varchar2, ParameterDirection.Input).Value = roles.UserRoleDesc;; cmdadd.Parameters.Add(":p_UserRoleStatus", OracleDbType.Varchar2, ParameterDirection.Input).Value = roles.UserRoleStatus; cmdadd.Parameters.Add(":p_MakerId", OracleDbType.Varchar2, ParameterDirection.Input).Value = GlobalValue.User_ID; cmdadd.Parameters.Add(":p_MakeDate", OracleDbType.Date, ParameterDirection.Input).Value = GlobalValue.Scheme_Today_Date; cmdadd.ExecuteNonQuery(); } return(true); } catch (Exception) { throw; } finally { if (conp.State == ConnectionState.Open) { conp.Close(); conp.Dispose(); } } } }