protected void lnkOpt_Click(object sender, EventArgs e) { int status = 0; divInputs.Visible = divView.Visible = divGHG.Visible = divExport.Visible = false; lblReportTitle.Text = ""; if (ddlPlantSelect.Visible) { PlantIDS = Array.ConvertAll(SQMBasePage.GetComboBoxSelectedValues(ddlPlantSelect).ToArray(), new Converter <string, decimal>(decimal.Parse)); PlantSelect = ddlPlantSelect.SelectedItem.Text; } if (PlantIDS.Length == 0 || radDateFrom.SelectedDate == null || radDateTo.SelectedDate == null || radDateFrom.SelectedDate > radDateTo.SelectedDate) { lblReportTitle.CssClass = "promptAlert"; lblReportTitle.Text = hfCriteriaErr.Value; return; } if (sender is decimal) { status = GeneratePerspectiveView((decimal)sender); } else { LinkButton lnk = (LinkButton)sender; lblReportTitle.CssClass = "labelTitle"; lblReportTitle.Text = PlantSelect + " - " + lnk.Text; hfViewOption.Value = lnk.CommandArgument; switch (lnk.CommandArgument) { case "1": status = GenerateInputsReport(); break; case "2": break; case "5": status = GenerateEmissionsReport(); break; default: break; } } if (status >= 0) { divExport.Visible = true; } }
private void SaveNotifyItem() { PSsqmEntities ctx = new PSsqmEntities(); NOTIFYACTION notifyAction = null; bool isNew = false; if (string.IsNullOrEmpty(hfNotifyActionID.Value)) // add new item { notifyAction = new NOTIFYACTION(); if (hfNotifyActionContext.Value == "plant") // plant level { notifyAction.PLANT_ID = Convert.ToDecimal(hfNotifyActionBusLoc.Value); } else { // plant level notifyAction.BUS_ORG_ID = Convert.ToDecimal(hfNotifyActionBusLoc.Value); } isNew = true; } else { notifyAction = SQMModelMgr.LookupNotifyAction(ctx, Convert.ToDecimal(hfNotifyActionID.Value)); } notifyAction.NOTIFY_SCOPE = ddlNotifyScope.SelectedValue; notifyAction.SCOPE_TASK = ddlScopeTask.SelectedValue; notifyAction.TASK_STATUS = ddlScopeStatus.SelectedValue; notifyAction.NOTIFY_TIMING = Convert.ToInt32(ddlScopeTiming.SelectedValue); notifyAction.NOTIFY_DIST = ""; foreach (string sv in SQMBasePage.GetComboBoxSelectedValues(ddlNotifyPrivGroup)) { notifyAction.NOTIFY_DIST += (string.IsNullOrEmpty(notifyAction.NOTIFY_DIST) ? "" : ",") + sv; } if ((notifyAction = SQMModelMgr.UpdateNotifyAction(ctx, notifyAction)) != null) { if (isNew) { if (OnNotifyActionCommand != null) { OnNotifyActionCommand("add"); } } else { foreach (GridDataItem item in rgNotifyAction.Items) { LinkButton lnk = (LinkButton)item.FindControl("lnkNotifyItem"); if (lnk.CommandArgument == hfNotifyActionID.Value) { lnk.Text = XLATList.Where(x => x.XLAT_GROUP == "NOTIFY_SCOPE" && x.XLAT_CODE == notifyAction.NOTIFY_SCOPE).FirstOrDefault().DESCRIPTION_SHORT; Label lbl = (Label)item.FindControl("lblScopeTask"); lbl.Text = XLATList.Where(x => x.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && x.XLAT_CODE == notifyAction.SCOPE_TASK).FirstOrDefault().DESCRIPTION_SHORT; lbl = (Label)item.FindControl("lblScopeStatus"); lbl.Text = XLATList.Where(x => x.XLAT_GROUP == "NOTIFY_TASK_STATUS" && x.XLAT_CODE == notifyAction.TASK_STATUS).FirstOrDefault().DESCRIPTION_SHORT; lbl = (Label)item.FindControl("lblNotifyTiming"); lbl.Text = XLATList.Where(x => x.XLAT_GROUP == "NOTIFY_TIMING" && x.XLAT_CODE == notifyAction.NOTIFY_TIMING.ToString()).FirstOrDefault().DESCRIPTION_SHORT; lbl = (Label)item.FindControl("lblNotifyDist"); lbl.Text = notifyAction.NOTIFY_DIST; } } } } }