Пример #1
0
        public async Task <ActionResult> PutStudent(long id, Student student)
        {
            if (id != student.Id)
            {
                return(BadRequest());
            }
            studentBusiness.UpdateStudent(student);

            return(NoContent());
        }
Пример #2
0
        private string Save()
        {
            try
            {
                //新增时判重,通过姓名,证件类型,证件号码进行唯一性判别别。
                if (isNew == 1 && Student.FindOne(CK.K["Name"] == tb_AssociationName.Text && CK.K["IdentityNo"] == tb_OrganizationCode.Text && CK.K["IsDelete"] == false) != null)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('此人信息已存在,请勿重复添加!')", true);
                    return("fail");
                }
                string   name           = tb_AssociationName.Text;
                bool     sex            = !radio_1.SelectedValue.Equals("1");
                String   identityNo     = tb_OrganizationCode.Text;
                DateTime birthday       = input_RegisterDate.Value.Equals("") ? new DateTime(1900, 1, 1) : Convert.ToDateTime(input_RegisterDate.Value);
                String   school         = ddl_School.SelectedValue;
                int      studyTypeId    = Convert.ToInt32(ddl_StudyType.SelectedValue);
                DateTime joinSchoolDate = input_JoinSchoolDate.Value.Equals("") ? new DateTime(1900, 1, 1) : Convert.ToDateTime(input_JoinSchoolDate.Value);
                String   major          = tb_ContactName.Text;
                String   systemOfEdu    = tb_Telephone.Text;
                String   phoneNo        = tb_Fax.Text;
                String   AddressOfH     = tb_ScopeOfBusiness.Text;
                //String addressOfTW = "台湾省" + ddl_csmc.SelectedValue;//TextBox1.Text;
                String tip = TextBox3.Text;

                string result = "";
                if (isNew == 0) //修改
                {
                    result = StudentBusiness.UpdateStudent(id, name, sex, identityNo, birthday, school, studyTypeId, joinSchoolDate, major, systemOfEdu, phoneNo, AddressOfH, tip);
                    LogInfoBusiness.AddLogInfo(Convert.ToInt32(log_userid), DateTime.Now, Convert.ToInt32(log_usertype), log_username, 4, "在校本科生信息", log_ip, log_account);//修改添加日志 操作类型->4
                }
                else
                {
                    result = StudentBusiness.AddStudentForNew(id, name, sex, identityNo, birthday, school, studyTypeId, joinSchoolDate, major, systemOfEdu, phoneNo, AddressOfH, tip);
                    LogInfoBusiness.AddLogInfo(Convert.ToInt32(log_userid), DateTime.Now, Convert.ToInt32(log_usertype), log_username, 2, "在校本科生信息", log_ip, log_account);//新增添加日志 操作类型->2
                }
                return(result);
            }
            catch (Exception ex)
            {
                //Page.RegisterStartupScript("alert", "<script>alert('数据加载失败!')</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('数据加载错误!')", true);
                text(ex.ToString());
                return("");
            }
        }