⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 某公司资料管理系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::FormShow(TObject *Sender)
{

//程序已通过,暂不执行
    //初始化
    AddUser->Enabled=true;
    DeleteUser->Enabled=true;
    UserPasswd->Enabled=true;

    MIDesigner->Enabled=false;
    MIApp->Enabled=false;
    MIQACheck->Enabled=false;
    MIQAApp->Enabled=false;
    MISearch->Enabled=true;

    SampleProduct->Enabled=false;
    SampleManage->Enabled=false;
    SampleSearch->Enabled=true;
    SampleDelete->Enabled=false;

    //基本资料
    Customer->Enabled=true;
    BaseBoard->Enabled=true;
    Prepreg->Enabled=true;
    BaseRoute->Enabled=true;
    SampleRoute->Enabled=true;

// 检查用户组
    try
    {
       MastData->StoredProc1->ExecProc();
       MastData->UserName=MastData->StoredProc1->Params->Items[1]->AsString;
       StatusBar1->Panels->Items[1]->Text=MastData->UserName;

       MastData->UserGroup->Params->Items[0]->AsString=MastData->UserName;
       MastData->UserGroup->Prepare();
       MastData->UserGroup->Open();

       MastData->UserGroup->First();
       while(!MastData->UserGroup->Eof)
      {
        if(Trim(MastData->UserGroup->FieldByName("UserName")->AsString)==Trim(MastData->UserName))
        {
          if(Trim(MastData->UserGroup->FieldByName("GroupName")->AsString)=="PPE")
          {
              MIDesigner->Enabled=true;
          }
          if(Trim(MastData->UserGroup->FieldByName("GroupName")->AsString)=="PPEAPP")
          {
             MIApp->Enabled=true;
          }
          if(Trim(MastData->UserGroup->FieldByName("GroupName")->AsString)=="QACHECK")
          {
             MIQACheck->Enabled=true;
          }
          if(Trim(MastData->UserGroup->FieldByName("GroupName")->AsString)=="QAAPP")
          {
             MIQAApp->Enabled=true;
          }
          if(Trim(MastData->UserGroup->FieldByName("GroupName")->AsString)=="SAMPLE")
          {
              SampleProduct->Enabled=true;
              SampleManage->Enabled=true;
              SampleSearch->Enabled=true;
              SampleDelete->Enabled=true;
          }
        }
        MastData->UserGroup->Next();

     }
   }
   catch(...)
   {
        MessageBox(NULL,"对不起您没有使用本系统的权...","提示",MB_OK);
        Abort();
        //     Application->Terminate();
   }

}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::SampleManageClick(TObject *Sender)
{
    bool haveform=false;
    if(!MastData->Database->InTransaction)
    {
        MastData->Database->StartTransaction();
    }
    try
    {
       for(int i = MainMenuForm->MDIChildCount-1; i>= 0; i--)
      {
         if(MainMenuForm->MDIChildren[i]->Name=="SampleManageForm")
        {
           haveform=true;
           break;
        }
      }
      if(haveform==true)
      {
         SampleManageForm->Show();
      }
      else
      {
         Screen->Cursor = crHourGlass;
         SampleManageForm=new TSampleManageForm(Application);
         Screen->Cursor = crDefault;
         SampleManageForm->Show();
       }
    }
    catch(...)
    {
       ShowMessage("您的权限不够...");
    }
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::SampleSearchClick(TObject *Sender)
{
    bool haveform=false;
    if(!MastData->Database->InTransaction)
    {
        MastData->Database->StartTransaction();
    }
    try
    {
       for(int i = MainMenuForm->MDIChildCount-1; i>= 0; i--)
      {
         if(MainMenuForm->MDIChildren[i]->Name=="SampleSearchForm")
        {
           haveform=true;
           break;
        }
      }
      if(haveform==true)
      {
         SampleSearchForm->Show();
      }
      else
      {
         Screen->Cursor = crHourGlass;
         SampleSearchForm=new TSampleSearchForm(Application);
         Screen->Cursor = crDefault;
         SampleSearchForm->Show();
       }
    }
    catch(...)
    {
       ShowMessage("您的权限不够...");
    }
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::SampleDeleteClick(TObject *Sender)
{
    bool haveform=false;
    if(!MastData->Database->InTransaction)
    {
        MastData->Database->StartTransaction();
    }
    try
    {
       for(int i = MainMenuForm->MDIChildCount-1; i>= 0; i--)
      {
         if(MainMenuForm->MDIChildren[i]->Name=="SampleDeleteForm")
        {
           haveform=true;
           break;
        }
      }
      if(haveform==true)
      {
         SampleDeleteForm->Show();
      }
      else
      {
         Screen->Cursor = crHourGlass;
         SampleDeleteForm=new TSampleDeleteForm(Application);
         Screen->Cursor = crDefault;
         SampleDeleteForm->Show();
       }
    }
    catch(...)
    {
       ShowMessage("您的权限不够...");
    }
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::MISearchClick(TObject *Sender)
{
     bool haveform=false;
    if(!MastData->Database->InTransaction)
    {
        MastData->Database->StartTransaction();
    }
    try
    {
       for(int i = MainMenuForm->MDIChildCount-1; i>= 0; i--)
      {
         if(MainMenuForm->MDIChildren[i]->Name=="MISearchForm")
        {
           haveform=true;
           break;
        }
      }
      if(haveform==true)
      {
         MISearchForm->Show();
      }
      else
      {
         Screen->Cursor = crHourGlass;
         MISearchForm=new TMISearchForm(Application);
         Screen->Cursor = crDefault;
         MISearchForm->Show();
       }
    }
    catch(...)
    {
       ShowMessage("您的权限不够...");
    }
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::PrintSetupClick(TObject *Sender)
{
    PrintDialog1->Execute();
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::SampleProductClick(TObject *Sender)
{
    bool haveform=false;
    if(!MastData->Database->InTransaction)
    {
        MastData->Database->StartTransaction();
    }
    try
    {
       for(int i = MainMenuForm->MDIChildCount-1; i>= 0; i--)
      {
         if(MainMenuForm->MDIChildren[i]->Name=="SampleProductForm")
        {
           haveform=true;
           break;
        }
      }
      if(haveform==true)
      {
         SampleProductForm->Show();
      }
      else
      {
         Screen->Cursor = crHourGlass;
         SampleProductForm=new TSampleProductForm(Application);
         Screen->Cursor = crDefault;
         SampleProductForm->Show();
       }
    }
    catch(...)
    {
       ShowMessage("您的权限不够...");
    }
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::ToolButton18Click(TObject *Sender)
{
    PrintDialog1->Execute();
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::N3Click(TObject *Sender)
{
   for(int i = MainMenuForm->MDIChildCount-1; i>= 0; i--)
    {
       MainMenuForm->MDIChildren[i]->Close();
     }
     MastData->Database->Connected=false;
     ReConnectForm->ShowModal();
     if(MastData->Database->Connected)
     {
           FormShow(Sender);
     }
     else
     {
         Application->Terminate();
     }
}
//---------------------------------------------------------------------------
void __fastcall TMainMenuForm::ToolButton5Click(TObject *Sender)
{

   for(int i = MainMenuForm->MDIChildCount-1; i>= 0; i--)
    {
       MainMenuForm->MDIChildren[i]->Close();
     }
     MastData->Database->Connected=false;
     //MastData->Database->Connected=true;
     ReConnectForm->ShowModal();
     if(MastData->Database->Connected)
     {
           FormShow(Sender);
     }
     else
     {
         Application->Terminate();
     }


}
//---------------------------------------------------------------------------


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -