Пример #1
0
        public object ImportNTM([FromBody] List <NTMRequestDTO> NTMData)
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), JsonConvert.SerializeObject(NTMData), Level.INFO);

            ResponseDTO Response      = new ResponseDTO();
            ErrorDTO    ErrorResponse = new ErrorDTO();
            WardDTO     UserResponse  = new WardDTO();

            var xmlElements = new XElement("Data",
                                           from item in NTMData
                                           select new XElement("Item",
                                                               new XElement("Reporter", item.reporter),
                                                               new XElement("ReporterCode", item.reporter_code),
                                                               new XElement("Partner", item.partner),
                                                               new XElement("PartnerCode", item.partner_code),
                                                               new XElement("PartnerComment", item.partner_comment),
                                                               new XElement("ProductCode", item.product_code),
                                                               new XElement("ProductCoverage", item.product_coverage),
                                                               new XElement("HSRevision", item.hs_revision),
                                                               new XElement("ProductComment", item.product_comment),
                                                               new XElement("NTMCode", item.ntm_code),
                                                               new XElement("NTMRevision", item.ntm_revision),
                                                               new XElement("NTMComment", item.ntm_comment),
                                                               new XElement("CategoryCode", item.category_code)
                                                               ));

            string data = xmlElements.ToString();

            Response = LegislationBUS.ImportNTM(xmlElements);

            return(Response);
        }
        public object Delete(int id, string category_code)
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), JsonConvert.SerializeObject(id), Level.INFO);

            ResponseDTO Response            = new ResponseDTO();
            ResponseDTO ResponseStore       = new ResponseDTO();
            ResponseDTO ResponseLegislation = new ResponseDTO();
            ErrorDTO    ErrorResponse       = new ErrorDTO();
            CategoryDTO UserResponse        = new CategoryDTO();

            ResponseStore       = StoreBUS.GetAllStore("", category_code, "", "", 1, 100);
            ResponseLegislation = LegislationBUS.GetAllLegislation("", "", category_code, 1, 100);

            if (ResponseStore.Data == null && ResponseLegislation.Data == null)
            {
                Response = CategoryBUS.DeleteCategory(id);
            }
            else
            {
                ErrorResponse.Code    = 400;
                ErrorResponse.Message = "Industry being used";
                Response.Error        = ErrorResponse;
            }

            return(Response);
        }
Пример #3
0
        public object ImportLegislation([FromBody] List <LegislationRequestDTO> LegislationData)
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), JsonConvert.SerializeObject(LegislationData), Level.INFO);

            ResponseDTO Response      = new ResponseDTO();
            ErrorDTO    ErrorResponse = new ErrorDTO();
            WardDTO     UserResponse  = new WardDTO();

            var xmlElements = new XElement("Data",
                                           from item in LegislationData
                                           select new XElement("Item",
                                                               new XElement("Title", item.title),
                                                               new XElement("Description", item.description),
                                                               new XElement("Summary", item.summary),
                                                               new XElement("StartDate", item.start_date),
                                                               new XElement("EndDate", item.end_date),
                                                               new XElement("CategoryCode", item.category_code),
                                                               new XElement("Reporter", item.reporter),
                                                               new XElement("ImplementingAuthority", item.implementing_authority),
                                                               new XElement("IsImportingCountry", item.is_importing_country),
                                                               new XElement("Agency", item.agency)
                                                               ));

            string data = xmlElements.ToString();

            Response = LegislationBUS.ImportLegislation(xmlElements);

            return(Response);
        }
Пример #4
0
        public object GetByID(int id)
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), null, Level.INFO);

            ResponseDTO Response = new ResponseDTO();

            Response = LegislationBUS.GetAllLegislationByID(id);

            return(Response);
        }
Пример #5
0
        public object GetMeansuerBP(string category_code = "", string reporter = "", string product = "", int page = 1, int size = 1200000)
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), null, Level.INFO);

            ResponseDTO Response = new ResponseDTO();

            Response = LegislationBUS.GetMeansuerBP(category_code, reporter, product, page, size);

            return(Response);
        }
Пример #6
0
        public object Get(string name = "")
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), null, Level.INFO);

            ResponseDTO Response = new ResponseDTO();

            Response = LegislationBUS.GetReporterData(name);

            return(Response);
        }
Пример #7
0
        public object Get(string start_date = "", string end_date = "", string category_code = "", int page = 1, int size = 12)
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), null, Level.INFO);

            ResponseDTO Response = new ResponseDTO();

            Response = LegislationBUS.GetAllLegislation(start_date, end_date, category_code, page, size);

            return(Response);
        }
Пример #8
0
        public object Delete(int id)
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), JsonConvert.SerializeObject(id), Level.INFO);

            ResponseDTO Response      = new ResponseDTO();
            ErrorDTO    ErrorResponse = new ErrorDTO();

            Response = LegislationBUS.DeleteLegislation(id);


            return(Response);
        }
Пример #9
0
        public object UpdateLegislation([FromBody] LegislationRequestDTO legislationData)
        {
            string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString();

            Logger.Info(Request.RequestUri + "  ||  Method: " + Request.Method, Request.Headers.ToString(), JsonConvert.SerializeObject(legislationData), Level.INFO);

            ResponseDTO Response      = new ResponseDTO();
            ErrorDTO    ErrorResponse = new ErrorDTO();

            Response = LegislationBUS.AddOrUpdateLegislation(legislationData);


            return(Response);
        }