public int AddUpdateINCFORM_ALERT(decimal incidentId)
        {
            lblStatusMsg.Visible = false;
            int  status            = 0;
            bool allFieldsComplete = true;

            localCtx = new PSsqmEntities();

            INCFORM_ALERT incidentAlert = EHSIncidentMgr.LookupIncidentAlert(localCtx, IncidentId);

            if (incidentAlert == null)  // new alert
            {
                incidentAlert             = new INCFORM_ALERT();
                incidentAlert.INCIDENT_ID = LocalIncident.INCIDENT_ID;
                incidentAlert.ALERT_TYPE  = ((int)TaskRecordType.HealthSafetyIncident).ToString();
                incidentAlert.CREATE_DT   = DateTime.UtcNow;
                incidentAlert.CREATE_BY   = SessionManager.UserContext.UserName();
                localCtx.AddToINCFORM_ALERT(incidentAlert);
                lblAlertStatus.Text = XLATList.Where(l => l.XLAT_GROUP == "TASK_STATUS" && l.XLAT_CODE == "0").FirstOrDefault().DESCRIPTION;
            }
            SaveAttachments(incidentId);
            incidentAlert.LOCATION_LIST = "";
            foreach (RadComboBoxItem item in ddlLocations.Items.Where(i => i.Checked == true && i.Value.Contains("BU") == false).ToList())
            {
                incidentAlert.LOCATION_LIST += string.IsNullOrEmpty(incidentAlert.LOCATION_LIST) ? item.Value : (item.Value + ",");
            }

            incidentAlert.ALERT_GROUP = "";
            foreach (RadComboBoxItem item in ddlNotifyGroup.Items.Where(i => i.Checked == true).ToList())
            {
                incidentAlert.ALERT_GROUP += string.IsNullOrEmpty(incidentAlert.ALERT_GROUP) ? item.Value : (item.Value + ",");
            }

            incidentAlert.RESPONSIBLE_GROUP = ddlResponsibleGroup.SelectedValue;
            //  incidentAlert.ALERT_DESC = tbAlertDesc.Text;
            incidentAlert.COMMENTS = tbComments.Text;
            incidentAlert.DUE_DT   = rdpDueDate.SelectedDate;



            // Update CEO-Comments value.
            incidentAlert.CEO_COMMENTS = tbCeoComments.Text.Trim();

            // send general notifications
            if (incidentAlert.INCIDENT_ALERT_ID < 1)
            {
                EHSNotificationMgr.NotifyIncidentAlert(LocalIncident, ((int)SysPriv.notify).ToString(), "380",
                                                       ddlLocations.Items.Where(i => i.Checked == true && i.Value.Contains("BU") == false).Select(i => Convert.ToDecimal(i.Value)).ToList());
            }

            List <TASK_STATUS> alertTaskList = UpdateAlertTaskList(EHSIncidentMgr.GetAlertTaskList(localCtx, LocalIncident.INCIDENT_ID));

            status = localCtx.SaveChanges();

            // send specific task assignments
            EHSNotificationMgr.NotifyIncidentAlertTaskAssignment(LocalIncident, alertTaskList.Where(l => l.RESPONSIBLE_ID.HasValue).ToList());

            return(status);
        }