Пример #1
0
        public string AddHostingUnit(BE.HostingUnit hostU) // add hosting unit
        {
            hostU.HostingUnitKey = 0;
            if (!(CheckMailAddress(hostU.Owner.MailAddress)))
            {
                throw new ArgumentException("This email address isn't correct");
            }
            int num;

            if (hostU.Owner.PhoneNumber.Length != 10 || !int.TryParse(hostU.Owner.PhoneNumber, out num))
            {
                throw new ArgumentException("This phone number isn't correct");
            }
            if (hostU.Owner.HostKey.Length != 8 || !int.TryParse(hostU.Owner.HostKey, out num))
            {
                throw new ArgumentException("the ID must be in format of 8 digits");
            }
            if (Convert.ToInt32(hostU.TypeOfHostingUnit) < 0 || Convert.ToInt32(hostU.TypeOfHostingUnit) > 3)
            {
                throw new ArgumentException("ERROR-This number of Type Of Hosting Unit dosn't exist");
            }

            dal.AddHostingUnit(hostU);
            return(" Add Hosting Unit accomplish with success \n Your hosting unit key is :" + hostU.HostingUnitKey);
        }
Пример #2
0
 public void AddHostingUnit(HostingUnit myHostingUnit)
 {
     try
     {
         dal.AddHostingUnit(myHostingUnit);
         CheckMatchBetweenHostingUnitToOpenRequests(myHostingUnit);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }