예제 #1
0
        protected string GetChartUrl(object container)
        {
            System.Web.UI.WebControls.RepeaterItem ri = container as System.Web.UI.WebControls.RepeaterItem;
            MetricTrac.Bll.MetricOrgValue          v  = (MetricTrac.Bll.MetricOrgValue)ri.DataItem;
            string FreqDate = "cskckj";//FrequencyFirstDate[v.FrequencyID].ToString("MM-dd-yyyy");

            return("DataValueChart.aspx?MetricID=" + v.MetricID + "&OrgLocationID=" + v.OrgLocationID + "&Date=" + FreqDate);
        }
예제 #2
0
        protected void rpMetric_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType < ListItemType.Item || e.Item.ItemType > ListItemType.EditItem)
            {
                return;
            }

            MetricTrac.Bll.MetricOrgValue NewMMV = (MetricTrac.Bll.MetricOrgValue)e.Item.DataItem;
            // !!! just remove rowspan for now
            bool IsNewUnit = true;//LastMetricMetricValue == null || IsNewGroup(e.Item) || LastMetricMetricValue.InputUnitOfMeasureName != NewMMV.InputUnitOfMeasureName;

            LastMetricMetricValue = NewMMV;

            if (IsNewUnit)
            {
                if (LastTdUnit[0] != null)
                {
                    LastTdUnit[0].RowSpan = LocationCount;
                    LastTdUnit[1].RowSpan = LocationCount;
                }
                LastTdUnit[0]         = e.Item.FindControl("tdUnitLeft") as System.Web.UI.HtmlControls.HtmlTableCell;
                LastTdUnit[1]         = e.Item.FindControl("tdUnitRight") as System.Web.UI.HtmlControls.HtmlTableCell;
                LastTdUnit[0].Visible = true;
                LastTdUnit[1].Visible = true;
                LocationCount         = 1;

                BindRepiter("rDate", /*LastFrequencyMetric*/ LastMetricMetricValue.Date, e);

                DateTime L0Date = MetricTrac.Bll.Frequency.GetNormalizedDate(LastFrequencyMetric.FrequencyID, CurrentDate);

                DateTime L1Date = MetricTrac.Bll.Frequency.GetNormalizedDate(LastFrequencyMetric.FrequencyID, CurrentDate);
                foreach (MetricValue.ShiftDate s in ShiftDates)
                {
                    if (s.FrequencyID == LastFrequencyMetric.FrequencyID && s.EntityID == (GroupByMetric ? LastMetricMetricValue.MetricID : LastMetricMetricValue.OrgLocationID))
                    {
                        L1Date = s.StartDate;
                        break;
                    }
                }
                L1Date = MetricTrac.Bll.Frequency.AddPeriod(L1Date, LastFrequencyMetric.FrequencyID, 1);
                if (L1Date > L0Date)
                {
                    Image i = (Image)e.Item.FindControl("iNav" + "L1");
                    i.ImageUrl = i.ImageUrl.Replace(".png", "-disabled.png");
                    HyperLink hl = (HyperLink)e.Item.FindControl("hlNav" + "L1");
                    hl.NavigateUrl = string.Empty;
                }
            }
            else
            {
                LocationCount++;
                LastTdUnit[0].RowSpan = LocationCount;
                LastTdUnit[1].RowSpan = LocationCount;
            }

            BindRepiter("rMericValue", NewMMV.MetricValues, e);
        }
예제 #3
0
 protected bool IsNewGroup(object container)
 {
     System.Web.UI.WebControls.RepeaterItem ri  = container as System.Web.UI.WebControls.RepeaterItem;
     MetricTrac.Bll.MetricOrgValue          mmv = ri.DataItem as MetricTrac.Bll.MetricOrgValue;
     if (LastMetricMetricValue == null)
     {
         return(true);
     }
     if (LastMetricMetricValue.FrequencyID != mmv.FrequencyID)
     {
         return(true);
     }
     if (GroupByMetric)
     {
         return(LastMetricMetricValue.MetricID != mmv.MetricID);
     }
     return(LastMetricMetricValue.OrgLocationID != mmv.OrgLocationID);
 }
