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

📄 hmdoc.cpp

📁 邮 电 公 司 erp源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    if(WhereStr.IsEmpty()==true)
        throw Exception("查找表达式不能为空");
    m_SqlStr="select * from sdVacType where  "+WhereStr;
    m_Query->Close();
    m_Query->SQL->Clear();
   m_Query->SQL->Add(m_SqlStr);
    m_Query->Open();
    if(m_Query->RecordCount!=1)
    {
        m_Query->Close();
        return false;
    }
    else
    {
        BatchLetValue();
        m_Query->Close();
        return true;
    }
}
//**************************************
//     TsdLr离职原因
//**************************************
//--------------------------------------------------------------
void __fastcall TsdLr:: SetLrCode(AnsiString value)
{
 if(value.IsEmpty())
   throw Exception("离职代码不能为空!");
 if(value.UpperCase()!=m_LrCode.UpperCase())
  {
   m_Query->Close();
   m_Query->SQL->Clear();
   m_Query->SQL->Add("select * from sdLr where LrCode='"+value+"'");
   m_Query->Open();
   if(m_Query->RecordCount>0)
     {
      m_Query->Close();
      throw Exception("离职代码"+value+"已存在!");
     }
   m_Query->Close();
  }
  m_LrCode=value;
}
void __fastcall TsdLr:: SetLrDesc(AnsiString value)
{
  if(value.IsEmpty())
     throw Exception("离职原因说明不能为空!");
  m_LrDesc=value;
}
//---------------------------------------------------------------------------
AnsiString TsdLr::GetFieldValue(euLr sdFieldName)
{
    switch(sdFieldName)
      {
      case fiLrCode:
           return  LrCode;
      case fiLrDesc:
           return  LrDesc;
       }
        throw Exception("当前字段未定义可取值");  
}
//---------------------------------------------------------------------------
void TsdLr::SetFieldValue(euLr sdFieldName, AnsiString value)
{
     value=Trim(value);
    switch(sdFieldName)
      {
    case fiLrCode:
         LrCode=value;
         break;
    case fiLrDesc:
         LrDesc=value;
         break;
      default: 
        throw Exception("当前字段未定义可赋值");  
         
       }
}
//---------------------------------------------------------------------------
TsdLr::TsdLr(TDataComm *DC)
                :TsdStandard(DC)
{
    try
    {
        QueryString="SELECT * FROM sdLr";
        FilterString="";
        OrderString="LrCode";
        EmptyValue(0);
        EmptyValue(1);

    }
    catch(Exception &e)
    {
        ShowMessage(e.Message);
    }
}
TsdLr::TsdLr()
          :TsdStandard()
{
    try
    {
        QueryString="SELECT * FROM sdLr";
        FilterString="";
        OrderString="LrCode";
        EmptyValue(0);
        EmptyValue(1);

    }
    catch(Exception &e)
    {
        ShowMessage(e.Message);
    }
}

