public static void Update(Alter entity) { using (ISession session = SessionFactory.OpenSession()) { session.Update(entity); session.Flush(); } }
public static object Add(Alter entity) { entity.Serial = GetLatestSerial(); using (ISession session = SessionFactory.OpenSession()) { var id = session.Save(entity); session.Flush(); return id; } }
/// <summary> /// 根据获得的注册信息设置控件内容 /// </summary> /// <param name="alter"></param> private void setAlterInfo(Alter alter) { this.category.Text = alter.Category; this.license.Text = alter.License; this.ownerName.Text = alter.OwnerName; this.purpose.Text = alter.Purpose; this.owner.Text = alter.Owner; this.newAddress.Text = alter.NewAddress; this.postAddress.Text = alter.PostAddress; this.postcode.Text = alter.Postcode; this.email.Text = alter.Email; this.phone.Text = alter.Phone; this.mobile.Text = alter.Mobile; this.province.Text = alter.Province; this.department.Text = alter.Department; this.engine.Checked = alter.Engine; this.body.Checked = alter.Body; this.color.Checked = alter.Color; this.whole.Checked = alter.Whole; this.engineCode.Checked = alter.EngineCode; this.vin.Checked = alter.Vin; this.idCode.Checked = alter.IdCode; this.information.Text = alter.Information; this.agentName.Text = alter.AgentName; this.agentPhone.Text = alter.AgentPhone; this.agentPostcode.Text = alter.AgentPostcode; this.agentAddress.Text = alter.AgentAddress; this.agentEmail.Text = alter.AgentEmail; this.handlerName.Text = alter.HandlerName; this.handlerPhone.Text = alter.HandlerPhone; }
/// <summary> /// 当光标焦点至于流水号时,用户回车产生新的流水号或获取流水号对应数据信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void serial_Leave(object sender, EventArgs e) { if (this.serial.ReadOnly || (this.serial.Text.Length != 11 && this.serial.Text.Length != 0)) { return; } //InitComboBox(); if (Utilities.IsNullOrEmpty(this.serial.Text)) { alter = new Alter(); this.serial.Text = AlterDao.GetLatestSerial(); this.setControlReadOnly(false); this.category.Focus(); this.isUpdate = false; } else { alter = AlterDao.GetBySerial(this.serial.Text); if (alter != null) { this.setControlReadOnly(false); this.isUpdate = true; setAlterInfo(alter); this.category.Focus(); } else { this.serial.Focus(); } } }