Beispiel #1
0
        public static List <KPICategoyCombination> GetCategoryItemsCombinatedByKpiId(int kpiId)
        {
            if (kpiId <= 0)
            {
                throw new ArgumentException("El ID del KPI no puede ser cero.");
            }

            List <KPICategoyCombination> theList = new List <KPICategoyCombination>();
            KPICategoyCombination        theData = null;

            try
            {
                KPICombinationCategoryTableAdapter localAdapter = new KPICombinationCategoryTableAdapter();
                KPICategoryCombinationDS.KPICombinationCategoryDataTable theTable = localAdapter.GetCategoryItemsCombinatedByKpiId(kpiId);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (KPICategoryCombinationDS.KPICombinationCategoryRow theRow in theTable)
                    {
                        theData       = FillRecord(theRow);
                        theData.KpiId = kpiId;
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetCategoryItemsCombinatedByKpiId para kpiId: " + kpiId, exc);
                throw exc;
            }

            return(theList);
        }
Beispiel #2
0
        private static KPICategoyCombination FillRecord(KPICategoryCombinationDS.KPICombinationCategoryRow row)
        {
            KPICategoyCombination theNewRecord = new KPICategoyCombination(
                row.productoId,
                row.categoriesId);

            return(theNewRecord);
        }
Beispiel #3
0
    protected void EnterDataRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            KPICategoyCombination theData = (KPICategoyCombination)(e.Item.DataItem);
            if (string.IsNullOrEmpty(theData.ItemsList))
            {
                e.Item.FindControl("pnlDetalle").Visible = false;
            }

            if (UnitIdHiddenField.Value.Equals("TIME"))
            {
                e.Item.FindControl("pnlDataDecimal").Visible = false;
                e.Item.FindControl("pnlDataTime").Visible    = true;

                DropDownList yearsCombobox             = (DropDownList)e.Item.FindControl("YearsCombobox");
                DropDownList monthsCombobox            = (DropDownList)e.Item.FindControl("MonthsCombobox");
                DropDownList daysCombobox              = (DropDownList)e.Item.FindControl("DaysCombobox");
                DropDownList hoursCombobox             = (DropDownList)e.Item.FindControl("HoursCombobox");
                DropDownList minutesCombobox           = (DropDownList)e.Item.FindControl("MinutesCombobox");
                HiddenField  measurementIDsHiddenField = (HiddenField)e.Item.FindControl("MeasurementIDsHiddenField");
                Label        imageTimeUpdate           = (Label)e.Item.FindControl("ImageTimeUpdate");

                yearsCombobox.Attributes.Add("onchange", "TimeComboBox_OnChange('" + yearsCombobox.ClientID + "', '" + monthsCombobox.ClientID + "', '" + daysCombobox.ClientID
                                             + "', '" + hoursCombobox.ClientID + "', '" + minutesCombobox.ClientID + "', '" + measurementIDsHiddenField.ClientID + "', '" + imageTimeUpdate.ClientID
                                             + "', '" + theData.ItemsList + "', '" + theData.CategoriesList + "')");
                monthsCombobox.Attributes.Add("onchange", "TimeComboBox_OnChange('" + yearsCombobox.ClientID + "', '" + monthsCombobox.ClientID + "', '" + daysCombobox.ClientID
                                              + "', '" + hoursCombobox.ClientID + "', '" + minutesCombobox.ClientID + "', '" + measurementIDsHiddenField.ClientID + "', '" + imageTimeUpdate.ClientID
                                              + "', '" + theData.ItemsList + "', '" + theData.CategoriesList + "')");
                daysCombobox.Attributes.Add("onchange", "TimeComboBox_OnChange('" + yearsCombobox.ClientID + "', '" + monthsCombobox.ClientID + "', '" + daysCombobox.ClientID
                                            + "', '" + hoursCombobox.ClientID + "', '" + minutesCombobox.ClientID + "', '" + measurementIDsHiddenField.ClientID + "', '" + imageTimeUpdate.ClientID
                                            + "', '" + theData.ItemsList + "', '" + theData.CategoriesList + "')");
                hoursCombobox.Attributes.Add("onchange", "TimeComboBox_OnChange('" + yearsCombobox.ClientID + "', '" + monthsCombobox.ClientID + "', '" + daysCombobox.ClientID
                                             + "', '" + hoursCombobox.ClientID + "', '" + minutesCombobox.ClientID + "', '" + measurementIDsHiddenField.ClientID + "', '" + imageTimeUpdate.ClientID
                                             + "', '" + theData.ItemsList + "', '" + theData.CategoriesList + "')");
                minutesCombobox.Attributes.Add("onchange", "TimeComboBox_OnChange('" + yearsCombobox.ClientID + "', '" + monthsCombobox.ClientID + "', '" + daysCombobox.ClientID
                                               + "', '" + hoursCombobox.ClientID + "', '" + minutesCombobox.ClientID + "', '" + measurementIDsHiddenField.ClientID + "', '" + imageTimeUpdate.ClientID
                                               + "', '" + theData.ItemsList + "', '" + theData.CategoriesList + "')");
            }
            else
            {
                e.Item.FindControl("pnlDataTime").Visible    = false;
                e.Item.FindControl("pnlDataDecimal").Visible = true;
                TextBox     valueTextBox = (TextBox)e.Item.FindControl("ValueTextBox");
                HiddenField measurementIDsHiddenField  = (HiddenField)e.Item.FindControl("MeasurementIDsHiddenField");
                Label       valueRequiredFileValidator = (Label)e.Item.FindControl("ValueRequiredFileValidator");
                Label       imageUpdate = (Label)e.Item.FindControl("ImageUpdate");

                valueTextBox.Attributes.Add("onchange", "ValueTextBox_OnChange('" + valueTextBox.ClientID + "', '" + measurementIDsHiddenField.ClientID + "', '"
                                            + valueRequiredFileValidator.ClientID + "', '" + imageUpdate.ClientID + "', '" + theData.ItemsList + "', '" + theData.CategoriesList + "')");
            }
        }
    }
