public GenericDocumentFormController(GenericDocumentForm frmGenericDocument)
            : base(frmGenericDocument)
        {
            FormConfigurationParameters pmtFormConfiguration = new FormConfigurationParameters();

            this.frmGenericDocument = frmGenericDocument;

            this.frmGenericDocument.grdPrincipal.InitializeLayout
                += new InitializeLayoutEventHandler(grdPrincipal_InitializeLayout);

            this.frmGenericDocument.ulblSchUsername.Text = Session.User.Username;

            if (this.FormConfiguration != null)
            {
                this.frmGenericDocument.Text = this.FormConfiguration.FormEndUserName;
            }


            if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
            {
                this.srvGeneric = SamsaraAppContext.Resolve <IGenericService>();
            }

            this.FormStatus = FormStatusEnum.Search;
            this.ShowDetail(false);
        }
        public SamsaraFormController(SamsaraForm frmSamsara)
        {
            this.frmSamsara = frmSamsara;

            FormConfigurationParameters pmtFormConfiguration = new FormConfigurationParameters();

            this.srvFormConfiguration = SamsaraAppContext.Resolve <IFormConfigurationService>();

            pmtFormConfiguration.FormName = this.frmSamsara.Name;
            this.FormConfiguration        = this.srvFormConfiguration.GetByParameters(pmtFormConfiguration);
        }
Ejemplo n.º 3
0
        public GenericDocumentFormController(GenericDocumentForm frmGenericDocument)
            : base(frmGenericDocument)
        {
            FormConfigurationParameters pmtFormConfiguration = new FormConfigurationParameters();

            this.frmGenericDocument = frmGenericDocument;

            this.frmGenericDocument.grdPrincipal.InitializeLayout
                += new InitializeLayoutEventHandler(grdPrincipal_InitializeLayout);

            this.frmGenericDocument.ulblSchUsername.Text = Session.User.Username;

            if (this.FormConfiguration != null)
            {
                this.frmGenericDocument.Text = this.FormConfiguration.FormEndUserName;
            }

            this.FormStatus = FormStatusEnum.Search;
            this.ShowDetail(false);
        }
