예제 #1
0
    private void RenderForm()
    {
        var grantToWrite       = this.ApplicationUser.HasGrantToWrite(ApplicationGrant.Objetivo);
        var defaultComboOption = FormSelectOption.DefaultOption(this.Dictionary);

        this.TxtRecursos = new FormTextArea
        {
            Value        = this.Objetivo.Resources,
            Label        = this.Dictionary["Item_Objetivo_FieldLabel_Resources"],
            Name         = "TxtResources",
            Rows         = 3,
            GrantToWrite = grantToWrite
        };

        this.TxtMetodologia = new FormTextArea
        {
            Value        = this.Objetivo.Methodology,
            Label        = this.Dictionary["Item_Objetivo_FieldLabel_Methodology"],
            Name         = "TxtMethodology",
            Rows         = 3,
            GrantToWrite = grantToWrite
        };

        this.TxtNotes = new FormTextArea
        {
            Value        = this.Objetivo.Notes,
            Label        = this.Dictionary["Item_Objetivo_FieldLabel_Notes"],
            Name         = "TxtNotes",
            Rows         = 3,
            GrantToWrite = grantToWrite
        };

        this.CmbResponsible = new FormSelect
        {
            ColumnsSpanLabel = 1,
            Label            = this.Dictionary["Item_Objetivo_FieldLabel_Responsible"],
            ColumnsSpan      = 3,
            Name             = "CmbResponsible",
            GrantToWrite     = grantToWrite,
            Required         = true,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = defaultComboOption
        };

        this.CmbResponsibleClose = new FormSelect
        {
            ColumnsSpanLabel = 3,
            Label            = this.Dictionary["Item_Objetivo_FieldLabel_CloseResponsible"],
            ColumnsSpan      = 9,
            Name             = "CmbEndResponsible",
            GrantToWrite     = grantToWrite,
            DefaultOption    = defaultComboOption,
            RequiredMessage  = this.Dictionary["Common_Required"],
            Required         = true
        };

        this.CmbResponsibleRecord = new FormSelect
        {
            ColumnsSpanLabel = 3,
            Label            = this.Dictionary["Item_IndicatorRecord_FieldLabel_Responsible"],
            ColumnsSpan      = 9,
            Name             = "CmbResponsibleRecord",
            GrantToWrite     = grantToWrite,
            DefaultOption    = defaultComboOption,
            Required         = true,
            RequiredMessage  = this.Dictionary["Common_Required"]
        };

        this.CmbIndicador = new FormSelect
        {
            ColumnsSpanLabel = 1,
            Label            = this.Dictionary["Item_Objetivo_FieldLabel_Indicator"],
            ColumnsSpan      = 3,
            Name             = "CmbIndicador",
            GrantToWrite     = grantToWrite,
            Required         = true,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = defaultComboOption
        };

        foreach (var indicador in Indicador.ByCompany(this.Company.Id))
        {
            if (indicador.Active || indicador.Id == this.Objetivo.IndicatorId)
            {
                this.CmbIndicador.AddOption(new FormSelectOption
                {
                    Value    = indicador.Id.ToString(),
                    Text     = indicador.Description,
                    Selected = indicador.Id == this.Objetivo.IndicatorId
                });
            }
        }

        foreach (var e in this.Company.Employees)
        {
            if (e.Active && e.DisabledDate == null)
            {
                this.CmbResponsible.AddOption(new FormSelectOption
                {
                    Value    = e.Id.ToString(),
                    Text     = e.FullName,
                    Selected = e.Id == this.Objetivo.Responsible.Id
                });

                this.CmbResponsibleClose.AddOption(new FormSelectOption
                {
                    Value    = e.Id.ToString(),
                    Text     = e.FullName,
                    Selected = e.Id == this.Objetivo.EndResponsible.Id
                });

                this.CmbResponsibleRecord.AddOption(new FormSelectOption
                {
                    Value    = e.Id.ToString(),
                    Text     = e.FullName,
                    Selected = false
                });
            }
        }

        this.TxtFechaCierrePrevista = new FormDatePicker
        {
            Id               = "TxtFechaCierrePrevista",
            Value            = this.Objetivo.PreviewEndDate,
            ColumnsSpan      = Constant.ColumnSpan4,
            ColumnsSpanLabel = Constant.ColumnSpan2,
            Label            = this.Dictionary["Item_Objetivo_FieldLabel_ClosePreviewDate"]
        };

        this.TxtFechaCierreReal = new FormDatePicker
        {
            Id               = "TxtFechaCierreReal",
            Value            = this.Objetivo.EndDate,
            ColumnsSpan      = Constant.ColumnSpan4,
            ColumnsSpanLabel = Constant.ColumnSpan2,
            Label            = this.Dictionary["Item_Objetivo_FieldLabel_CloseRealDate"]
        };
    }
