Exemple #1
0
        protected void cbMetric_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
        {
            if (mc == null)
            {
                mc = Bll.MetricCategory.SelectAll().ToList();
            }
            Bll.Metric.Extend m    = (Bll.Metric.Extend)e.Item.DataItem;
            Guid?  mcID            = m.MetricCategoryID;
            string CategoryListStr = null;

            while (mcID != null)
            {
                if (CategoryListStr != null)
                {
                    CategoryListStr += ",";
                }
                CategoryListStr += mcID.ToString();

                Bll.MetricCategory NextMc = mc.Where(c => c.MetricCategoryID == mcID).FirstOrDefault();
                mcID = null;
                if (NextMc.MetricCategoryID != Guid.Empty && NextMc.ParentId != Guid.Empty)
                {
                    mcID = NextMc.ParentId;
                }
            }
            if (CategoryListStr != null)
            {
                e.Item.Attributes.Add("MetricCateroryID", CategoryListStr);
            }
        }
Exemple #2
0
        private Bll.Metric.Extend InitMagicForm()
        {
            Bll.Metric.Extend CopyMetric = Bll.Metric.Get(CopyMetricID);
            if (CopyMetric != null)
            {
                ((Micajah.Common.WebControls.HtmlEditor)mfMetric.Rows[17].Cells[1].Controls[0]).Content = CopyMetric.Notes;
                ((Micajah.Common.WebControls.HtmlEditor)mfMetric.Rows[18].Cells[1].Controls[0]).Content = CopyMetric.Definition;
                ((Micajah.Common.WebControls.HtmlEditor)mfMetric.Rows[19].Cells[1].Controls[0]).Content = CopyMetric.Documentation;
                ((Micajah.Common.WebControls.HtmlEditor)mfMetric.Rows[20].Cells[1].Controls[0]).Content = CopyMetric.MetricReferences;

                ((Micajah.Common.WebControls.CheckBox)mfMetric.Rows[16].Cells[1].Controls[0]).Checked = CopyMetric.AllowCustomNames;

                ddlMetricCategorySelect.MetricCategoryID = CopyMetric.MetricCategoryID;
                ddlMetricType.SelectedValue         = CopyMetric.MetricTypeID.ToString();
                ddlDataType.SelectedValue           = CopyMetric.MetricDataTypeID.ToString();
                ddlUnitOfMeasure.SelectedValue      = CopyMetric.UnitOfMeasureID.ToString();
                ddlInputUnitOfMeasure.SelectedValue = CopyMetric.InputUnitOfMeasureID == null ? String.Empty : CopyMetric.InputUnitOfMeasureID.ToString();
                ddlInputUnitOfMeasure.DataBind();
                if (CopyMetric.MetricTypeID == 2)
                {
                    heExpression.Text = MetricFormula.Formula;
                }
                ddlInputPeriod.SelectedValue = CopyMetric.FrequencyID.ToString();
                rcbUpGood.SelectedValue      = CopyMetric.GrowUpIsGood.ToString();

                if (CopyMetric.CollectionStartDate != null)
                {
                    ((Micajah.Common.WebControls.DatePicker)mfMetric.Rows[7].Cells[1].Controls[0]).SelectedDate = (DateTime)CopyMetric.CollectionStartDate;
                }
                else
                {
                    ((Micajah.Common.WebControls.DatePicker)mfMetric.Rows[7].Cells[1].Controls[0]).Clear();
                }

                if (CopyMetric.CollectionEndDate != null)
                {
                    ((Micajah.Common.WebControls.DatePicker)mfMetric.Rows[8].Cells[1].Controls[0]).SelectedDate = (DateTime)CopyMetric.CollectionEndDate;
                }
                else
                {
                    ((Micajah.Common.WebControls.DatePicker)mfMetric.Rows[8].Cells[1].Controls[0]).Clear();
                }
                ((Micajah.Common.WebControls.TextBox)mfMetric.Rows[0].Cells[1].Controls[0]).Text  = CopyMetric.Name;
                ((Micajah.Common.WebControls.TextBox)mfMetric.Rows[1].Cells[1].Controls[0]).Text  = CopyMetric.Alias;
                ((Micajah.Common.WebControls.TextBox)mfMetric.Rows[2].Cells[1].Controls[0]).Text  = CopyMetric.Code;
                ((Micajah.Common.WebControls.TextBox)mfMetric.Rows[11].Cells[1].Controls[0]).Text = CopyMetric.NODecPlaces.ToString();
                ((Micajah.Common.WebControls.TextBox)mfMetric.Rows[12].Cells[1].Controls[0]).Text = CopyMetric.NOMinValue.ToString();
                ((Micajah.Common.WebControls.TextBox)mfMetric.Rows[13].Cells[1].Controls[0]).Text = CopyMetric.NOMaxValue.ToString();
                ((Micajah.Common.WebControls.TextBox)mfMetric.Rows[21].Cells[1].Controls[0]).Text = CopyMetric.FormulaCode;
            }
            return(CopyMetric);
        }
