Exemplo n.º 1
0
 public void Add(object pobjObjectVO)
 {
     try
     {
         sys_ReportDrillDownDS templateDS = new sys_ReportDrillDownDS();
         templateDS.Add(pobjObjectVO);
     }
     catch (PCSDBException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
        //**************************************************************************
        ///    <Description>
        ///       This method uses to make a copy of specified report to another group,
        ///       also copy all data relative to report (sys_ReportAndGroup, sys_ReportDrillDown,
        ///       sys_ReportFields, sys_ReportPara).
        ///    </Description>
        ///    <Inputs>
        ///        Source ReportID, Destination GroupID
        ///    </Inputs>
        ///    <Outputs>
        ///      New report id
        ///    </Outputs>
        ///    <Returns>
        ///       new report id
        ///    </Returns>
        ///    <Authors>
        ///       DungLA
        ///    </Authors>
        ///    <History>
        ///       03-Jan-2005
        ///       11-Jan-2005
        ///    </History>
        ///    <Notes>
        ///		Return newly report id
        ///    </Notes>
        //**************************************************************************

        public object CopyReport(string pstrReportID, string pstrGroupID, out int ointReportOrder)
        {
            const string METHOD_NAME          = THIS + ".CopyReport()";
            const int    REPORT_ID_MAX_LENGTH = 20;
            const string CODE_DATE_FORMAT     = "yyyyMMddHHmmssfff";
            UtilsBO      boUtils  = new UtilsBO();
            sys_ReportDS dsReport = new sys_ReportDS();
            sys_ReportVO voReport;

            // use to add new report to selected group
            sys_ReportAndGroupVO voReportAndGroup = new sys_ReportAndGroupVO();
            sys_ReportAndGroupDS dsReportAndGroup = new sys_ReportAndGroupDS();

            // use to copy report para
            sys_ReportParaDS dsReportPara = new sys_ReportParaDS();

            // use to copy report fields
            sys_ReportFieldsDS dsReportFields = new sys_ReportFieldsDS();

            // use to copy drill down report
            sys_ReportDrillDownDS dsReportDrillDown = new sys_ReportDrillDownDS();

            // get the data of selected object
            voReport = (sys_ReportVO)(dsReport.GetObjectVO(pstrReportID));

            #region Copy report
            // make a copy report
            sys_ReportVO voCopiedReport = new sys_ReportVO();
            voCopiedReport = voReport;
            // get database server date time
            DateTime dtmDB = boUtils.GetDBDate();
            // report ID = yyyyMMddHHmmssfff
            voCopiedReport.ReportID = dtmDB.ToString(CODE_DATE_FORMAT);
            if (voCopiedReport.ReportID.Length > REPORT_ID_MAX_LENGTH)
            {
                throw new PCSBOException(ErrorCode.MESSAGE_VALUE_TOO_LONG, METHOD_NAME, new Exception());
            }
            voCopiedReport.ReportName = Constants.COPY_OF + voCopiedReport.ReportName;
            // save new report to database
            dsReport.Add(voCopiedReport);
            #endregion

            #region Add new report to group
            voReportAndGroup.GroupID  = pstrGroupID;
            voReportAndGroup.ReportID = voCopiedReport.ReportID;
            // increase report order by one in group.
            voReportAndGroup.ReportOrder = dsReportAndGroup.GetMaxReportOrder(pstrGroupID) + 1;
            // save data
            dsReportAndGroup.Add(voReportAndGroup);
            ointReportOrder = voReportAndGroup.ReportOrder;
            #endregion

            #region Copy all data relative from old report to new report

            #region ReportPara
            // get all parameter(s)
            sys_ReportParaVO voReportPara;
            ArrayList        arrParas = dsReportPara.GetObjectVOs(pstrReportID);
            // make a copy of each parameter
            if (arrParas.Count > 0)
            {
                for (int i = 0; i < arrParas.Count; i++)
                {
                    voReportPara = (sys_ReportParaVO)(arrParas[i]);
                    // assign new report id
                    voReportPara.ReportID = voCopiedReport.ReportID;
                    // save new para
                    dsReportPara.Add(voReportPara);
                }
            }
            #endregion

            #region ReportFields
            // get all report fields
            sys_ReportFieldsVO voReportFields;
            ArrayList          arrFields = dsReportFields.GetObjectVOs(pstrReportID);
            // make a copy of each field
            if (arrFields.Count > 0)
            {
                for (int i = 0; i < arrFields.Count; i++)
                {
                    voReportFields = (sys_ReportFieldsVO)arrFields[i];
                    // assign new report id
                    voReportFields.ReportID = voCopiedReport.ReportID;
                    // save new field
                    dsReportFields.Add(voReportFields);
                }
            }
            #endregion

            #region ReportDrillDown
            // get all drill down report
            sys_ReportDrillDownVO voReportDrillDown;
            ArrayList             arrDrillDown = dsReportDrillDown.GetObjectVOs(pstrReportID);
            // make a copy each drill down report
            if (arrDrillDown.Count > 0)
            {
                for (int i = 0; i < arrDrillDown.Count; i++)
                {
                    voReportDrillDown = (sys_ReportDrillDownVO)arrDrillDown[i];
                    // assign new report id
                    voReportDrillDown.MasterReportID = voCopiedReport.ReportID;
                    // save new drill down
                    dsReportDrillDown.Add(voReportDrillDown);
                }
            }
            #endregion

            #endregion

            return(voCopiedReport);
        }