Пример #1
0
        public ActionResult Create(IncidentType IncidentType)
        {
            if (ModelState.IsValid)
            {
                if (db.IncidentTypes.Any(p => p.IncidentType1 == IncidentType.IncidentType1) == false)
                {
                    //if IncidentType does not exist yet
                    IncidentType.IncidentTypeID = Guid.NewGuid();
                    db.IncidentTypes.InsertOnSubmit(IncidentType);
                    db.SubmitChanges();
                }

                return(RedirectToAction("Index"));
            }

            return(View(IncidentType));
        }
Пример #2
0
        public IncidentType GetIncidentType(Incident incident)
        {
            IncidentType incidentType = new IncidentType();

            incidentType.Identification = new IdentificationType
            {
                Identification       = incident.ID.ToString(),
                IdentificationSchema = "UUID"
            };
            incidentType.ResponsibleUnit = new OrgUnitType
            {
                Classification = "SOR-Region",
                Code           = states.RegionCode,
                Name           = states.RegionName
            };
            return(incidentType);
        }
Пример #3
0
 public IncidentTypeValidator()
 {
     RuleFor(x => x)
     .Must(incidenTypeToValidate =>
     {
         try
         {
             var incidentType = new IncidentType(incidenTypeToValidate.IncidentType);
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
         }
     })
     .WithMessage("Incorrect IncidentType value");
 }
Пример #4
0
        public static DraftApplication Create(
            Title tile,
            Content content,
            IncidentType incidentType,
            EmployeeId applicantId,
            List <EmployeeId> suspiciousEmployees)
        {
            var id = DraftApplicationId.Create();
            var suspiciousEmployeesList = suspiciousEmployees.Select(x => new SuspiciousEmployee(x)).ToList();

            var draftApplication = new DraftApplication(id, content, tile, incidentType, applicantId, suspiciousEmployeesList);

            draftApplication.AddDomainEvent(new DraftApplicationCreated(id, content,
                                                                        incidentType, applicantId, suspiciousEmployeesList));

            return(draftApplication);
        }
Пример #5
0
        public void NewIncident(IncidentType incident)
        {
            SeleniumDriver.Instance.SwitchTo().Frame("gsft_main");
            switch (incident)
            {
            case IncidentType.Ask_A_Question:
                wait.IgnoreExceptionTypes(typeof(StaleElementReferenceException));
                wait.Until(e => AskQuestion.Displayed);
                AskQuestion.Click();

                break;

            case IncidentType.IT_Incident:
                wait.Until(e => Incident.Displayed);
                Incident.Click();
                // AbtDriver.NewIncidentPage.NewIncident(priority, shortdescription, description);
                break;

            case IncidentType.ConferencingSetup:
                wait.IgnoreExceptionTypes(typeof(StaleElementReferenceException));
                wait.Until(e => conferencingSetupLink.Displayed);
                conferencingSetupLink.Click();

                break;

            case IncidentType.DistributionListRequest:

                wait.IgnoreExceptionTypes(typeof(StaleElementReferenceException));
                wait.Until(e => DistributionListLink.Displayed);
                DistributionListLink.Click();
                break;

            case IncidentType.HardwarePeripheralRequest:
                break;

            case IncidentType.SoftwareRequest:
                break;

            case IncidentType.Contractor_Consultant_TempOffBoarding:
                break;

            default:
                break;
            }
        }
 public IActionResult Put([FromBody] IncidentType value)
 {
     try
     {
         if (String.IsNullOrEmpty(value.Name))
         {
             return(Ok(new { responseCode = 500, responseDescription = "Kindly Supply Cost Center Code" }));
         }
         var getbal = IncidentTypeService.GetIncidentTypeByCode(value.Name.Trim()).Result;
         getbal.Description = value.Description;
         IncidentTypeService.UpdateIncidentType(getbal);
         return(Ok(new { responseCode = 200, responseDescription = "Updated Successfully" }));
     }
     catch (Exception ex)
     {
         return(Ok(new { responseCode = 500, responseDescription = "Failed" }));
     }
 }
Пример #7
0
        public async Task <IActionResult> UpdateIncidentType(int id, IncidentType entityForUpdate)
        {
            var entity = await _context.IncidentTypes
                         .Where(b => b.Id == id)
                         .FirstOrDefaultAsync();

            if (entity == null)
            {
                return(NotFound());
            }
            entity.Name = entityForUpdate.Name;
            if (await _context.SaveChangesAsync() > 0)
            {
                return(CreatedAtRoute("GetIncidentType",
                                      new { controller = "References", id = entity.Id }, entity));
            }
            return(BadRequest("Error update Incident Type"));
        }
