public IActionResult Record(int pid, bool isclone) { if (Factory.CurrentUser.j03EnvironmentFlag == 1) { return(this.StopPageClientPageOnly(true)); } if (!this.TestIfUserEditor(false, true)) { return(this.StopPageCreateEdit(true)); } var v = new Models.p12RecordViewModel(); if (pid > 0) { v.Rec = Factory.p12ClientTpvBL.Load(pid); if (v.Rec == null) { return(RecNotFound(v)); } BO.p21License cP21 = Factory.p21LicenseBL.Load(v.Rec.p21ID); //if (isclone == false && v.Rec.p13ID_Master>0) //{ // return this.StopPage(true, "Recepturu s Master vzorem nelze upravovat.<hr>Zkopírujte si ji do nové receptury, kterou můžete upravovat."); //} if (cP21.p21PermissionFlag != BO.p21PermENUM.Full) { return(this.StopPage(true, string.Format("S licencí typu {2} [{0} - {1}] nemáte oprávnění zakládat vlastní receptury.", cP21.p21Code, cP21.p21Name, cP21.PermFlagAlias))); } var tg = Factory.o51TagBL.GetTagging("p12", pid); v.TagPids = tg.TagPids; v.TagNames = tg.TagNames; v.TagHtml = tg.TagHtml; } else { v.Rec = new BO.p12ClientTpv(); v.Rec.entity = "p12"; if (Factory.p21LicenseBL.GetList(new BO.myQuery("p21License")).Where(p => p.p21PermissionFlag == BO.p21PermENUM.Full).Count() == 0) { //Factory.CurrentUser.AddMessage("Systém nepovolí uložit vlastní recepturu, protože ani jedna z vašich licencí k tomu nemá oprávnění.", "warning"); return(this.StopPage(true, "Systém nepovolí uložit vlastní recepturu, protože ani jedna z vašich licencí k tomu nemá oprávnění.")); } } v.Toolbar = new MyToolbarViewModel(v.Rec); if (isclone) { v.Toolbar.MakeClone(); v.Rec.p12Code += "-COPY"; } return(View(v)); }
public IActionResult Record(Models.p21RecordViewModel v) { if (ModelState.IsValid) { BO.p21License c = new BO.p21License(); if (v.Rec.pid > 0) { c = Factory.p21LicenseBL.Load(v.Rec.pid); } c.p21Code = v.Rec.p21Code; c.p21Name = v.Rec.p21Name; c.p21Memo = v.Rec.p21Memo; c.b02ID = v.Rec.b02ID; c.p28ID = v.Rec.p28ID; c.p21Price = v.Rec.p21Price; c.p21PermissionFlag = v.Rec.p21PermissionFlag; c.ValidFrom = v.Rec.ValidFrom; c.ValidUntil = v.Rec.ValidUntil; v.Rec.pid = Factory.p21LicenseBL.Save(c); if (v.Rec.pid > 0) { Factory.o51TagBL.SaveTagging("p21", v.Rec.pid, v.TagPids); v.SetJavascript_CallOnLoad(v.Rec.pid); return(View(v)); } } RefreshState(v); this.Notify_RecNotSaved(); return(View(v)); }