Esempio n. 1
0
int project::addpgroup(QString name, QString parrent)
{
	if (name.isEmpty())
		return (-1);
	group *p = groupsearch(parrent, &listgroup[0]);
	QList<int> lf;
	QList<int>::iterator lfi;

	if (p)
	{
		lf = p->getListfils();
		lfi = lf.begin();
		while(lfi != lf.end())
		{
			if (listgroup[*lfi].name.compare(name) == 0)
				return (listgroup[*lfi].id);
			lfi++;
		}
		return (sqlo::addgroup(this, this->name, name, p->id, p->type, name, 0));
	}
	return (-1);
}
Esempio n. 2
0
group	*project::groupsearch(QString name, group *g)
{
	vector<group> & gv = (g->type) ? listqgroup : listgroup;
	QList<int> lf;
	QList<int>::iterator lfi;
	group *ret = NULL;

	if (name.compare(g->name) == 0)
		return (g);
//	if (g->getListfils().empty())
//		return (NULL);
	lf = g->getListfils();
	lfi = lf.begin();
	while (lfi != lf.end())
	{
		ret = groupsearch(name, &gv[*lfi]);
		if (ret)
			return (ret);
		lfi++;
	}
	return (NULL);
}
Esempio n. 3
0
void main()
{
    int k;
    char s[20],c[20]={'1'};
    char p[20];
    Link head = NULL;
    printf("Welcome to CY's NOTEBOOK!\n");
    printf("Please enter you password:\n");
    gets(p);
    printf("\n Please wait...\n");
    Sleep(1000);
    system("cls");
    if(!strcmp("Chen Yi",p))
    {
        printf("\n\n Welcome!\n");
        printf(" []             *   *    *                 @              *                 *   ");
        printf("\n");
        printf(" []          *             *               @                *              *    ");
        printf("\n");
        printf(" []         *               *              @                  *          *      ");
        printf("\n");
        printf(" []         *                              @                    *      *       ");
        printf("\n");
        printf(" []         *                              @                        *          ");
        printf("\n");
        printf(" []          *                             @                        *           ");
        printf("\n");
        printf(" []            *           *               @                        *           ");
        printf("\n");
        printf(" []               *  *  *                  @                        *           ");
        ReadData(&head);
        do
        {
            printf("分类查询请按1,添加记录请按2,删除记录请按3,显示全部请按4,保存记录请按5,个人信息查询请按6,退出系统请按0\n");
            scanf("%d",&k);
            while(k!=1&&k!=2&&k!=3&&k!=4&&k!=5&&k!=6&&k!=0)
            {
                printf("输入错误!请输入数字1至6!\n");
                scanf("%d",&k);
            }
            switch(k)
            {
                case 1:
                    do
                    {
                        groupsearch(head);//查寻群组信息
                        printf("继续查询请按1,按其他键退出查询!\n");
                        scanf("%s",s);
                    }while(!strcmp(s,c));
                    break;
                case 2:
                    do
                    {
                        sort(head);
                        head=enter(head);//添加个人信息
                        printf("继续添加请按1,按其他键退出添加!\n");
                        scanf("%s",s);
                    }while(!strcmp(s,c));
                    break;
                case 3:
                    do
                    {
                        sort(head);
                        head=delet(head);//删除个人信息
                        printf("继续删除请按1,按其他键退出删除!\n");
                        scanf("%s",s);
                    }while(!strcmp(s,c));
                    break;
                case 4:sort(head);display(head);break;
                case 5:sort(head);save(head);printf("保存成功");break;//保存个人信息
                case 6:sort(head);search(head);break;//查询个人信息
                case 0:Free(&head);return;
            }
        }while(1);
    }
    else printf("密码错误,系统将自动退出!");
    Beep(1060,500);//i
    Beep(784,500);//5
    Beep(523,500);//1
}