/// <summary> /// Create a new person /// </summary> /// <param name="person"></param> /// <param name="objContex"></param> public static void Insertar(Person person, PeopleContainer objContex) { try { PersonDal.Insert(person, objContex); } catch (Exception) { } }
public void TestMethod1() { AccountDal account = new AccountDal(); account.Insert(new Account { UserID = Guid.NewGuid(), Username = "******", Password = "******" }); PersonDal person = new PersonDal(); person.Insert(new Person { PID = Guid.NewGuid(), Pname = "york", Pgrade = "BoardMember", Padvs = "", Pact4fire = "", Pact4water = "", Pcontact = "", Pemail = "", Pfield_of_firm = "", Phobbies = "", Pjob4u = "", Ppro = "", Psex = "男", Ptel = "135", Ptime = 1234567, PwechatID = "", Pwork_years = 1, Username = "******" }); }
/// <summary> /// Insert a person /// </summary> /// <param name="person">Object person to insert</param> /// <param name="objContex">Get table to object</param> public static void Insert(PersonDto personDto, ModelUnibookContainer objContex) { try { Person person = new Person(); person.PersonId = personDto.PersonId; person.Name = personDto.Name; person.LastName = personDto.LastName; person.Birthday = personDto.BirthDay; person.Deleted = personDto.Deleted; //person.Gender = GenderBrl.Get(personDto.Gender.GenderId); PersonDal.Insert(person, objContex); } catch (DbEntityValidationException ex) { throw ex; } catch (Exception ex) { throw ex; } }
public bool insertMem(Account account, Person person, XiaoYan xiaoyan) { bool res = true; try { _account.Insert(account); _persondal.Insert(person); _memdal.Insert(xiaoyan); } catch (Exception e) { res = false; using (StreamWriter writer = new StreamWriter(@"C:\Users\lenovo\Desktop\log.txt", true)) { writer.WriteLine(DateTime.Now.ToString()); writer.WriteLine(e.Message); writer.WriteLine(e.StackTrace); } } return(res); }