예제 #4
0
        protected void rpMetric_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType < ListItemType.Item || e.Item.ItemType > ListItemType.EditItem)
            {
                return;
            }
            MetricTrac.Bll.MetricOrgValue mov = (MetricTrac.Bll.MetricOrgValue)e.Item.DataItem;
            if (LastMetricMetricValue == null)
            {
                BindRepiter("rDate", LastFrequencyMetric.Date, e);
                SetNavigationButton(e, FrequencyID);
            }
            LastMetricMetricValue = mov;

            System.Web.UI.WebControls.DropDownList ddlInputUnitOfMeasure = (System.Web.UI.WebControls.DropDownList)e.Item.FindControl("ddlInputUnitOfMeasure");
            System.Web.UI.WebControls.Label        lblUoM = (System.Web.UI.WebControls.Label)e.Item.FindControl("lblUoM");
            ddlInputUnitOfMeasure.Items.Clear();
            if (mov.RelatedOrgLocationUoMRecordID == null)
            { // no previous records exists
                ddlInputUnitOfMeasure.Visible = true;
                lblUoM.Visible = false;
                if (mov.InputUnitOfMeasureID != null)
                {
                    List <Micajah.Common.Bll.MeasureUnit> l = Bll.Mc_UnitsOfMeasure.GetConvertedUoMs(mov.InputUnitOfMeasureID);
                    ddlInputUnitOfMeasure.DataSource = l;
                    ddlInputUnitOfMeasure.DataBind();
                    ddlInputUnitOfMeasure.SelectedValue = mov.InputUnitOfMeasureID.ToString();
                }
                else
                {
                    ddlInputUnitOfMeasure.Items.Add(new ListItem("", ""));
                }
            }
            else
            {// there are defined uom
                ddlInputUnitOfMeasure.Visible = false;
                lblUoM.Visible = true;
            }
            BindRepiter("rMericValue", mov.MetricValues, e);
        }
예제 #5
0
        private static void PushMetricValue(MetricOrgValue mmv, MetricValue.Extend mv, List <DateHeader> hl)
        {
            if (mmv == null)
            {
                return;
            }
            DateTime NextDate = DateTime.MinValue;
            DateTime AddDate  = mv == null ? DateTime.MinValue : mv.Date;

            while (mmv.MetricValues.Count < hl.Count && (NextDate = hl[mmv.MetricValues.Count].Date) > AddDate)
            {
                MetricValue.Extend CalculatedValue = new MetricValue.Extend();
                CalculatedValue.InstanceId           = mmv.InstanceId;
                CalculatedValue.MetricValueID        = Guid.Empty;
                CalculatedValue.MetricID             = mmv.MetricID;
                CalculatedValue.Date                 = NextDate;
                CalculatedValue.OrgLocationID        = mmv.OrgLocationID;
                CalculatedValue.FrequencyID          = mmv.FrequencyID;
                CalculatedValue.Value                = null;
                CalculatedValue.Verified             = false;
                CalculatedValue.Approved             = false;
                CalculatedValue.FilesAttached        = false;
                CalculatedValue.ReviewUpdated        = false;
                CalculatedValue.MissedCalc           = false;
                CalculatedValue.MetricDataTypeID     = 1;
                CalculatedValue.InputUnitOfMeasureID = mmv.InputUnitOfMeasureID;
                CalculatedValue.IsCalculated         = (int)mmv.MetricTypeID > 1;
                CalculatedValue.IsAbsent             = true;
                mmv.MetricValues.Add(CalculatedValue);
            }

            if (mv != null && mmv.MetricValues.Count < hl.Count && hl[mmv.MetricValues.Count].Date == mv.Date)
            {
                mmv.MetricValues.Add(mv);
            }
        }
