public static Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, ROLE_PERMISSIONS objSave)
        {
            Int32 objReturn          = 0;
            ROLE_PERMISSIONSDB objDB = new ROLE_PERMISSIONSDB();

            objReturn = objDB.Save(CURRENT_USER, CURRENT_REGISTRY_ID, objSave);

            return(objReturn);
        }
        public static ROLE_PERMISSIONS GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 ROLE_PERMISSION_ID)
        {
            ROLE_PERMISSIONS   objReturn = null;
            ROLE_PERMISSIONSDB objDB     = new ROLE_PERMISSIONSDB();

            objReturn = objDB.GetItem(CURRENT_USER, CURRENT_REGISTRY_ID, ROLE_PERMISSION_ID);

            return(objReturn);
        }
Esempio n. 3
0
        public ROLE_PERMISSIONS ParseReaderCustom(DataRow row)
        {
            ROLE_PERMISSIONS objReturn = new ROLE_PERMISSIONS
            {
                CREATED             = (DateTime)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_CREATED")),
                CREATEDBY           = (string)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_CREATEDBY")),
                DELETE              = (bool?)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_DELETE")),
                INSERT              = (bool?)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_INSERT")),
                ROLE_PERMISSION_ID  = (Int32)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_ROLE_PERMISSION_ID")),
                STD_GUI_CONTROLS_ID = (Int32)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_STD_GUI_CONTROLS_ID")),
                STD_ROLE_ID         = (Int32)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_STD_ROLE_ID")),
                UPDATE              = (bool?)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_UPDATE")),
                UPDATED             = (DateTime)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_UPDATED")),
                UPDATEDBY           = (string)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_UPDATEDBY")),
                VIEW = (bool?)GetNullableObject(row.Field <object>("ROLE_PERMISSIONS_VIEW"))
            };

            return(objReturn);
        }
Esempio n. 4
0
        public ROLE_PERMISSIONS GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 ROLE_PERMISSION_ID)
        {
            ROLE_PERMISSIONS objReturn = null;

            SqlConnection  sConn    = null;
            SqlCommand     sCmd     = null;
            SqlDataAdapter sAdapter = null;
            DataSet        objTemp  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_ROLE_PERMISSIONS_getitem", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID);
                sCmd.Parameters.AddWithValue("@ROLE_PERMISSION_ID", ROLE_PERMISSION_ID);

                objTemp  = new DataSet();
                sAdapter = new SqlDataAdapter(sCmd);

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                sAdapter.Fill(objTemp);
                LogManager.LogTiming(logDetails);
                CheckDataSet(objTemp);

                if (objTemp != null && objTemp.Tables.Count > 0 && objTemp.Tables[0].Rows.Count > 0)
                {
                    objReturn = ParseReader(objTemp.Tables[0].Rows[0]);
                }

                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }
            finally
            {
                if (sAdapter != null)
                {
                    sAdapter.Dispose();
                    sAdapter = null;
                }
                if (sCmd != null)
                {
                    sCmd.Dispose();
                    sCmd = null;
                }
                if (sConn != null)
                {
                    if (sConn.State != ConnectionState.Closed)
                    {
                        sConn.Close();
                    }
                    sConn.Dispose();
                    sConn = null;
                }
            }

            return(objReturn);
        }
Esempio n. 5
0
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, ROLE_PERMISSIONS objSave)
        {
            Int32 objReturn = 0;

            SqlConnection sConn = null;
            SqlCommand    sCmd  = null;
            SqlParameter  p     = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_ROLE_PERMISSIONS_save", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID);

                p           = new SqlParameter("@CREATED", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.CREATED);
                p           = new SqlParameter("@CREATEDBY", SqlDbType.VarChar, 30);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CREATEDBY);
                p           = new SqlParameter("@DELETE", SqlDbType.Bit, 1);
                p.Precision = 1;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.DELETE);
                p           = new SqlParameter("@INSERT", SqlDbType.Bit, 1);
                p.Precision = 1;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.INSERT);
                p           = new SqlParameter("@ROLE_PERMISSION_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.ROLE_PERMISSION_ID);
                p           = new SqlParameter("@STD_GUI_CONTROLS_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_GUI_CONTROLS_ID);
                p           = new SqlParameter("@STD_ROLE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_ROLE_ID);
                p           = new SqlParameter("@UPDATE", SqlDbType.Bit, 1);
                p.Precision = 1;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.UPDATE);
                p           = new SqlParameter("@UPDATED", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.UPDATED);
                p           = new SqlParameter("@UPDATEDBY", SqlDbType.VarChar, 30);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.UPDATEDBY);
                p           = new SqlParameter("@VIEW", SqlDbType.Bit, 1);
                p.Precision = 1;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.VIEW);

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                int        cnt        = sCmd.ExecuteNonQuery();
                LogManager.LogTiming(logDetails);

                objReturn = (Int32)sCmd.Parameters["@ROLE_PERMISSION_ID"].Value;

                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }
            finally
            {
                if (sCmd != null)
                {
                    sCmd.Dispose();
                    sCmd = null;
                }
                if (sConn != null)
                {
                    if (sConn.State != ConnectionState.Closed)
                    {
                        sConn.Close();
                    }
                    sConn.Dispose();
                    sConn = null;
                }
            }

            return(objReturn);
        }
 public static Boolean Delete(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, ROLE_PERMISSIONS objDelete)
 {
     return(Delete(CURRENT_USER, CURRENT_REGISTRY_ID, objDelete.ROLE_PERMISSION_ID));
 }