Ejemplo n.º 4
0
        protected override void OnInitializeLayout(InitializeLayoutEventArgs e)
        {
            base.OnInitializeLayout(e);

            e.Layout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;

            FormConfiguration formConfiguration = null;

            if (this.DataSource != null)
            {
                IList <string> lstCustomControlNames = new List <string>();
                this.GetCustomControlsNames(this.Parent, lstCustomControlNames);
                string parentFormName = lstCustomControlNames.Last();
                lstCustomControlNames.Remove(parentFormName);
                string schemeName = null;

                if (parentFormName != null && parentFormName.Contains("Form"))
                {
                    Form form = this.GetForm(this.Parent);
                    schemeName = form.GetType().Namespace.Split('.')[1];

                    if (typeof(IConfigurableForm).IsAssignableFrom(form.GetType()))
                    {
                        IConfigurableForm configurableForm = form as IConfigurableForm;

                        formConfiguration = configurableForm.FormConfiguration;
                    }
                    else
                    {
                        FormConfigurationParameters pmtFormConfiguration = new FormConfigurationParameters();
                        pmtFormConfiguration.FormName = parentFormName;
                        formConfiguration             = srvFormConfiguration.GetByParameters(pmtFormConfiguration);
                    }
                }
                else
                {
                    return;
                }

                if (formConfiguration == null)
                {
                    SchemeParameters pmtScheme = new SchemeParameters();
                    pmtScheme.Name = schemeName;

                    Scheme scheme = this.srvScheme.GetByParameters(pmtScheme);

                    formConfiguration          = new FormConfiguration();
                    formConfiguration.FormName = parentFormName;
                    formConfiguration.Scheme   = scheme;
                    srvFormConfiguration.SaveOrUpdate(formConfiguration);
                }

                string gridName = (lstCustomControlNames.Count == 0 ? "" :
                                   string.Join(".", lstCustomControlNames.Reverse().ToArray()) + ".") + this.Name;

                FormConfigurationGrid formGrid = formConfiguration.FormConfigurationGrids
                                                 .SingleOrDefault(x => x.GridName == gridName);

                if (formGrid == null)
                {
                    FormConfigurationGridParameters pmtFormConfigurationGrid = new FormConfigurationGridParameters();
                    pmtFormConfigurationGrid.GridName            = gridName;
                    pmtFormConfigurationGrid.FormConfigurationId = formConfiguration.FormConfigurationId;
                    formGrid = srvFormConfigurationGrid.GetByParameters(pmtFormConfigurationGrid);
                }

                if (formGrid == null)
                {
                    formGrid                     = new FormConfigurationGrid();
                    formGrid.GridName            = gridName;
                    formGrid.IgnoreConfiguration = false;
                    formGrid.FormConfiguration   = formConfiguration;
                    srvFormConfigurationGrid.SaveOrUpdate(formGrid);
                }

                if (formGrid.IgnoreConfiguration)
                {
                    return;
                }

                foreach (UltraGridBand band in this.DisplayLayout.Bands)
                {
                    foreach (UltraGridColumn column in band.Columns)
                    {
                        FormConfigurationGridColumn formGridColumn = null;

                        if (formGrid.FormConfigurationGridColumns != null)
                        {
                            formGridColumn = formGrid
                                             .FormConfigurationGridColumns.SingleOrDefault(x => x.ColumnName == column.Key &&
                                                                                           (x.BandKey == null || x.BandKey == band.Key));
                        }

                        if (formGridColumn == null)
                        {
                            formGridColumn = new FormConfigurationGridColumn();
                            formGrid.FormConfigurationGridColumns.Add(formGridColumn);
                            formGridColumn.ColumnName            = column.Key;
                            formGridColumn.ColumnEndUserName     = column.Key;
                            formGridColumn.FormConfigurationGrid = formGrid;
                            formGridColumn.Visible = false;
                            formGridColumn.BandKey = band.Key;
                            srvFormConfigurationGridColumn.SaveOrUpdate(formGridColumn);
                        }
                    }
                }

                IList <string> lstOrderedColumnNames = formGrid.FormConfigurationGridColumns
                                                       .OrderBy(x => x.FormConfigurationGridColumnId).Select(x => x.ColumnName).ToList();

                foreach (UltraGridBand band in this.DisplayLayout.Bands)
                {
                    int index = 0;
                    foreach (UltraGridColumn column in band.Columns.Cast <UltraGridColumn>()
                             .OrderBy(x => lstOrderedColumnNames.IndexOf(x.Key)))
                    {
                        FormConfigurationGridColumn gridColumnConfiguration = formGrid
                                                                              .FormConfigurationGridColumns.Single(x => x.ColumnName == column.Key &&
                                                                                                                   (x.BandKey == null || x.BandKey == band.Key));

                        column.Hidden                 = !gridColumnConfiguration.Visible && !formGrid.IgnoreConfiguration;
                        column.Header.Caption         = gridColumnConfiguration.ColumnEndUserName;
                        column.Header.VisiblePosition = index++;

                        if (gridColumnConfiguration.TextFormat != null)
                        {
                            WindowsFormsUtil.SetUltraColumnFormat(column, gridColumnConfiguration.TextFormat);
                        }
                        if (gridColumnConfiguration.Width.HasValue)
                        {
                            column.Width = gridColumnConfiguration.Width.Value;
                        }
                    }

                    //band.SummaryFooterCaption = "Sumatorias";
                }
            }
        }
