// ================================================================================ public string[] GetAllLoginnamesFromCpr(string context, string cprNo, ref string aux) { //CREATE PROCEDURE spGK_PMU_GetLoginNameFromCPR // @context VARCHAR(120), // @cprNo VARCHAR(10), // @loginName VARCHAR(30) OUTPUT, // @aux VARCHAR(1020) OUTPUT string[] sa = new string[0]; // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_PMU_GetLoginNameFromCPR"); spContext.AddInParameter("cprNo", DbType.String, cprNo.Trim()); spContext.AddOutParameter("loginName", DbType.String, 30); DataSet ds = spContext.ExecuteDataSet(); if (ds != null) { int tblCnt = ds.Tables.Count; if (tblCnt > 0) { // It's the last table that contains login names DataTable dt = ds.Tables[tblCnt - 1]; if (dt != null) { int rowCnt = dt.Rows.Count; sa = new string[rowCnt]; for (int i = 0; i < rowCnt; i++) { sa[i] = (string)dt.Rows[i]["loginName"]; } } } } aux = spContext.Aux; return(sa); }
// ================================================================================ public Guid GetObjectOwnerIDFromNamespace(string context, string nameSpace, ref string aux) { //CREATE PROCEDURE spGK_PM_GetOwnerIDFromNamespace // @context VARCHAR(120), // @objectOwnerID uniqueidentifier OUTPUT, // @objectOwnerNamespace VARCHAR(510), // @aux VARCHAR(1020) OUTPUT // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_PM_GetOwnerIDFromNamespace"); spContext.AddInParameter("objectOwnerNamespace", DbType.String, nameSpace.Trim()); spContext.AddOutParameter("objectOwnerID", DbType.Guid); spContext.ExecuteNonQueryWithReturnValue(); aux = spContext.Aux; return(spContext.GetParameterGuidValue("objectOwnerID")); }
// ================================================================================ public bool IsRegisteredNonAdminUser(string context, string cprNo, ref string aux) { //CREATE PROCEDURE spGK_N2L_IsRegisteredNonAdminUser // @context VARCHAR(120), // @cprNo VARCHAR(10), // @registered INTEGER OUTPUT, // @aux VARCHAR(1020) OUTPUT // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_N2L_IsRegisteredNonAdminUser"); spContext.AddInParameter("cprNo", DbType.String, cprNo.Trim()); spContext.AddOutParameter("registered", DbType.Int32); int registered = spContext.ExecuteNonQueryWithReturnValue(); aux = spContext.Aux; return(registered == 1); }
// ================================================================================ public string GetCprFromLoginname(string context, string loginName, ref string aux) { //CREATE PROCEDURE spGK_PMU_GetCPRFromLoginName // @context VARCHAR(120), // @loginName VARCHAR(30), // @cprNo VARCHAR(10) OUTPUT, // @aux VARCHAR(1020) OUTPUT // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_PMU_GetCPRFromLoginName"); spContext.AddInParameter("loginName", DbType.String, loginName.Trim()); spContext.AddOutParameter("cprNo", DbType.String, 10); spContext.ExecuteNonQueryWithReturnValue(); aux = spContext.Aux; return(spContext.GetParameterStringValue("cprNo")); }
// ================================================================================ public string GetCprFromObjectID(string context, Guid objectID, ref string aux) { //CREATE PROCEDURE spGK_PM_GetCPRFromObjectID // @context VARCHAR(120), // @objectID uniqueidentifier, // @cprNo VARCHAR(10) OUTPUT, // @aux VARCHAR(1020) OUTPUT // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_PM_GetCPRFromObjectID"); spContext.AddInParameter("objectID", DbType.Guid, objectID); spContext.AddOutParameter("cprNo", DbType.String, 10); spContext.ExecuteNonQueryWithReturnValue(); aux = spContext.Aux; return(spContext.GetParameterStringValue("cprNo")); }
// ================================================================================ public bool IsRegisteredNonAdminUser(string context, string cprNo, ref string aux) { //CREATE PROCEDURE spGK_N2L_IsRegisteredNonAdminUser // @context VARCHAR(120), // @cprNo VARCHAR(10), // @registered INTEGER OUTPUT, // @aux VARCHAR(1020) OUTPUT // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_N2L_IsRegisteredNonAdminUser"); spContext.AddInParameter("cprNo", DbType.String, cprNo.Trim()); spContext.AddOutParameter("registered", DbType.Int32); int registered = spContext.ExecuteNonQueryWithReturnValue(); aux = spContext.Aux; return (registered == 1); }
// ================================================================================ //public string GetPrimaryLoginnameFromCpr(string context, string cprNo, ref string aux) //{ // string result = ""; // result = GetPreferredLoginnameFromCpr(context, cprNo, ref aux); // aux += "This operation is deprecated (as of 20110106). Use operation GetPreferredLoginnameFromCpr() instead! "; // return result; //} // ================================================================================ public string GetPreferredLoginnameFromCpr(string context, string cprNo, ref string aux) { //CREATE PROCEDURE spGK_PMU_GetLoginNameFromCPR // @context VARCHAR(120), // @cprNo VARCHAR(10), // @loginName VARCHAR(30) OUTPUT, // @aux VARCHAR(1020) OUTPUT // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_PMU_GetLoginNameFromCPR"); spContext.AddInParameter("cprNo", DbType.String, cprNo.Trim()); spContext.AddOutParameter("loginName", DbType.String, 30); spContext.ExecuteNonQueryWithReturnValue(); aux = spContext.Aux; return spContext.GetParameterStringValue("loginName"); }
// ================================================================================ public Guid GetObjectOwnerIDFromNamespace(string context, string nameSpace, ref string aux) { //CREATE PROCEDURE spGK_PM_GetOwnerIDFromNamespace // @context VARCHAR(120), // @objectOwnerID uniqueidentifier OUTPUT, // @objectOwnerNamespace VARCHAR(510), // @aux VARCHAR(1020) OUTPUT // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_PM_GetOwnerIDFromNamespace"); spContext.AddInParameter("objectOwnerNamespace", DbType.String, nameSpace.Trim()); spContext.AddOutParameter("objectOwnerID", DbType.Guid); spContext.ExecuteNonQueryWithReturnValue(); aux = spContext.Aux; return spContext.GetParameterGuidValue("objectOwnerID"); }
// ================================================================================ public string GetCprFromObjectID(string context, Guid objectID, ref string aux) { //CREATE PROCEDURE spGK_PM_GetCPRFromObjectID // @context VARCHAR(120), // @objectID uniqueidentifier, // @cprNo VARCHAR(10) OUTPUT, // @aux VARCHAR(1020) OUTPUT // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_PM_GetCPRFromObjectID"); spContext.AddInParameter("objectID", DbType.Guid, objectID); spContext.AddOutParameter("cprNo", DbType.String, 10); spContext.ExecuteNonQueryWithReturnValue(); aux = spContext.Aux; return spContext.GetParameterStringValue("cprNo"); }
// ================================================================================ public string[] GetAllLoginnamesFromCpr(string context, string cprNo, ref string aux) { //CREATE PROCEDURE spGK_PMU_GetLoginNameFromCPR // @context VARCHAR(120), // @cprNo VARCHAR(10), // @loginName VARCHAR(30) OUTPUT, // @aux VARCHAR(1020) OUTPUT string[] sa = new string[0]; // Init params StoredProcedureCallContext.ClearStandardParams(ref context, ref aux); StoredProcedureCallContext spContext = new StoredProcedureCallContext("CPRMapperDB", "spGK_PMU_GetLoginNameFromCPR"); spContext.AddInParameter("cprNo", DbType.String, cprNo.Trim()); spContext.AddOutParameter("loginName", DbType.String, 30); DataSet ds = spContext.ExecuteDataSet(); if (ds != null) { int tblCnt = ds.Tables.Count; if (tblCnt > 0) { // It's the last table that contains login names DataTable dt = ds.Tables[tblCnt - 1]; if (dt != null) { int rowCnt = dt.Rows.Count; sa = new string[rowCnt]; for (int i = 0; i < rowCnt; i++) { sa[i] = (string)dt.Rows[i]["loginName"]; } } } } aux = spContext.Aux; return sa; }