Exemple #1
0
 public IEnumerable <AmplifyingReportView> List()
 {
     try
     {
         using (AmplifyingReportRepository ARRepo = new AmplifyingReportRepository())
         {
             return(ARRepo.GetList <AmplifyingReportView>());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 public List <AmplifyingReportView> GetByCOIId(int COIId)
 {
     try
     {
         using (AmplifyingReportRepository ARRepo = new AmplifyingReportRepository())
         {
             return(ARRepo.GetList <AmplifyingReportView>(new { COI_Id = COIId }).ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 public IEnumerable <AmplifyingReportView> GetSubsARs(Subscriber subsModel)
 {
     try
     {
         using (AmplifyingReportRepository ARRepo = new AmplifyingReportRepository())
         {
             return(ARRepo.GetList <AmplifyingReportView>("WHERE Information_Addressee_Codes LIKE '%" + subsModel.SubscriberCode + "%'"));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
        public AmplifyingReportView Add(Subscriber SubsModel, string UserName, AmplifyingReport ARModel)
        {
            try
            {
                if (SubsModel == null)
                {
                    throw new Exception("Subscriber model is null");
                }
                else if (ARModel == null)
                {
                    throw new Exception("Preliminary report model is null");
                }

                using (AmplifyingReportRepository ARRepo = new AmplifyingReportRepository())
                {
                    AmplifyingReportView ARView        = new AmplifyingReportView();
                    string coiNumber                   = "";
                    List <AmplifyingReportView> lstARs = ARRepo.GetList <AmplifyingReportView>(new { COI_ID = ARModel.COIId }).ToList();

                    using (COIRepository coiRepo = new COIRepository())
                    {
                        coiNumber = coiRepo.Get <COI>(ARModel.COIId).COINumber;
                    }
                    string generatedARNo = coiNumber + "-AR-" + 1;

                    ARView = lstARs.OrderByDescending(x => x.ARId).FirstOrDefault();
                    if (ARView != null)
                    {
                        generatedARNo = Common.GetNextSubReportNumber(ARView.ARNumber);
                    }

                    ARModel.ARNumber             = generatedARNo;
                    ARModel.ActionAddressee      = string.Join(",", ARModel.ActionAddresseeArray);
                    ARModel.InformationAddressee = string.Join(",", ARModel.InformationAddresseeArray);
                    ARModel.ReportingDatetime    = Common.GetLocalDateTime(MemCache.GetFromCache <string>("Timezone_" + SubsModel.SubscriberId));
                    ARModel.SubscriberId         = SubsModel.SubscriberId;
                    ARModel.CreatedOn            = Common.GetLocalDateTime(MemCache.GetFromCache <string>("Timezone_" + SubsModel.SubscriberId));
                    ARModel.CreatedBy            = UserName;

                    int rowId = ARRepo.Insert(ARModel);
                    return(ARView = GetById(rowId));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }