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

📄 unit_timuluru.pas

📁 用户登录、自动出题、试题录入、手动出题、试题管理等
💻 PAS
📖 第 1 页 / 共 2 页
字号:
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('Select TypeID From Type Where TypeName=''简答题''');
         ADOQuery1.Open;
         temp:=ADOQuery1.FieldValues['TypeID'];
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('INSERT INTO JianDaTi(TypeID,TM,DA,NY,CZ) VALUES(:temp,:TM,:DA,:NY,:CZ)');
         ADOQuery1.Parameters.ParamByName('temp').Value:=temp;
         ADOQuery1.Parameters.ParamByName('TM').Value:=TM_Memo1.Text;
         ADOQuery1.Parameters.ParamByName('DA').Value:=DA_Memo1.Text;
         ADOQuery2.Close;
         ADOQuery2.SQL.Clear;
         ADOQuery2.SQL.Add('Select BH From NYD Where NYD=:NY');
         ADOQuery2.Parameters.ParamByName('NY').Value:=NY_ComboBox3.Text;
         ADOQuery2.Open;
         temp:=ADOQuery2.FieldValues['BH'];
         ADOQuery1.Parameters.ParamByName('NY').Value:=temp;
         ADOQuery1.Parameters.ParamByName('CZ').Value:=ZJ_ComboBox3.Text;
         ADOQuery1.ExecSQL;
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('Select 1 From JianDaTi');
         ADOQuery1.Open;
         TH_Edit3.Text:=IntToStr(ADOQuery1.RecordCount+1);
         TM_Memo1.Clear;
         DA_Memo1.Clear;
       end
    else showmessage('此题已经存在!');
  end;
end;

procedure TTIMuLuRu.LR_Button4Click(Sender: TObject);
var
  temp,x:Integer;
  temp1,temp2:string;
begin
  x:=0;
  if TM_Memo2.Text='' then ShowMessage('题目不能为空')
  else if DA_Memo2.Text='' then ShowMessage('答案不能为空')
  else if NY_ComboBox4.Text='' then ShowMessage('难易度不能为空')
  else if ZJ_ComboBox4.Text='' then ShowMessage('所在章节不能为空')
  else begin
    temp1:=TM_Memo2.Text;
    ADOQuery2.Close;
    ADOQuery2.SQL.Clear;
    ADOQuery2.SQL.Add('SELECT TM FROM YuanLiLunShu');
    ADOQuery2.Open;
    While not ADOQuery2.Eof do
      begin
        temp2:=ADOQuery2.FieldValues['TM'];
        if temp1=temp2 then begin
                              x:=1;
                              break;
                            end;
        ADOQuery2.Next;
      end;
    if x=0 then begin
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('Select TypeID From Type Where TypeName=''原理论述题''');
         ADOQuery1.Open;
         temp:=ADOQuery1.FieldValues['TypeID'];
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('INSERT INTO YuanLiLunShu(TypeID,TM,DA,NY,CZ) VALUES(:temp,:TM,:DA,:NY,:CZ)');
         ADOQuery1.Parameters.ParamByName('temp').Value:=temp;
         ADOQuery1.Parameters.ParamByName('TM').Value:=TM_Memo2.Text;
         ADOQuery1.Parameters.ParamByName('DA').Value:=DA_Memo2.Text;
         ADOQuery2.Close;
         ADOQuery2.SQL.Clear;
         ADOQuery2.SQL.Add('Select BH From NYD Where NYD=:NY');
         ADOQuery2.Parameters.ParamByName('NY').Value:=NY_ComboBox4.Text;
         ADOQuery2.Open;
         temp:=ADOQuery2.FieldValues['BH'];
         ADOQuery1.Parameters.ParamByName('NY').Value:=temp;
         ADOQuery1.Parameters.ParamByName('CZ').Value:=ZJ_ComboBox4.Text;
         ADOQuery1.ExecSQL;
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('Select 1 From YuanLiLunShu');
         ADOQuery1.Open;
         TH_Edit4.Text:=IntToStr(ADOQuery1.RecordCount+1);
         TM_Memo2.Clear;
         DA_Memo2.Clear;
       end
    else showmessage('此题已经存在!');
  end;
end;

procedure TTIMuLuRu.LR_Button5Click(Sender: TObject);
var
  temp,temp3,temp4,y,w1,w2:Integer;
  temp1,temp2,temp5,temp6,x,AppPath:string;
