示例#1
0
 public bool Update(Organization organization, string prevName, string prevCode, string prevContactNo)
 {
     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 (organization.Name != prevName)
     {
         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 (organization.Code != prevCode)
     {
         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 (organization.ContactNo != prevContactNo)
     {
         if (_organizationGetway.GetByContactNo(organization).Count > 0)
         {
             throw new Exception("Contact no should be unique");
         }
     }
     return(_organizationGetway.Update(organization));
 }
示例#2
0
 public int Update(Organization entity)
 {
     return(_organizationGetway.Update(entity));
 }