コード例 #1
0
        protected void gvScore_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            int          daysid        = Convert.ToInt32(gvScore.DataKeys[e.RowIndex].Value);
            DayScoreInfo days          = new DayScoreInfo(daysid);
            TextBox      txtToday      = gvScore.Rows[e.RowIndex].FindControl("txtToday") as TextBox;
            TextBox      txtItem       = gvScore.Rows[e.RowIndex].FindControl("txtItem") as TextBox;
            TextBox      txtFinishTime = gvScore.Rows[e.RowIndex].FindControl("txtFinishTime") as TextBox;
            TextBox      txtTimeSpan   = gvScore.Rows[e.RowIndex].FindControl("txtTimeSpan") as TextBox;
            TextBox      txtMemo       = gvScore.Rows[e.RowIndex].FindControl("txtMemo") as TextBox;
            DropDownList ddlRole       = gvScore.Rows[e.RowIndex].FindControl("ddlRole") as DropDownList;

            try
            {
                days.Today      = txtToday.Text.ToString();
                days.Item       = txtItem.Text.ToString();
                days.FinishTime = txtFinishTime.Text.ToString();
                days.TimeSpan   = txtTimeSpan.Text.ToString();
                days.Memo       = txtMemo.Text.ToString();
                days.DayRoleId  = Convert.ToInt32(ddlRole.SelectedValue);
                days.Save();
                gvScore.EditIndex = -1;
                gvDataBind();
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('更新失败:" + ex.Message + "');", true);
            }
        }
コード例 #2
0
ファイル: ScoreApprove.aspx.cs プロジェクト: xingfudaiyan/OA
        protected void btnSave_Click(object sender, EventArgs e)
        {
            WeekScoreInfo wk  = new WeekScoreInfo(Convert.ToInt32(ViewState["wkid"]));
            float         sum = 0;

            foreach (GridViewRow row in gvScore.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    int          dayid = Convert.ToInt32(gvScore.DataKeys[row.RowIndex].Value);
                    DayScoreInfo days  = new DayScoreInfo(dayid);

                    TextBox txtScore = gvScore.Rows[row.RowIndex].FindControl("txtScore") as TextBox;
                    days.Score = txtScore.Text.ToString();
                    days.Save();
                    if (txtScore.Text.ToString() != "")
                    {
                        sum = sum + float.Parse(txtScore.Text.ToString());
                    }
                }
            }
            wk.TotalScore = sum.ToString();
            wk.IsSubmit   = 2;
            wk.Save();

            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('保存成功!');</script>");
        }
コード例 #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            DayScoreInfo das = new DayScoreInfo();

            das.WeekScoreId = Convert.ToInt32(ViewState["wksid"]);
            das.DayRoleId   = Convert.ToInt32("1");
            das.Save();
            gvDataBind();
        }
コード例 #4
0
        protected void Init()
        {
            WeekScoreInfo weekscore = new WeekScoreInfo();

            weekscore.IsSubmit = 0;
            int emid = Convert.ToInt32(Request["EmployeeId"]);

            weekscore.EmployeeId = emid;
            weekscore.Save();
            WeekScoreInfo wk = new WeekScoreInfo(weekscore.WeekScoreId);

            wk.WeekScoreNum = DateTime.Now.Date.ToString("yyyyMMdd") + weekscore.WeekScoreId.ToString();
            wk.Save();
            ViewState["wksid"] = weekscore.WeekScoreId;
            for (int i = 0; i < 5; i++)
            {
                DayScoreInfo dayscore = new DayScoreInfo();
                dayscore.WeekScoreId = (int)ViewState["wksid"];
                dayscore.DayRoleId   = Convert.ToInt32("1");
                dayscore.Save();
            }
        }