예제 #6
0
 protected bool IsTotalMetric(object container)
 {
     System.Web.UI.WebControls.RepeaterItem ri  = container as System.Web.UI.WebControls.RepeaterItem;
     MetricTrac.Bll.MetricOrgValue          mmv = ri.DataItem as MetricTrac.Bll.MetricOrgValue;
     return(mmv.IsTotalAgg);
 }
예제 #7
0
 protected string GetRelatedUrl(object container)
 {
     System.Web.UI.WebControls.RepeaterItem ri = container as System.Web.UI.WebControls.RepeaterItem;
     MetricTrac.Bll.MetricOrgValue          m  = ri.DataItem as MetricTrac.Bll.MetricOrgValue;
     return((DataMode == Mode.View ? "RelatedInputValues" : "RelatedInputValuesA") + ".aspx?MetricID=" + m.MetricID);
 }
예제 #8
0
        public static List <MetricOrgValue> RelatedValuesList(int ValueCount, DateTime NormalizedDate, int FrequencyID, LinqMicajahDataContext dc, List <DateHeader> hl, Guid?CalcMetricID, bool OrderByMetric, Guid? @ApproverUserId)
        {
            DateTime EndDate   = Frequency.AddPeriod(NormalizedDate, FrequencyID, 1);
            DateTime BeginDate = Frequency.AddPeriod(EndDate, FrequencyID, -ValueCount);
            ISingleResult <Sp_SelectMetricRelatedValuesResult> V = dc.Sp_SelectMetricRelatedValues(LinqMicajahDataContext.InstanceId, FrequencyID, CalcMetricID, BeginDate, EndDate, OrderByMetric, @ApproverUserId);
            List <MetricOrgValue> MetricMetricValues             = new List <MetricOrgValue>();
            MetricOrgValue        LastMetricMetricValue          = null;
            int GroupNumber = 0;
            int GroupCount  = 0;
            List <Micajah.Common.Bll.MeasureUnit> OrgUoMs = Mc_UnitsOfMeasure.GetOrganizationUoMs();

            foreach (var v in V)
            {
                if (LastMetricMetricValue == null || v.MetricID != LastMetricMetricValue.MetricID || v.OrgLocationID != LastMetricMetricValue.OrgLocationID)
                {
                    if (LastMetricMetricValue == null || v.OrgLocationID == LastMetricMetricValue.OrgLocationID)
                    {
                        GroupNumber++;
                    }
                    else
                    {
                        SetOrgLocationNumber(GroupNumber, MetricMetricValues);
                        GroupNumber = 1;
                        GroupCount++;
                    }
                    PushMetricValue(LastMetricMetricValue, null, hl);
                    LastMetricMetricValue            = new MetricOrgValue();
                    LastMetricMetricValue.GroupCount = GroupCount;

                    // Common fields
                    LastMetricMetricValue.InstanceId    = (Guid)v.InstanceId;
                    LastMetricMetricValue.FrequencyID   = FrequencyID;
                    LastMetricMetricValue.FrequencyName = v.FrequencyName;

                    //Metric fields
                    LastMetricMetricValue.MetricID               = (Guid)v.MetricID;
                    LastMetricMetricValue.Name                   = v.MetricName;
                    LastMetricMetricValue.MetricTypeID           = (int)v.MetricTypeID;
                    LastMetricMetricValue.MetricDataTypeID       = 1;
                    LastMetricMetricValue.NODecPlaces            = v.NODecPlaces;
                    LastMetricMetricValue.InputUnitOfMeasureID   = v.MetricInputUnitOfMeasureID;
                    LastMetricMetricValue.InputUnitOfMeasureName = GetMeasureUnitAbbvr(OrgUoMs, v.MetricInputUnitOfMeasureID);

                    //MetricOrg fields
                    LastMetricMetricValue.OrgLocationID                 = (Guid)v.OrgLocationID;
                    LastMetricMetricValue.OrgLocationFullName           = v.OrgLocationID == Guid.Empty ? LinqMicajahDataContext.OrganizationName : v.OrgLocationFullName;
                    LastMetricMetricValue.RelatedOrgLocationUoMRecordID = v.MetricOrgLocationUoMID;
                    LastMetricMetricValue.OrgLocationUnitOfMeasureID    = v.OrgLocationUnitOfMeasureID;
                    LastMetricMetricValue.OrgLocationUnitOfMeasureName  = GetMeasureUnitAbbvr(OrgUoMs, v.OrgLocationUnitOfMeasureID);

                    // define actual measure unit
                    if (v.MetricOrgLocationUoMID != null)
                    {
                        LastMetricMetricValue.InputUnitOfMeasureName = LastMetricMetricValue.OrgLocationUnitOfMeasureName;
                    }
                    MetricMetricValues.Add(LastMetricMetricValue);
                }

                MetricValue.Extend LastMetricValue = new MetricValue.Extend();
                // Value fields
                LastMetricValue.InstanceId           = (Guid)v.InstanceId;
                LastMetricValue.MetricValueID        = (Guid)v.MetricValueID;
                LastMetricValue.MetricID             = (Guid)v.MetricID;
                LastMetricValue.Date                 = (DateTime)v.Date;
                LastMetricValue.OrgLocationID        = (Guid)v.OrgLocationID;
                LastMetricValue.FrequencyID          = FrequencyID;
                LastMetricValue.Value                = v.Value;
                LastMetricValue.Verified             = v.Verified == null ? false : (bool)v.Verified;
                LastMetricValue.Approved             = v.MetricValueID == Guid.Empty ? false : v.Approved;
                LastMetricValue.FilesAttached        = v.FilesAttached == null ? false : (bool)v.FilesAttached;
                LastMetricValue.ReviewUpdated        = v.ReviewUpdated == null ? false : (bool)v.ReviewUpdated;
                LastMetricValue.MissedCalc           = v.MissedCalc == null ? false : (bool)v.MissedCalc;
                LastMetricValue.MetricDataTypeID     = 1;
                LastMetricValue.InputUnitOfMeasureID = v.ValueInputUnitOfMeasureID;

                // Extend fields
                // extend - value reference
                LastMetricValue.ValueFrequencyName            = v.FrequencyName;
                LastMetricValue.ValueInputUnitOfMeasureName   = GetMeasureUnitAbbvr(OrgUoMs, v.ValueInputUnitOfMeasureID);
                LastMetricValue.OrgLocationFullName           = v.OrgLocationID == Guid.Empty ? LinqMicajahDataContext.OrganizationName : v.OrgLocationFullName;
                LastMetricValue.RelatedOrgLocationUoMRecordID = v.MetricOrgLocationUoMID;
                LastMetricValue.OrgLocationUnitOfMeasureID    = v.OrgLocationUnitOfMeasureID;
                LastMetricValue.OrgLocationUnitOfMeasureName  = GetMeasureUnitAbbvr(OrgUoMs, v.OrgLocationUnitOfMeasureID);

                // extend - metric fields
                LastMetricValue.MetricName                   = v.MetricName;
                LastMetricValue.MetricFrequencyID            = FrequencyID;
                LastMetricValue.ActualMetricDataTypeID       = 1;
                LastMetricValue.MetricInputUnitOfMeasureID   = v.MetricInputUnitOfMeasureID;
                LastMetricValue.NODecPlaces                  = v.NODecPlaces;
                LastMetricValue.MetricInputUnitOfMeasureName = GetMeasureUnitAbbvr(OrgUoMs, v.MetricInputUnitOfMeasureID);
                LastMetricValue.IsCalculated                 = (int)v.MetricTypeID > 1;
                LastMetricValue.IsAbsent         = false;
                LastMetricValue.RelatedFormulaID = v.MetricFormulaID;
                LastMetricValue.Formula          = v.Formula;

                PushMetricValue(LastMetricMetricValue, LastMetricValue, hl);
            }
            SetOrgLocationNumber(GroupNumber, MetricMetricValues);
            PushMetricValue(LastMetricMetricValue, null, hl);
            return(MetricMetricValues);
        }