public void SaveButton_Click(object sender, EventArgs e)
    {
        RS_ScoreManageModel smModel = new RS_ScoreManageModel();
        RS_EmployScoreModel esModel = new RS_EmployScoreModel();
        RS_EmployScoreBFL   esBFL;

        smModel.MarkDate = bfl.GetMonthFirstDate(DateTime.Now);
        smModel.Marker   = user.UserCode;
        smModel.Status   = WorkFlowStatus.Audited.ToString("d");
        smModel.Type     = Int32.Parse(ScoreType.Dept.ToString("d"));
        int manageCode = bfl.Insert(smModel);

        foreach (GridViewRow gvRow in GridView1.Rows)
        {
            HtmlInputHidden hidDeptCode = (HtmlInputHidden)(gvRow.FindControl("HidUnitCode"));
            TextBox         tbScore     = (TextBox)(gvRow.FindControl("ScoreTextBox"));
            esModel.ManageCode = manageCode;
            esModel.UserCode   = hidDeptCode.Value;
            int score = 1;
            Int32.TryParse(tbScore.Text.Trim(), out score);
            esModel.Score = score;
            esBFL         = new RS_EmployScoreBFL();
            esBFL.Insert(esModel);
        }

        Response.Write("<script> window.opener.location.reload();window.close();</script>");
    }
    protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        RS_EmployScoreModel es          = new RS_EmployScoreModel();
        RS_ScoreManageModel tempSmModel = new RS_ScoreManageModel();

        tempSmModel.DeptCode = Request.QueryString["UnitCode"];
        tempSmModel.Marker   = user.UserCode;
        tempSmModel.MarkDate = smBFL.GetMonthFirstDate(DateTime.Now);
        tempSmModel.Type     = Int32.Parse(ScoreType.Employ.ToString("d"));
        tempSmModel.Status   = WorkFlowStatus.Apply.ToString("d").ToString();
        int tempCode = smBFL.Insert(tempSmModel);

        foreach (GridViewRow gvRow in GridView1.Rows)
        {
            int score = 1;
            es = new RS_EmployScoreModel();
            TextBox         tbScore     = (TextBox)(gvRow.FindControl("ScoreTextBox"));
            HtmlInputHidden hidUserCode = (HtmlInputHidden)(gvRow.FindControl("HidUserCode"));
            es.UserCode = hidUserCode.Value;
            Int32.TryParse(tbScore.Text, out score);
            es.Score      = score;
            es.ManageCode = tempCode;
            esBFL         = new RS_EmployScoreBFL();
            esBFL.Insert(es);
        }
        Response.Redirect("RS_ScoreForEmployEdit.aspx?FKCode=" + tempCode.ToString() + "&DeptCode=" + Request.QueryString["UnitCode"] + "");
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.HasFiles())
     {
         this.GridView1.RowDataBound += new GridViewRowEventHandler(GridView1_RowDataBound);
     }
     else
     {
         this.GridView1.RowDataBound += new GridViewRowEventHandler(GridView1_RowDataBound2);
     }
     if (!Page.IsPostBack)
     {
         lsModel = smBFl.GetDeptScores(user.UserCode, RS_ScoreExtend.CheckMonth, "Load");
         if (lsModel != null && lsModel.Count != 0)
         {
             dtNow             = DateTime.Parse(lsModel[0].MarkTime);
             ViewState["Time"] = dtNow;
             if (dtNow == smBFl.GetMonthFirstDate(RS_ScoreExtend.CheckMonth))
             {
                 hasScored = true;
             }
             else
             {
                 hasScored = false;
             }
         }
         else
         {
             //dtNow = DateTime.Now;
             ViewState["Time"] = RS_ScoreExtend.CheckMonth;
             hasScored         = false;
         }
         this.GridView1.DataSource = lsModel;
         this.GridView1.DataBind();
         if (hasScored.Equals(true))
         {
             this.AddButton.Enabled = false;
         }
     }//添加新记录后的页面刷新
     else
     {
         if (ScorceMonth.Value.Equals(string.Empty))
         {
             lsModel = smBFl.GetDeptScores(user.UserCode, RS_ScoreExtend.CheckMonth, "");
             this.GridView1.DataSource = lsModel;
             this.GridView1.DataBind();
             this.AddButton.Enabled = false;
         }
     }
     this.InitNavigator();
 }