Exemple #3
0
 protected void mfMetric_PreRender(object sender, EventArgs e)
 {
     ddlMetricType.Attributes.Add("onchange", "fMetricTypeChange('" + ddlMetricType.ClientID + "', '" + ddlDataType.ClientID + "');");
     ddlDataType.Attributes.Add("onchange", "fDataTypeChange('" + ddlDataType.ClientID + "');");
     ddlInputPeriod.Attributes.Add("onchange", "fClearFormulaBox();");
     InitAjaxManager();
     if (!IsPostBack)
     {
         if (ddlInputUnitOfMeasure.Items.FindByValue(InputID.ToString()) != null)
         {
             ddlInputUnitOfMeasure.SelectedValue = InputID.ToString();
         }
         if (MetricID == Guid.Empty)
         {
             if (CopyMetricID != Guid.Empty)
             {
                 Bll.Metric.Extend CopyMetric = InitMagicForm();
                 if (CopyMetric != null)
                 {
                     RegisterStartScript(CopyMetric.MetricTypeID == 1, CopyMetric.MetricDataTypeID == 1);
                 }
                 else
                 {
                     RegisterStartScript(true, true);
                 }
             }
             else
             {
                 RegisterStartScript(true, true);
             }
         }
     }
     else
     {
         RegisterStartScript(ddlMetricType.SelectedValue == "1", ddlDataType.SelectedValue == "1");
     }
     heExpression.Attributes.Add("readonly", "readonly");
 }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleApplicationLogo = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleBreadcrumbs     = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleFooter          = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleFooterLinks     = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleHeader          = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleHeaderLinks     = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleLeftArea        = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleMainMenu        = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleHeaderLogo      = false;
            ((Micajah.Common.Pages.MasterPage)Page.Master).VisibleSearchControl   = false;
            Bll.Metric.Extend m = Bll.Metric.Get(MetricID);
            lblName.Text       = String.IsNullOrEmpty(m.Name) ? "---" : m.Name;
            lblCode.Text       = String.IsNullOrEmpty(m.Code) ? "---" : m.Code;
            lblAlias.Text      = String.IsNullOrEmpty(m.Alias) ? "---" : m.Alias;
            lblCategory.Text   = String.IsNullOrEmpty(m.MetricCategoryName) ? "---" : m.MetricCategoryName;
            lblMetricType.Text = String.IsNullOrEmpty(m.MetricTypeName) ? "---" : m.MetricTypeName;
            lblDataType.Text   = String.IsNullOrEmpty(m.MetricDataTypeName) ? "---" : m.MetricDataTypeName;
            lblUoM.Text        = String.IsNullOrEmpty(m.UnitOfMeasureName) ? "---" : m.UnitOfMeasureName;
            lblInputUoM.Text   = String.IsNullOrEmpty(m.InputUnitOfMeasureName) ? "---" : m.InputUnitOfMeasureName;
            lblDecPlaces.Text  = (m.NODecPlaces == null) ? "---" : m.NODecPlaces.ToString();
            lblMinValue.Text   = (m.NOMinValue == null) ? "---" : m.NOMinValue.ToString();
            lblMaxValue.Text   = (m.NOMaxValue == null) ? "---" : m.NOMaxValue.ToString();
            string formula = Bll.Metric.GetMetricFormula(MetricID).Formula;

            lblFormula.Text       = String.IsNullOrEmpty(formula) ? "---" : formula;
            lblFrequency.Text     = String.IsNullOrEmpty(m.FrequencyName) ? "---" : m.FrequencyName;
            lblDescription.Text   = String.IsNullOrEmpty(m.Notes) ? "---" : m.Notes;
            lblDefinition.Text    = String.IsNullOrEmpty(m.Definition) ? "---" : m.Definition;
            lblDocumentation.Text = String.IsNullOrEmpty(m.Documentation) ? "---" : m.Documentation;
            lblReferences.Text    = String.IsNullOrEmpty(m.MetricReferences) ? "---" : m.MetricReferences;

            if (m.MetricTypeID == 1)
            {
                rowDataType.Visible = true;
                if (m.MetricDataTypeID == 1)
                {
                    rowUoM.Visible       = true;
                    rowInputUoM.Visible  = true;
                    rowDecPlaces.Visible = true;
                    rowMinValue.Visible  = true;
                    rowMaxValue.Visible  = true;
                }
                else
                {
                    rowUoM.Visible       = false;
                    rowInputUoM.Visible  = false;
                    rowDecPlaces.Visible = false;
                    rowMinValue.Visible  = false;
                    rowMaxValue.Visible  = false;
                }
                rowFormula.Visible = false;
            }
            else
            {
                rowDataType.Visible  = false;
                rowUoM.Visible       = true;
                rowInputUoM.Visible  = false;
                rowDecPlaces.Visible = false;
                rowMinValue.Visible  = false;
                rowMaxValue.Visible  = false;
                rowFormula.Visible   = true;
            }
        }