protected void lnkDisplayInputs(object sender, EventArgs e) { EHSProfile profile = null; LinkButton lnk = (LinkButton)sender; string cmdID = lnk.CommandArgument; string id = lnk.ID; CheckBox cb; EHSCalcsCtl esMgr = new EHSCalcsCtl().CreateNew(SessionManager.FYStartDate().Month, DateSpanOption.SelectRange); foreach (RepeaterItem r in rptProfile.Items) { Repeater rptStatus = (Repeater)r.FindControl("rptProfileStatus"); foreach (RepeaterItem item in rptStatus.Items) { lnk = (LinkButton)item.FindControl("lnkInputs"); if (lnk.CommandArgument == cmdID) { profile = LocalProfileList().Where(l => l.Plant.PLANT_ID == Convert.ToDecimal(cmdID)).FirstOrDefault(); Ucl_MetricList ucl = (Ucl_MetricList)item.FindControl("uclInputsList"); if (id.Contains("Inputs")) { cb = (CheckBox)item.FindControl("cbInputsSelect"); cb.Checked = cb.Checked == false ? true : false; if (cb.Checked) { ucl.BindInputsList(profile); ucl.BindHistoryList(null, null); // cb.Focus(); } else { ucl.BindInputsList(null); } } else { cb = (CheckBox)item.FindControl("cbHistorySelect"); cb.Checked = cb.Checked == false ? true : false; if (cb.Checked) { esMgr.LoadMetricHistory(new decimal[1] { profile.Plant.PLANT_ID }, profile.InputPeriod.PeriodDate, profile.InputPeriod.PeriodDate, DateIntervalType.month, false); ucl.BindHistoryList(profile, esMgr.MetricHst); ucl.BindInputsList(null); // cb.Focus(); } else { ucl.BindHistoryList(null, null); } } break; } } } ((LinkButton)sender).Focus(); }
protected void rgProfilePeriodList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HiddenField hf; Label lbl; try { EHSProfilePeriod period = (EHSProfilePeriod)e.Item.DataItem; LinkButton lnk = (LinkButton)e.Item.FindControl("lnkPeriod"); lnk.Text = SQMBasePage.FormatDate(period.PeriodDate, "MMMM yyyy", false); lnk.CommandArgument = period.PeriodDate.ToShortDateString(); Ucl_MetricList ucl = (Ucl_MetricList)e.Item.FindControl("uclInputsList"); ucl.BindInputsList(period, ""); } catch (Exception ex) { } } }