public static BasicInfo GetBasicInfoById(int id) { try { var ps = BasicInfo.FindById(id); return(ps); } catch { return(null); } }
public static bool DeleteBasicInfo(int basicInfoId) { try { BasicInfo basic = BasicInfo.FindById(basicInfoId); basic.IsDelete = true; basic.Save(); } catch { return(false); } return(true); }
public static bool UpdateBasicInfo(int basicInfoId, string name, string phone, string email, string address, string zipcode) { try { BasicInfo basic = BasicInfo.FindById(basicInfoId); basic.Name = name; basic.Phone = phone; basic.Email = email; basic.DepartmentAddress = address; basic.ZipCode = zipcode; basic.Save(); } catch { return(false); } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (basicInfoId != 0)//修改 { btn_Add.Text = "确认修改"; //回填 try { BasicInfo basic = BasicInfo.FindById(basicInfoId); tb_name.Text = basic.Name; tb_phone.Text = basic.Phone; tb_email.Text = basic.Email; } catch (Exception ex) { text(ex.ToString()); Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('数据加载错误,请重新再试!')", true); } } } }