Пример #1
0
 public bool Add(Organization organization)
 {
     if (organization == null)
     {
         throw new Exception("Insert Organization information");
     }
     if (organization.Name == null || organization.Name.Length < 3)
     {
         throw new Exception("Name should be at least 3 charecter");
     }
     if (_organizationGetway.GetByName(organization).Count > 0)
     {
         throw new Exception("Name should be unique");
     }
     if (organization.Code == null || organization.Code.Length != 7)
     {
         throw new Exception("Code length should be 7 charecter");
     }
     if (_organizationGetway.GetByCode(organization).Count > 0)
     {
         throw new Exception("Code should be unique");
     }
     if (organization.ContactNo == null || organization.ContactNo.Length != 11)
     {
         throw new Exception("Contact no should be 11 digit");
     }
     if (_organizationGetway.GetByContactNo(organization).Count > 0)
     {
         throw new Exception("Contact no should be unique");
     }
     return(_organizationGetway.Add(organization));
 }
Пример #2
0
 public int Add(Organization entity)
 {
     return(_organizationGetway.Add(entity));
 }