//============================== public int AddClass(QMItemClass model) { string sql = "insert into QM_QMItemClass output inserted.QMCId values(@QMCCode, @QMCName, @cMaker, @dCreateDate)"; model.dCreateDate = DateTime.Now; return(conn.ExecuteScalar <int>(sql, model)); }
private void FormLoad(object sender, EventArgs e) { #region 加载主窗体事件 if (opState == OpState.Add) { model = new QMItemClass() { cMaker = Information.UserInfo.cUser_Name }; lblModuleTitle.Text = "新增 - " + this.lblModuleTitle.Text; } else if (opState == OpState.Update) { oldCode = model.QMCCode; lblModuleTitle.Text = "编辑 - " + this.lblModuleTitle.Text; } UIControl.SetStatus(Head_Bar, tab_Main.AttachedControl, opState); UIBinding <QMItemClass> .UIDataBinding(panelEx1, model); #endregion }
public void UpdateClass(QMItemClass model) { string sql = "update QM_QMItemClass set QMCCode = @QMCCode, QMCName = @QMCName where QMCId = @QMCId"; conn.Execute(sql, model); }