예제 #1
0
    private void RenderUnidadData()
    {
        var  res        = new StringBuilder();
        var  sea        = new StringBuilder();
        var  searchItem = new List <string>();
        bool first      = true;
        int  contData   = 0;

        foreach (var unidad in Unidad.GetActive(((Company)Session["Company"]).Id))
        {
            if (!unidad.Active)
            {
                continue;
            }

            if (!searchItem.Contains(unidad.Description))
            {
                searchItem.Add(unidad.Description);
            }

            res.Append(unidad.ListRow(this.dictionary, this.user.Grants));
            contData++;
        }

        this.ProviderDataTotal.Text = contData.ToString();

        searchItem.Sort();
        foreach (string item in searchItem)
        {
            if (first)
            {
                first = false;
            }
            else
            {
                sea.Append(",");
            }

            if (item.IndexOf("\"") != -1)
            {
                sea.Append(string.Format(@"'{0}'", item));
            }
            else
            {
                sea.Append(string.Format(@"""{0}""", item));
            }
        }

        this.UnidadData.Text         = res.ToString();
        this.master.SearcheableItems = sea.ToString();
    }
예제 #2
0
    public void RenderForm()
    {
        this.TxtCalculo = new FormTextArea
        {
            Rows             = 3,
            Value            = this.Indicador.Calculo,
            Name             = "TxtCalculo",
            Label            = this.dictionary["Item_Indicador_Field_Calculo"],
            ColumnsSpan      = 11,
            ColumnsSpanLabel = 1,
            MaxLength        = 500,
            GrantToWrite     = this.grantToWrite
        };

        this.CmbUnidad = new FormSelect
        {
            ColumnsSpanLabel = 1,
            Label            = this.dictionary["Item_Indicador_Field_Unidad"],
            ColumnsSpan      = Constant.ColumnSpan2,
            Name             = "CmdUnidad",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption()
            {
                Text = "...", Value = "0"
            }
        };

        this.CmbMetaComparer = new FormSelect
        {
            ColumnsSpanLabel = 1,
            Label            = this.dictionary["Item_Indicador_Field_Meta"],
            ColumnsSpan      = 1,
            Name             = "CmbMetaComparer",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption()
            {
                Text = "...", Value = "0"
            }
        };

        this.CmbAlarmaComparer = new FormSelect
        {
            ColumnsSpanLabel = 1,
            Label            = this.dictionary["Item_Indicador_Field_Alarma"],
            ColumnsSpan      = 1,
            Name             = "CmbAlarmaComparer",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption {
                Text = "...", Value = "0"
            }
        };

        this.CmbResponsible = new FormSelect
        {
            ColumnsSpanLabel = 1,
            Label            = this.dictionary["Item_Indicador_Field_Responsible"],
            ColumnsSpan      = 3,
            Name             = "CmbResponsible",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption()
            {
                Text = this.dictionary["Common_SelectAll"], Value = "0"
            },
            Required        = true,
            RequiredMessage = this.dictionary["Common_Required"]
        };

        this.CmbResponsibleRecord = new FormSelect
        {
            ColumnsSpanLabel = 3,
            Label            = this.dictionary["Item_IndicatorRecord_FieldLabel_Responsible"],
            ColumnsSpan      = 9,
            Name             = "CmbResponsibleRecord",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption()
            {
                Text = this.dictionary["Common_SelectAll"], Value = "0"
            },
            Required        = true,
            RequiredMessage = this.dictionary["Common_Required"]
        };

        this.CmbResponsibleAnularRecord = new FormSelect
        {
            ColumnsSpanLabel = 3,
            Label            = this.dictionary["Item_IndicatorRecord_FieldLabel_Responsible"],
            ColumnsSpan      = 9,
            Name             = "CmbResponsibleAnularRecord",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption {
                Text = this.dictionary["Common_SelectAll"], Value = "0"
            },
            RequiredMessage = this.dictionary["Common_Required"],
            Required        = true
        };

        this.CmbEndResponsible = new FormSelect
        {
            ColumnsSpanLabel = 1,
            Label            = this.dictionary["Item_Indicador_Field_EndResponsible"],
            ColumnsSpan      = 3,
            Name             = "CmbEndResponsible",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption {
                Text = this.dictionary["Common_SelectAll"], Value = "0"
            }
        };

        this.CmbType = new FormSelect
        {
            Label            = this.dictionary["Item_Indicador_Label_Type"],
            ColumnsSpanLabel = 1,
            ColumnsSpan      = 3,
            Name             = "CmbType",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption {
                Text = this.dictionary["Common_All_Male_Plural"], Value = "0"
            }
        };

        this.CmbProcess = new FormSelect
        {
            Label            = this.dictionary["Item_Indicador_Field_Process"],
            ColumnsSpanLabel = 1,
            ColumnsSpan      = 4,
            Name             = "CmbProcess",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption {
                Text = this.dictionary["Common_SelectOne"], Value = "0"
            }
        };

        this.CmbObjetivo = new FormSelect
        {
            Label            = this.dictionary["Item_Indicador_Field_Objetivo"],
            ColumnsSpanLabel = 1,
            ColumnsSpan      = 3,
            Name             = "CmbObjetivo",
            GrantToWrite     = this.grantToWrite,
            DefaultOption    = new FormSelectOption {
                Text = this.dictionary["Common_SelectOne"], Value = "0"
            },
            Required        = true,
            RequiredMessage = this.dictionary["Common_Required"]
        };

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

        this.TxtPeriodicidad = new FormTextInteger
        {
            ColumnSpan      = 2,
            ColumnSpanLabel = 1,
            GrantToWrite    = this.grantToWrite,
            Label           = this.Dictionary["Item_Indicador_Field_Periodicity"],
            MaximumLength   = 3,
            Name            = "TxtPeriodicity",
            Placeholder     = this.Dictionary["Item_Indicador_Field_Periodicity"],
            Value           = this.Indicador.Periodicity.ToString(),
            Required        = true
        };

        this.TxtMeta = new FormTextDecimal
        {
            ColumnSpan      = 1,
            ColumnSpanLabel = 0,
            GrantToWrite    = this.grantToWrite,
            Label           = string.Empty,
            MaximumLength   = 8,
            Name            = "TxtMeta",
            Placeholder     = this.Dictionary["Item_Indicador_Field_Meta"],
            Value           = this.Indicador.Meta.ToString(),
            Required        = true
        };

        this.TxtAlarma = new FormTextDecimal
        {
            ColumnSpan      = 1,
            ColumnSpanLabel = 0,
            GrantToWrite    = this.grantToWrite,
            Label           = string.Empty,
            MaximumLength   = 8,
            Name            = "TxtAlarma",
            Placeholder     = this.Dictionary["Item_Indicador_Field_Alarma"]
        };

        if (this.Indicador.Alarma.HasValue)
        {
            this.TxtAlarma.Value = this.Indicador.Alarma.ToString();
        }

        this.EndDate = new FormDatePicker
        {
            Id               = "TxtEndDate",
            Label            = this.dictionary["Item_Indicador_Field_EndDate"],
            ColumnsSpanLabel = Constant.ColumnSpan4,
            ColumnsSpan      = Constant.ColumnSpan8,
            Value            = this.Indicador.EndDate,
            GrantToWrite     = this.grantToWrite
        };

        foreach (Unidad unidad in Unidad.GetActive(this.company.Id))
        {
            this.CmbUnidad.AddOption(new FormSelectOption
            {
                Text     = unidad.Description,
                Value    = unidad.Id.ToString(),
                Selected = unidad.Id == this.Indicador.Unidad.Id
            });
        }

        //foreach (Objetivo objetivo in Objetivo.GetActive(this.company.Id))
        //{
        //    this.CmbObjetivo.AddOption(new FormSelectOption()
        //        {
        //            Text = objetivo.Description,
        //            Value = objetivo.Id.ToString(),
        //            Selected = objetivo.Id == this.Indicador.Objetivo.Id
        //        });
        //}

        foreach (var proceso in Process.ByCompany(this.company.Id).Where(p => p.Active == true))
        {
            this.CmbProcess.AddOption(new FormSelectOption
            {
                Value    = proceso.Id.ToString(),
                Text     = proceso.Description,
                Selected = proceso.Id == this.Indicador.Proceso.Id
            });
        }

        this.CmbType.AddOption(new FormSelectOption
        {
            Value    = "1",
            Text     = this.dictionary["Item_Indicador_Label_TypeObjetivo"],
            Selected = false
        });

        this.CmbType.AddOption(new FormSelectOption
        {
            Value    = "2",
            Text     = this.dictionary["Item_Indicador_Label_TypeProceso"],
            Selected = false
        });

        long responsibleId = 0;

        if (this.Indicador.Responsible != null)
        {
            responsibleId = this.Indicador.Responsible.Id;
        }

        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 == responsibleId
                });

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

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

        this.CmbMetaComparer.AddOption(new FormSelectOption {
            Value = "eq", Text = "=", Selected = this.Indicador.MetaComparer == "eq"
        });
        this.CmbMetaComparer.AddOption(new FormSelectOption {
            Value = "gt", Text = "&gt;", Selected = this.Indicador.MetaComparer == "gt"
        });
        this.CmbMetaComparer.AddOption(new FormSelectOption {
            Value = "eqgt", Text = "=&gt;", Selected = this.Indicador.MetaComparer == "eqgt"
        });
        this.CmbMetaComparer.AddOption(new FormSelectOption {
            Value = "lt", Text = "&lt;", Selected = this.Indicador.MetaComparer == "lt"
        });
        this.CmbMetaComparer.AddOption(new FormSelectOption {
            Value = "eqlt", Text = "&lt;=", Selected = this.Indicador.MetaComparer == "eqlt"
        });

        this.CmbAlarmaComparer.AddOption(new FormSelectOption {
            Value = "eq", Text = "=", Selected = this.Indicador.AlarmaComparer == "eq"
        });
        this.CmbAlarmaComparer.AddOption(new FormSelectOption {
            Value = "gt", Text = "&gt;", Selected = this.Indicador.AlarmaComparer == "gt"
        });
        this.CmbAlarmaComparer.AddOption(new FormSelectOption {
            Value = "eqgt", Text = "=&gt;", Selected = this.Indicador.AlarmaComparer == "eqgt"
        });
        this.CmbAlarmaComparer.AddOption(new FormSelectOption {
            Value = "lt", Text = "&lt;", Selected = this.Indicador.AlarmaComparer == "lt"
        });
        this.CmbAlarmaComparer.AddOption(new FormSelectOption {
            Value = "eqlt", Text = "&lt;=", Selected = this.Indicador.AlarmaComparer == "eqlt"
        });
    }