예제 #2
0
    private void RenderActionsForm()
    {
        var defaultOption = FormSelectOption.DefaultOption(this.Dictionary);
        var grantToWrite  = this.ApplicationUser.HasGrantToWrite(ApplicationGrant.BusinessRisk);

        this.ComboActionWhatHappenedResponsible = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_ResponsibleWhatHappend"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbActionWhatHappenedResponsible",
            GrantToWrite     = grantToWrite,
            Required         = true,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = defaultOption
        };

        this.ComboActionCausesResponsible = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_ResponsibleCauses"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbActionCausesResponsible",
            GrantToWrite     = grantToWrite,
            Required         = true,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = defaultOption
        };

        this.ComboActionActionsResponsible = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_ResponsibleActions"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbActionActionsResponsible",
            GrantToWrite     = grantToWrite,
            Required         = true,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = defaultOption
        };

        this.ComboActionActionsExecuter = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_Responsible"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbActionActionsExecuter",
            GrantToWrite     = this.ApplicationUser.HasGrantToWrite(ApplicationGrant.BusinessRisk),
            Required         = true,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = defaultOption
        };

        this.ComboActionClosedResponsible = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_ResponsibleClose"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbActionClosedResponsible",
            GrantToWrite     = grantToWrite,
            Required         = true,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = defaultOption
        };

        long whatHappenedResponsibleId = this.IncidentAction.WhatHappenedBy == null ? 0 : this.IncidentAction.WhatHappenedBy.Id;
        long causesResponsibleId       = this.IncidentAction.CausesBy == null ? 0 : this.IncidentAction.CausesBy.Id;
        long actionsResponsibleId      = this.IncidentAction.ActionsBy == null ? 0 : this.IncidentAction.ActionsBy.Id;
        long actionsExecuterId         = this.IncidentAction.ActionsExecuter == null ? 0 : this.IncidentAction.ActionsExecuter.Id;
        long closedResponsibleId       = this.IncidentAction.ClosedBy == null ? 0 : this.IncidentAction.ClosedBy.Id;

        foreach (var e in this.Company.Employees)
        {
            if (e.Active && e.DisabledDate == null)
            {
                this.ComboActionWhatHappenedResponsible.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == whatHappenedResponsibleId
                });
                this.ComboActionCausesResponsible.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == causesResponsibleId
                });
                this.ComboActionActionsResponsible.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == actionsResponsibleId
                });
                this.ComboActionActionsExecuter.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == actionsExecuterId
                });
                this.ComboActionClosedResponsible.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == closedResponsibleId
                });
            }
            else
            {
                if (this.IncidentAction.WhatHappenedBy != null)
                {
                    if (e.Id == this.IncidentAction.WhatHappenedBy.Id && !e.Active)
                    {
                        this.ComboActionWhatHappenedResponsible.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }

                if (this.IncidentAction.CausesBy != null)
                {
                    if (e.Id == this.IncidentAction.CausesBy.Id && !e.Active)
                    {
                        this.ComboActionCausesResponsible.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }

                if (this.IncidentAction.ActionsBy != null)
                {
                    if (e.Id == this.IncidentAction.ActionsBy.Id && !e.Active)
                    {
                        this.ComboActionActionsResponsible.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }

                if (this.IncidentAction.ActionsExecuter != null)
                {
                    if (e.Id == this.IncidentAction.ActionsExecuter.Id && !e.Active)
                    {
                        this.ComboActionActionsExecuter.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }

                if (this.IncidentAction.ClosedBy != null)
                {
                    if (e.Id == this.IncidentAction.ClosedBy.Id && !e.Active)
                    {
                        this.ComboActionClosedResponsible.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }
            }
        }
    }
예제 #3
0
    public void RenderForm()
    {
        this.TxtWhatHappened = new FormTextArea {
            Rows = 5, Value = this.IncidentAction.WhatHappened, Name = "TxtWhatHappened", Label = this.Dictionary["Item_IncidentAction_Field_WhatHappened"], ColumnsSpan = Constant.ColumnSpan8, ColumnsSpanLabel = 12, MaxLength = Constant.MaximumTextAreaLength, Embedded = true
        };
        this.TxtCauses = new FormTextArea {
            Rows = 5, Value = this.IncidentAction.Causes, Name = "TxtCauses", Label = this.Dictionary["Item_IncidentAction_Field_Causes"], ColumnsSpan = Constant.ColumnSpan8, ColumnsSpanLabel = 12, MaxLength = Constant.MaximumTextAreaLength, Embedded = true
        };
        this.TxtActions = new FormTextArea {
            Rows = 5, Value = this.IncidentAction.Actions, Name = "TxtActions", Label = this.Dictionary["Item_IncidentAction_Field_Actions"], ColumnsSpan = Constant.ColumnSpan8, ColumnsSpanLabel = 12, MaxLength = Constant.MaximumTextAreaLength, Embedded = true
        };
        this.TxtMonitoring = new FormTextArea {
            Rows = 5, Value = this.IncidentAction.Monitoring, Name = "TxtMonitoring", Label = this.Dictionary["Item_IncidentAction_Field_Monitoring"], ColumnsSpan = 12, ColumnsSpanLabel = 12, MaxLength = Constant.MaximumTextAreaLength, Embedded = true
        };
        this.TxtNotes = new FormTextArea {
            Rows = 5, Value = this.IncidentAction.Notes, Name = "TxtNotes", Label = this.Dictionary["Item_IncidentAction_Field_Notes"], ColumnsSpan = 12, ColumnsSpanLabel = 12, MaxLength = Constant.MaximumTextAreaLength, Embedded = true
        };

        this.CmbWhatHappenedResponsible = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_ResponsibleWhatHappend"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbWhatHappenedResponsible",
            GrantToWrite     = this.grantToWrite,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = FormSelectOption.DefaultOption(this.Dictionary)
        };

        this.CmbCausesResponsible = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_ResponsibleCauses"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbCausesResponsible",
            GrantToWrite     = this.grantToWrite,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = FormSelectOption.DefaultOption(this.Dictionary)
        };

        this.CmbActionsResponsible = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_ResponsibleActions"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbActionsResponsible",
            GrantToWrite     = this.grantToWrite,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = FormSelectOption.DefaultOption(this.Dictionary)
        };

        this.CmbActionsExecuter = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_Executer"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbActionsExecuter",
            GrantToWrite     = this.grantToWrite,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = FormSelectOption.DefaultOption(this.Dictionary)
        };

        this.CmbClosedResponsible = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan4,
            Label            = this.Dictionary["Item_IncidentAction_Field_ResponsibleClose"],
            ColumnsSpan      = Constant.ColumnSpan8,
            Name             = "CmbClosedResponsible",
            GrantToWrite     = this.grantToWrite,
            RequiredMessage  = this.Dictionary["Common_Required"],
            Required         = true,
            DefaultOption    = FormSelectOption.DefaultOption(this.Dictionary)
        };

        this.CmbClosedExecutor = new FormSelect
        {
            ColumnsSpanLabel = Constant.ColumnSpan2,
            Label            = this.Dictionary["Item_IncidentAction_Field_Executer"],
            ColumnsSpan      = 3,
            Name             = "CmbClosedExecutor",
            GrantToWrite     = this.grantToWrite,
            RequiredMessage  = this.Dictionary["Common_Required"],
            DefaultOption    = FormSelectOption.DefaultOption(this.Dictionary)
        };

        long whatHappendResponsibleId = this.IncidentAction.WhatHappenedBy == null ? 0 : this.IncidentAction.WhatHappenedBy.Id;
        long causesResponsibleId      = this.IncidentAction.CausesBy == null ? 0 : this.IncidentAction.CausesBy.Id;
        long actionsResponsibleId     = this.IncidentAction.ActionsBy == null ? 0 : this.IncidentAction.ActionsBy.Id;
        long actionsExecuterId        = this.IncidentAction.ActionsExecuter == null ? 0 : this.IncidentAction.ActionsExecuter.Id;
        long closedResponsibleId      = this.IncidentAction.ClosedBy == null ? 0 : this.IncidentAction.ClosedBy.Id;
        long closedExecutorId         = this.IncidentAction.ClosedExecutor == null ? 0 : this.IncidentAction.ClosedExecutor.Id;

        foreach (var e in this.Company.Employees)
        {
            if (e.Active && e.DisabledDate == null)
            {
                this.CmbWhatHappenedResponsible.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == whatHappendResponsibleId
                });
                this.CmbCausesResponsible.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == causesResponsibleId
                });
                this.CmbActionsResponsible.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == actionsResponsibleId
                });
                this.CmbActionsExecuter.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == actionsExecuterId
                });
                this.CmbClosedResponsible.AddOption(new FormSelectOption {
                    Value = e.Id.ToString(), Text = e.FullName, Selected = e.Id == closedResponsibleId
                });
            }
            else
            {
                if (this.IncidentAction.WhatHappenedBy != null)
                {
                    if (e.Id == this.IncidentAction.WhatHappenedBy.Id && (!e.Active || e.DisabledDate != null))
                    {
                        this.CmbWhatHappenedResponsible.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }

                if (this.IncidentAction.CausesBy != null)
                {
                    if (e.Id == this.IncidentAction.CausesBy.Id && (!e.Active || e.DisabledDate != null))
                    {
                        this.CmbCausesResponsible.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }

                if (this.IncidentAction.ActionsBy != null)
                {
                    if (e.Id == this.IncidentAction.ActionsBy.Id && (!e.Active || e.DisabledDate != null))
                    {
                        this.CmbActionsResponsible.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }

                if (this.IncidentAction.ActionsExecuter != null)
                {
                    if (e.Id == this.IncidentAction.ActionsExecuter.Id && (!e.Active || e.DisabledDate != null))
                    {
                        this.CmbActionsExecuter.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }

                if (this.IncidentAction.ClosedBy != null)
                {
                    if (e.Id == this.IncidentAction.ClosedBy.Id && (!e.Active || e.DisabledDate != null))
                    {
                        this.CmbClosedResponsible.AddOption(new FormSelectOption {
                            Value = e.Id.ToString(), Text = e.FullName, Selected = true
                        });
                    }
                }
            }
        }

        var defaultOption = FormSelectOption.DefaultOption(this.Dictionary);

        this.CmbReporterDepartment = new FormSelect
        {
            ColumnsSpan   = 12,
            Name          = "CmbReporterType1",
            GrantToWrite  = this.grantToWrite,
            DefaultOption = defaultOption
        };

        this.CmbReporterProvider = new FormSelect
        {
            ColumnsSpan   = 12,
            Name          = "CmbReporterType2",
            GrantToWrite  = this.grantToWrite,
            DefaultOption = defaultOption
        };

        this.CmbReporterCustomer = new FormSelect
        {
            ColumnsSpan   = 12,
            Name          = "CmbReporterType3",
            GrantToWrite  = this.grantToWrite,
            DefaultOption = defaultOption
        };

        this.TxtDescription = new FormText
        {
            ColumnSpan      = 10,
            ColumnSpanLabel = 1,
            GrantToWrite    = this.grantToWrite,
            Label           = this.Dictionary["Item_IncidentAction_Label_Description"],
            MaximumLength   = 100,
            Name            = "TxtDescription",
            Placeholder     = this.Dictionary["Item_IncidentAction_Label_Description"],
            Required        = true,
            RequiredMessage = this.Dictionary["Common_Required"],
            Value           = this.IncidentAction.Description
        };

        this.WhatHappenedDate = new FormDatePicker
        {
            Id               = "TxtWhatHappenedDate",
            Label            = this.Dictionary["Item_IncidentAction_Field_Date"],
            ColumnsSpanLabel = Constant.ColumnSpan4,
            ColumnsSpan      = Constant.ColumnSpan8,
            Value            = this.IncidentAction.WhatHappenedOn
        };

        this.CausesDate = new FormDatePicker
        {
            Id               = "TxtCausesDate",
            Label            = this.Dictionary["Item_IncidentAction_Field_Date"],
            ColumnsSpanLabel = Constant.ColumnSpan4,
            ColumnsSpan      = Constant.ColumnSpan8,
            Value            = this.IncidentAction.CausesOn
        };

        this.ActionsDate = new FormDatePicker
        {
            Id               = "TxtActionsDate",
            Label            = this.Dictionary["Common_DateExecution"],
            ColumnsSpanLabel = Constant.ColumnSpan4,
            ColumnsSpan      = Constant.ColumnSpan8,
            Value            = this.IncidentAction.ActionsOn
        };

        this.ActionsSchedule = new FormDatePicker
        {
            Id               = "TxtActionsSchedule",
            Label            = this.Dictionary["Item_IncidentAction_Field_Date"],
            ColumnsSpanLabel = Constant.ColumnSpan4,
            ColumnsSpan      = Constant.ColumnSpan8,
            Value            = this.IncidentAction.ActionsSchedule
        };

        this.ClosedDate = new FormDatePicker
        {
            Id               = "TxtClosedDate",
            Label            = this.Dictionary["Item_IncidentAction_Field_Date"],
            ColumnsSpanLabel = Constant.ColumnSpan4,
            ColumnsSpan      = Constant.ColumnSpan6,
            Value            = this.IncidentAction.ClosedOn,
            GrantToWrite     = this.grantToWrite,
            Required         = true
        };

        this.ClosedExecutorDate = new FormDatePicker
        {
            Id               = "TxtClosedExecutorDate",
            Label            = this.Dictionary["Item_IncidentAction_Field_Date"],
            ColumnsSpanLabel = Constant.ColumnSpan2,
            ColumnsSpan      = Constant.ColumnSpan2,
            Value            = this.IncidentAction.ClosedExecutorOn
        };
    }