Пример #8
0
        public static IncidentApplication Create(Title title,
                                                 Content content,
                                                 IncidentType incidentType,
                                                 EmployeeId applicantId,
                                                 List <EmployeeId> suspiciousEmployees,
                                                 List <Attachment> attachments)
        {
            var id                      = IncidentApplicationId.Create();
            var postDate                = SystemClock.Now;
            var applicationNumber       = new ApplicationNumber(postDate, incidentType);
            var suspiciousEmployeesList = suspiciousEmployees.Select(x => new SuspiciousEmployee(x)).ToList();

            var application = new IncidentApplication(id, content, title, incidentType, applicantId, suspiciousEmployeesList, attachments, postDate, applicationNumber);

            application.AddDomainEvent(new IncidentApplicationCreated(application));

            return(application);
        }
Пример #9
0
        public List <IncidentType> GetIncidentTypes()
        {
            // Initialize a list of IncidentType objects
            List <IncidentType> incidentTypes = new List <IncidentType>();

            try
            {
                using (SqlConnection conn = new SqlConnection(connString))
                {
                    // Query the database for all incident types and matching agencies for the incident type
                    String query = "SELECT IncidentTypes.*, Agencies.* FROM IncidentTypes LEFT JOIN Agencies ON Agencies.AgencyId = IncidentTypes.AgencyId";
                    using (SqlCommand cmd = new SqlCommand(query, conn))
                    {
                        conn.Open();

                        using (SqlDataReader dr = cmd.ExecuteReader())
                        {
                            while (dr.Read())
                            {
                                // If a row is returned, create new IncidentType object with relevant values
                                IncidentType incidentType = new IncidentType();
                                incidentType.IncidentTypeId   = dr["IncidentTypeId"].ToString();
                                incidentType.IncidentTypeName = dr["IncidentTypeName"].ToString();
                                if (!(dr["AgencyId"] is DBNull))
                                {
                                    // If agency is found, add Agency object with relevant values to the retrieved IncidentType object
                                    incidentType.Agency               = new Agency();
                                    incidentType.Agency.AgencyId      = dr["AgencyId"].ToString();
                                    incidentType.Agency.AgencyName    = dr["AgencyName"].ToString();
                                    incidentType.Agency.AgencyContact = dr["AgencyContact"].ToString();
                                }
                                // Add IncidentType object into the list of incident types
                                incidentTypes.Add(incidentType);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            // Return the list of IncidentType objects
            return(incidentTypes);
        }
Пример #10
0
        private DraftApplication(
            DraftApplicationId draftApplicationId,
            Content content,
            Title title,
            IncidentType incidentType,
            EmployeeId applicantId,
            List <SuspiciousEmployee> suspiciousEmployees)
        {
            this.CheckRule(new ApplicantCannotBeSuspectRule(suspiciousEmployees.Select(x => x.EmployeeId).ToList(), applicantId));

            this.ApplicantId = Guard.Argument(applicantId, nameof(applicantId)).NotNull();
            this.Content     = Guard.Argument(content, nameof(content)).NotNull();
            this.Title       = Guard.Argument(title, nameof(title)).NotNull();
            this.Id          = Guard.Argument(draftApplicationId, nameof(draftApplicationId)).NotNull();

            this.IncidentType        = incidentType;
            this.SuspiciousEmployees = suspiciousEmployees;
            this.Attachments         = new List <Attachment>();
        }
Пример #11
0
        public IncidentType GetIncidentType(string id)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(connString))
                {
                    // Query the database for all incident types and matching agencies for the incident type
                    String query = "SELECT IncidentTypes.*, Agencies.* FROM IncidentTypes LEFT JOIN Agencies ON Agencies.AgencyId = IncidentTypes.AgencyId WHERE IncidentTypes.IncidentTypeId=@IncidentTypeId";
                    using (SqlCommand cmd = new SqlCommand(query, conn))
                    {
                        cmd.Parameters.AddWithValue("@IncidentTypeId", id);
                        conn.Open();

                        using (SqlDataReader dr = cmd.ExecuteReader())
                        {
                            if (dr.Read())
                            {
                                // If a row is returned, create new IncidentType object with relevant values
                                IncidentType incidentType = new IncidentType();
                                incidentType.IncidentTypeId   = dr["IncidentTypeId"].ToString();
                                incidentType.IncidentTypeName = dr["IncidentTypeName"].ToString();
                                if (!(dr["AgencyId"] is DBNull))
                                {
                                    // If agency is found, add Agency object with relevant values to the retrieved IncidentType object
                                    incidentType.Agency               = new Agency();
                                    incidentType.Agency.AgencyId      = dr["AgencyId"].ToString();
                                    incidentType.Agency.AgencyName    = dr["AgencyName"].ToString();
                                    incidentType.Agency.AgencyContact = dr["AgencyContact"].ToString();
                                }
                                // Return IncidentType object
                                return(incidentType);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            // Return null if there is no matching row or an error
            return(null);
        }
        public ActionResult AddIncidentType(IncidentTypeRequest incidentTypeRequest)
        {
            var result = appDbContex.IncidentTypes.Where(a => a.Name == incidentTypeRequest.incidenttypename).FirstOrDefault();

            if (result == null)
            {
                string       id           = Guid.NewGuid().ToString();
                IncidentType incidentType = new IncidentType()
                {
                    Id   = id,
                    Name = incidentTypeRequest.incidenttypename
                };

                appDbContex.Add(incidentType);
                appDbContex.SaveChangesAsync();
                return(Ok(new { Message = "Incident Type Added Successfully..!" }));
            }

            return(BadRequest(new { Message = "Incident Type Already Exist..!" }));
        }
Пример #13
0
        public ActionResult Edit(IncidentType IncidentType)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.IncidentTypes.Attach(IncidentType);
                    db.Refresh(RefreshMode.KeepCurrentValues, IncidentType);
                    db.SubmitChanges();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            return(View(IncidentType));
        }
Пример #14
0
        public void Update(
            Content content,
            Title title,
            IncidentType incidentType,
            List <EmployeeId> employeeIds)
        {
            this.CheckRule(new ApplicantCannotBeSuspectRule(employeeIds, this.ApplicantId));

            this.Content = Guard.Argument(content, nameof(content)).NotNull();
            this.Title   = Guard.Argument(title, nameof(title)).NotNull();

            this.IncidentType = incidentType;

            var suspiciousEmployees = employeeIds.Select(x => new SuspiciousEmployee(x)).ToList();

            this.SuspiciousEmployees = suspiciousEmployees;

            this.AddDomainEvent(new DraftApplicationUpdated(this.Id, this.Content,
                                                            this.IncidentType, this.SuspiciousEmployees));
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dateTime">The date and time of the incident</param>
 /// <param name="caller">The original caller for the incident</param>
 /// <param name="exchange">The telephone exchange that passed the details of the caller</param>
 /// <param name="type">The incident type</param>
 /// <param name="details">Any other important details relating to the incident</param>
 /// <param name="address">The address of the incident</param>
 /// <param name="additionalAddressInfo">Any additional information stored in the database for the incident address</param>
 /// <param name="summary">A summary of the incident - this is typically only completed when the incident is closed</param>
 /// <param name="oic">The officer if charge (OIC) of the incident</param>
 /// <param name="assignedResources">Details of resources that were assigned to the incident</param>
 /// <param name="operatorName">The name of the operator that created the incident</param>
 /// <param name="stopTime">The 'stop' time of the incident.  This is the time the emergency is declared over by the Fire Service</param>
 /// <param name="incidentClosedTime">The time the incident was closed on the system.  Typically, this is following a
 /// stop message being placed, all resources returning and a summary being completed.</param>
 public IncidentInfo(int incidentNumber, DateTime dateTime, string caller, string exchange, IncidentType type, string details,
                     Address address, AdditionalAddressInfo additionalAddressInfo, string summary, string oic,
                     AssignedResource[] assignedResources, string operatorName, DateTime stopTime, DateTime incidentClosedTime)
 {
     //assign parameters to properties.
     this.incidentNumber = incidentNumber;
     DateTime            = dateTime;
     Caller   = caller;
     Exchange = exchange;
     Type     = type;
     Details  = details;
     Address  = address;
     AdditionalAddressInfo = additionalAddressInfo;
     Summary = summary;
     OiC     = oic;
     //AssignedResources = assignedResources;
     Operator           = operatorName;
     StopTime           = stopTime;
     IncidentClosedTime = incidentClosedTime;
 }
Пример #16
0
        public List <IncidentType> GetIncidentTypesInArea(string areaId)
        {
            // Initialize a list of IncidentType objects
            List <IncidentType> incidentTypes = new List <IncidentType>();

            try
            {
                using (AreaController ac = new AreaController())
                    using (SqlConnection conn = new SqlConnection(connString))
                    {
                        // Query the database for all incident types with matching area id
                        String query = "SELECT IncidentTypes.IncidentTypeId, COUNT(Incidents.IncidentId) AS IncidentCount FROM IncidentTypes LEFT JOIN Incidents ON IncidentTypes.IncidentTypeId = Incidents.IncidentTypeId AND Incidents.AreaId=@AreaId AND Incidents.ResolveDateTime IS NULL GROUP BY IncidentTypes.IncidentTypeId";
                        using (SqlCommand cmd = new SqlCommand(query, conn))
                        {
                            cmd.Parameters.AddWithValue("@AreaId", areaId);
                            conn.Open();

                            using (SqlDataReader dr = cmd.ExecuteReader())
                            {
                                while (dr.Read())
                                {
                                    // If a row is returned, create new IncidentType object with relevant values
                                    IncidentType incidentType = GetIncidentType(dr["IncidentTypeId"].ToString());
                                    incidentType.Severity = Convert.ToInt32(dr["IncidentCount"]);
                                    // Add IncidentType object into the list of incident types
                                    incidentTypes.Add(incidentType);
                                }
                            }
                        }
                    }
            }
            catch (Exception ex)
            {
            }
            using (NeaController nc = new NeaController())
                // Add haze incident type in the particular area into the list of incident types
                incidentTypes.Add(nc.GetPsiInArea(areaId));

            // Return the list of IncidentType objects
            return(incidentTypes);
        }
Пример #17
0
        /// <summary>
        /// Widok strony głównej z listą incydentów i opcjami filtrowania incydentów z danego okresu.
        /// </summary>
        /// <returns>
        /// Widok strony głównej z listą incydentów.
        /// </returns>
        public ActionResult Index()
        {
            DateTime incidentsFromDate = DateTime.Now.AddDays(-30);
            DateTime incidentsToDate   = DateTime.Now;

            ViewBag.endDate   = incidentsToDate.ToString("dd/M/yyyy", CultureInfo.InvariantCulture);
            ViewBag.startDate = incidentsFromDate.ToString("dd/M/yyyy", CultureInfo.InvariantCulture);

            List <IncidentsViewModel> list = new List <IncidentsViewModel>();

            var incidents = (from i in db.Incidents
                             where (i.DateOfIncident >= incidentsFromDate) && (i.DateOfIncident <= incidentsToDate)
                             select i).ToList();

            if (incidents != null)
            {
                foreach (Incident i in incidents)
                {
                    var services = db.ServiceParticipations.Where(p => p.IncidentId == i.ID);
                    foreach (var s in services)
                    {
                        if (User.IsInRole(s.RoleName) || User.IsInRole("Viewer"))
                        {
                            IncidentsViewModel model = new IncidentsViewModel();
                            IncidentType       type  = dbt.IncidentTypes.SingleOrDefault(t => t.TypeID == i.TypeID);
                            model.ID             = i.ID;
                            model.Address        = i.Address;
                            model.City           = i.City;
                            model.Lat            = i.Lat;
                            model.Long           = i.Long;
                            model.Type           = i.Type;
                            model.IconUrl        = type.IconUrl;
                            model.DateOfIncident = i.DateOfIncident;
                            list.Add(model);
                            break;
                        }
                    }
                }
            }
            return(View(list));
        }
Пример #18
0
        public List <IncidentType> GetAllIncidentTypeDetails(int id)
        {
            List <IncidentType> lstRetorno  = new List <IncidentType>();
            IncidentType        objetolista = new IncidentType();

            if (SqlConexion(false))
            {
                AddStore("Usp_GetAllIncidentType");
                AddParametro("@Id_Incident_Type", SqlDbType.VarChar, id);

                try
                {
                    SqlDataReader reader = ComandoSql.ExecuteReader();
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            objetolista = new IncidentType();
                            objetolista.idIncidentType          = Convert.ToInt32(reader["id_Incident_Type"]);
                            objetolista.descriptionIncidentType = Convert.ToString(reader["description_Incident_Type"]);
                            objetolista.statusIncidentType      = Convert.ToInt32(reader["status_Incident_Type"]);
                            lstRetorno.Add(objetolista);
                        }
                        reader.Close();
                    }
                }
                catch (Exception ex)
                {
                    SqlError = ex.Message;
                }
                SqlDesconexion();
            }

            //if (lstRetorno.Count==0)
            //{
            //    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            //}

            return(lstRetorno);
        }
        public IncidentItem(string Region, string Suburb, string Location, DateTime LastUpdate,
            IncidentType Type, IncidentStatus Status, int ApplianceCount, string Size,
            string ID, string Latitude, string Longitude, string AgencyResponsible, CFAIncidentSource parent, CFAIncidentSourceOptions options)
        {
            mRegion = Region;
            Region_GENERIC = Region.ToString();

            mSuburb = Suburb;
            Suburb_GENERIC = Suburb;

            mLocation = Location;
            Location_GENERIC = Location;

            mLatitude = Latitude;
            mLongitude = Longitude;

            mLastUpdate = LastUpdate;
            LastUpdate_GENERIC = LastUpdate;

            mResponsible = AgencyResponsible;

            mIncidentType = Type;
            Type_GENERIC = IncidentItem.IncidentTypeToString(Type);

            mIncidentStatus = Status;
            Status_GENERIC = IncidentItem.IncidentStatusToString(Status);

            mApplianceCount = ApplianceCount;
            ApplianceCount_GENERIC = ApplianceCount;

            mIncidentSize = Size;
            Size_GENERIC = Size;

            mIncidentID = ID;
            ID_GENERIC = SourceConstants.ID_PREFIX + ID;

            mParent = parent;
            mOptions = options;
        }
Пример #20
0
        //public string DeleteEmpDetails(string id)
        //{
        //    return "Employee details deleted having Id " + id;

        //}
        public Boolean DeleteIncidentType([FromBody] IncidentType tabla)//
        {
            bool retorno = true;

            if (SqlConexion(true))
            {
                try
                {
                    AddStore("Usp_DeleteIncidentType");
                    AddParametro("@id_Incident_Type", SqlDbType.VarChar, tabla.idIncidentType);
                    ComandoSql.ExecuteNonQuery();
                    ComandoSql.Parameters.Clear();
                }
                catch (Exception ex)
                {
                    SqlError = ex.Message;
                    retorno  = false;
                }
                SqlDesconexion();
            }
            return(retorno == true);
        }
        public IActionResult createIncidentType([FromBody] IncidentType value)
        {
            try
            {
                if (String.IsNullOrEmpty(value.Name))
                {
                    return(Ok(new { responseCode = 500, responseDescription = "Kindly Supply Code" }));
                }
                if (IncidentTypeService.GetIncidentTypeByCode(value.Name.Trim()).Result != null)
                {
                    return(Ok(new { responseCode = 400, responseDescription = "Code already Exist" }));
                }
                // value.datecreated = DateTime.Now;
                IncidentTypeService.AddIncidentType(value);

                return(Ok(new { responseCode = 200, responseDescription = "Created Successfully" }));
            }
            catch (Exception ex)
            {
                return(Ok(new { responseCode = 500, responseDescription = "Failed" }));
            }
        }
Пример #22
0
        //
        /// <summary>
        /// Delete one row from IncidentType
        /// </summary>
        /// <param name="incidentTypeId"></param>
        /// <returns></returns>
        public int Delete(int incidentTypeId)
        {
            int _return = 0;

            if (incidentTypeId > 0) // don't delete all
            {
                var _incidentTypes =
                    from _r in _niEntities.IncidentTypes
                    where _r.IncidentTypeId == incidentTypeId
                    select _r;
                if (_incidentTypes.Count() > 0)
                {
                    if (_niEntities.NetworkLogs.Where(ni => ni.IncidentTypeId == incidentTypeId).Count() == 0)
                    {
                        IncidentType _incidentType = _incidentTypes.First();
                        _niEntities.IncidentTypes.Remove(_incidentType);
                        _niEntities.SaveChanges();
                        _return = 1;    // one row updated
                    }
                }
            }
            return(_return);
        }
Пример #23
0
 public IncidentTypeData Insert(IncidentTypeData incidentType)
 {
     if (_niEntities.IncidentTypes.Where(
             _r => _r.IncidentTypeShortDesc == incidentType.IncidentTypeShortDesc).Count() == 0
         )
     {
         IncidentType _incidentType = new IncidentType();
         _incidentType.IncidentTypeShortDesc      = incidentType.IncidentTypeShortDesc;
         _incidentType.IncidentTypeDesc           = incidentType.IncidentTypeDesc;
         _incidentType.IncidentTypeFromServer     = incidentType.IncidentTypeFromServer;
         _incidentType.IncidentTypeSubjectLine    = incidentType.IncidentTypeSubjectLine;
         _incidentType.IncidentTypeEmailTemplate  = incidentType.IncidentTypeEmailTemplate;
         _incidentType.IncidentTypeTimeTemplate   = incidentType.IncidentTypeTimeTemplate;
         _incidentType.IncidentTypeThanksTemplate = incidentType.IncidentTypeThanksTemplate;
         _incidentType.IncidentTypeLogTemplate    = incidentType.IncidentTypeLogTemplate;
         _incidentType.IncidentTypeTemplate       = incidentType.IncidentTypeTemplate;
         _niEntities.IncidentTypes.Add(_incidentType);
         _niEntities.SaveChanges();
         //
         incidentType.IncidentTypeId = _incidentType.IncidentTypeId;
         return(incidentType);
     }
     return(null);
 }
Пример #24
0
        // GET: Incidents
        /// <summary>
        /// Widok główny z listą incydentów.
        /// </summary>
        /// <returns>Widok z listą incydentów.</returns>
        public ActionResult Index()
        {
            List <IncidentsViewModel> list = new List <IncidentsViewModel>();
            var incidents = db.Incidents;

            if (incidents != null)
            {
                foreach (Incident i in incidents)
                {
                    var services = db.ServiceParticipations.Where(p => p.IncidentId == i.ID);
                    foreach (var s in services)
                    {
                        if (User.IsInRole(s.RoleName) || User.IsInRole("Viewer"))
                        {
                            IncidentsViewModel model = new IncidentsViewModel();
                            IncidentType       type  = dbt.IncidentTypes.SingleOrDefault(t => t.TypeID == i.TypeID);
                            model.ID             = i.ID;
                            model.AddDate        = i.AddDate;
                            model.DateOfIncident = i.DateOfIncident;
                            model.TimeOfIncident = i.TimeOfIncident;
                            model.Address        = i.Address;
                            model.City           = i.City;
                            model.ZipCode        = i.ZipCode;
                            model.Lat            = i.Lat;
                            model.Long           = i.Long;
                            model.Type           = i.Type;
                            model.IconUrl        = type.IconUrl;
                            model.confirmed      = s.confirmed;
                            list.Add(model);
                            break;
                        }
                    }
                }
            }
            return(View(list));
        }
        private void ConfirmButtonOnClick(object sender, EventArgs e)
        {
            DateTime reportedAt = dateTimeReportedPicker.Value;
            string   subject    = subjectTextBox.Text;

            // Get the combo box options
            ComboBoxOption typeOfIncidentOption = (ComboBoxOption)typeOfIncidentComboBox.SelectedItem;
            ComboBoxOption priorityOption       = (ComboBoxOption)priorityComboBox.SelectedItem;
            ComboBoxOption deadlineOption       = (ComboBoxOption)deadlineComboBox.SelectedItem;
            ComboBoxOption openStatusOption     = (ComboBoxOption)statusComboBox.SelectedItem;

            // Get the values from the combo box options
            IncidentType incidentType = (IncidentType)typeOfIncidentOption.Value;
            Priority     priority     = (Priority)priorityOption.Value;
            Deadline     deadline     = (Deadline)deadlineOption.Value;
            OpenState    openState    = (OpenState)openStatusOption.Value;

            string description = descriptionTextBox.Text;

            // Construct the ticket. If ticketId is null, MongoDB will create a new id
            Ticket ticket = new Ticket()
            {
                Id             = ticketId,
                DateReported   = reportedAt,
                Deadline       = deadline,
                Priority       = priority,
                Subject        = subject,
                TypeOfIncident = incidentType,
                Description    = description,
                ReportedByUser = selectedUser,
                OpenStatus     = openState,
            };

            // Trigger callback
            OnConfirm(ticket);
        }
        /// <summary>
        /// Logs a generic log.
        /// </summary>
        /// <param name="type">The tpe of the log.</param>
        /// <param name="severity">The error severity of the log in case of error log.</param>
        /// <param name="message">The user message.</param>
        /// <param name="ex">The system exception.</param>
        public virtual void Log(IncidentType type, ErrorSeverity severity, string message, Exception ex)
        {
            switch (type)
            {
            case IncidentType.Info:
                LogInfo(message);
                break;

            case IncidentType.Debug:
                LogDebug(message);
                break;

            case IncidentType.Warning:
                LogWarning(message);
                break;

            case IncidentType.Error:
                LogError(severity, message, ex);
                break;

            default:
                break;
            }
        }
        public static string UnparseIncidentType(IncidentType type)
        {
            if (type == IncidentType.FalseAlarm)
                return "FALSE ALARM";
            if (type == IncidentType.Other)
                return "OTHER";
            if (type == IncidentType.NonStructure)
                return "NON STRUCTURE";
            if (type == IncidentType.Structure)
                return "STRUCTURE";
            if (type == IncidentType.GrassAndScrub)
                return "GRASS";
            if (type == IncidentType.Rescue)
                return "RESCUE";
            if (type == IncidentType.Incident)
                return "INCIDENT";
            if (type == IncidentType.Hazmat)
                return "HAZMAT";
            if (type == IncidentType.Wildfire)
                return "WILD FIRE";
            if (type == IncidentType.Scrub)
                return "SCRUB";
            if (type == IncidentType.Washaway)
                return "WASHAWAY";
            if (type == IncidentType.Assist)
                return "ASSIST OTHER AGENCY";

            return "UNKNOWN";
        }
        public static string IncidentTypeToString(IncidentType type)
        {
            if (type == IncidentType.FalseAlarm)
                return "False Alarm";
            if (type == IncidentType.Other)
                return "Other";
            if (type == IncidentType.NonStructure)
                return "Non Structure Fire";
            if (type == IncidentType.Structure)
                return "Structure Fire";
            if (type == IncidentType.GrassAndScrub)
                return "Grass & Scrub";
            if (type == IncidentType.Rescue)
                return "Rescue";
            if (type == IncidentType.Incident)
                return "Incident";
            if (type == IncidentType.Hazmat)
                return "Hazmat";
            if (type == IncidentType.Wildfire)
                return "Wildfire";
            if (type == IncidentType.Scrub)
                return "Scrub";
            if (type == IncidentType.Washaway)
                return "Washaway";
            if (type == IncidentType.Assist)
                return "Assist Other Agency";

            return "Unknown";
        }
Пример #29
0
        public void merge(ReportViewModel rvm, CompanyModel companyModel, ReportModel reportModel, ReportViewModel model)
        {
            this.confidentialLevelInt = model.incident_anonymity_id;

            if (model.incident_anonymity_id != 1)
            {
                name    = model.userName;
                surname = model.userLastName;
                email   = model.userEmail;
            }

            if (companyModel != null && rvm != null)
            {
                CountryModel country         = new CountryModel();
                country      selectedCountry = country.loadById(model.reportFrom);
                reportingFrom = selectedCountry.country_nm;
            }
            List <anonymity> list_anon = companyModel.GetAnonymities(companyModel._company.id, 0);

            if (list_anon != null)
            {
                var       temp = from n in list_anon where n.id == model.incident_anonymity_id select n;
                anonymity anon = temp.FirstOrDefault();
                confidentialLevel = anon.anonymity_company_en;
            }

            List <company_relationship> relationship = reportModel.getCustomRelationshipCompany(companyModel._company.id);

            if (relationship != null)
            {
                var temp = from n in relationship where n.id == model.reporterTypeDetail select n;
                company_relationship rel = temp.FirstOrDefault();
                if (rel != null)
                {
                    reportedAs = rel.relationship_en;
                }
            }

            var locations = companyModel.Locations(companyModel._company.id).ToList();

            if (locations != null)
            {
                var temp = from n in locations where n.id == model.locationsOfIncident select n.location_en;
                if (temp != null)
                {
                    incidentLocation = String.Join(", ", temp);
                }
            }

            List <company_department> depActive   = companyModel.CompanyDepartmentsActive(companyModel._company.id).ToList();
            List <string>             departments = model.departments;
            List <int> departmentsInt             = new List <int>();

            foreach (string item in departments)
            {
                try
                {
                    int temp = 0;
                    Int32.TryParse(item, out temp);
                    if (temp > 0)
                    {
                        departmentsInt.Add(temp);
                    }
                    else if (temp == 0)
                    {
                        departmentsInt.Add(0);
                    }
                }
                catch (Exception) { }
            }
            if (depActive != null && depActive.Count > 0 && departments != null && departments.Count > 0)
            {
                var temp = from n in depActive
                           join entry in departmentsInt
                           on n.id equals entry
                           select n.department_en;
                foreach (string item in temp)
                {
                    affectedDepartments = String.Join(", ", item);
                }
                if (affectedDepartments == null)
                {
                    affectedDepartments = GlobalRes.notListed;
                }
            }

            List <management_know> managament = companyModel.getManagamentKnow();

            if (managament != null && model.managamentKnowId > 0)
            {
                var temp = from n in managament
                           where n.id == model.managamentKnowId
                           select n.text_en;
                managamentKnow = temp.FirstOrDefault();
            }
            List <reported_outside> reported_outside = companyModel.getReportedOutside();

            if (model.reported_outside_id > 0 && reported_outside != null)
            {
                var temp = from n in reported_outside where n.id == model.reported_outside_id select n;
                outOrganization = temp.FirstOrDefault().description_en;
            }

            if (model.isUrgent == 0)
            {
                isCaseUrgent = GlobalRes.No;
            }
            else
            {
                isCaseUrgent = GlobalRes.Yes;
            }

            if (reportModel.isCustomIncidentTypes(model.currentCompanyId))
            {
                /*custom types*/
                List <company_secondary_type> company_secondary_type = reportModel.getCompanySecondaryType(model.currentCompanyId);
                foreach (int item in model.whatHappened)
                {
                    if (item != 0)
                    {
                        var something = company_secondary_type.Where(m => m.id == item).FirstOrDefault();
                        IncidentType += something.secondary_type_en + ", ";
                    }
                    else
                    {
                        IncidentType += GlobalRes.Other + ", ";
                    }
                }
            }
            else
            {
                /*default*/
                List <secondary_type_mandatory> secondary_type_mandatory = reportModel.getSecondaryTypeMandatory();
                foreach (int item in model.whatHappened)
                {
                    if (item != 0)
                    {
                        var something = secondary_type_mandatory.Where(m => m.id == item).FirstOrDefault();
                        IncidentType += something.secondary_type_en + ", ";
                    }
                    else
                    {
                        IncidentType += GlobalRes.Other + ", ";
                    }
                }
            }
            IncidentType = IncidentType.Remove(IncidentType.Length - 2);

            IncidentDate = model.dateIncidentHappened.ToShortDateString();
            switch (model.isOnGoing)
            {
            case 1:
                incidentOngoing = GlobalRes.No;
                break;

            case 2:
                incidentOngoing = GlobalRes.Yes;
                break;

            case 3:
                incidentOngoing = GlobalRes.NotSureUp;
                break;
            }



            List <injury_damage> injuryDamage = companyModel.GetInjuryDamages().ToList();

            if (injuryDamage != null && injuryDamage.Count > 0 && model.incidentResultReport > 0)
            {
                var temp = from n in injuryDamage where n.id == model.incidentResultReport select n;
                incidentResult = temp.FirstOrDefault().text_en;
            }


            incidentDescription = model.describeHappened;

            if (model.files.Count > 0)
            {
                HttpFileCollectionBase files = model.files;
                var fileItem = files["attachDocuments"];
                if (fileItem != null)
                {
                    attachFiles = fileItem.FileName;
                }
            }
            this.report_by_myself = model.report_by_myself == true ? GlobalRes.Myself : GlobalRes.SomeoneElse;

            this.personName     = new List <string>();
            this.personLastName = new List <string>();
            this.personTitle    = new List <string>();
            this.personRole     = new List <string>();
            var personRoles = new List <int>();

            if (model.personName != null)
            {
                this.personName     = model.personName.ToList();
                this.personLastName = model.personLastName.ToList();
                this.personTitle    = model.personTitle.ToList();
                personRoles         = model.personRole.ToList();
            }


            List <role_in_report> roleInReport = ReportModel.getRoleInReport();

            for (int i = 0; i < personRoles.Count; i++)
            {
                role_in_report nameRole = roleInReport.Where(m => m.id == personRoles[i]).FirstOrDefault();
                if (nameRole != null)
                {
                    personRole.Add(nameRole.role_en);
                }
            }
        }
Пример #30
0
        public ActionResult IncidentType()
        {
            ViewBag.EGHLayout = "RGE.IncidentType";
            RGEContext   db       = null;
            ActionResult view     = View("Index");
            string       menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty";

            try
            {
                db = new RGEContext();
                //ViewBag.msg = "Соединение с базой данных установлено";  // debug
                view = View("IncidentType", db);
                if (menuitem.Equals("IncidentType.Create"))
                {
                    view = View("IncidentTypeCreate");
                }
                else if (menuitem.Equals("IncidentType.Delete"))
                {
                    string type_code_item = this.HttpContext.Request.Params["type_code"];
                    if (type_code_item != null)
                    {
                        int c = 0;
                        if (int.TryParse(type_code_item, out c))
                        {
                            IncidentType it = new IncidentType();
                            if (EGH01DB.Types.IncidentType.GetByCode(db, c, out it))
                            {
                                view = View("IncidentTypeDelete", it);
                            }
                        }
                    }
                }
                else if (menuitem.Equals("IncidentType.Update"))
                {
                    string type_code_item = this.HttpContext.Request.Params["type_code"];
                    if (type_code_item != null)
                    {
                        int c = 0;
                        if (int.TryParse(type_code_item, out c))
                        {
                            IncidentType it = new IncidentType();
                            if (EGH01DB.Types.IncidentType.GetByCode(db, c, out it))
                            {
                                view = View("IncidentTypeUpdate", it);
                            }
                        }
                    }
                }
                else if (menuitem.Equals("IncidentType.Excel"))
                {
                    EGH01DB.Types.IncidentTypeList list = new IncidentTypeList(db);
                    XmlNode     node  = list.toXmlNode();
                    XmlDocument doc   = new XmlDocument();
                    XmlNode     nnode = doc.ImportNode(node, true);
                    doc.AppendChild(nnode);
                    doc.Save(Server.MapPath("~/App_Data/IncidentType.xml"));
                    view = View("Index");

                    view = File(Server.MapPath("~/App_Data/IncidentType.xml"), "text/plain", "Типы инцидентов.xml");
                }
            }
            catch (RGEContext.Exception e)
            {
                ViewBag.msg = e.message;
            }
            catch (Exception e)
            {
                ViewBag.msg = e.Message;
            }

            return(view);
        }
        public ActionResult FindIncidentTypeById(string id)
        {
            IncidentType incidentType = appDbContex.IncidentTypes.Where(a => a.Id == id).FirstOrDefault();

            return(Ok(incidentType));
        }
        /// <summary>
        /// This method gets called by the system when a new incident (accident or natural disaster) has been simulated.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="connector"></param>
        /// <param name="involvedObjects"></param>
        /// <param name="roadDamage"></param>
        public static void IncidentHappened(IncidentType type, List <StreetConnector> connectors)
        {
            Incident incident = new Incident(type, connectors);

            TrafficControl.IncidentDetected(incident);
        }
Пример #33
0
 public DraftApplicationBuilder SetIncidentType(IncidentType incidentType)
 {
     this._incidentType = incidentType;
     return(this);
 }