Beispiel #4
0
    protected void CategoriesRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Literal lt = (Literal)e.Item.FindControl("CollapseLiteral");

        if (lt == null)
        {
            return;
        }
        KPICategoyCombination obj = (KPICategoyCombination)e.Item.DataItem;

        if (obj == null)
        {
            return;
        }
        lt.Text = "<div class='collapse m-b-20' id='" + obj.HtmlId + "'>";

        UserControls_KPI_KpiSummary_KpiMeasurements measurementsControl = (UserControls_KPI_KpiSummary_KpiMeasurements)e.Item.FindControl("MeasurementsControl");

        measurementsControl.Unit         = UnitIdHiddenField.Value;
        measurementsControl.Currency     = CurrencyHiddenField.Value;
        measurementsControl.CurrencyUnit = CurrencyUnitHiddenField.Value;
    }
Beispiel #5
0
        public static List <KPICategoyCombination> GetKPITargetCategoriesByKpiId(List <Category> theCategories)
        {
            if (theCategories == null || theCategories.Count <= 0)
            {
                throw new ArgumentException("No se tiene la lista de categorias.");
            }

            string categories = "";

            foreach (Category cat in theCategories)
            {
                categories = string.IsNullOrEmpty(categories) ? cat.ID : categories + "," + cat.ID;
            }

            List <KPICategoyCombination> theList = new List <KPICategoyCombination>();
            KPICategoyCombination        theData = null;

            try
            {
                KPICombinationCategoryTableAdapter localAdapter = new KPICombinationCategoryTableAdapter();
                KPICategoryCombinationDS.KPICombinationCategoryDataTable theTable = localAdapter.GetCombinationCategoryItems(categories);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (KPICategoryCombinationDS.KPICombinationCategoryRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetKPITargetCategoriesByKpiId.", exc);
                throw exc;
            }

            return(theList);
        }