private void button1_Click(object sender, EventArgs e) { if (dateTimePicker1.Value >= dateTimePicker2.Value) { System.Windows.Forms.MessageBox.Show("【使用到期日期】必须大于【安装到期日期】"); return; } string key = GetKey(); UserSet u = new UserSetManager().GetItemById(); if (u == null) { u = new UserSet(); u.ID = Guid.NewGuid(); } u.UserInfo = key; new UserSetManager().Save(u); textBox1.Text = u.UserInfo; }
/// <summary> /// 根据ID获取员工设置实体 /// </summary> /// <param name="guid">主键ID</param> /// <returns>返回员工设置实体</returns> public UserSet GetItemById() { UserSet tem = new UserSet(); tem = Dal.From<UserSet>().ToFirst<UserSet>(); return tem; }