public FmMaterialMerge(DataRow[] rows) : this() { this.opState = OpState.Add; model = new MergeCard(); model.MCCode = "自动生成"; model.dtDetails = dal.GetDTable(""); model.cInvCode = rows[0]["cInvCode"].ToString(); model.cInvName = rows[0]["cInvName"].ToString(); model.cInvStd = rows[0]["cInvStd"].ToString(); model.dDate = DateTime.Now.Date; model.cMaker = Information.UserInfo.cUser_Name; decimal iqty = 0; foreach (DataRow row in rows) { var r = model.dtDetails.NewRow(); r["cardNo"] = row["cardNo"]; r["cardChildId"] = row["AutoId"]; //r["opSeq"] = row["OpSeq"]; r["OpName"] = row["OpName"]; r["cInvCode"] = row["cInvCode"]; r["cInvName"] = row["cInvName"]; r["cInvStd"] = row["cInvStd"]; r["MergeQuantity"] = row["iQuantity"]; r["cComUnitName"] = row["cComUnitName"]; iqty += Convert.ToDecimal(row["iQuantity"]); model.dtDetails.Rows.Add(r); } model.iQuantity = iqty; }
//新增 private void Add(object sender, EventArgs e) { opState = OpState.Add; model = new MergeCard(); model.dDate = DateTime.Now.Date; this.RefreshUI(); }
//取消 private void Cancel(object sender, EventArgs e) { this.opState = OpState.Browse; this.model = dal.Get(guid); if (model == null) { model = new MergeCard(); } this.RefreshUI(); }
private void FmLoad(object sender, EventArgs e) { this.InitGridView(); if (opState == OpState.Add) { model = new MergeCard(); model.MCCode = "自动生成"; model.dDate = DateTime.Now.Date; } this.RefreshUI(); }
//保存 private void Save(object sender, EventArgs e) { SaveCheck(); if (this.opState == OpState.Add) { this.guid = dal.Add(model); } this.model = dal.Get(guid); this.opState = OpState.Browse; this.RefreshUI(); }
private void BtnSave_Click(object sender, EventArgs e) { string guid = ""; if (opState == OpState.Add) { guid = dal.Add(model); } else if (opState == OpState.Update) { guid = model.Guid; } this.opState = OpState.Browse; this.model = dal.Get(guid); SetUIStatus(opState); }
//删除 private void Delete(object sender, EventArgs e) { this.dal.Delete(guid); this.model = new MergeCard(); this.RefreshUI(); }