示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (familyId != 0)//修改
         {
             btn_Add.Text = "确认修改";
             //回填
             try
             {
                 FamilyOfStudent fam = FamilyOfStudent.FindById(familyId);
                 tb_PeriodicalName.Text = fam.Name;
                 radio_1.SelectedValue  = (bool)fam.Sex ? "2" : "1";
                 //input_RegisterDate.Value = fam.Birthday.ToString().Substring(0, 9);
                 input_RegisterDate.Value = DateTime.Compare((DateTime)fam.Birthday, new DateTime(1900, 1, 1)) > 0 ? ((DateTime)fam.Birthday).ToString("yyyy/MM/dd") : "";
                 tb_PublishCount.Text     = fam.Relationship;
                 tb_EIC_Name.Text         = fam.Company;
                 tb_EO_Address.Text       = fam.Tip;
             }
             catch (Exception ex)
             {
                 text(ex.ToString());
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('数据加载错误,请重新再试!')", true);
             }
         }
     }
 }
示例#2
0
 public static bool deleteFamilyOfStudent(int stuId)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             FamilyOfStudent stu = FamilyOfStudent.FindById(stuId);
             stu.IsDelete        = true;
             stu.Save();
         });
     }
     catch { return(false); }
     return(true);
 }
示例#3
0
 public static bool UpdateFamilyOfStudent(int family_id, string name, bool sex, DateTime birthday, String relationship, String company, String tip)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             FamilyOfStudent stu = FamilyOfStudent.FindById(family_id);
             stu.Name            = name;
             stu.Sex             = sex;
             stu.Birthday        = birthday;
             stu.Relationship    = relationship;
             stu.Company         = company;
             stu.Tip             = tip;
             stu.Save();
         });
     }
     catch { return(false); }
     return(true);
 }