Esempio n. 1
0
        /// <summary>
        /// 报表文件
        /// </summary>
        /// <param name="vo"></param>
        /// <returns></returns>
        public int SaveReportFile(EntitySysReport vo)
        {
            int       affectRows = 0;
            SqlHelper svc        = null;

            try
            {
                svc        = new SqlHelper(EnumBiz.onlineDB);
                affectRows = svc.Commit(svc.GetUpdateParm(vo, new List <string> {
                    EntitySysReport.Columns.rptFile
                }, new List <string> {
                    EntitySysReport.Columns.rptId
                }));
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }
Esempio n. 2
0
        /// <summary>
        /// 主信息
        /// </summary>
        /// <param name="vo"></param>
        /// <returns></returns>
        public int SaveReport(ref EntitySysReport vo)
        {
            int       affectRows = 0;
            SqlHelper svc        = null;

            try
            {
                svc = new SqlHelper(EnumBiz.onlineDB);
                if (vo.rptId <= 0)
                {
                    affectRows = svc.Commit(svc.GetInsertParm(vo));
                }
                else
                {
                    affectRows = svc.Commit(svc.GetUpdateParm(vo, new List <string> {
                        EntitySysReport.Columns.rptNo, EntitySysReport.Columns.rptName, EntitySysReport.Columns.pyCode,
                        EntitySysReport.Columns.wbCode, EntitySysReport.Columns.rptSql
                    },
                                                              new List <string> {
                        EntitySysReport.Columns.rptId
                    }));
                }
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }
Esempio n. 3
0
 /// <summary>
 /// SetMainInfo
 /// </summary>
 /// <param name="vo"></param>
 void SetMainInfo(EntitySysReport vo)
 {
     uiHelper.BeginLoading(Viewer);
     if (vo == null)
     {
         Viewer.txtRptNo.Tag    = null;
         Viewer.txtRptNo.Text   = string.Empty;
         Viewer.txtRptName.Text = string.Empty;
         Viewer.txtSql.Text     = string.Empty;
     }
     else
     {
         Viewer.txtRptNo.Tag    = vo;
         Viewer.txtRptNo.Text   = vo.rptNo;
         Viewer.txtRptName.Text = vo.rptName;
         Viewer.txtSql.Text     = vo.rptSql;
     }
     Viewer.txtSql.Refresh();
     xr = new XtraReport();
     if (vo != null && vo.rptFile != null && vo.rptFile.Length > 0)
     {
         MemoryStream stream = new MemoryStream(vo.rptFile);
         xr.LoadLayout(stream);
         xr.DataSource = GetDataSource();
     }
     this.Viewer.ucPrintControl.PrintingSystem = xr.PrintingSystem;
     xr.CreateDocument();
     Viewer.ValueChanged = false;
     uiHelper.CloseLoading(Viewer);
 }
Esempio n. 4
0
        /// <summary>
        /// Delete
        /// </summary>
        internal void Delete()
        {
            EntitySysReport reportVo = Viewer.txtRptNo.Tag as EntitySysReport;

            if (reportVo == null || reportVo.rptId == 0)
            {
                return;
            }
            if (DialogBox.Msg("是否删除当前报表?", MessageBoxIcon.Question) == DialogResult.Yes)
            {
                using (ProxyFrame proxy = new ProxyFrame())
                {
                    int ret = proxy.Service.DeleteReport(reportVo.rptId);
                    if (ret > 0)
                    {
                        SetMainInfo(null);
                        Viewer.tvRport.Nodes.Remove(Viewer.tvRport.FocusedNode);
                        DialogBox.Msg("删除成功!");
                    }
                    else
                    {
                        DialogBox.Msg("删除失败。");
                    }
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 报表文件
 /// </summary>
 /// <param name="vo"></param>
 /// <returns></returns>
 public int SaveReportFile(EntitySysReport vo)
 {
     using (BizFormDesign biz = new BizFormDesign())
     {
         return(biz.SaveReportFile(vo));
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 报表文件
        /// </summary>
        /// <param name="vo"></param>
        /// <returns></returns>
        public int SaveReportFile(EntitySysReport vo)
        {
            int       affectRows = 0;
            SqlHelper svc        = null;

            try
            {
                svc        = new SqlHelper(EnumBiz.onlineDB);
                affectRows = svc.Commit(svc.GetUpdateParm(vo, new List <string> {
                    EntitySysReport.Columns.rptFile
                }, new List <string> {
                    EntitySysReport.Columns.rptId
                }));
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(Function.GetExceptionCaption(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message));
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }
Esempio n. 7
0
        /// <summary>
        /// GetXR
        /// </summary>
        /// <returns></returns>
        XtraReport GetXR(decimal rptId)
        {
            EntitySysReport rptVo = null;

            using (ProxyCommon proxy = new ProxyCommon())
            {
                rptVo = proxy.Service.GetReport(this.rptId);
            }
            XtraReport xr = new XtraReport();

            if (rptVo != null)
            {
                MemoryStream ms = new MemoryStream();
                ms.Write(rptVo.rptFile, 0, rptVo.rptFile.Length);
                xr.LoadLayout(ms);
            }
            xr.DataSource = this.gcData.DataSource as List <EntityYgInpatStat>;
            XRControl xc; //报表上的组件

            xc = xr.FindControl("lblDate", true);
            if (xc != null)
            {
                (xc as XRLabel).Text = " " + dateScope;
            }
            xr.CreateDocument();
            return(xr);
        }
Esempio n. 8
0
        /// <summary>
        /// 获取报表文件
        /// </summary>
        /// <param name="rptId"></param>
        /// <returns></returns>
        public EntitySysReport GetReport(decimal rptId)
        {
            SqlHelper svc = null;

            try
            {
                EntitySysReport vo = new EntitySysReport();
                vo.rptId = rptId;
                svc      = new SqlHelper(EnumBiz.onlineDB);
                List <EntitySysReport> lstRpt = EntityTools.ConvertToEntityList <EntitySysReport>(svc.Select(vo, new List <string> {
                    EntitySysReport.Columns.rptId
                }));
                if (lstRpt != null && lstRpt.Count > 0)
                {
                    return(lstRpt[0]);
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(Function.GetExceptionCaption(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message));
            }
            finally
            {
                svc = null;
            }
            return(null);
        }
Esempio n. 9
0
 /// <summary>
 /// 报表文件
 /// </summary>
 /// <param name="vo"></param>
 /// <returns></returns>
 public int SaveReportFile(EntitySysReport vo)
 {
     using (BizFrame biz = new BizFrame())
     {
         return(biz.SaveReportFile(vo));
     }
 }
Esempio n. 10
0
 public frmReportDesigner(EntitySysReport _reportVo)
 {
     InitializeComponent();
     if (!DesignMode)
     {
         ((ctlReportDesigner)Controller).rptTypeId = 1;
         ((ctlReportDesigner)Controller).reportVo  = _reportVo;
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Refresh
        /// </summary>
        internal void Refresh()
        {
            LoadDataSource();
            EntitySysReport reportVo = Viewer.txtRptNo.Tag as EntitySysReport;

            if (reportVo != null)
            {
                Viewer.tvRport.FocusedNode = Viewer.tvRport.FindNodeByKeyID(reportVo.rptId);
            }
        }
Esempio n. 12
0
 /// <summary>
 /// LoadDeptInfo
 /// </summary>
 /// <param name="node"></param>
 void LoadRptInfo(TreeListNode node)
 {
     if (node == null)
     {
         return;
     }
     uiHelper.BeginLoading(Viewer);
     try
     {
         EntitySysReport rptVo = (EntitySysReport)Viewer.tvRport.GetDataRecordByNode(node);
         SetMainInfo(rptVo);
     }
     finally
     {
         uiHelper.CloseLoading(Viewer);
     }
 }
Esempio n. 13
0
        /// <summary>
        /// Init
        /// </summary>
        void Init()
        {
            #region 参数
            List <EntityRptEventParm> EventParmData = null;
            using (ProxyEntityFactory proxy = new ProxyEntityFactory())
            {
                EventParmData = EntityTools.ConvertToEntityList <EntityRptEventParm>(proxy.Service.SelectFullTable(new EntityRptEventParm()));
            }
            #endregion

            #region xr
            decimal         printId = 0;
            EntitySysReport rptVo   = null;
            if (EventParmData != null)
            {
                if (EventParmData.Any(t => t.eventId == "12" && t.keyId == "printId"))
                {
                    printId = Function.Dec(EventParmData.FirstOrDefault(t => t.eventId == "12" && t.keyId == "printId").keyValue);
                }
            }
            if (printId > 0)
            {
                using (ProxyCommon proxy = new ProxyCommon())
                {
                    rptVo = proxy.Service.GetReport(printId);
                }
            }
            else
            {
                return;
            }
            xr = new XtraReport();
            if (rptVo != null)
            {
                MemoryStream ms = new MemoryStream();
                ms.Write(rptVo.rptFile, 0, rptVo.rptFile.Length);
                xr.LoadLayout(ms);
            }
            this.ucPrintControl.PrintingSystem = xr.PrintingSystem;
            xr.CreateDocument();
            #endregion

            this.Stat();
        }
Esempio n. 14
0
 /// <summary>
 /// Init
 /// </summary>
 void InitXr()
 {
     #region xr
     decimal         printId = 9;
     EntitySysReport rptVo   = null;
     using (ProxyCommon proxy = new ProxyCommon())
     {
         rptVo = proxy.Service.GetReport(printId);
     }
     xr = new XtraReport();
     if (rptVo != null)
     {
         MemoryStream ms = new MemoryStream();
         ms.Write(rptVo.rptFile, 0, rptVo.rptFile.Length);
         xr.LoadLayout(ms);
     }
     xr.CreateDocument();
     #endregion
 }
Esempio n. 15
0
        /// <summary>
        /// init
        /// </summary>
        void init()
        {
            string[] arrStr = null;
            string   strTmp = string.Empty;

            DateTime dtmNow = DateTime.Now;

            this.dteDateStart.DateTime = new DateTime(dtmNow.Year, dtmNow.Month, 1);
            this.dteDateEnd.DateTime   = dtmNow;

            using (ProxyAnaReport proxy = new ProxyAnaReport())
            {
                strTmp = proxy.Service.GetSysParamStr("3069");
                if (!string.IsNullOrEmpty(strTmp))
                {
                    arrStr = strTmp.Split('*');
                    foreach (string str in arrStr)
                    {
                        JyStr += "'" + str + "'" + ",";
                    }
                    JyStr = "(" + JyStr.TrimEnd(',') + ")";
                }
            }

            decimal         printId = 23;
            EntitySysReport rptVo   = null;

            using (ProxyCommon proxy = new ProxyCommon())
            {
                rptVo = proxy.Service.GetReport(printId);
            }

            xr = new XtraReport();
            if (rptVo != null)
            {
                MemoryStream ms = new MemoryStream();
                ms.Write(rptVo.rptFile, 0, rptVo.rptFile.Length);
                xr.LoadLayout(ms);
            }
            this.ucPrintControl.PrintingSystem = xr.PrintingSystem;
            xr.CreateDocument();
        }
Esempio n. 16
0
        /// <summary>
        /// Design
        /// </summary>
        internal void Design()
        {
            EntitySysReport rptVo = Viewer.txtRptNo.Tag as EntitySysReport;

            if (rptVo == null)
            {
                DialogBox.Msg("请保存报表。");
                return;
            }
            if (string.IsNullOrEmpty(rptVo.rptSql))
            {
                DialogBox.Msg("请书写报表数据源(Sql)");
                return;
            }
            if (Viewer.ValueChanged)
            {
                if (this.Save() == false)
                {
                    return;
                }
            }
            DataTable dt = GetDataSource();

            if (dt == null)
            {
                DialogBox.Msg("书写的Sql不能正确构造出数据源,请检查Sql是否正确。");
                return;
            }
            rptVo.dataSource = dt;
            using (frmReportDesigner frm = new frmReportDesigner(rptVo))
            {
                frm.ShowDialog();
                if (frm.IsSave)
                {
                    int index = (Viewer.tvRport.DataSource as List <EntitySysReport>).FindIndex(t => t.rptId == rptVo.rptId);
                    (Viewer.tvRport.DataSource as List <EntitySysReport>)[index] = rptVo;
                    SetMainInfo(rptVo);
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="rptId"></param>
        /// <returns></returns>
        public int DeleteReport(decimal rptId)
        {
            int       affectRows = 0;
            SqlHelper svc        = null;

            try
            {
                svc = new SqlHelper(EnumBiz.onlineDB);
                EntitySysReport vo = new EntitySysReport();
                vo.rptId   = (int)rptId;
                affectRows = svc.Commit(svc.GetDelParmByPk(vo));
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }
Esempio n. 18
0
        /// <summary>
        /// Save
        /// </summary>
        internal void Save()
        {
            uiHelper.BeginLoading(Viewer);
            try
            {
                MemoryStream ms = new MemoryStream();
                Viewer.xrDesignPanel.Report.SaveLayout(ms);
                ms.Seek(0, SeekOrigin.Begin);
                byte[] bytData = new byte[ms.Length];
                ms.Read(bytData, 0, bytData.Length);
                ms.Close();

                if (this.rptTypeId == 1)
                {
                    this.reportVo.rptFile = ms.ToArray();
                    using (ProxyFormDesign proxy = new ProxyFormDesign())
                    {
                        EntitySysReport updateVo = new EntitySysReport();
                        updateVo.rptId   = this.reportVo.rptId;
                        updateVo.rptFile = this.reportVo.rptFile;
                        if (proxy.Service.SaveReportFile(updateVo) > 0)
                        {
                            Viewer.IsSave = true;
                            Viewer.xrDesignPanel.ReportState = DevExpress.XtraReports.UserDesigner.ReportState.Saved;
                            DialogBox.Msg("保存成功!");
                        }
                        else
                        {
                            DialogBox.Msg("保存失败。");
                        }
                    }
                }
                else if (this.rptTypeId == 2)
                {
                    this.templateVo.templateFile = ms.ToArray();
                    using (ProxyFormDesign proxy = new ProxyFormDesign())
                    {
                        object obj = this.templateVo.dataSource;
                        this.templateVo.dataSource = null;
                        if (proxy.Service.UpdateFormPrintTemplate(this.templateVo) > 0)
                        {
                            Viewer.IsSave = true;
                            Viewer.xrDesignPanel.ReportState = DevExpress.XtraReports.UserDesigner.ReportState.Saved;
                            DialogBox.Msg("保存成功!");
                        }
                        else
                        {
                            DialogBox.Msg("保存失败。");
                        }
                        this.templateVo.dataSource = obj;
                    }
                }
            }
            catch (Exception ex)
            {
                DialogBox.Msg(ex.Message);
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Save
        /// </summary>
        internal bool Save()
        {
            if (isSave)
            {
                return(false);
            }
            isSave = true;
            try
            {
                bool            isNew    = false;
                EntitySysReport reportVo = null;
                if (Viewer.txtRptNo.Tag == null)
                {
                    reportVo            = new EntitySysReport();
                    reportVo.creatorId  = GlobalLogin.objLogin.EmpNo;
                    reportVo.createDate = Utils.ServerTime();
                    isNew = true;
                }
                else
                {
                    reportVo = Viewer.txtRptNo.Tag as EntitySysReport;
                }
                reportVo.rptNo   = Viewer.txtRptNo.Text.Trim();
                reportVo.rptName = Viewer.txtRptName.Text.Trim();
                reportVo.rptSql  = Viewer.txtSql.Text.Trim();

                if (string.IsNullOrEmpty(reportVo.rptNo))
                {
                    DialogBox.Msg("请输入报表编号。");
                    Viewer.txtRptNo.Focus();
                    return(false);
                }
                if (string.IsNullOrEmpty(reportVo.rptName))
                {
                    DialogBox.Msg("请输入报表名称。");
                    Viewer.txtRptName.Focus();
                    return(false);
                }
                reportVo.pyCode = SpellCodeHelper.GetPyCode(reportVo.rptName);
                reportVo.wbCode = SpellCodeHelper.GetWbCode(reportVo.rptName);
                reportVo.type   = 1;
                reportVo.status = 1;

                using (ProxyFrame proxy = new ProxyFrame())
                {
                    if (proxy.Service.SaveReport(ref reportVo) > 0)
                    {
                        Viewer.txtRptNo.Tag = reportVo;
                        if (isNew)
                        {
                            (Viewer.tvRport.DataSource as List <EntitySysReport>).Add(reportVo);
                            Viewer.tvRport.RefreshDataSource();
                            Viewer.tvRport.FocusedNode = Viewer.tvRport.FindNodeByKeyID(reportVo.rptId);
                        }
                        else
                        {
                            int index = (Viewer.tvRport.DataSource as List <EntitySysReport>).FindIndex(t => t.rptId == reportVo.rptId);
                            (Viewer.tvRport.DataSource as List <EntitySysReport>)[index] = reportVo;
                            Viewer.tvRport.RefreshDataSource();
                        }
                        DialogBox.Msg("保存报表成功!");
                    }
                    else
                    {
                        DialogBox.Msg("保存报表失败。");
                    }
                }
                Viewer.ValueChanged = false;
            }
            catch (Exception ex)
            {
                DialogBox.Msg(ex.Message);
                return(false);
            }
            finally
            {
                isSave = false;
            }
            return(true);
        }