public mFolder(mSeat s) { Id = s.Id; ParentFolderId = s.ParentFolderId; Name = s.Name; Description = s.Name; isParent = false; }
public mSeat SeatUpdatetemp(mSeat upseat) { Seat seat = seat_repo.Get(d => d.id == upseat.Id); var auths_useseat = auth_repo.GetMulti(d => (d.type == (int)eAuthType.UseSeat || d.type == (int)eAuthType.EditSeat || d.type == (int)eAuthType.UseSeatProp) && d.key1 == upseat.Id); foreach (var auth in auths_useseat) { string[] strs = auth.name.SplitBystr(" - ", null); strs[strs.Length - 1] = upseat.Name; auth.name = String.Join(" - ", strs); } upseat.ToDb(seat); SubmitChanges(); return(new mSeat(seat)); }
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); }
public mSeat SeatUpdateByuser(mSeat upseat, int userId) { Seat seat = seat_repo.Get(d => d.id == upseat.Id); upseat.ToDb(seat); var seathistory = seathist_repo.GetMulti(d => d.seatName == seat.name && d.endTime == null); foreach (SeatHistory item in seathistory) { item.endTime = DateTime.Now; } SeatHistory seathist = new SeatHistory { seatName = seat.name, startTime = DateTime.Now, userName = user_repo.Get(d => d.id == userId).name, cache = seat.cache }; seathist_repo.Add(seathist); SubmitChanges(); return(new mSeat(seat)); }
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; }
public mSeat SeatUpdatetemp(mSeat upseat) { Seat seat = seat_repo.Get(d => d.id == upseat.Id); var auths_useseat = auth_repo.GetMulti(d => (d.type == (int)eAuthType.UseSeat || d.type == (int)eAuthType.EditSeat || d.type == (int)eAuthType.UseSeatProp) && d.key1 == upseat.Id); foreach (var auth in auths_useseat) { string[] strs = auth.name.SplitBystr(" - ", null); strs[strs.Length - 1] = upseat.Name; auth.name = String.Join(" - ", strs); } upseat.ToDb(seat); SubmitChanges(); return new mSeat(seat); }
public mSeat SeatUpdateByuser(mSeat upseat, int userId) { Seat seat = seat_repo.Get(d => d.id == upseat.Id); upseat.ToDb(seat); var seathistory = seathist_repo.GetMulti(d => d.seatName == seat.name && d.endTime == null); foreach (SeatHistory item in seathistory) { item.endTime = DateTime.Now; } SeatHistory seathist = new SeatHistory { seatName = seat.name, startTime = DateTime.Now, userName = user_repo.Get(d => d.id == userId).name, cache = seat.cache }; seathist_repo.Add(seathist); SubmitChanges(); return new mSeat(seat); }
public JsonResult CreatByhtml(string name, int parentId, string temphtml, string definejson) { mSeat newseat = new mSeat { Name = name, ParentFolderId = parentId, TempHtml = temphtml, DefineJson = definejson }; try { seat_sub.SeatAdd(newseat); } catch (Exception ex) { return Json(new { result = false, msg = ex.Message }); } return Json(new { result = true }); }
public JsonResult Creat(string name, int parentId, string tempjson, string definejson) { if (seat_get.SeatCheckNameExist(name)) { return Json(new { result = false, msg = "名称已存在,请换一个。" }); } mSeat newseat = new mSeat { Name = name, ParentFolderId = parentId, TempJson = tempjson, DefineJson = definejson }; try { seat_sub.SeatAdd(newseat); } catch (Exception ex) { return Json(new { result = false, msg = ex.Message }); } return Json(new { result = true }); }
public JsonResult UseUpdate(int seatId, string defineJson, string cache, string userstore) { UserIdentity user = (UserIdentity)ViewBag.UserModel; mSeat seat = seat_get.SeatGet(seatId); try { if (seat.EditUserId != 0 && int.Parse(user.Id) != seat.EditUserId) throw new ConcurrentException(); mSeat upseat = new mSeat { Id = seatId, DefineJson = defineJson, Cache = cache }; seat_sub.SeatUpdateByuser(upseat, int.Parse(user.Id)); mUser upuser = new mUser { Id = int.Parse(user.Id), StoreData = userstore }; user_sub.UserUpdate(upuser); } catch (Exception ex) { return Json(new { result = false, msg = ex.Message }); } return Json(new { result = true }); }
public JsonResult Index(int seatid, string name, int parentId, string tempjson, string definejson) { mSeat seat = new mSeat { Id = seatid, Name = name, ParentFolderId = parentId, TempJson = tempjson, DefineJson = definejson }; try { seat_sub.SeatUpdatetemp(seat); } catch (Exception ex) { return Json(new { result = false, msg = ex.Message }); } return Json(new { result = true }); }