begin
  y:=0;
  w1:=1;
  w2:=1;
  if TM_Memo3.Text='' then ShowMessage('题目不能为空')
  else if DA_Memo3.Text='' then ShowMessage('答案不能为空')
  else if NY_ComboBox5.Text='' then ShowMessage('难易度不能为空')
  else if ZJ_ComboBox5.Text='' then ShowMessage('所在章节不能为空')
  else begin
    temp1:=TM_Memo3.Text;
    ADOQuery2.Close;
    ADOQuery2.SQL.Clear;
    ADOQuery2.SQL.Add('SELECT TM FROM XiTongSheJi');
    ADOQuery2.Open;
    While not ADOQuery2.Eof do
      begin
        temp2:=ADOQuery2.FieldValues['TM'];
        if temp1=temp2 then begin
                              y:=1;
                              break;
                            end;
        ADOQuery2.Next;
      end;
    x:='.doc';
    temp1:=DAYY_Edit1.Text;
    temp2:=TMYY_Edit1.Text;
    temp3:=length(temp1);
    temp4:=length(temp2);
    temp5:=copy(temp1,temp3-3,temp3);
    temp6:=copy(temp2,temp4-3,temp4);
    if (temp5<>x)and(temp5<>'') then temp1:=temp1+x;
    if (temp6<>x)and(temp6<>'') then temp2:=temp2+x;
    AppPath:=ExtractFilePath(Application.ExeName);
    //Memo1.Text:=AppPath;
    if TMYY_Edit1.Text<>''then begin
                                 temp2:=AppPath+temp2;
                                 if not FileExists(temp2) then begin
                                                                 showmessage('对不起,题目所引用文件不存在!');
                                                                 w1:=0;
                                                               end;
                               end;
    if DAYY_Edit1.Text<>''then begin
                                 temp1:=AppPath+temp1;
                                 if not FileExists(temp1) then begin
                                                                 showmessage('对不起,答案所引用文件不存在!');
                                                                 w2:=0;
                                                               end;
                               end;
    if (w1=1)and(w2=1) then begin
    if y=0 then begin
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('Select TypeID From Type Where TypeName=''系统设计题''');
         ADOQuery1.Open;
         temp:=ADOQuery1.FieldValues['TypeID'];
         x:='.doc';
         temp1:=DAYY_Edit1.Text;
         temp2:=TMYY_Edit1.Text;
         temp3:=length(temp1);
         temp4:=length(temp2);
         temp5:=copy(temp1,temp3-3,temp3);
         temp6:=copy(temp2,temp4-3,temp4);
         if (temp5<>x)and(temp5<>'') then temp1:=temp1+x;
         if (temp6<>x)and(temp6<>'') then temp2:=temp2+x;
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('INSERT INTO XiTongSheJi(TypeID,TM,DA,NY,CZ,DABG,TMBG) VALUES(:temp,:TM,:DA,:NY,:CZ,:DABG,:TMBG)');
         ADOQuery1.Parameters.ParamByName('temp').Value:=temp;
         ADOQuery1.Parameters.ParamByName('TM').Value:=TM_Memo3.Text;
         ADOQuery1.Parameters.ParamByName('DA').Value:=DA_Memo3.Text;
         ADOQuery2.Close;
         ADOQuery2.SQL.Clear;
         ADOQuery2.SQL.Add('Select BH From NYD Where NYD=:NY');
         ADOQuery2.Parameters.ParamByName('NY').Value:=NY_ComboBox5.Text;
         ADOQuery2.Open;
         temp:=ADOQuery2.FieldValues['BH'];
         ADOQuery1.Parameters.ParamByName('NY').Value:=temp;
         ADOQuery1.Parameters.ParamByName('CZ').Value:=ZJ_ComboBox5.Text;
         ADOQuery1.Parameters.ParamByName('DABG').Value:=temp1;
         ADOQuery1.Parameters.ParamByName('TMBG').Value:=temp2;
         ADOQuery1.ExecSQL;
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('Select 1 From XiTongSheJi');
         ADOQuery1.Open;
         TH_Edit5.Text:=IntToStr(ADOQuery1.RecordCount+1);
         TM_Memo3.Clear;
         DA_Memo3.Clear;
         TMYY_Edit1.Clear;
         DAYY_EDit1.Clear;
       end
    else showmessage('此题已经存在!');
  end;
  end;
end;

