public static WorkReport CloneAsNew(WorkReportInfo source)
        {
            WorkReport clon = WorkReport.New();

            clon.CopyFrom(source);

            clon.GetNewCode();

            clon.MarkNew();

            if (source.Lines == null)
            {
                source.LoadChilds(typeof(WorkReportResources), false);
            }

            foreach (WorkReportResourceInfo item in source.Lines)
            {
                if (item.EEntityType != moleQule.Common.Structs.ETipoEntidad.OutputDelivery)
                {
                    clon.Lines.NewItem(clon, item);
                }
            }

            clon.Lines.MarkAsNew();

            return(clon);
        }
        /*private static void FormatReport(WorkReportRpt rpt, string logo)
         * {
         *  string path = Images.GetRootPath() + "\\" + Resources.Paths.LOGO_EMPRESAS + logo;
         *
         *  if (File.Exists(path))
         *  {
         *      Image image = Image.FromFile(path);
         *      int width = rpt.Section1.ReportObjects["Logo"].Width;
         *      int height = rpt.Section1.ReportObjects["Logo"].Height;
         *
         *      rpt.Section1.ReportObjects["Logo"].Width = 15 * image.Width;
         *      rpt.Section1.ReportObjects["Logo"].Height = 15 * image.Height;
         *      rpt.Section1.ReportObjects["Logo"].Left += (width - 15 * image.Width) / 2;
         *      rpt.Section1.ReportObjects["Logo"].Top += (height - 15 * image.Height) / 2;
         *  }
         * }*/

        #endregion

        #region Business Methods

        public ReportClass GetDetailReport(WorkReportInfo item)
        {
            if (item == null)
            {
                return(null);
            }

            WorkReportRpt doc = new WorkReportRpt();

            List <WorkReportPrint> pList = new List <WorkReportPrint>();

            pList.Add(WorkReportPrint.New(item));
            doc.SetDataSource(pList);

            List <WorkReportResourcePrint> pLines = new List <WorkReportResourcePrint>();

            foreach (WorkReportResourceInfo child in item.Lines)
            {
                pLines.Add(WorkReportResourcePrint.New(child));
            }

            doc.Subreports["LinesSubRpt"].SetDataSource(pLines);

            return(doc);
        }
        protected void CopyValues(WorkReportInfo source)
        {
            if (source == null)
            {
                return;
            }

            _base.CopyValues(source);
        }
        protected virtual void CopyFrom(WorkReportInfo source)
        {
            if (source == null)
            {
                return;
            }

            OidOwner     = source.OidOwner;
            OidExpedient = source.OidExpedient;
            Serial       = source.Serial;
            Code         = source.Code;
        }
        public void CopyValues(WorkReportInfo source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);

            _expedient     = source.Expedient;
            _owner         = source.Owner;
            _category_name = source.CategoryName;
        }
        public static WorkReportResourceList GetChildList(WorkReportInfo parent, bool childs)
        {
            CriteriaEx criteria = WorkReportResource.GetCriteria(WorkReportResource.OpenSession());

            criteria.Query  = SELECT(parent);
            criteria.Childs = childs;

            WorkReportResourceList list = DataPortal.Fetch <WorkReportResourceList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
 internal static string SELECT(long oid, bool lockTable)
 {
     return(SELECT(new QueryConditions {
         WorkReport = WorkReportInfo.New(oid)
     }, lockTable));
 }
 public static string SELECT(WorkReportInfo parent)
 {
     return(WorkReportResource.SELECT(new QueryConditions {
         WorkReport = parent
     }, false));
 }