Exemple #1
0
 public IEnumerable <AfterActionReportView> List()
 {
     try
     {
         using (AfterActionReportRepository aarRepo = new AfterActionReportRepository())
         {
             return(aarRepo.GetList <AfterActionReportView>());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 public IEnumerable <AfterActionReportView> GetAllAARsBySubsId(int subsId)
 {
     try
     {
         using (AfterActionReportRepository aarRepo = new AfterActionReportRepository())
         {
             return(aarRepo.GetList <AfterActionReportView>(new { Subscriber_Id = subsId }));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 public bool Update(int SubscriberId, string UserName, AfterActionReport AARModel)
 {
     try
     {
         using (AfterActionReportRepository AARRepo = new AfterActionReportRepository())
         {
             AARModel.LastModifiedOn = Common.GetLocalDateTime(MemCache.GetFromCache <string>("Timezone_" + SubscriberId));
             AARModel.LastModifiedBy = UserName;
             AARRepo.Update <AfterActionReport>(AARModel);
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
 public AfterActionReportView GetById(int id)
 {
     try
     {
         using (AfterActionReportRepository AARRepo = new AfterActionReportRepository())
         {
             AfterActionReportView AARViewModel = new AfterActionReportView();
             {
                 AARViewModel = AARRepo.Get <AfterActionReportView>(id);
                 return(AARViewModel);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #5
0
        public AfterActionReportView Add(Subscriber SubsModel, string UserName, AfterActionReport AARModel)
        {
            try
            {
                using (AfterActionReportRepository aarRepo = new AfterActionReportRepository())
                {
                    AfterActionReportView aarView = new AfterActionReportView();
                    AARModel.AddressedTo       = string.Join(",", AARModel.AddressedToArray);
                    AARModel.ReportingDatetime = Common.GetLocalDateTime(MemCache.GetFromCache <string>("Timezone_" + SubsModel.SubscriberId));
                    AARModel.SubscriberId      = SubsModel.SubscriberId;
                    AARModel.CreatedOn         = Common.GetLocalDateTime(MemCache.GetFromCache <string>("Timezone_" + SubsModel.SubscriberId));
                    AARModel.CreatedBy         = UserName;

                    int rowId = aarRepo.Insert(AARModel);
                    return(aarView = GetById(rowId));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #6
0
        public bool Delete(int id)
        {
            try
            {
                using (AfterActionReportRepository AARRepo = new AfterActionReportRepository())
                {
                    var AARExisting = AARRepo.Get <AfterActionReport>(id);
                    if (AARExisting == null)
                    {
                        return(false);
                    }

                    else
                    {
                        AARRepo.Delete <AfterActionReport>(id);
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #7
0
        public DataTableModel ListPaged(Dictionary <string, string> dic = null)
        {
            try
            {
                string[]       searchColumns = new string[] { "COI_Number", "Subscriber_Code", "PR_Number", "Remarks", "MMSI", "Latitude", "Longitude" };
                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 (AfterActionReportRepository aarRepo = new AfterActionReportRepository())
                {
                    dtModel.Data = aarRepo.GetListPaged <AfterActionReportView>(Convert.ToInt32(dic["pagination[page]"]), Convert.ToInt32(dic["pagination[perpage]"]), parameters, parameters["orderby"].ToString() + " " + parameters["sortorder"].ToString(), new string[] { "COI_Number", "PR_Number", "COI_Type_Name", "Threat_Name", "Info_Confidence_Level_Name", "Subscriber_Code", "Remarks" });
                    meta.total   = aarRepo.RecordCount <AfterActionReportView>(parameters, searchColumns);
                }
                dtModel.Meta = meta;
                return(dtModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }