public DeliveryNoteModel CreateEmptyDeliveryNote()
        {
            var properties     = _notePropertySearchRepository.GetEntities(UserContext.Current.SubscriberId, s => true);
            var propertyValues = properties.Select(s => s.CreateEmptyValue()).ToList();
            var note           = new DeliveryNoteModel
            {
                Properties = Mapper.Map <List <DeliveryNotePropertyValueModel> >(propertyValues)
            };

            return(note);
        }
        public bool AddDeliveryNote(DeliveryNoteModel model)
        {
            var note = Mapper.Map <DeliveryNoteEntity>(model);

            note.SubscriberId = UserContext.Current.SubscriberId;
            if (_noteRepository.AddDeliveryNote(note))
            {
                if (model.HasProperties)
                {
                    if (!AddPropertyValues(note, model.Properties))
                    {
                        var properties = JsonConvert.SerializeObject(model.Properties);
                    }
                }
                return(true);
            }
            return(false);
        }
示例#3
0
        public bool UpdateDeliveryNote(DeliveryNoteModel model)
        {
            var note = Mapper.Map <DeliveryNoteEntity>(model);

            note.SubscriberId = UserContext.Current.SubscriberId;
            var update = _noteUpdateRepository.UpdateEntity(note);

            if (update && model.HasProperties)
            {
                model.Properties.ForEach(property =>
                {
                    property.DeliveryNoteId = note.Id;
                    property.SubscriberId   = note.SubscriberId;
                    var value = Mapper.Map <DeliveryNotePropertyValueEntity>(property);
                    update   &= _notePropertyValueSetRepository.SetPropertyValue(value);
                });
            }
            return(update);
        }
示例#4
0
        public ActionResult AddDeliveryNote(DeliveryNoteModel model)
        {
            var result = _noteService.AddDeliveryNote(model);

            return(BoolResult(result));
        }
示例#5
0
        public ActionResult EditDeliveryNote(DeliveryNoteModel model)
        {
            var result = _noteService.UpdateService.UpdateDeliveryNote(model);

            return(BoolResult(result));
        }