Beispiel #1
0
        /// <summary>
        /// Switch two field order
        /// </summary>
        /// <param name="pobjSourceField">Source Field</param>
        /// <param name="pobjDestField">Destination Field</param>

        public void SwitchFields(object pobjSourceField, object pobjDestField)
        {
            sys_ReportFieldsDS dsReportField = new sys_ReportFieldsDS();

            dsReportField.UpdateByName(pobjSourceField);
            dsReportField.UpdateByName(pobjDestField);
        }
Beispiel #2
0
        /// <summary>
        /// Insert a new record into database
        /// </summary>

        public int AddAndReturnID(object pobjFieldGroup, ArrayList parrSelectedItem)
        {
            try
            {
                Sys_FieldGroupVO       voFieldGroup       = (Sys_FieldGroupVO)pobjFieldGroup;
                Sys_FieldGroupDS       dsFieldGroup       = new Sys_FieldGroupDS();
                sys_ReportFieldsDS     dsReportField      = new sys_ReportFieldsDS();
                Sys_FieldGroupDetailDS dsFieldGroupDetail = new Sys_FieldGroupDetailDS();
                // get current field group order
                voFieldGroup.GroupOrder = dsFieldGroup.GetFieldGroupOrder(voFieldGroup.ReportID, voFieldGroup.ParentFieldGroupID) + 1;
                // save new field group to database
                int intNewID = dsFieldGroup.AddAndReturnID(voFieldGroup);
                // save all selected sub group/field to database if any
                for (int i = 0; i < parrSelectedItem.Count; i++)
                {
                    switch (voFieldGroup.GroupLevel)
                    {
                    case (int)GroupFieldLevel.One:
                        // update sub group
                        Sys_FieldGroupVO voSubGroup = (Sys_FieldGroupVO)parrSelectedItem[i];
                        // parent field group id
                        voSubGroup.ParentFieldGroupID = intNewID;
                        // new order in group
                        voSubGroup.GroupOrder = i + 1;
                        // save to database
                        dsFieldGroup.Update(voSubGroup);
                        break;

                    case (int)GroupFieldLevel.Two:
                        // update report field
                        sys_ReportFieldsVO voReportField = (sys_ReportFieldsVO)parrSelectedItem[i];
                        // new field order in group
                        voReportField.FieldOrder = i + 1;
                        dsReportField.UpdateByName(voReportField);
                        // create new Field Group Detail
                        Sys_FieldGroupDetailVO voFieldGroupDetail = new Sys_FieldGroupDetailVO();
                        voFieldGroupDetail.FieldGroupID = intNewID;
                        voFieldGroupDetail.ReportID     = voFieldGroup.ReportID;
                        voFieldGroupDetail.FieldName    = voReportField.FieldName;
                        // save to database
                        dsFieldGroupDetail.Add(voFieldGroupDetail);
                        break;
                    }
                }
                return(intNewID);
            }
            catch (PCSDBException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        //**************************************************************************
        ///    <Description>
        ///       This method not implements yet
        ///    </Description>
        ///    <Inputs>
        ///
        ///    </Inputs>
        ///    <Outputs>
        ///
        ///    </Outputs>
        ///    <Returns>
        ///
        ///    </Returns>
        ///    <Authors>
        ///       DungLA
        ///    </Authors>
        ///    <History>
        ///		Created: 28-Dec-2004
        ///    </History>
        ///    <Notes>
        ///    </Notes>
        //**************************************************************************

        public void Delete(object pObjectVO)
        {
            sys_ReportVO voReport = (sys_ReportVO)pObjectVO;

            sys_ReportAndGroupDS dsReportAndGroup = new sys_ReportAndGroupDS();

            // delete data in sys_ReportAndGroup
            dsReportAndGroup.DeleteByReportID(voReport.ReportID);

            // delete data in sys_ReportDrillDown where master id is selected report id
            sys_ReportDrillDownDS dsDrillDown = new sys_ReportDrillDownDS();

            dsDrillDown.Delete(voReport.ReportID);

            // delete data in sys_ReportFields
            sys_ReportFieldsDS dsReportFields = new sys_ReportFieldsDS();

            dsReportFields.Delete(voReport.ReportID);

            // delete data in sys_ReportPara
            sys_ReportParaDS dsReportPara = new sys_ReportParaDS();

            dsReportPara.Delete(voReport.ReportID);

            // retrieve history of this report
            sys_ReportHistoryVO     voReportHistory = new sys_ReportHistoryVO();
            sys_ReportHistoryDS     dsReportHistory = new sys_ReportHistoryDS();
            sys_ReportHistoryParaDS dsHistoryPara   = new sys_ReportHistoryParaDS();
            ArrayList arrHistory = new ArrayList();

            arrHistory = dsReportHistory.ListByReport(voReport.ReportID);
            // delete all data in sys_ReportHistoryPara related to each history
            if (arrHistory.Count > 0)
            {
                for (int i = 0; i < arrHistory.Count - 1; i++)
                {
                    voReportHistory = (sys_ReportHistoryVO)arrHistory[i];
                    dsHistoryPara.Delete(voReportHistory.HistoryID);
                }
            }
            // delete data in sys_ReportHistory
            dsReportHistory.DeleteByReportID(voReport.ReportID);

            // delete data in sys_Report
            sys_ReportDS dsReport = new sys_ReportDS();

            dsReport.Delete(voReport.ReportID);
        }
Beispiel #4
0
        /// <summary>
        /// Delete record by condition
        /// </summary>

        public void Delete(object pObjectVO, ArrayList parrSelected)
        {
            try
            {
                Sys_FieldGroupVO       voFieldGroup       = (Sys_FieldGroupVO)pObjectVO;
                Sys_FieldGroupDS       dsFieldGroup       = new Sys_FieldGroupDS();
                sys_ReportFieldsDS     dsReportField      = new sys_ReportFieldsDS();
                Sys_FieldGroupDetailDS dsFieldGroupDetail = new Sys_FieldGroupDetailDS();
                int intCurrentGroupOrder = dsFieldGroup.GetFieldGroupOrder(voFieldGroup.ReportID, 0);
                int intCurrentFieldOrder = dsReportField.GetMaxFieldOrder(voFieldGroup.ReportID);
                for (int i = 0; i < parrSelected.Count; i++)
                {
                    switch (voFieldGroup.GroupLevel)
                    {
                    case (int)GroupFieldLevel.One:
                        // update sub group (order and parent id)
                        Sys_FieldGroupVO voSubGroup = (Sys_FieldGroupVO)parrSelected[i];
                        voSubGroup.ParentFieldGroupID = 0;
                        voSubGroup.GroupOrder         = intCurrentGroupOrder + i + 1;
                        dsFieldGroup.Update(voSubGroup);
                        break;

                    case (int)GroupFieldLevel.Two:
                        // update report field
                        sys_ReportFieldsVO voReportField = (sys_ReportFieldsVO)parrSelected[i];
                        // new field order in group
                        voReportField.FieldOrder = intCurrentFieldOrder + i + 1;
                        dsReportField.UpdateByName(voReportField);
                        // delete field group detail records first
                        dsFieldGroupDetail.Delete(voFieldGroup.FieldGroupID, voFieldGroup.ReportID);
                        break;
                    }
                }
                // delete field group
                dsFieldGroup.Delete(voFieldGroup.FieldGroupID);
            }
            catch (PCSDBException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #5
0
        public bool MoveDownField(string pstrReportID, string pstrFieldName)
        {
            const string       METHOD_NAME     = THIS + ".MoveDownField()";
            bool               blnResult       = true;
            sys_ReportFieldsDS dsReportField   = new sys_ReportFieldsDS();
            sys_ReportFieldsVO voPreviousField = new sys_ReportFieldsVO();
            sys_ReportFieldsVO voCurrentField  = new sys_ReportFieldsVO();
            ArrayList          arrFields       = new ArrayList();

            arrFields = dsReportField.GetObjectVOs(pstrReportID);
            for (int i = 0; i < arrFields.Count; i++)
            {
                sys_ReportFieldsVO voReportField = (sys_ReportFieldsVO)arrFields[i];
                string             strFieldName  = voReportField.FieldName;
                if (strFieldName.Equals(pstrFieldName))
                {
                    int intCurrentOrder = voReportField.FieldOrder;
                    // if current order reached the bottom of layout then return false
                    if (intCurrentOrder >= arrFields.Count)
                    {
                        blnResult = false;
                    }
                    else
                    {
                        // get the previous group
                        voPreviousField = (sys_ReportFieldsVO)arrFields[i + 1];
                        // get the current group
                        voCurrentField = (sys_ReportFieldsVO)arrFields[i];
                        // switch order
                        voCurrentField.FieldOrder  = voPreviousField.FieldOrder;
                        voPreviousField.FieldOrder = intCurrentOrder;

                        //update two rows into database
                        dsReportField.UpdateByName(voPreviousField);
                        dsReportField.UpdateByName(voCurrentField);
                        blnResult = true;
                    }
                }
            }
            return(blnResult);
        }
Beispiel #6
0
        public bool MoveUpField(string pstrReportID, string pstrFieldName)
        {
            bool blnResult = true;
            sys_ReportFieldsDS dsReportField   = new sys_ReportFieldsDS();
            sys_ReportFieldsVO voPreviousField = new sys_ReportFieldsVO();
            sys_ReportFieldsVO voCurrentField  = new sys_ReportFieldsVO();
            ArrayList          arrFields       = new ArrayList();

            arrFields = dsReportField.GetObjectVOs(pstrReportID);
            for (int i = 0; i < arrFields.Count; i++)
            {
                sys_ReportFieldsVO voReportField = (sys_ReportFieldsVO)arrFields[i];
                string             strFieldName  = voReportField.FieldName;
                if (strFieldName.Equals(pstrFieldName))
                {
                    int intCurrentOrder = voReportField.FieldOrder;
                    // if current order reached the top of layout then return false
                    if (intCurrentOrder <= 1)
                    {
                        blnResult = false;
                    }
                    else
                    {
                        // get previous group
                        voPreviousField = (sys_ReportFieldsVO)arrFields[i - 1];
                        // get current group
                        voCurrentField = (sys_ReportFieldsVO)arrFields[i];
                        // switch order between two groups
                        voCurrentField.FieldOrder  = voPreviousField.FieldOrder;
                        voPreviousField.FieldOrder = intCurrentOrder;

                        //update two rows into database
                        dsReportField.UpdateByName(voPreviousField);
                        dsReportField.UpdateByName(voCurrentField);
                        blnResult = true;
                    }
                }
            }
            return(blnResult);
        }
Beispiel #7
0
        /// <summary>
        /// Update into Database
        /// </summary>

        public void Update(object pobjFieldGroup, ArrayList parrSelectedItem, ArrayList parrAvailableItem)
        {
            try
            {
                Sys_FieldGroupVO       voFieldGroup       = (Sys_FieldGroupVO)pobjFieldGroup;
                Sys_FieldGroupDS       dsFieldGroup       = new Sys_FieldGroupDS();
                sys_ReportFieldsDS     dsReportField      = new sys_ReportFieldsDS();
                Sys_FieldGroupDetailDS dsFieldGroupDetail = new Sys_FieldGroupDetailDS();
                // update Field Group
                dsFieldGroup.Update(voFieldGroup);
                int intCurrentGroupOrder = dsFieldGroup.GetFieldGroupOrder(voFieldGroup.ReportID, 0);
                int intCurrentFieldOrder = dsReportField.GetMaxFieldOrder(voFieldGroup.ReportID);
                for (int i = 0; i < parrAvailableItem.Count; i++)
                {
                    switch (voFieldGroup.GroupLevel)
                    {
                    case (int)GroupFieldLevel.One:
                        Sys_FieldGroupVO voSubGroup = (Sys_FieldGroupVO)parrAvailableItem[i];
                        // remove parent field group
                        voSubGroup.ParentFieldGroupID = 0;
                        voSubGroup.GroupOrder         = intCurrentGroupOrder + 1 + i;
                        dsFieldGroup.Update(voSubGroup);
                        break;

                    case (int)GroupFieldLevel.Two:
                        // update report field
                        sys_ReportFieldsVO voReportField = (sys_ReportFieldsVO)parrSelectedItem[i];
                        // new field order in group
                        voReportField.FieldOrder = intCurrentFieldOrder + i + 1;
                        dsReportField.UpdateByName(voReportField);
                        // create new Field Group Detail
                        Sys_FieldGroupDetailVO voFieldGroupDetail = new Sys_FieldGroupDetailVO();
                        voFieldGroupDetail.FieldGroupID = voFieldGroup.FieldGroupID;
                        voFieldGroupDetail.ReportID     = voFieldGroup.ReportID;
                        voFieldGroupDetail.FieldName    = voReportField.FieldName;
                        // save to database
                        dsFieldGroupDetail.Add(voFieldGroupDetail);
                        break;
                    }
                }
                // delete old field group detail
                dsFieldGroupDetail.Delete(voFieldGroup.FieldGroupID, voFieldGroup.ReportID);
                // update selected group/field
                for (int i = 0; i < parrSelectedItem.Count; i++)
                {
                    switch (voFieldGroup.GroupLevel)
                    {
                    case (int)GroupFieldLevel.One:
                        Sys_FieldGroupVO voSubGroup = (Sys_FieldGroupVO)parrSelectedItem[i];
                        voSubGroup.ParentFieldGroupID = voFieldGroup.FieldGroupID;
                        voSubGroup.GroupOrder         = i + 1;
                        dsFieldGroup.Update(voSubGroup);
                        break;

                    case (int)GroupFieldLevel.Two:
                        // update report field
                        sys_ReportFieldsVO voReportField = (sys_ReportFieldsVO)parrSelectedItem[i];
                        // new field order in group
                        voReportField.FieldOrder = i + 1;
                        dsReportField.UpdateByName(voReportField);
                        // create new Field Group Detail
                        Sys_FieldGroupDetailVO voFieldGroupDetail = new Sys_FieldGroupDetailVO();
                        voFieldGroupDetail.FieldGroupID = voFieldGroup.FieldGroupID;
                        voFieldGroupDetail.ReportID     = voFieldGroup.ReportID;
                        voFieldGroupDetail.FieldName    = voReportField.FieldName;
                        // save to database
                        dsFieldGroupDetail.Add(voFieldGroupDetail);
                        break;
                    }
                }
            }
            catch (PCSDBException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #8
0
        public ArrayList ListByReport(string pstrReportID)
        {
            sys_ReportFieldsDS dsReportFields = new sys_ReportFieldsDS();

            return(dsReportFields.GetObjectVOs(pstrReportID));
        }
Beispiel #9
0
        public void UpdateDataSet(DataSet pData)
        {
            sys_ReportFieldsDS templateDS = new sys_ReportFieldsDS();

            templateDS.UpdateDataSet(pData);
        }
Beispiel #10
0
        public DataSet List()
        {
            sys_ReportFieldsDS templateDS = new sys_ReportFieldsDS();

            return(templateDS.List());
        }
Beispiel #11
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);
        }
Beispiel #12
0
        public void Delete(string pstrReportID)
        {
            sys_ReportFieldsDS dsReportField = new sys_ReportFieldsDS();

            dsReportField.Delete(pstrReportID);
        }
Beispiel #13
0
        public void Delete(int pintID)
        {
            sys_ReportFieldsDS templateDS = new sys_ReportFieldsDS();

            templateDS.Delete(pintID);
        }
Beispiel #14
0
        /// <summary>
        /// Update Report field by name
        /// </summary>
        /// <param name="pobjObjectVO">sys_ReportFieldsVO</param>

        public void UpdateByName(object pobjObjectVO)
        {
            sys_ReportFieldsDS dsReportField = new sys_ReportFieldsDS();

            dsReportField.UpdateByName(pobjObjectVO);
        }
Beispiel #15
0
        public ArrayList GetSortFields(string pstrReportID)
        {
            sys_ReportFieldsDS dsFields = new sys_ReportFieldsDS();

            return(dsFields.GetSortFields(pstrReportID));
        }
Beispiel #16
0
        public void Add(object pobjObjectVO)
        {
            sys_ReportFieldsDS templateDS = new sys_ReportFieldsDS();

            templateDS.Add(pobjObjectVO);
        }
Beispiel #17
0
        public int SumFieldsWidth(string pstrReportID)
        {
            sys_ReportFieldsDS dsField = new sys_ReportFieldsDS();

            return(dsField.SumFieldsWidth(pstrReportID));
        }
Beispiel #18
0
        public object GetObjectVO(int pintID)
        {
            sys_ReportFieldsDS templateDS = new sys_ReportFieldsDS();

            return(templateDS.GetObjectVO(pintID));
        }
Beispiel #19
0
        public void Update(object pobjObjecVO)
        {
            sys_ReportFieldsDS templateDS = new sys_ReportFieldsDS();

            templateDS.UpdateByName(pobjObjecVO);
        }
Beispiel #20
0
        public int GetMaxFieldOrder(string pstrReportID)
        {
            sys_ReportFieldsDS dsField = new sys_ReportFieldsDS();

            return(dsField.GetMaxFieldOrder(pstrReportID));
        }