Beispiel #1
0
 public static int FetchOrCreateMaritalStatus(CMSDataContext Db, string type)
 {
     var ms = Db.MaritalStatuses.SingleOrDefault(m => m.Description == type);
     if (ms == null)
     {
         var max = Db.BaptismTypes.Max(mm => mm.Id) + 10;
         ms = new MaritalStatus() { Id = max, Code = "ms" + max, Description = type };
         Db.MaritalStatuses.InsertOnSubmit(ms);
         Db.SubmitChanges();
     }
     return ms.Id;
 }
Beispiel #2
0
 public static int FetchOrCreateMaritalStatusId(CMSDataContext db, string status)
 {
     var ms = db.MaritalStatuses.SingleOrDefault(m => m.Description == status);
     if (ms == null)
     {
         var max = db.MaritalStatuses.Max(mm => mm.Id) + 1;
         ms = new MaritalStatus() { Id = max, Code = "M" + max, Description = status };
         db.MaritalStatuses.InsertOnSubmit(ms);
         db.SubmitChanges();
     }
     return ms.Id;
 }