private void BatSaveBtn_Click(object sender, EventArgs e) { DateTime now = DateTime.Now; string user = UserBLL.userInfo.UserName; #region 组装物料对应关系信息 MatMaping matMaping = new MatMaping { CustomMat = materialTB.Text.Trim(), Mat_ID = hscMat_ID.Text.Trim(), createDate = now, createUser = user, modifyDate = now, modifyUser = user }; #endregion string Msg = string.Empty; if (!SaveValidate(ref Msg)) { MessageBox.Show(Msg); return; } var result = matMapingbll.AddMatMapingInfo(matMaping); MessageBox.Show(result.Msg); }
private void matMapingSaveBTN_Click(object sender, EventArgs e) { if (matMapingModel == null) { MessageBox.Show("界面数据获取异常,请重新打开编辑界面!"); this.Close(); return; } if (string.IsNullOrEmpty(hscMat_ID.Text.Trim())) { MessageBox.Show("新物料号不能为空,请检查!"); return; } #region 更新对象组装 matMapingModel.Mat_ID = hscMat_ID.Text.Trim(); matMapingModel.modifyDate = DateTime.Now; matMapingModel.modifyUser = UserBLL.userInfo.UserName; #endregion MatMapingBLL matMapingbll = new MatMapingBLL(); var rv = matMapingbll.UpdateMatMapingInfo(matMapingModel); MessageBox.Show(rv.Msg); this.DialogResult = DialogResult.OK; this.matMapingModel = null; this.Close(); }
/// <summary> /// 物料对应关系删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void matRelationDelBtn_Click(object sender, EventArgs e) { if (matRelationDGV.SelectedRows.Count <= 0) { MessageBox.Show("至少选中一行数据"); return; } if (MessageBox.Show("确认删除" + matRelationDGV.SelectedRows.Count + "条记录?", "此删除不可恢复", MessageBoxButtons.YesNo) == DialogResult.Yes) { List <string> list = new List <string>(); foreach (DataGridViewRow item in matRelationDGV.SelectedRows) { MatMaping matMapingModel = (MatMaping)item.DataBoundItem; list.Add(matMapingModel.CustomMat); } var rv = matMapingbll.DelMatMapingInfo(list.ToArray()); MessageBox.Show(rv.Msg); } Search(sender); }
/// <summary> /// 编辑物料对应关系 /// </summary> /// <param name="model"></param> /// <returns></returns> public ReturnValue UpdateMatMapingInfo(MatMaping model) { ReturnValue rv = new ReturnValue(); var matDao = SqlSugarDB.Instance <MatMaping>(); try { int result = matDao.Update(model).ExecuteCommand(); if (result > 0) { return(rv.Success("更新成功!")); } else { return(rv.Fail("物料对应关系更新失败!")); } } catch (Exception e) { return(rv.Fail(e.Message)); } }
public UpdateMatRelationForm(MatMaping model) { InitializeComponent(); this.matMapingModel = model; }