Example #1
0
        public bool ValidateBeforeSave(BO.x31Report rec)
        {
            if (string.IsNullOrEmpty(rec.x31Name))
            {
                this.AddMessage("Chybí vyplnit [Název sestavy]."); return(false);
            }
            if (string.IsNullOrEmpty(rec.x31Code))
            {
                this.AddMessage("Chybí vyplnit [Kód sestavy]."); return(false);
            }

            if (rec.x31ReportFormat == BO.x31ReportFormatEnum.DOC && rec.x31Is4SingleRecord == false)
            {
                this.AddMessage("Sestavy formátu DOCX mohou být pouze kontextové k vybranému záznamu"); return(false);
            }



            return(true);
        }
Example #2
0
        public int Save(BO.x31Report rec)
        {
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.x31ID);
            p.AddString("x31Entity", rec.x31Entity);
            p.AddString("x31FileName", rec.x31FileName);
            p.AddString("x31Name", rec.x31Name);
            p.AddString("x31Code", rec.x31Code);

            p.AddEnumInt("x31ReportFormat", rec.x31ReportFormat);
            p.AddString("x31Description", rec.x31Description);
            p.AddBool("x31Is4SingleRecord", rec.x31Is4SingleRecord);

            int intPID = _db.SaveRecord("x31Report", p.getDynamicDapperPars(), rec);



            return(intPID);
        }