Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        //新增
        private void Add(object sender, EventArgs e)
        {
            opState     = OpState.Add;
            model       = new MergeCard();
            model.dDate = DateTime.Now.Date;

            this.RefreshUI();
        }
Esempio n. 3
0
 //取消
 private void Cancel(object sender, EventArgs e)
 {
     this.opState = OpState.Browse;
     this.model   = dal.Get(guid);
     if (model == null)
     {
         model = new MergeCard();
     }
     this.RefreshUI();
 }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        //保存
        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();
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 //删除
 private void Delete(object sender, EventArgs e)
 {
     this.dal.Delete(guid);
     this.model = new MergeCard();
     this.RefreshUI();
 }