zoukankan      html  css  js  c++  java
  • 点击按钮触发事件调用存储过程1

    protected void btnAdd_Click(object sender,EventArgs e)

    {

      txtEmpID.Text = Coeno.Utility.String.CleanUpInput(txtEmpID.Text); 

      txtEmpName.Text= Coeno.Utility.String.CleanUpInput(txtEmpName.Text);

      txtEmpCardID.Text = Coeno.Utility.String.CleanUpInput(txtEmpCardID.Text);

           --(点击按钮触发事件调用存储过程2)

      string EmpCardID = txtEmpCardID.Text + "-" + txtEmpID.Text;

      if(string.IsNullOrEmpty(txtEmpID.Text))

      {

        lblMsg.Text = "工号不可为空";

        lblMsg.ForeColor = System.Drawing.Color.Red;

        return;

      }

      if(string.IsNullOrEmpty(txtEmpCard.Text))

      {

        lblMsg.Text="卡号不可为空";

        lblMsg.ForeColor=System.Drawing.Color.Red;

        return;

      }

      if(txtEmpCardID.Text.Length!=10)

      {

        lblMsg.Text="卡号必须是10位";

        lblMsg.ForeColor=System.Drawing.Color.Red;

        return;

      }

      string ReturnStatus = "";

         string ReturnID="";

      string ReturnMsg="";

      try

      {

         Coeno.GSManaweb.EmpCard.AddICCard(txtEmpID.Text,EmpCardID,txtEmpCardID.Text,txtCurrentEmpID.Text,out ReturnStatus,Out ReturnID,out ReturnMsg);

         --(点击按钮触发事件调用存储过程4)

        if(ReturnStatus=="1")

        {

          QueryCard();

          lblMsg.Text = ReturnMsg;

          lblMsg.ForeColor = System.Drawing.Color.Blue;

          

          txtEmpID.Text = " ";

          txtEmpCardID.Text = " ";

          txtEmpName.Text = " ";

          txtDeptID.Text = " ";

          txtDeptName.Text = “ ”; 

          return;

        }

        else

        {

          lblMsg.Text = ReturnMsg;

          lblMsg.ForeColor = System.Drawing.Color.Red;

          

          GVInfo.EditIndex = -1;

          QueryCard();

          return

        }

      }

      catch(Exception ed)

      {

        lblMsg.Text="卡號資料新增失敗"

        lblMsg.ForeColor = System.Drawing.Color.Red;

        QueryCard();

        return;

      }

    }

    --QueryCard

    public void QueryCard()

    {

      txtEmpID.Text = Coeno.Utility.String.CleanUpInput(txtEmpID.Text);

      txtEmpName.Text = Coeno.Utility.String.CleanUpInput(txtEmpName.Text);

      txtEmpCardID.Text = Coeno.Utility.String.CleanUpInput(txtEmpCardID.Text);

      if (string.IsNullOrEmpty(txtEmpID.Text)&&string.IsNullOrEmpty(txtEmpCardID.Text))

      {

        lblMsg.Text = "請至少輸入一個查詢條件";

        lblMsg.ForeColor = System.Drawing.Color.Red;

        return;

      }

      DataTable da = Coeno.GSManaweb.EmpCard.GetICCardInfo(txtEmpID.Text,txtEmpCardID.Text);

           --点击按钮触发事件调用存储过程6

      if(da.Row.Count>0)

      {

        GVInfo.DataSource = da;

        GVInfo.DataBind();

      }

      else

      {

        lblMsg.Text = "無相關資料";

        lblMsg.ForeColor = System.Drawing.Color.Red;

        GVInfo.DataSource = null;

        GVInfo.DataBind();

      }

     

    }

  • 相关阅读:
    阿里云弹性计算研发团队如何从0到1自建SRE体系
    开创云端时空智能,千寻位置加速三维实景中国建设
    实时复制真实世界,51World用云上数字孪生变革产业
    阿里云弹性计算性能测试负责人三年实战复盘 | 性能测试没那么简单
    阿里技术实战:一些云上资源调度的经验谈
    阿里云第七代云服务器,引领IaaS市场四大趋势
    最新干货!如何深入集群调度与管理?
    E2E性能再攀高峰、安全再加码,阿里云第七代ECS云服务器正式进入公测阶段
    centos7装linux翻译软件
    MySql 5.7中添加用户,新建数据库,用户授权,删除用户,修改密码
  • 原文地址:https://www.cnblogs.com/ximi07/p/11143387.html
Copyright © 2011-2022 走看看