예제 #1
0
        public int UpdateCausation(decimal incidentID)
        {
            int status = 0;

            using (PSsqmEntities ctx = new PSsqmEntities())
            {
                status = ctx.ExecuteStoreCommand("DELETE FROM INCFORM_CAUSATION WHERE INCIDENT_ID = " + incidentID.ToString());

                if (!string.IsNullOrEmpty(ddlCausation.SelectedValue))
                {
                    INCFORM_CAUSATION causation = new INCFORM_CAUSATION();
                    causation.INCIDENT_ID   = incidentID;
                    causation.CAUSEATION_CD = ddlCausation.SelectedValue;
                    causation.TEAM_LIST     = tbTeam.Text.Trim();
                    causation.LAST_UPD_BY   = SessionManager.UserContext.UserName();
                    causation.LAST_UPD_DT   = WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ);
                    ctx.AddToINCFORM_CAUSATION(causation);

                    status = ctx.SaveChanges();

                    EHSIncidentMgr.UpdateIncidentStatus(incidentID, IncidentStepStatus.rootcauseComplete, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ));
                }
                else
                {
                }
            }

            return(status);
        }