Example #1
0
 public string UpdateSex(Sex sex)
 {
     string message = ValidateSex(sex);
     if (string.IsNullOrEmpty(message))
     {
         bool isProcessDone = UpdateEntity<Sex>(sex);
         if (isProcessDone)
         {
             log.Info(string.Format("Sex {0} changed", sex.Code));
             return string.Empty;
         }
         else
         {
             return "Code will be UNIQE!";
         }
     }
     else
     {
         return message;
     }
 }
Example #2
0
 public string EditSex(DtoSex dtoSex)
 {
     var uniqueSex = SexMethods.Instance.GetSexByCode(dtoSex.Code);
     if (!dtoSex.IsEdit)
     {
         Sex sex = new Sex()
         {
             Code = dtoSex.Code,
             Name = dtoSex.Name,
         };
         return SexMethods.Instance.InsertSex(sex);
     }
     else
     {
         var sex = new Sex()
         {
             Id = uniqueSex.Id,
             Code = dtoSex.Code,
             Name = dtoSex.Name,
         };
         return SexMethods.Instance.UpdateSex(sex);
     }
 }
Example #3
0
 private static string ValidateSex(Sex sex)
 {
     if (!string.IsNullOrEmpty(sex.Code) && !string.IsNullOrEmpty(sex.Name))
     {
         return string.Empty;
     }
     else
     {
         return "Fill all fields!";
     }
 }