public async Task <Result> AddWareAsync(reqmodel <AddWareModel> reqmodel) { Result result = new Result { code = ErrorCodeConst.ERROR_1030, status = ErrorCodeConst.ERROR_403 }; string sql_insert = g_sqlMaker.Insert <t_ware>(i => new { i.name, i.location, i.remark, i.state, i.status }).ToSQL(); t_ware model = new t_ware { name = reqmodel.Data.name, location = reqmodel.Data.location, remark = reqmodel.Data.remark, state = (int)EnumState.Normal, status = (int)EnumStatus.Enable }; bool insert_flag = await g_dbHelper.ExecAsync(sql_insert, model) > 0; if (!insert_flag) { result.code = ErrorCodeConst.ERROR_1018; return(result); } result.code = ErrorCodeConst.ERROR_1019; result.status = ErrorCodeConst.ERROR_200; return(result); }
public WareResult(t_ware model) { this.id = model.id; this.name = model.name; this.location = model.location; this.remark = model.remark; this.status = model.status; this.add_time = model.add_time; }
private void btnOK_Click(object sender, EventArgs e) { using (var db = new Database()) { if (EditMode == Web.Core.Enums.EnViewEditMode.Edit) { var kt = db.FirstOrDefault <t_ware>("where warename=@0 and guid <> @1", txtName.Text, GuidKey); if (null != kt) { MsgBox.ShowMessage("提示", "仓库名称已存在!"); txtName.Select(); return; } var et = db.FirstOrDefault <t_ware>(" where guid=@0", this.GuidKey); et.WareName = txtName.Text; et.WareCode = txtCode.Text; et.IsUsing = chk.Checked; db.Save(et); } else { var kt = db.FirstOrDefault <t_ware>("where warename=@0", txtName.Text); if (null != kt) { MsgBox.ShowMessage("提示", "仓库名称已存在!"); txtName.Select(); return; } var et = new t_ware { Guid = Guid.NewGuid(), WareCode = txtCode.Text, WareName = txtName.Text, IsUsing = chk.Checked, Creator = this.CurUser, CreateDate = TimeSync.Default.CurrentSyncTime }; db.Save(et); } } DialogResult = System.Windows.Forms.DialogResult.OK; Close(); }
private void btnOK_Click(object sender, EventArgs e) { using (var db = new Database()) { if (EditMode == Web.Core.Enums.EnViewEditMode.Edit) { var kt = db.FirstOrDefault<t_ware>("where warename=@0 and guid <> @1", txtName.Text,GuidKey); if (null != kt) { MsgBox.ShowMessage("提示", "仓库名称已存在!"); txtName.Select(); return; } var et = db.FirstOrDefault<t_ware>(" where guid=@0", this.GuidKey); et.WareName = txtName.Text; et.WareCode = txtCode.Text; et.IsUsing = chk.Checked; db.Save(et); } else { var kt = db.FirstOrDefault<t_ware>("where warename=@0", txtName.Text); if (null != kt) { MsgBox.ShowMessage("提示", "仓库名称已存在!"); txtName.Select(); return; } var et = new t_ware { Guid= Guid.NewGuid(), WareCode = txtCode.Text, WareName = txtName.Text, IsUsing = chk.Checked, Creator=this.CurUser, CreateDate=TimeSync.Default.CurrentSyncTime }; db.Save(et); } } DialogResult = System.Windows.Forms.DialogResult.OK; Close(); }