예제 #1
0
        // ================================================================================
        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);
        }
예제 #2
0
        // ================================================================================
        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"));
        }
예제 #3
0
        // ================================================================================
        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);
        }
예제 #4
0
        // ================================================================================
        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"));
        }
예제 #5
0
        // ================================================================================
        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"));
        }
예제 #6
0
        // ================================================================================
        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);
        }
예제 #7
0
        // ================================================================================
        //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");
        }
예제 #8
0
        // ================================================================================
        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");
        }
예제 #9
0
        // ================================================================================
        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");
        }
예제 #10
0
        // ================================================================================
        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;
        }