public int Save(BO.j02Person rec) { if (ValidateBeforeSave(rec) == false) { return(0); } var p = new DL.Params4Dapper(); p.AddInt("pid", rec.j02ID); p.AddInt("p28ID", rec.p28ID, true); if (rec.j02ID_Owner == 0) { rec.j02ID_Owner = _db.CurrentUser.j02ID; } p.AddInt("j02ID_Owner", rec.j02ID_Owner, true); p.AddString("j02FirstName", rec.j02FirstName); p.AddString("j02LastName", rec.j02LastName); p.AddString("j02TitleBeforeName", rec.j02TitleBeforeName); p.AddString("j02TitleAfterName", rec.j02TitleAfterName); p.AddString("j02Email", rec.j02Email); p.AddString("j02Tel1", rec.j02Tel1); p.AddString("j02Tel2", rec.j02Tel2); p.AddString("j02JobTitle", rec.j02JobTitle); return(_db.SaveRecord("j02Person", p.getDynamicDapperPars(), rec)); }
private bool ValidateBeforeSave(BO.j02Person rec) { if (string.IsNullOrEmpty(rec.j02FirstName)) { _db.CurrentUser.AddMessage("Chybí vyplnit [Jméno]."); return(false); } if (string.IsNullOrEmpty(rec.j02LastName)) { _db.CurrentUser.AddMessage("Chybí vyplnit [Příjmení]."); return(false); } return(true); }
public int Save(BO.p28Company rec, BO.j02Person recFirstPerson) { if (recFirstPerson != null) { if (String.IsNullOrEmpty(recFirstPerson.j02FirstName) || String.IsNullOrEmpty(recFirstPerson.j02LastName)) { _mother.CurrentUser.AddMessage("U kontaktní osoby musíte vyplnit [Jméno] a [Příjmení] nebo odškrtněte, že se má založit první kontaktní osoba klienta."); return(0); } } var p = new DL.Params4Dapper(); p.AddInt("pid", rec.p28ID); if (rec.j02ID_Owner == 0) { rec.j02ID_Owner = _db.CurrentUser.j02ID; } p.AddInt("j02ID_Owner", rec.j02ID_Owner, true); p.AddString("p28Name", rec.p28Name); p.AddString("p28ShortName", rec.p28ShortName); p.AddString("p28Code", rec.p28Code); p.AddString("p28CloudID", rec.p28CloudID); p.AddString("p28RegID", rec.p28RegID); p.AddString("p28VatID", rec.p28VatID); p.AddString("p28Street1", rec.p28Street1); p.AddString("p28City1", rec.p28City1); p.AddString("p28PostCode1", rec.p28PostCode1); p.AddString("p28Country1", rec.p28Country1); p.AddString("p28Street2", rec.p28Street2); p.AddString("p28City2", rec.p28City2); p.AddString("p28PostCode2", rec.p28PostCode2); p.AddString("p28Country2", rec.p28Country2); int intPID = _db.SaveRecord("p28Company", p.getDynamicDapperPars(), rec); if (intPID > 0 && recFirstPerson != null) { recFirstPerson.p28ID = intPID; _mother.j02PersonBL.Save(recFirstPerson); } return(intPID); }