Ejemplo n.º 5
0
        protected override void OnInitializeLayout(InitializeLayoutEventArgs e)
        {
            base.OnInitializeLayout(e);
            e.Layout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;

            Assert.IsNotNull(this.srvFormConfiguration);
            Assert.IsNotNull(this.srvGridConfiguration);
            Assert.IsNotNull(this.srvGridColumnConfiguration);

            FormConfiguration formConfiguration = null;

            if (this.DataSource != null && this.DataSource is DataTable)
            {
                string parentFormName = this.GetParentFormName(this.Parent);

                if (parentFormName != null)
                {
                    FormConfigurationParameters pmtFormConfiguration = new FormConfigurationParameters();
                    pmtFormConfiguration.FormName = parentFormName;
                    formConfiguration             = srvFormConfiguration.GetByParameters(pmtFormConfiguration);
                }
                else
                {
                    return;
                }

                if (formConfiguration == null)
                {
                    formConfiguration          = new FormConfiguration();
                    formConfiguration.FormName = parentFormName;
                    srvFormConfiguration.SaveOrUpdate(formConfiguration);
                }

                GridConfigurationParameters pmtGridConfiguration = new GridConfigurationParameters();
                pmtGridConfiguration.GridName            = this.Name;
                pmtGridConfiguration.FormConfigurationId = formConfiguration.FormConfigurationId;
                GridConfiguration gridConfiguration = srvGridConfiguration.GetByParameters(pmtGridConfiguration);

                if (gridConfiguration == null)
                {
                    gridConfiguration                     = new GridConfiguration();
                    gridConfiguration.GridName            = this.Name;
                    gridConfiguration.IgnoreConfiguration = false;
                    gridConfiguration.FormConfiguration   = formConfiguration;
                    srvGridConfiguration.SaveOrUpdate(gridConfiguration);
                }

                if (gridConfiguration.IgnoreConfiguration)
                {
                    return;
                }

                foreach (UltraGridBand band in this.DisplayLayout.Bands)
                {
                    foreach (UltraGridColumn column in band.Columns)
                    {
                        GridColumnConfiguration gridColumnConfiguration = null;

                        if (gridConfiguration.GridColumnConfigurations != null)
                        {
                            gridColumnConfiguration = gridConfiguration
                                                      .GridColumnConfigurations.SingleOrDefault(x => x.ColumnName == column.Key &&
                                                                                                x.Band == band.Index);
                        }

                        if (gridColumnConfiguration == null)
                        {
                            gridColumnConfiguration = new GridColumnConfiguration();
                            gridConfiguration.GridColumnConfigurations.Add(gridColumnConfiguration);
                            gridColumnConfiguration.ColumnName        = column.Key;
                            gridColumnConfiguration.ColumnEndUserName = column.Key;
                            gridColumnConfiguration.GridConfiguration = gridConfiguration;
                            gridColumnConfiguration.Visible           = false;
                            gridColumnConfiguration.Band = band.Index;
                            srvGridColumnConfiguration.SaveOrUpdate(gridColumnConfiguration);
                        }
                    }
                }

                IList <string> lstOrderedColumnNames = gridConfiguration.GridColumnConfigurations
                                                       .OrderBy(x => x.GridColumnConfigurationId).Select(x => x.ColumnName).ToList();

                foreach (UltraGridBand band in this.DisplayLayout.Bands)
                {
                    int index = 0;
                    foreach (UltraGridColumn column in band.Columns.Cast <UltraGridColumn>()
                             .OrderBy(x => lstOrderedColumnNames.IndexOf(x.Key)))
                    {
                        GridColumnConfiguration gridColumnConfiguration = gridConfiguration
                                                                          .GridColumnConfigurations.Single(x => x.ColumnName == column.Key &&
                                                                                                           x.Band == band.Index);

                        column.Hidden                 = !gridColumnConfiguration.Visible && !gridConfiguration.IgnoreConfiguration;
                        column.Header.Caption         = gridColumnConfiguration.ColumnEndUserName;
                        column.Header.VisiblePosition = index++;
                    }

                    //band.SummaryFooterCaption = "Sumatorias";
                }
            }
        }