private void grdRelations_InitializeLayout(object sender, InitializeLayoutEventArgs e) { UltraGridBand band = e.Layout.Bands[0]; band.Override.AllowUpdate = DefaultableBoolean.False; CommutatorBrandParameters pmtCommutatorBrand = new CommutatorBrandParameters(); IList <CommutatorBrand> cctvBrands = this.srvCommutatorBrand.GetListByParameters(pmtCommutatorBrand); WindowsFormsUtil.SetUltraGridValueList(e.Layout, cctvBrands, band.Columns["CommutatorBrandId"], "CommutatorBrandId", "Name", "Seleccione"); CommutatorTypeParameters pmtCommutatorType = new CommutatorTypeParameters(); this.controlCustomerInfrastructureNetworkCommutators.ctcCommutatorType.Parameters = pmtCommutatorType; this.controlCustomerInfrastructureNetworkCommutators.ctcCommutatorType.Refresh(); IList <CommutatorType> cctvTypes = this.srvCommutatorType.GetListByParameters(pmtCommutatorType); WindowsFormsUtil.SetUltraGridValueList(e.Layout, cctvTypes, band.Columns["CommutatorTypeId"], "CommutatorTypeId", "Name", "Seleccione"); }
private void grdRelations_InitializeLayout(object sender, InitializeLayoutEventArgs e) { UltraGridBand band = e.Layout.Bands[0]; band.Override.AllowUpdate = DefaultableBoolean.False; ComputerBrandParameters pmtComputerBrand = new ComputerBrandParameters(); IList <ComputerBrand> cctvBrands = this.srvComputerBrand.GetListByParameters(pmtComputerBrand); WindowsFormsUtil.SetUltraGridValueList(e.Layout, cctvBrands, band.Columns["ComputerBrandId"], "ComputerBrandId", "Name", "Seleccione"); OperativeSystemParameters pmtOperativeSystem = new OperativeSystemParameters() { OperativeSystemTypeId = (int)OperativeSystemTypeEnum.Server }; IList <OperativeSystem> operativeSystemTypes = this.srvOperativeSystem.GetListByParameters(pmtOperativeSystem); WindowsFormsUtil.SetUltraGridValueList(e.Layout, operativeSystemTypes, band.Columns["OperativeSystemId"], "OperativeSystemId", "Name", "Seleccione"); ServerComputerTypeParameters pmtServerComputerType = new ServerComputerTypeParameters(); IList <ServerComputerType> serverComputerTypes = this.srvServerComputerType.GetListByParameters(pmtServerComputerType); WindowsFormsUtil.SetUltraGridValueList(e.Layout, serverComputerTypes, band.Columns["ServerComputerTypeId"], "ServerComputerTypeId", "Name", "Seleccione"); RackTypeParameters pmtRackType = new RackTypeParameters(); IList <RackType> rackTypes = this.srvRackType.GetListByParameters(pmtRackType); WindowsFormsUtil.SetUltraGridValueList(e.Layout, rackTypes, band.Columns["RackTypeId"], "RackTypeId", "Name", "Seleccione"); }
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"; } } }
private void InitializeFormControls() { // OpportunityType OpportunityTypeParameters pmtOpportunityType = new OpportunityTypeParameters(); IList <OpportunityType> lstOpportunityType = this.srvOpportunityType.GetListByParameters(pmtOpportunityType); WindowsFormsUtil.LoadCombo <OpportunityType>(this.frmOpportunity.uceSchOpportunityType, lstOpportunityType, "OpportunityTypeId", "Name", "Seleccione"); WindowsFormsUtil.LoadCombo <OpportunityType>(this.frmOpportunity.uceDetOpportunityType, lstOpportunityType, "OpportunityTypeId", "Name", "Seleccione"); this.frmOpportunity.uceDetOpportunityType.ValueChanged += new EventHandler(uceDetOpportunityType_ValueChanged); this.frmOpportunity.uceSchOpportunityType.ValueChanged += new EventHandler(uceSchOpportunityType_ValueChanged); this.uceDetOpportunityType_ValueChanged(null, null); this.uceSchOpportunityType_ValueChanged(null, null); // Bidder BidderParameters pmtBidder = new BidderParameters(); IList <Bidder> lstBidders = srvBidder.GetListByParameters(pmtBidder); WindowsFormsUtil.LoadCombo <Bidder>(this.frmOpportunity.uceSchBidder, lstBidders, "BidderId", "Name", "Seleccione"); WindowsFormsUtil.LoadCombo <Bidder>(this.frmOpportunity.uceDetBidder, lstBidders, "BidderId", "Name", "Seleccione"); this.frmOpportunity.uceSchBidder.ValueChanged += new EventHandler(uceSchBidder_ValueChanged); this.frmOpportunity.uceDetBidder.ValueChanged += new EventHandler(uceDetBidder_ValueChanged); // Dependency DependencyParameters pmtDependency = new DependencyParameters(); pmtDependency.BidderId = ParameterConstants.IntNone; IList <Dependency> lstDependencies = srvDependency.GetListByParameters(pmtDependency); WindowsFormsUtil.LoadCombo <Dependency>(this.frmOpportunity.uceSchDependency, lstDependencies, "DependencyId", "Name", "Seleccione"); WindowsFormsUtil.LoadCombo <Dependency>(this.frmOpportunity.uceDetDependency, lstDependencies, "DependencyId", "Name", "Seleccione"); this.frmOpportunity.uceSchDependency.ValueChanged += new EventHandler(uceSchDependency_ValueChanged); this.frmOpportunity.uceDetDependency.ValueChanged += new EventHandler(uceDetDependency_ValueChanged); // EndUser EndUserParameters pmtEndUser = new EndUserParameters(); pmtEndUser.DependencyId = ParameterConstants.IntNone; IList <EndUser> lstEndUsers = srvEndUser.GetListByParameters(pmtEndUser); WindowsFormsUtil.LoadCombo <EndUser>(this.frmOpportunity.uceSchEndUser, lstEndUsers, "EndUserId", "Name", "Seleccione"); WindowsFormsUtil.LoadCombo <EndUser>(this.frmOpportunity.uceDetEndUser, lstEndUsers, "EndUserId", "Name", "Seleccione"); // Asesor AsesorParameters pmtAsesor = new AsesorParameters(); IList <Asesor> lstAsesors = srvAsesor.GetListByParameters(pmtAsesor); WindowsFormsUtil.LoadCombo <Asesor>(this.frmOpportunity.uceSchAsesor, lstAsesors, "AsesorId", "Name", "Seleccione"); WindowsFormsUtil.LoadCombo <Asesor>(this.frmOpportunity.uceDetAsesor, lstAsesors, "AsesorId", "Name", "Seleccione"); // OpportunityStatus OpportunityStatusParameters pmtOpportunityStatus = new OpportunityStatusParameters(); IList <OpportunityStatus> lstOpportunityStatuses = srvOpportunityStatus.GetListByParameters(pmtOpportunityStatus); WindowsFormsUtil.LoadCombo <OpportunityStatus>(this.frmOpportunity.uceSchOpportunityStatus, lstOpportunityStatuses, "OpportunityStatusId", "Name", "Seleccione"); WindowsFormsUtil.LoadCombo <OpportunityStatus>(this.frmOpportunity.uceDetOpportunityStatus, lstOpportunityStatuses, "OpportunityStatusId", "Name", "Seleccione"); // Organization OrganizationParameters pmtOrganization = new OrganizationParameters(); IList <Organization> lstOrganizations = srvOrganization.GetListByParameters(pmtOrganization); WindowsFormsUtil.LoadCombo <Organization>(this.frmOpportunity.uceSchOrganization, lstOrganizations, "OrganizationId", "Name", "Seleccione"); WindowsFormsUtil.LoadCombo <Organization>(this.frmOpportunity.uceDetOrganization, lstOrganizations, "OrganizationId", "Name", "Seleccione"); //grdDetLog this.frmOpportunity.grdDetLog.InitializeLayout += new InitializeLayoutEventHandler(grdDetLog_InitializeLayout); this.frmOpportunity.grdDetLog.BeforeCellUpdate += new BeforeCellUpdateEventHandler(grdDetLog_BeforeCellUpdate); OpportunityLogParameters pmtOpportunityLog = new OpportunityLogParameters(); pmtOpportunityLog.OpportunityLogId = ParameterConstants.IntNone; this.dtOpportunityLog = this.srvOpportunityLog.SearchByParameters(pmtOpportunityLog); this.frmOpportunity.grdDetLog.DataSource = null; this.frmOpportunity.grdDetLog.DataSource = this.dtOpportunityLog; this.frmOpportunity.btnSchEdit.Click += new EventHandler(btnSchEdit_Click); this.frmOpportunity.btnSchSearch.Click += new EventHandler(btnSchSearch_Click); this.frmOpportunity.btnSchCreate.Click += new EventHandler(btnSchCreate_Click); this.frmOpportunity.btnDetSave.Click += new EventHandler(btnDetSave_Click); this.frmOpportunity.btnDetCancel.Click += new EventHandler(btnDetCancel_Click); this.frmOpportunity.btnSchDelete.Click += new EventHandler(this.btnSchDelete_Click); this.frmOpportunity.btnSchClear.Click += new EventHandler(btnSchClear_Click); this.frmOpportunity.ubtnDetGenerateTender.Click += new EventHandler(ubtnDetGenerateTender_Click); this.frmOpportunity.ubtnDetCreateLog.Click += new EventHandler(ubtnDetCreateLog_Click); this.hiddenOpportunityDetailTab = this.frmOpportunity.tabDetDetail.TabPages["OpportunityDetails"]; this.frmOpportunity.uosSchDates.Value = -1; this.frmOpportunity.HiddenDetail(true); this.ClearSearchControls(); }
private void grdDetalleQuincena_InitializeLayout(object sender, InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; e.Layout.Override.AllowUpdate = DefaultableBoolean.False; e.Layout.Override.HeaderClickAction = HeaderClickAction.Select; WindowsFormsUtil.SetUltraColumnFormat(band.Columns["fiscal"], TextFormatEnum.Integer); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["factura"], TextFormatEnum.Integer); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["factura_original"], TextFormatEnum.Integer); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["importe"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["costo"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad_comisionable"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["margen_utilidad"], TextFormatEnum.Percentage); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total_acumulado"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_cuota"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_comision"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_comision_agente"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total_pagado"], TextFormatEnum.Currency); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["porcentaje_comision"], TextFormatEnum.Percentage); WindowsFormsUtil.SetUltraColumnFormat(band.Columns["cuota"], TextFormatEnum.Currency); Parallel.ForEach(this.grdDetalleQuincena.Rows, row => { if (row.Cells["pendiente_pago"].Value.ToString() == "Si") { row.CellAppearance.BackColor = Color.LightGreen; } decimal utilidad = Convert.ToDecimal(row.Cells["utilidad_comisionable"].Value); decimal utilidadComissionable = Convert.ToDecimal(row.Cells["utilidad_comisionable"].Value); if (utilidad - utilidadComissionable > 0.01M || utilidadComissionable <= 0) { if (row.CellAppearance.BackColor == Color.LightGreen) { row.CellAppearance.BackColor = Color.YellowGreen; } else { row.CellAppearance.BackColor = Color.Yellow; } } }); }