Beispiel #1
0
        private void loadDeliveryGroups()
        {
            //clear all the commands out of the powershell object
            ps.Commands.Clear();

            //add the cmdlet to the powershell obect
            ps.Commands.AddCommand("Get-BrokerDesktopGroup");
            //call the cmdlet
            var desktopGroups = ps.Invoke();

            //loop through each of the delivery groups returned
            foreach (var desktopGroup in desktopGroups)
            {
                try
                {
                    //create a delivery group object
                    DeliveryGroup dGroup = new DeliveryGroup();
                    dGroup.Name          = desktopGroup.Properties["Name"].Value.ToString();
                    dGroup.PublishedName = desktopGroup.Properties["PublishedName"].Value.ToString();
                    dGroup.Description   = desktopGroup.Properties["Description"].Value.ToString();
                    dGroup.UUID          = Guid.Parse(desktopGroup.Properties["UUID"].Value.ToString());
                    dGroup.Uid           = int.Parse(desktopGroup.Properties["uid"].Value.ToString());

                    deliveryGroups.Add(dGroup);
                }
                catch
                {
                }
            }
        }
Beispiel #2
0
        public bool Update(int id, DeliveryGroup deliveryGroup)
        {
            DeliveryGroup deliveryGroups = _deliveryGroupRepository.FindById(a => a.Id == id);

            deliveryGroups.DeliveryBoyId = deliveryGroup.DeliveryBoyId;
            deliveryGroups.Priority      = deliveryGroup.Priority;
            deliveryGroups.SubZoneId     = deliveryGroup.SubZoneId;
            _deliveryGroupRepository.Update(deliveryGroup);
            return(_deliveryGroupRepository.Save() > 0);
        }
 public void Submit(DeliveryGroup deliveryGroup)
 {
     SubmitValidate(deliveryGroup);
     if (deliveryGroup.Id > 0)
     {
         _deliveryGroupRepository.Update(deliveryGroup);
     }
     else
     {
         _deliveryGroupRepository.Insert(deliveryGroup);
     }
     _unitOfWork.Commit();
 }
        private void DeleteValidate(DeliveryGroup deliveryGroup)
        {
            var messages = new List <string>();

            if (_productsDeliveryGroupsRepository.GetByDeliveryGroup(deliveryGroup.Id).Count() > 1)
            {
                messages.Add("Delivery Group Is Used In Products And Can't Be Deleted.");
            }

            if (messages.Count > 0)
            {
                throw new ApplicationException(messages);
            }
        }
        private void SubmitValidate(DeliveryGroup deliveryGroup)
        {
            var messages = new List <string>();

            if (string.IsNullOrEmpty(deliveryGroup.Name))
            {
                messages.Add("Delivery Group's Name Can't Be Empty.");
            }

            if (_deliveryGroupRepository.IsNameDuplicated(deliveryGroup))
            {
                messages.Add("Delivery Group's Name Is Duplicate.");
            }

            if (messages.Count > 0)
            {
                throw new ApplicationException(messages);
            }
        }
 public void Delete(DeliveryGroup deliveryGroup)
 {
     DeleteValidate(deliveryGroup);
     _deliveryGroupRepository.Delete(deliveryGroup);
     _unitOfWork.Commit();
 }
Beispiel #7
0
 public bool Insert(DeliveryGroup deliveryGroup)
 {
     _deliveryGroupRepository.Insert(deliveryGroup);
     return(_deliveryGroupRepository.Save() > 0);
 }