示例#1
0
        protected void bAddEmploymentInfo_Click(object sender, EventArgs e)
        {
            CY.GFive.Core.Business.GraduationInfo ngi = new CY.GFive.Core.Business.GraduationInfo();
            IList<CY.GFive.Core.Business.GraduationInfo> testngi = CY.GFive.Core.Business.GraduationInfo.GetGraduationInfoListByQuery(" [StdCode]='" + txtStdCode.Text.Trim()+"'");
            if (testngi.Count != 0)
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('错误:该学生就业信息已存在!');location.href='EmploymentInfoList.aspx';</script>");
                return;
            }
            ngi.StdCode = txtStdCode.Text.Trim();
            try
            {
                if (!string.IsNullOrEmpty(ddlEntName.SelectedValue))
                    ngi.EntName = ddlEntName.SelectedItem.ToString();
                if (!string.IsNullOrEmpty(txtProDate.Text))
                {
                    ngi.ProDate = DateTime.Parse(txtProDate.Text);
                    txtProDate.Text = "";
                }
                if (!string.IsNullOrEmpty(txtEmployDate.Text))
                {
                    ngi.EmployDate = DateTime.Parse(txtEmployDate.Text);
                    txtEmployDate.Text = "";
                }
                if (!string.IsNullOrEmpty(ddlEntName.SelectedValue))
                    ngi.EntCode = ddlEntName.SelectedValue;
                ngi.AddDate = DateTime.Now;
                if (!string.IsNullOrEmpty(ddlEmployCate.SelectedValue))
                    ngi.EmployCate = ddlEmployCate.SelectedValue;
                if (!string.IsNullOrEmpty(ddlAdderCode.SelectedValue))
                    ngi.AdderCode = ddlAdderCode.SelectedValue;
                if (!string.IsNullOrEmpty(txtProtcolCode.Text))
                    ngi.ProtcolCode = txtProtcolCode.Text;
                ngi.Save();
                ErrorMsg.Text = "添加成功";
                txtProDate.Text = "";
                txtProtcolCode.Text = "";
                txtStdCode.Text = "";

            }
            catch (Exception ex)
            {
                ErrorMsg.Text = ("错误:" + ex.Message);
            }
        }
示例#2
0
 protected void bDelete_Click(object sender, EventArgs e)
 {
     CheckBox cb;
     CY.GFive.Core.Business.GraduationInfo gi = new CY.GFive.Core.Business.GraduationInfo();
     for (int i = 0; i < GridView1.Rows.Count; i++)
     {
         cb = (CheckBox)GridView1.Rows[i].FindControl("chkSelect");
         if (cb.Checked)
         {
             int iID = int.Parse(GridView1.DataKeys[i].Value.ToString());
             gi = CY.GFive.Core.Business.GraduationInfo.Load(iID);
             if (gi != null)
             {
                 gi.DeleteOnSave();
                 gi.Save();
             }
         }
     }
     BindEmploymentInfoList(sql);
 }