protected void btn_Add_Click(object sender, EventArgs e) { string name = tb_PeriodicalName.Text; bool sex = !radio_1.SelectedValue.Equals("1"); DateTime birthday = new DateTime(1900, 1, 2); try { birthday = input_RegisterDate.Value.Equals("") ? birthday : Convert.ToDateTime(input_RegisterDate.Value); } catch (Exception ex) { text(ex.ToString()); Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('时间输入格式不规范,请重新输入!')", true); return; } String relationship = tb_PublishCount.Text; String company = tb_EIC_Name.Text; String tip = tb_EO_Address.Text; bool result = false; if (familyId != 0) //修改 { result = FamilyOfPeopleBusiness.UpdateFamilyOfPeople(familyId, name, sex, birthday, relationship, company, tip); if (!result) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('修改失败,请重新再试!')", true); return; } Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg('修改成功', 2, -1);close();", true); } else //新增 { result = FamilyOfPeopleBusiness.AddFamilyOfPeople(peopleId, name, sex, birthday, relationship, company, tip); if (!result) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('新增失败,请重新再试!')", true); return; } Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg('新增成功', 2, -1);close();", true); } }