procedure TTIMuLuRu.LR_Button6Click(Sender: TObject);
type
  SZ=array[1..5]of string;
var
  temp,x,i,y,t,t1,w1,w2,w3,w4,w5:Integer;
  temp1,temp2,s,AppPath:string;
  SZx,SZy:SZ;
begin
  t1:=1;
  w1:=1;
  w2:=1;
  w3:=1;
  w4:=1;
  w5:=1;
  t:=0;
  i:=1;
  s:='.doc';
  SZx[1]:='';
  if TM_Memo4.Text='' then ShowMessage('题目不能为空')
  else if NY_ComboBox6.Text='' then ShowMessage('难易度不能为空')
  else if ZJ_ComboBox6.Text='' then ShowMessage('所在章节不能为空')
       else begin
              temp:=StrToInt(WTS_ComboBox.Text);
              SZx[1]:=DA1_Edit.Text;
              SZx[2]:=DA2_Edit.Text;
              SZx[3]:=DA3_Edit.Text;
              SZx[4]:=DA4_Edit.Text;
              SZx[5]:=DA5_Edit.Text;
              for x:=1 To temp do
                begin
                  i:=x;
                  if SZx[i]='' then break;
                end;
            end;
  if SZx[i]='' then ShowMessage('您少输入了问题的答案')
  else begin
    temp1:=TM_Memo4.Text;
    ADOQuery2.Close;
    ADOQuery2.SQL.Clear;
    ADOQuery2.SQL.Add('SELECT TM FROM XiTongCZ');
    ADOQuery2.Open;
    While not ADOQuery2.Eof do
      begin
        temp2:=ADOQuery2.FieldValues['TM'];
        if temp1=temp2 then begin
                              t:=1;
                              break;
                            end;
        ADOQuery2.Next;
      end;
    SZx[1]:=DAYY1_Edit.Text;
    SZx[2]:=DAYY2_Edit.Text;
    SZx[3]:=DAYY3_Edit.Text;
    SZx[4]:=DAYY4_Edit.Text;
    SZx[5]:=DAYY5_Edit.Text;
    AppPath:=ExtractFilePath(Application.ExeName);
    x:=StrToInt(WTS_ComboBox.Text);
    while x<>0 do
      begin
        SZy[x]:=SZx[x];
        y:=length(SZy[x]);
        temp1:=copy(SZy[x],y-3,y);
        if (temp1<>s)and(temp1<>'') then SZy[x]:=SZy[x]+s;
        x:=x-1;
      end;
    SZy[1]:=AppPath+SZy[1];
    SZy[2]:=AppPath+SZy[2];
    SZy[3]:=AppPath+SZy[3];
    SZy[4]:=AppPath+SZy[4];
    SZy[5]:=AppPath+SZy[5];
    temp1:=TMYY_Edit2.Text;
    y:=length(temp2);
    temp2:=copy(temp1,y-3,y);
    if (temp2<>s)and(temp2<>'') then temp1:=temp1+s;
    temp1:=AppPath+temp1;
    if TMYY_Edit2.Text<>'' then begin
                                  if not FileExists(temp1) then showmessage('对不起,题目所引用文件不存在!');
                                  t1:=0;
                                end;
    if DAYY1_Edit.Text<>'' then begin
                                  if not FileExists(SZy[1]) then showmessage('对不起,答案一所引用文件不存在!');
                                  w1:=0;
                                end;
    if DAYY2_Edit.Text<>'' then begin
                                  if not FileExists(SZy[2]) then showmessage('对不起,答案二所引用文件不存在!');
                                  w2:=0;
                                end;
    if DAYY3_Edit.Text<>'' then begin
                                  if not FileExists(SZy[3]) then showmessage('对不起,答案三所引用文件不存在!');
                                  w3:=0;
                                end;
    if DAYY4_Edit.Text<>'' then begin
                                  if not FileExists(SZy[4]) then showmessage('对不起,答案四所引用文件不存在!');
                                  w4:=0;
                                end;
    if DAYY5_Edit.Text<>'' then begin
                                  if not FileExists(SZy[5]) then showmessage('对不起,答案五所引用文件不存在!');
                                  w5:=0;
                                end;
    if (t1=1)and(w1=1)and(w2=1)and(w3=1)and(w4=1)and(w5=1) then begin
    if t=0 then begin
         SZx[1]:=DAYY1_Edit.Text;
         SZx[2]:=DAYY2_Edit.Text;
         SZx[3]:=DAYY3_Edit.Text;
         SZx[4]:=DAYY4_Edit.Text;
         SZx[5]:=DAYY5_Edit.Text;
         for x:=1 to 5 do
           begin
             SZy[i]:=SZx[i];
           end;
         x:=StrToInt(WTS_ComboBox.Text);
         while x<>0 do
           begin
            SZy[x]:=SZx[x];
            y:=length(SZy[x]);
            temp1:=copy(SZy[x],y-3,y);
            if (temp1<>s)and(temp1<>'') then SZy[x]:=SZy[x]+s;
            x:=x-1;
           end;
         temp1:=TMYY_Edit2.Text;
         y:=length(temp2);
         temp2:=copy(temp1,y-3,y);
         if (temp2<>s)and(temp2<>'') then temp1:=temp1+s;
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('Select TypeID From Type Where TypeName=''系统操作题''');
         ADOQuery1.Open;
         temp:=ADOQuery1.FieldValues['TypeID'];
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('INSERT INTO XiTongCZ(TypeID,TM,NY,CZ,W1DA,W1DABG,W2DA,W2DABG,W3DA,W3DABG,W4DA,W4DABG,W5DA,W5DABG,WTS,TMBG) VALUES(:temp,:TM,:NY,:CZ,:W1DA,:W1DABG,:W2DA,:W2DABG,:W3DA,:W3DABG,:W4DA,:W4DABG,:W5DA,:W5DABG,:WTS,:TMBG)');
         ADOQuery1.Parameters.ParamByName('temp').Value:=temp;
         ADOQuery1.Parameters.ParamByName('TM').Value:=TM_Memo4.Text;
         ADOQuery2.Close;
         ADOQuery2.SQL.Clear;
         ADOQuery2.SQL.Add('Select BH From NYD Where NYD=:NY');
         ADOQuery2.Parameters.ParamByName('NY').Value:=NY_ComboBox6.Text;
         ADOQuery2.Open;
         temp:=ADOQuery2.FieldValues['BH'];
         ADOQuery1.Parameters.ParamByName('NY').Value:=temp;
         ADOQuery1.Parameters.ParamByName('CZ').Value:=ZJ_ComboBox6.Text;
         ADOQuery1.Parameters.ParamByName('W1DA').Value:=DA1_Edit.Text;
         ADOQuery1.Parameters.ParamByName('W1DABG').Value:=SZy[1];
         ADOQuery1.Parameters.ParamByName('W2DA').Value:=DA2_Edit.Text;
         ADOQuery1.Parameters.ParamByName('W2DABG').Value:=SZy[2];
         ADOQuery1.Parameters.ParamByName('W3DA').Value:=DA3_Edit.Text;
         ADOQuery1.Parameters.ParamByName('W3DABG').Value:=SZy[3];
         ADOQuery1.Parameters.ParamByName('W4DA').Value:=DA4_Edit.Text;
         ADOQuery1.Parameters.ParamByName('W4DABG').Value:=SZy[4];
         ADOQuery1.Parameters.ParamByName('W5DA').Value:=DA5_Edit.Text;
         ADOQuery1.Parameters.ParamByName('W5DABG').Value:=SZy[5];
         ADOQuery1.Parameters.ParamByName('WTS').Value:=WTS_ComboBox.Text;
         ADOQuery1.Parameters.ParamByName('TMBG').Value:=temp1;
         ADOQuery1.ExecSQL;
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('Select 1 From XiTongCZ');
         ADOQuery1.Open;
         TH_Edit6.Text:=IntToStr(ADOQuery1.RecordCount+1);
         TM_Memo4.Clear;
         DA1_Edit.Clear;
         DAYY1_Edit.Clear;
         DA2_Edit.Clear;
         DAYY2_Edit.Clear;
         DA3_Edit.Clear;
         DAYY3_Edit.Clear;
         DA4_Edit.Clear;
         DAYY4_Edit.Clear;
         DA5_Edit.Clear;
         DAYY5_Edit.Clear;
         TMYY_Edit2.Clear;
       end
    else showmessage('此题已经存在!');
  end;
  end;
end;

procedure TTIMuLuRu.FL1_ButtonClick(Sender: TObject);
begin
  FL1_Form.Show;
end;

procedure TTIMuLuRu.Button1Click(Sender: TObject);
begin
  close;
end;

end.

⌨️ 快捷键说明

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