예제 #1
0
        private void PivotForm_Save(PivotFormWin m, SaveLayoutEventArgs e)
        {
            ReportCentral           rc         = (ReportCentral)View.CurrentObject;
            ReportCentralLayoutData layoutData = this.ObjectSpace.CreateObject <ReportCentralLayoutData>();
            bool IsOkay = false;

            if (rc.ReportCentralLayoutData.Count > 0)
            {
                foreach (ReportCentralLayoutData layout in rc.ReportCentralLayoutData)
                {
                    if (layout.Owner.Oid.ToString() == SecuritySystem.CurrentUserId.ToString())
                    {
                        IsOkay             = true;
                        layout.PivotLayout = e.LayoutXML;
                    }
                }
            }
            if (!IsOkay)
            {
                layoutData.Owner       = ObjectSpace.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);
                layoutData.PivotLayout = e.LayoutXML;
                rc.ReportCentralLayoutData.Add(layoutData);
            }
            ObjectSpace.CommitChanges();
        }
예제 #2
0
        private void BindToPivot_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            ReportCentral rc = (ReportCentral)View.CurrentObject;

            PivotFormWin pivotForm = new PivotFormWin();

            pivotForm.QueryString       = rc.QueryString;
            pivotForm.LayoutData        = rc.PivotViewXML;
            pivotForm.DefaultLayoutData = rc.PivotViewXML;
            if (rc.CreatedBy.Oid.ToString() == SecuritySystem.CurrentUserId.ToString())
            {
                pivotForm.IsOwnwer = true;
            }
            if (rc.ReportCentralLayoutData.Count > 0)
            {
                foreach (ReportCentralLayoutData layout in rc.ReportCentralLayoutData)
                {
                    if (layout.Owner.Oid.ToString() == SecuritySystem.CurrentUserId.ToString())
                    {
                        pivotForm.LayoutData = layout.PivotLayout;
                    }
                }
            }

            pivotForm.ConnectionString = rc.Connection.ConnectionString;
            pivotForm.ReportName       = rc.Name;
            List <ParameterDefinition> list = new List <ParameterDefinition>();

            rc.Parameters.Sorting.Add(new SortProperty("ParameterIndex", DevExpress.Xpo.DB.SortingDirection.Ascending));
            if (rc.Parameters.Count > 0)
            {
                foreach (ReportParameter param in rc.Parameters)
                {
                    ParameterDefinition definition = new ParameterDefinition()
                    {
                        ParameterCaption      = param.Caption,
                        ParameterName         = param.Name,
                        ParameterPropertyType = param.ParameterType.Type,
                        ParameterDefaultValue = param.DefaultValue,
                        ParameterIndex        = param.ParameterIndex
                    };

                    if (param.ParameterType.Type == BusinessObjects.ParameterPropertyType.DataSource)
                    {
                        definition.ParameterConnection  = param.ParameterType.Connection.ConnectionString;
                        definition.ParameterQueryString = param.ParameterType.QueryString;
                    }
                    list.Add(definition);
                }
                pivotForm.ParameterDefinition = list;
            }
            pivotForm.Save += PivotForm_Save;
            pivotForm.SaveDefaultLayout += PivotForm_SaveDefaultLayout;
            pivotForm.ShowPivotForm();
        }
예제 #3
0
        private void PivotForm_SaveDefaultLayout(PivotFormWin m, SaveLayoutEventArgs e)
        {
            ReportCentral rc = (ReportCentral)View.CurrentObject;

            rc.PivotViewXML = e.LayoutXML;
            MediaDataObject mediaDataObject = ObjectSpace.CreateObject <MediaDataObject>();

            mediaDataObject.MediaData = ConvertBitMapToByteArray(e.ImageData);
            rc.PivotLayout            = mediaDataObject;
            rc.Save();
            ObjectSpace.CommitChanges();
        }