Пример #1
0
        /// <summary>
        /// GetByGroupAndFunction
        /// Calls [usp_select_TabSecurityFunction_Permission_by_Login]
        /// </summary>
        public override TabSecurityFunctionDetails GetInvisibleTabSecurityList(System.Int32?pageId, System.Int32?loginId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try
            {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_TabSecurityFunction_Permission_by_Login", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@TabSecurityFunctionNo", SqlDbType.Int).Value = pageId;
                cmd.Parameters.Add("@LoginNo", SqlDbType.Int).Value = loginId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    TabSecurityFunctionDetails obj = new TabSecurityFunctionDetails();
                    obj.MyTab       = GetReaderValue_Boolean(reader, "MyTab", false);
                    obj.TeamTab     = GetReaderValue_Boolean(reader, "TeamTab", false);
                    obj.DivisionTab = GetReaderValue_Boolean(reader, "DivisionTab", false);
                    obj.CompanyTab  = GetReaderValue_Boolean(reader, "CompanyTab", false);
                    return(obj);
                }
                else
                {
                    return(null);
                }
            }
            catch (SqlException sqlex)
            {
                //LogException(sqlex);
                throw new Exception("Failed to get GetInvisibleTabSecurityList", sqlex);
            }
            finally
            {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }