Exemple #1
0
        public static DataTable GetGroupsByItensForm(
            int groupId,
            int formId,
            int[] itens
            )
        {
            createConnection();
            cmd.CommandText = "Sp_GetGroupsByItensForm";
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@groupId", groupId);
            cmd.Parameters.Add("@formId", formId);
            cmd.Parameters.Add("@itens", DaFunctions.ConvertArrayToString(itens));

            try
            {
                cn.Open();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                return(dt);
            }
            catch (Exception e) { throw e; }
            finally{ closeConnection(); }
        }
Exemple #2
0
        public static DataTable GetGroupsByFields(
            int groupId,
            string description,
            int[] fields
            )
        {
            createConnection();
            cmd.CommandText = "Sp_GetGroupsByFields";
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@groupId", groupId);
            cmd.Parameters.Add("@description", description);
            cmd.Parameters.Add("@fields", DaFunctions.ConvertArrayToString(fields));

            try
            {
                cn.Open();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                return(dt);
            }
            catch (Exception e) { throw e; }
            finally{ closeConnection(); }
        }
Exemple #3
0
        public static DataTable GetFoldersByGroups(
            int idFolder,
            int idParent,
            string name,
            int [] groups
            )
        {
            createConnection();

            cmd.CommandText = "Sp_GetFoldersByGroups";
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@groups", DaFunctions.ConvertArrayToString(groups));
            cmd.Parameters.Add("@idFolder", idFolder);
            cmd.Parameters.Add("@idParent", idParent);
            cmd.Parameters.Add("@name", name);

            try
            {
                cn.Open();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                return(dt);
            }
            catch (Exception e) { throw e; }
            finally{ closeConnection(); }
        }
Exemple #4
0
        public static int CountChild(
            int idParent,
            int [] groups
            )
        {
            createConnection();

            if (groups.Length > 0)
            {
                cmd.CommandText = "Sp_getContChildByGroups";
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@idParent", idParent);
                cmd.Parameters.Add("@groups", DaFunctions.ConvertArrayToString(groups));
            }
            else
            {
                cmd.CommandText = "Sp_getContChild";
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@idParent", idParent);
            }

            try
            {
                cn.Open();
                return(Convert.ToInt32(cmd.ExecuteScalar()));
            }
            catch (Exception e) { throw e; }
            finally{ closeConnection(); }
        }
Exemple #5
0
        public static DataTable GetItensFormByGroups(
            int itemFormId,
            int formId,
            int idFolder, string order, string where,
            int [] groups
            )
        {
            createConnection();

            cmd.CommandText = "Sp_GetItensFormByGroups";
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@itemFormId", itemFormId);
            cmd.Parameters.Add("@formId", formId);
            cmd.Parameters.Add("@idFolder", idFolder);
            cmd.Parameters.Add("@order", order);
            cmd.Parameters.Add("@where", where);
            cmd.Parameters.Add("@groups", DaFunctions.ConvertArrayToString(groups));

            try
            {
                cn.Open();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                return(dt);
            }
            catch (Exception e) { throw e; }
            finally{ closeConnection(); }
        }
Exemple #6
0
		public DataTable GetUsersByGroups(
			int userId,
			int []groups
			)
		{
			createConnection();

			cmd.CommandText = "Sp_GetUsersByGroups";
			cmd.Connection = cn;
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.Parameters.Add( "@groups", DaFunctions.ConvertArrayToString( groups ) );
			cmd.Parameters.Add( "@userId", userId );
						
			try								
			{
				cn.Open();				
				SqlDataAdapter da = new SqlDataAdapter(cmd);
				DataTable dt = new DataTable();
				da.Fill( dt );
				return dt;
			}
			catch( Exception e ){ throw e; }
			finally{ closeConnection(); }
		}