Esempio n. 1
0
 public ActivityDocument Create(CostCentre hub, CostCentre clerk, CostCentre supplier, CommodityProducer commodityProducer, ActivityType activityType, Route route, Centre centre, Season season, string documentReference, Guid documentIssueCostCentreApplicationId, DateTime documentDate, DateTime activityDate, string description = "", string note = "")
 {
     Guid id = Guid.NewGuid();
     ActivityDocument doc = DocumentPrivateConstruct<ActivityDocument>(id);
    
     doc.DocumentDate = documentDate;
     doc.DocumentDateIssued = activityDate;
     doc.Description = description;
     doc.Hub = hub;
     doc.FieldClerk = clerk;
     doc.Supplier = supplier;
     doc.Producer = commodityProducer;
     doc.ActivityType = activityType;
     doc.Route = route;
     doc.Centre = centre;
     doc.DocumentReference = documentReference;
     doc.DocumentIssuerCostCentreApplicationId = documentIssueCostCentreApplicationId;
     doc.Hub = hub;
     doc.FieldClerk = clerk;
     doc.Supplier = supplier;
     doc.DocumentReference = documentReference;
     doc.ActivityDate = activityDate;
     doc.DocumentDateIssued = DateTime.Now;
     doc.Season = season;
     SetDefaultDates(doc);
     doc.EnableAddCommands();
     return doc;
 }
        public async Task<ResponseBool> SeasonSaveAsync(Season season)
        {
            ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
            var dto = _masterDataToDTOMapping.Map(season);
            if (dto == null)
                return _response;

            string url = string.Format("api/pushmasterdata/season/save");
            var httpClient = setupHttpClient();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            try
            {
                var response = await httpClient.PostAsJsonAsync(url, dto);
                _response = await response.Content.ReadAsAsync<ResponseBool>();

            }
            catch (Exception ex)
            {
                _response.ErrorInfo = "Failed to save season DTO.\n" + ex.Message;
                _log.Error("Failed to save season DTO", ex);
            }
            return _response;

        }
 public SeasonDTO Map(Season seasonEntity)
 {
     if (seasonEntity == null) return null;
     var seasonDto = Mapper.Map<Season, SeasonDTO>(seasonEntity);
     return seasonDto;
 }
Esempio n. 4
0
 protected Guid AddSeason(string name, string code, string description, Guid commodityProducerId,DateTime startDate,DateTime endDate)
 {
     var season = new Season(Guid.NewGuid())
     {
         Name = name,
         Code = code,
         CommodityProducer =_commodityProducerRepository.GetById(commodityProducerId),
         StartDate = startDate,
         EndDate = endDate,
         Description = description
     };
     season._SetStatus(EntityStatus.Active);
     return _SeasonRepository.Save(season);
 }