zoukankan      html  css  js  c++  java
  • 表单送件按钮代码(一)cs(C#)(未完)

    protected void BtnRequest_Clich(object sender, EventArgs e)

    {

      lblMsg.Text= " " ;

      lblfmsg.Text= " " ;

    TxtEmpID.Text=Coeno.Utility.String.CleanUpInput(TxtEmpID.Text);            --Coeno.Utility命名空间,String类名,CleanUpInput方法名

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

      if (TxtVocMemo.Text.Length>100)

      {

        lblMsg.Text= " 原因不能大于100个字符!!" ;

             lblMsg.ForeColor=System.Drawing.Color.Red ;                              --字体颜色

        lblfmsg.Text= " 原因不能大于100个字符" ;

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

        return ;

      }

            TxtEmpID.Text = Coeno.Utility.String.CleanUpInput(TxtEmpID.Text.Trim().ToUpper());
            TxtAgeEmpID.Text = Coeno.Utility.String.CleanUpInput(TxtAgeEmpID.Text.Trim().ToUpper());

            #region 對於頁面必要欄位是否填寫正確的檢查

      if ( string.IsNullOrEmpty(TxtFormID.Text))

      {

          lblMsg.Text= " 请先申请一张新表单编号!!" ;

             lblMsg.ForeColor=System.Drawing.Color.Red ;                              --字体颜色

        lblfmsg.Text= " 请先申请一张新表单编号!!" ;

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

        return ;

         }

       if (!string.IsNullOrEmpty(TxtAgeEmpID.Text)) &&(TxtAgeEmpID.Text == TxtEmpID.Text))

               {

           lblMsg.Text= " 代理人工号不可与申请者一致!!" ;

              lblMsg.ForeColor=System.Drawing.Color.Red ;                              --字体颜色

         lblfmsg.Text= " 代理人工号不可与申请者一致!!" ;

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

         return ;

          }

       if (string.IsNullOrEmpty(DropDutyCode.SelectedValue))

          {  

          lblMsg.Text= " 请选择申请者正确的【上下班时间】!!" ;

                    lblMsg.ForeColor=System.Drawing.Color.Red ;                              --字体颜色

         lblfmsg.Text = "請選擇請假者正確的【上下班時間】!!!" ;
                   lblfmsg.ForeColor = System.Drawing.Color.Red;
                   return;

       }

                if (string.IsNullOrEmpty(TxtTotalHour.Value)) || TxtTotalHour.Value == "0" )

        {

         lblMsg.Text= " 请正确填写申请时间信息!!" ;

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

            lblfmsg.Text= " 请正确填写申请时间信息!!"

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

            Return;

         }

                System.DateTime OutDatetime;

        if (string.IsNullOrEmpty(TxtVocSTime.Text))

       {

         lblMsg.Text= "开始时间不能为空!! "

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

         lblfmsg.Text= "开始时间不能为空! !" ;

         lblfmsg.ForeColor = System.Drawing.Color.Red

         return;

       }

                else

       {

             if (!System.DateTime.TryParse(TxtVocSTime.Text, out OutDatetime))   --输入的开始时间与系统时间格式不同

          {

            lblMsg.Text = "开始時間有效格式應為(yyyy/MM/dd)!!!" ;

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

            lblfmsg.Text = "开始時間有效格式應為(yyyy/MM/dd)!" ;

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

            return;

           }

              if (!IsDate(TxtVocEtime.Text))

           {

            lblMsg.Text= " 结束时间有效格式应为(yyyy/MM/dd)! ! !" ;

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

            lblfmsg.Text= " 结束时间有效格式应为(yyyy/MM/dd)!" ;

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

            Return;

           }

           }

               if (string.IsNullOrEmpty(TxtVocSHour.Value))

       {

          lblMsg.Text= " 开始时间不能为空!!" ;

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

          lblfmsg.Text= " 开始时间不能为空!!" ;

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

             Return;

          }

          if (string.IsNullOrEmpty(TxtVocSMin.Value))

       {

          lblMsg.Text= " 开始时间不能为空!!" ;

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

          lblfmsg.Text= " 开始时间不能为空!!" ;

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

             Return;

          }

          if (gvNewBody.Rows.Count<1)

       {

          lblMsg.Text= " 请点【计算】拆分时间段!!"

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

          lblfmsg.Text= " 请点击【计算】拆分时间段!!" ;

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

          return;

          }

       else

        {

          for (int t =0; t<gvNewBody.Rows.Count ; t++)

               {

            double vhou =0;

            if (!double.TryParse(( (TextBox)gvNewBody.Rows[t] .FindControl( "txtNewBodyVocaHours " ) ).Text.ToString(),out vhou  ))

            {

              lblMsg.Text= " 时数格式错误!!" ;

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

              lblfmsg.Text= " 时数格式错误" ;

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

                 return ;

            }

          }

        }

             #endregion

      //检查申请时数是否符合标准

      double totalhours = 0;

      string v_msg=string.Empty ;

      if (!double.TryParse(TxtTotalHours.value,out totalhours))   --TxtTotalHours.value的值与输出的totalhours样式不同

      {

        lblMsg.Text= " 总时数格式错误" ;

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

        lblfmsg.Text= "总时数格式错误 " ;

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

        return;

      }

            if (!CheckSmallestUnit(totalhours,out v_msg))                                                  --判斷請假單位不为空

         {

        lblMsg.Text=v_msg;

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

        lblfmsg.ForeColor=v_msg;

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

        return;

      }

    }

  • 相关阅读:
    mysql命令集锦
    linux 删除文件名带括号的文件
    linux下的cron定时任务
    struts2文件下载的实现
    贴一贴自己写的文件监控代码python
    Service Unavailable on IIS6 Win2003 x64
    'style.cssText' is null or not an object
    "the current fsmo could not be contacted" when change rid role
    远程激活程序
    新浪图片病毒
  • 原文地址:https://www.cnblogs.com/ximi07/p/10584592.html
Copyright © 2011-2022 走看看