//---------------------------------------------------------------------------
TsdLr::~TsdLr()
{
  try{
  }
  catch(...)
  {
    throw Exception("析构函数出错");
  }
}
//---------------------------------------------------------------------------
void TsdLr::BackupValue()
{
      b_LrCode=m_LrCode;
      b_LrDesc=m_LrDesc;
}
//---------------------------------------------------------------------------
void TsdLr::RestoreValue()
{
      m_LrCode=b_LrCode;
      m_LrDesc=b_LrDesc;
}
//---------------------------------------------------------------------------
void TsdLr::EmptyValue(int Index)
{
   switch(Index)
   {
    case 0:
    m_LrCode="";
    m_LrDesc="";
    break;
    case 1:
    b_LrCode="";
    b_LrDesc="";
      break;
    }
}
//---------------------------------------------------------------------------
void TsdLr::BatchLetValue()
{
    m_LrCode=m_Query->FieldValues["LrCode"];
    m_LrDesc=m_Query->FieldValues["LrDesc"];
    BackupValue();
}
//---------------------------------------------------------------------------
void TsdLr::Update()
{
    if(CurStatus==0||CurStatus==1)
        throw Exception("当前不是编辑状态,不能进行存盘操作!");
    if(m_LrCode.IsEmpty()==true)
        throw Exception("单号不能为空!");
    m_StoredProc->Close();
    if(CurStatus==2||CurStatus==4)
    {
        m_StoredProc->ProcedureName="sdLr_Insert";
        m_StoredProc->Parameters->Clear();
        m_StoredProc->Parameters->CreateParameter("@LrCode",ftString,pdInputOutput,18,m_LrCode);
        m_StoredProc->Parameters->CreateParameter("@LrDesc",ftString,pdInput,255,m_LrDesc);

        m_StoredProc->ExecProc();
        m_LrCode=m_StoredProc->Parameters->ParamValues["@LrCode"];

   }
  else
    {
        m_StoredProc->ProcedureName="sdLr_Update";
        m_StoredProc->Parameters->Clear();

        m_StoredProc->Parameters->CreateParameter("@W_LrCode",ftString,pdInput,18,b_LrCode);
        m_StoredProc->Parameters->CreateParameter("@LrCode",ftString,pdInput,18,m_LrCode);
        m_StoredProc->Parameters->CreateParameter("@LrDesc",ftString,pdInput,255,m_LrDesc);
 
       m_StoredProc->ExecProc();


   }
    m_StoredProc->Close();
  TsdLr *p=new TsdLr();
  if(CurStatus==2)
    {
     SetActionID(1);
     p->Assign(this);
     AddRecord((void *)p,p->LrCode);
     }
  else
    {
     SetActionID(1);
     p->Assign(this);
     ChangeRecord((void *)p,p->LrCode,this->b_LrCode);
    }
}
//---------------------------------------------------------------------------
void TsdLr::Delete()
{
    if(CurStatus!=1)
        throw Exception("当前状态不能进行删除操作!");
    if(m_LrCode.IsEmpty()==true)
        throw Exception("当前没有记录可以删除!");
    m_StoredProc->Close();
    m_StoredProc->ProcedureName="sdLr_Delete";
    m_StoredProc->Parameters->Clear();
        m_StoredProc->Parameters->CreateParameter("@W_LrCode",ftString,pdInput,18,b_LrCode);
    m_StoredProc->ExecProc();
    m_StoredProc->Close();
    DeleteRecord(this->b_LrCode);
}
//---------------------------------------------------------------------------
void TsdLr::Assign(TsdLr *p)
{
    this->SetActionID(p->CurStatus);
    this->m_LrCode=p->m_LrCode;
    this->m_LrDesc=p->m_LrDesc;
    this->BackupValue();
}
//---------------------------------------------------------------------------
void TsdLr::AssignValue()
{
    TsdLr *p=(TsdLr *)Records(CurRecNo);
    Assign(p);
}
//---------------------------------------------------------------------------
int TsdLr::Query()
{
    AnsiString m_SqlStr;
    m_SqlStr=QueryString;
    if(FilterString.IsEmpty()==false)
        m_SqlStr=m_SqlStr+" where  "+FilterString;
    if(OrderString.IsEmpty()==false)
        m_SqlStr=m_SqlStr+" Order by "+OrderString;
    m_Query->Close();
    m_Query->SQL->Clear();
    m_Query->SQL->Add(m_SqlStr);
    m_Query->Open();
    ClearRecord();
    if(m_Query->RecordCount>0)
    {
        m_Query->First();
        while(!m_Query->Eof)
        {
            BatchLetValue();
            TsdLr *p=new TsdLr();
            SetActionID(1);
            p->Assign(this);
            AddRecord((void *)p,p->LrCode);
            m_Query->Next();
        }
        MoveFirst();
    }
    m_Query->Close();
    return Count;
}
//---------------------------------------------------------------------------
bool TsdLr::Find(AnsiString WhereStr)
{
    AnsiString m_SqlStr;
    if(WhereStr.IsEmpty()==true)
        throw Exception("查找表达式不能为空");
    m_SqlStr="select * from sdLr where  "+WhereStr;
    m_Query->Close();
    m_Query->SQL->Clear();
   m_Query->SQL->Add(m_SqlStr);
    m_Query->Open();
    if(m_Query->RecordCount!=1)
    {
        m_Query->Close();
        return false;
    }
    else
    {
        BatchLetValue();
        m_Query->Close();
        return true;
    }
}
//**************************************
//     TsdSkill技能等级
//**************************************
//--------------------------------------------------------------
void __fastcall TsdSkill:: SetSkillCode(AnsiString value)
{
 if(value.IsEmpty())
   throw Exception("技能代码不能为空!");
 if(value.UpperCase()!=m_SkillCode.UpperCase())
   {
    m_Query->Close();
    m_Query->SQL->Clear();
    m_Query->SQL->Add("select * from sdSkill where skillcode='"+value+"'");
    m_Query->Open();
    if(m_Query->RecordCount>0)
      {
        m_Query->Close();
        throw Exception("技能代码"+value+"已存在!");
      }
    m_Query->Close();
   }
   m_SkillCode=value;
 }
