Пример #1
0
        public int Update(IncidentTypeData incidentType)
        {
            int _return        = 0;
            var _incidentTypes =
                from _r in _niEntities.IncidentTypes
                where _r.IncidentTypeId == incidentType.IncidentTypeId
                select _r;

            if (_incidentTypes.Count() > 0)
            {
                IncidentType _incidentType = _incidentTypes.First();
                _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.SaveChanges();
                _return = 1;    // one row updated
            }
            return(_return);
        }
Пример #2
0
        //
        /// <summary>
        /// Return one row of IncidentType
        /// </summary>
        /// <param name="incidentTypeShortDesc"></param>
        /// <returns></returns>
        public IncidentTypeData GetByShortDesc(string incidentTypeShortDesc)
        {
            IncidentTypeData _incidentType = null;
            var _incidentTypes             = ListIncidentTypeQueryable()
                                             .Where(_r => _r.IncidentTypeShortDesc == incidentTypeShortDesc);

            if (_incidentTypes.Count() > 0)
            {
                _incidentType = _incidentTypes.First();
            }
            return(_incidentType);
        }
Пример #3
0
        //
        /// <summary>
        /// Return one row of IncidentType
        /// </summary>
        /// <param name="incidentTypeId">Incident type id</param>
        /// <returns>A single IncidentTypeData or null</returns>
        public IncidentTypeData GetByPrimaryKey(int incidentTypeId)
        {
            IncidentTypeData _incidentType = null;
            var _incidentTypes             = ListIncidentTypeQueryable()
                                             .Where(_r => _r.IncidentTypeId == incidentTypeId);

            if (_incidentTypes.Count() > 0)
            {
                _incidentType = _incidentTypes.First();
            }
            return(_incidentType);
        }
Пример #4
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);
 }