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); }
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); }
//************************************************************************** /// <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); }
public ArrayList ListByReport(string pstrReportID) { sys_ReportFieldsDS dsReportFields = new sys_ReportFieldsDS(); return(dsReportFields.GetObjectVOs(pstrReportID)); }