void __fastcall TsdSkill:: SetSkillName(AnsiString value)
{
 if(value.IsEmpty())
   throw Exception("技能名称不能为空!");
  m_SkillName=value;
}
void __fastcall TsdSkill:: SetSkillDesc(AnsiString value)
{

  m_SkillDesc=value;
}
//---------------------------------------------------------------------------
AnsiString TsdSkill::GetFieldValue(euSkill sdFieldName)
{
    switch(sdFieldName)
    {
      case fiSkillCode:
             return  SkillCode;
      case fiSkillName:
             return  SkillName;
      case fiSkillDesc:
             return  SkillDesc;
    }
        throw Exception("当前字段未定义可取值");  
}
//---------------------------------------------------------------------------
void TsdSkill::SetFieldValue(euSkill sdFieldName, AnsiString value)
{
     value=Trim(value);
    switch(sdFieldName)
    {
    case fiSkillCode:
            SkillCode=value;
        break;
    case fiSkillName:
            SkillName=value;
        break;
    case fiSkillDesc:
            SkillDesc=value;
        break;
      default: 
        throw Exception("当前字段未定义可赋值");  
        
    }
}
//---------------------------------------------------------------------------
TsdSkill::TsdSkill(TDataComm *DC)
                :TsdStandard(DC)
{
    try
    {
        QueryString="SELECT * FROM sdSkill";
        FilterString="";
        OrderString="SkillCode";
        EmptyValue(0);
        EmptyValue(1);

    }
    catch(Exception &e)
    {
        ShowMessage(e.Message);
    }
}
TsdSkill::TsdSkill()
                :TsdStandard()
{
    try
    {
        QueryString="SELECT * FROM sdSkill";
        FilterString="";
        OrderString="SkillCode";
        EmptyValue(0);
        EmptyValue(1);

    }
    catch(Exception &e)
    {
        ShowMessage(e.Message);
    }
}

//---------------------------------------------------------------------------
TsdSkill::~TsdSkill()
{
  try{
  }
  catch(...)
  {
    throw Exception("析构函数出错");
  }
}
//---------------------------------------------------------------------------
void TsdSkill::BackupValue()
{
      b_SkillCode=m_SkillCode;
      b_SkillName=m_SkillName;
      b_SkillDesc=m_SkillDesc;
}
//---------------------------------------------------------------------------
void TsdSkill::RestoreValue()
{
      m_SkillCode=b_SkillCode;
      m_SkillName=b_SkillName;
      m_SkillDesc=b_SkillDesc;
}
//---------------------------------------------------------------------------
void TsdSkill::EmptyValue(int Index)
{
   switch(Index)
   {
    case 0:
    m_SkillCode="";
    m_SkillName="";
    m_SkillDesc="";
    break;
    case 1:
    b_SkillCode="";
    b_SkillName="";
    b_SkillDesc="";
      break;
    }
}
//---------------------------------------------------------------------------
void TsdSkill::BatchLetValue()
{
    m_SkillCode=m_Query->FieldValues["SkillCode"];
    m_SkillName=m_Query->FieldValues["SkillName"];
    m_SkillDesc=m_Query->FieldValues["SkillDesc"];
    BackupValue();
}
//---------------------------------------------------------------------------
void TsdSkill::Update()
{
    if(CurStatus==0||CurStatus==1)
        throw Exception("当前不是编辑状态,不能进行存盘操作!");
    if(m_SkillCode.IsEmpty()==true)
        throw Exception("单号不能为空!");
    m_StoredProc->Close();
    if(CurStatus==2||CurStatus==4)
    {
        m_StoredProc->ProcedureName="sdSkill_Insert";
        m_StoredProc->Parameters->Clear();
        m_StoredProc->Parameters->CreateParameter("@SkillCode",ftString,pdInputOutput,18,m_SkillCode);
        m_StoredProc->Parameters->CreateParameter("@SkillName",ftString,pdInput,20,m_SkillName);
        m_StoredProc->Parameters->CreateParameter("@SkillDesc",ftString,pdInput,40,m_SkillDesc);

        m_StoredProc->ExecProc();
        m_SkillCode=m_StoredProc->Parameters->ParamValues["@SkillCode"];

   }
  else

⌨️ 快捷键说明

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