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 DeleteSeat(Seat instance);
partial void UpdateSeat(Seat instance);
partial void InsertSeat(Seat instance);
public Seat ToDb(Seat upseat) { if(!string.IsNullOrEmpty(Name)) upseat.name = Name; if(!string.IsNullOrEmpty(Cache)) upseat.cache = Cache; if(!string.IsNullOrEmpty(TempJson)) upseat.tempJson = TempJson; if(!string.IsNullOrEmpty(TempHtml)) upseat.tempHtml = TempHtml; if(!string.IsNullOrEmpty(DefineJson)) upseat.defineJson = DefineJson; upseat.act = (int)Act; if(ParentFolderId.HasValue) upseat.parentFolderId = ParentFolderId.Value; upseat.editingUser = EditUserId; return upseat; }
public mSeat(Seat s) { Id = s.id; Act = (eAct)s.act; ParentFolderId = s.parentFolderId; Name = s.name; Cache = s.cache; TempJson = s.tempJson; DefineJson = s.defineJson; EditUserId = s.editingUser; }