public int AuthAdd(mAuth mauth) { Auth auth = new Auth(); auth_repo.Add(mauth.ToDb(auth)); SubmitChanges(); return auth.id; }
public mAuth(Auth a) { Id = a.id; Act = (eAct)a.act; Name = a.name; Key1 = a.key1; Key2 = a.key2; Key3 = a.key3; Type = (eAuthType)a.type; }
public int SeatAdd(mSeat newseat) { Seat seat = new Seat(); seat_repo.Add(newseat.ToDb(seat)); SubmitChanges(); Auth useseatauth = new Auth { name = EnumDescription.GetFieldText(eAuthType.UseSeat) + " - " + seat.name, type = (int)eAuthType.UseSeat, key1 = seat.id }; auth_repo.Add(useseatauth); Auth editseatauth = new Auth { name = EnumDescription.GetFieldText(eAuthType.EditSeat) + " - " + seat.name, type = (int)eAuthType.EditSeat, key1 = seat.id }; auth_repo.Add(editseatauth); foreach (eSelpropType etype in Enum.GetValues(typeof(eSelpropType))) { Auth selpropauth = new Auth { name = EnumDescription.GetFieldText(eAuthType.UseSeatProp) + " - " + EnumDescription.GetFieldText(etype) + " - " + seat.name, type = (int)eAuthType.UseSeatProp, key1 = seat.id, key2 = (int)etype }; auth_repo.Add(selpropauth); } foreach (eItemPropType etype in Enum.GetValues(typeof(eItemPropType))) { Auth itempropauth = new Auth { name = EnumDescription.GetFieldText(eAuthType.UseSeatProp) + " - " + EnumDescription.GetFieldText(etype) + " - " + seat.name, type = (int)eAuthType.UseSeatProp, key1 = seat.id, key2 = (int)etype }; auth_repo.Add(itempropauth); } SubmitChanges(); return seat.id; }
partial void DeleteAuth(Auth instance);
partial void UpdateAuth(Auth instance);
partial void InsertAuth(Auth instance);
public Auth ToDb(Auth auth) { auth.act = (int)Act; auth.type = (int)Type; if (!string.IsNullOrEmpty(Name)) auth.name = Name; if (Key1.HasValue) auth.key1 = Key1.Value; if (Key2.HasValue) auth.key2 = Key2.Value; if (Key3.HasValue) auth.key3 = Key3.Value; return auth; }