Example #1
0
        public IActionResult Record(int pid, bool isclone)
        {
            if (!this.TestIfUserEditor(true, false))
            {
                return(this.StopPageCreateEdit(true));
            }
            var v = new Models.p10RecordViewModel();

            if (pid > 0)
            {
                v.Rec = Factory.p10MasterProductBL.Load(pid);
                if (v.Rec == null)
                {
                    return(RecNotFound(v));
                }
                var tg = Factory.o51TagBL.GetTagging("p10", pid);
                v.TagPids  = tg.TagPids;
                v.TagNames = tg.TagNames;
                v.TagHtml  = tg.TagHtml;
            }
            else
            {
                v.Rec        = new BO.p10MasterProduct();
                v.Rec.entity = "p10";
            }
            RefreshState(v);

            if (isclone)
            {
                v.Toolbar.MakeClone();
            }


            return(View(v));
        }
Example #2
0
        public IActionResult Record(Models.p10RecordViewModel v)
        {
            if (ModelState.IsValid)
            {
                BO.p10MasterProduct c = new BO.p10MasterProduct();
                if (v.Rec.pid > 0)
                {
                    c = Factory.p10MasterProductBL.Load(v.Rec.pid);
                }

                c.p10Code            = v.Rec.p10Code;
                c.p10Name            = v.Rec.p10Name;
                c.p10Memo            = v.Rec.p10Memo;
                c.b02ID              = v.Rec.b02ID;
                c.p20ID              = v.Rec.p20ID;
                c.p20ID_Pro          = v.Rec.p20ID_Pro;
                c.p13ID              = v.Rec.p13ID;
                c.p10TypeFlag        = v.Rec.p10TypeFlag;
                c.p10RecalcUnit2Kg   = v.Rec.p10RecalcUnit2Kg;
                c.p10PackagingCode   = v.Rec.p10PackagingCode;
                c.p10Davka           = v.Rec.p10Davka;
                c.p10DavkaMin        = v.Rec.p10DavkaMin;
                c.p10DavkaMax        = v.Rec.p10DavkaMax;
                c.p10SalesPerMonth   = v.Rec.p10SalesPerMonth;
                c.p10UnitsPerPalette = v.Rec.p10UnitsPerPalette;
                c.ValidUntil         = v.Toolbar.GetValidUntil(c);
                c.ValidFrom          = v.Toolbar.GetValidFrom(c);

                v.Rec.pid = Factory.p10MasterProductBL.Save(c);
                if (v.Rec.pid > 0)
                {
                    Factory.o51TagBL.SaveTagging("p10", v.Rec.pid, v.TagPids);
                    v.SetJavascript_CallOnLoad(v.Rec.pid);
                    return(View(v));
                }
            }


            RefreshState(v);
            this.Notify_RecNotSaved();
            return(View(v));
        }