コード例 #1
0
        protected void btnSubmit2_Click(object sender, EventArgs e)
        {
            string start        = this.txtStartTime2.Text;
            string end          = this.txtendTime2.Text;
            string school       = this.txtSchool.Text;
            string professional = this.txtStudyProfessional.Text;
            string graduateTime = this.txtGraduateTime.Text;

            if (ViewState["EditId2"] == null)
            {//添加
                modelstudyresume.dbo_StartTime    = start;
                modelstudyresume.dbo_EndTime      = end;
                modelstudyresume.dbo_School       = school;
                modelstudyresume.dbo_Professional = professional;
                modelstudyresume.dbo_GraduateTime = graduateTime;
                modelstudyresume.dbo_TeacherId    = Convert.ToInt32(teacherId);
                bllteacherstudayresume.Add(modelstudyresume);

                BindGridViews();
                sys.regisgerScirpt("window.location.hash='resumes2';\n", "tags");
                sys.alert("添加成功!");
            }
            else
            {//编辑
                string editId = ViewState["EditId2"].ToString();
                modelstudyresume = bllteacherstudayresume.GetModel(Convert.ToInt32(editId));
                modelstudyresume.dbo_StartTime    = start;
                modelstudyresume.dbo_EndTime      = end;
                modelstudyresume.dbo_School       = school;
                modelstudyresume.dbo_Professional = professional;
                modelstudyresume.dbo_GraduateTime = graduateTime;
                bllteacherstudayresume.Update(modelstudyresume);
                this.BindGridViews();
                ViewState["EditId2"] = null;
                sys.regisgerScirpt("window.location.hash='resumes2';\n", "tags");
                sys.alert("编辑成功!");
            }

            this.txtStartTime2.Text        = "";
            this.txtendTime2.Text          = "";
            this.txtSchool.Text            = "";
            this.txtStudyProfessional.Text = "";
            this.txtGraduateTime.Text      = "";
        }
コード例 #2
0
 protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "myEdit")
     {
         ViewState["EditId2"] = e.CommandArgument;
         modelstudyresume     = bllteacherstudayresume.GetModel(Convert.ToInt32(e.CommandArgument));
         if (modelstudyresume != null)
         {
             this.txtStartTime2.Text        = modelstudyresume.dbo_StartTime;
             this.txtendTime2.Text          = modelstudyresume.dbo_EndTime;
             this.txtSchool.Text            = modelstudyresume.dbo_School;
             this.txtStudyProfessional.Text = modelstudyresume.dbo_Professional;
             this.txtGraduateTime.Text      = modelstudyresume.dbo_GraduateTime;
         }
         this.btnSubmit2.Text = "保存";
         //输出客户端脚本显示编辑内容
         sys.regisgerScirpt("document.getElementById('pnl2').style.display = 'block';\n document.getElementById('btnAdd2').style.display='none';\n");
         sys.regisgerScirpt("window.location.hash='resumes2';\n", "tags");
     }
 }