Пример #1
0
 public long TotalRecord(object whereClause)
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             return(AIRepo.RecordCount <AAASIncident>(whereClause));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 public IEnumerable <AAASIncident> List()
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             return(AIRepo.GetList <AAASIncident>());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
 public bool Update(AAASIncident AIModel)
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             AIRepo.Update(AIModel);
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
0
 public AAASIncident GetById(int id)
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             AAASIncident AIModel = new AAASIncident();
             {
                 AIModel = AIRepo.Get <AAASIncident>(id);
                 return(AIModel);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #5
0
 public AAASIncident Add(AAASIncident AIModel, int SubscriberId, string UserName)
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             if (AIModel != null)
             {
                 AIModel.CreatedOn = Common.GetLocalDateTime(MemCache.GetFromCache <string>("Timezone_" + SubscriberId));
                 AIModel.CreatedBy = UserName;
                 var rowId = AIRepo.Insert(AIModel);
                 AIModel.Id = rowId;
             }
             return(AIModel);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #6
0
 public bool Delete(int id)
 {
     try
     {
         using (AAASIncidentRepository AIRepo = new AAASIncidentRepository())
         {
             var AIExisting = AIRepo.Get <AAASIncident>(id);
             if (AIExisting == null)
             {
                 return(false);
             }
             else
             {
                 AIRepo.Delete <AAASIncident>(id);
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #7
0
        public DataTableModel ListPaged(Dictionary <string, string> dic = null)
        {
            try
            {
                string[]       searchColumns = new string[] { "User_Contact_Number", "Incident_Type", "Description", "Created_By" };
                DataTableModel dtModel       = new DataTableModel();
                Meta           meta          = new Meta();
                if (dic.TryGetValue("pagination[page]", out string page))
                {
                    meta.page = Convert.ToInt64(page);
                }

                if (dic.TryGetValue("pagination[pages]", out string pages))
                {
                    meta.pages = Convert.ToInt64(pages);
                }

                if (dic.TryGetValue("pagination[perpage]", out string perpage))
                {
                    meta.perpage = Convert.ToInt64(perpage);
                }

                var parameters = this.ParseParameters(dic);
                using (AAASIncidentRepository IncidentRepository = new AAASIncidentRepository())
                {
                    dtModel.Data = IncidentRepository.GetListPaged <AAASIncident>(Convert.ToInt32(dic["pagination[page]"]), Convert.ToInt32(dic["pagination[perpage]"]), parameters, parameters["orderby"].ToString() + " " + parameters["sortorder"].ToString(), searchColumns);
                    meta.total   = IncidentRepository.RecordCount <AAASIncident>(parameters, searchColumns);
                }
                dtModel.Meta = meta;
                return(dtModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }