public VIEWManageForm(Form parent, DBRegistrationClass drc, TreeNode tnSelected) { InitializeComponent(); this.MdiParent = parent; instance = this; ViewClass viewObject = (ViewClass)tnSelected.Tag; _localNofity.NotifyType = eNotifyType.ErrorWithoutMessage; _localNofity.AllowErrors = false; _localNofity.Notify.OnRaiseInfoHandler += new NotifyInfos.RaiseNotifyHandler(MeldungRaised); _localNofity.Notify.OnRaiseErrorHandler += new NotifyInfos.RaiseNotifyHandler(ErrorRaised); //Notifies.AddNotify(localNofity,"VIEWManageForm"); //Notifies.AddNotify(NotifiesClass.Instance(),"GLOBAL"); TnSelected = tnSelected; ViewObject = (ViewClass)tnSelected.Tag; InitMessages(); DBReg = drc; txtMaxRows.Text = DBReg.MaxRowsForSelect.ToString(); this.GetDataWorker.WorkerReportsProgress = true; this.GetDataWorker.WorkerSupportsCancellation = true; this.GetDataWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); this.GetDataWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged); this.GetDataWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted); }
public void RefreshAutocompleteForView(string viewname) { //create autocomplete popup menu _popupMenu = new AutocompleteMenu(_txtBox); _popupMenu.MinFragmentLength = 1; var words = new List <string>(); words.AddRange(ViewSqlCommands()); ViewClass actView = null; actViews.TryGetValue(viewname, out actView); if (actView != null) { foreach (var tcf in actView.Fields.Values) { words.Add(tcf.Name); } } _popupMenu.SearchPattern = @"[\w\.$]"; _popupMenu.Items.SetAutocompleteItems(words); _popupMenu.AllowTabKey = true; //size of popupmenu _popupMenu.Items.MaximumSize = new System.Drawing.Size(400, 500); _popupMenu.Items.Width = 400; }
public GameForm(Game game, ViewClass v) { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.context = v; this.g = game; this.cardBoxes = new List <PictureBox>(); this.lblGameName.Text = g.name; this.Text = this.context.player.username; this.btnEndTurn.Hide(); this.lblOnTurn.Hide(); this.bought = false; this.finish = false; this.gameStarted = true; this.activeForm = true; this.isListening = true; gameLogic = new GameLogic(); gameLogic.SetPlayers(new List <Player>(g.players)); gameLogic.SetGameId(g.id); gameLogic.SetMyName(v.player.username); foreach (Player player in this.g.players) { ListViewItem item = new ListViewItem(player.username); item.SubItems.Add(""); this.listPlayers.Items.Add(item); } }
public ActionResult ViewReport(int?classid, int id = 0) { ViewClass @class = null; ViewClassReport report = null; if (classid > 0) { @class = client.Get((int)classid); report = @class.Reports[0]; } else if (id > 0) { ClassReportServiceClient rc = new ClassReportServiceClient(); report = rc.Get(id); @class = client.Get(report.ClassId); } int nowIndex = 0; for (int i = 0; i < @class.Reports.Count; i++) { if (@class.Reports[i].Id == report.Id) { nowIndex = i; break; } } //更多中移除当前活动 @class.Reports.RemoveAt(nowIndex); ViewBag.Class = @class; return(View(report)); }
public ActionResult ViewClass(int id) { ClassServiceClient client = new ClassServiceClient(); ViewClass @class = client.Get(id); return(View(@class)); }
public JsonResult AddActivity(ViewClass entity) { ClassServiceClient client = new ClassServiceClient(); entity.Banner = ""; entity.Discount = 0; entity.IsItem = false; entity.ItemClassID = 0; entity.ClassType = (int)ClassType.activity; entity.ClassStatus = (int)ClassStatus.审核中; entity.UserId = user.Uid; entity.UpdateTime = DateTime.Now; entity.IsDeleted = false; if (entity.DurationUnit == 1) { entity.EndTime = Convert.ToDateTime(entity.Start).AddHours(entity.Duration); } else { entity.EndTime = Convert.ToDateTime(entity.Start).AddDays(entity.Duration); } entity.Id = client.Add(entity); if (!string.IsNullOrEmpty(entity.TeacherIds) && entity.Id > 0) { ClassTeacherServiceClient subClient = new ClassTeacherServiceClient(); subClient.AddTeachers(entity.Id, entity.TeacherIds); } return(Json(entity)); }
/// <summary> /// 通用 留言/评论 /// </summary> /// <returns></returns> //public ActionResult PartialMessage(int id,int page=1) //{ // #region 留言/评论 // int rcount = 0; // int pagesize = 10; // List<ViewtMessage> msgEntity = new List<ViewtMessage>(); // msgEntity = clientMsg.GettMessageUidList(id, 0, page, pagesize, out rcount); // List<ViewtMessageGroup> listGroupMsg = new List<ViewtMessageGroup>(); // #region // foreach (var item in msgEntity) // { // ViewtMessageGroup model = new ViewtMessageGroup(); // model.entity = item; // //被留言人 // ViewYogaUser yuser = clientUser.GetYogaUserById(item.ToUid.Value); // if (yuser != null) // model.ToUser = yuser.NickName; // //留言人 // ViewYogaUser usermodel = clientUser.GetYogaUserById(item.FromUid.Value); // if (usermodel != null) // model.FromUser = usermodel.NickName; // if (item.FormType == 0) // { // //习练者头像 // using (YogaUserDetailServiceClient clientDet = new YogaUserDetailServiceClient()) // { // ViewYogaUserDetail ViewDet = new ViewYogaUserDetail(); // if (item.FromUid != 0) // { // ViewDet = clientDet.GetYogaUserDetailById(item.FromUid.Value); // if (ViewDet != null) // { // model.DisplayImg = ViewDet.DisplayImg; // } // model.sUrl = "/YogaUserDetail/Details/" + item.FromUid.Value; // } // } // } // else // { // //导师头像 // using (YogisModelsServiceClient clientDet = new YogisModelsServiceClient()) // { // ViewYogisModels ViewDet = new ViewYogisModels(); // if (item.FromUid != 0) // { // ViewDet = clientDet.GetYogisModelsById(item.FromUid.Value); // if (ViewDet != null) // { // model.DisplayImg = ViewDet.DisplayImg; // } // model.sUrl = "/YogisModels/Details/" + item.FromUid.Value; // } // } // } // //strPic // //回复 // List<ViewtMessage> listM = clientMsg.GettMessageParentID(item.ID); // List<ViewtMessageGroup> entitylist = new List<ViewtMessageGroup>(); // foreach (var it in listM) // { // ViewtMessageGroup entityMsg = new ViewtMessageGroup(); // entityMsg.entity = it; // //被留言人 // ViewYogaUser yuser2 = clientUser.GetYogaUserById(it.ToUid.Value); // if (yuser2 != null) // entityMsg.ToUser = yuser2.NickName; // //留言人 // ViewYogaUser usermodel2 = clientUser.GetYogaUserById(it.FromUid.Value); // if (usermodel2 != null) // entityMsg.FromUser = usermodel2.NickName; // entitylist.Add(entityMsg); // } // model.msgList = entitylist; // listGroupMsg.Add(model); // } // #endregion // ViewBag.MsgInfo = listGroupMsg; // ViewBag.rcount = rcount; // Webdiyer.WebControls.Mvc.PagedList<ViewtMessageGroup> messlist = new Webdiyer.WebControls.Mvc.PagedList<ViewtMessageGroup>(ViewBag.MsgInfo, page, pagesize, rcount); // //if (Request.IsAjaxRequest()) // //{ // // return PartialView("PartialMessage", messlist); // //} // #endregion // return PartialView("PartialMessage", messlist); //} public ActionResult Add() { ClassServiceClient classService = new ClassServiceClient(); for (int i = 0; i < 10; i++) { ViewClass vc = new ViewClass(); vc.TopicIds = "1,11,1"; vc.Name = "活动名称"; vc.Start = DateTime.Now.ToString(); vc.Duration = 3; vc.DurationUnit = (int)TimeUnit.小时; vc.AreaID = 82; vc.Address = "奥森公园"; vc.Max = 100; vc.Summary = "这是一个测试活动"; vc.Content = "这是活动的图文详细介绍"; vc.Banner = "http://www.iyogakoo.com/files/avatar/original/100004.JPG"; vc.ClassStatus = (int)ClassStatus.审核中; vc.CreateTime = DateTime.Now; vc.UpdateTime = DateTime.Now; classService.Add(vc); if (vc.Id > 0) { } } return(View()); }
public void BindingAcrossObjectBoundaries() { var binder = new Binder(); /* ViewModelClass, ViewClass, and ControlClass all implement interface * INotifyPropertyChanged. */ var view = new ViewClass() { MyControl = new ControlClass { Label = "aaa" } }; var viewModel = new ViewModelClass { MyControlLabel = "bbb" }; this._bindings = binder.Bind(viewModel, view); // viewModel.MyControlLabel is now bound to view.MyControl.Label. // both will have the value "bbb". Assert.AreEqual("bbb", ((ControlClass)view.MyControl).Label); ((ControlClass)view.MyControl).Label = "ccc"; // propagates "ccc" to viewModel.MyControlLabel Assert.AreEqual("ccc", viewModel.MyControlLabel); viewModel.MyControlLabel = "ddd"; // propagates "ddd" to view.MyControl.Label Assert.AreEqual("ddd", ((ControlClass)view.MyControl).Label); }
public void NameBasedBinding() { var binder = new Binder(); /* ViewModelClass and ViewClass both have a string property MyProperty, * and they both implement INotifyPropertyChanged */ var view = new ViewClass { MyProperty = "aaa" }; var viewModel = new ViewModelClass { MyProperty = "bbb" }; this._bindings = binder.Bind(viewModel, view); // viewModel.MyProperty is now bound to view.MyProperty. // view.MyProperty will have the value "bbb". Assert.AreEqual("bbb", view.MyProperty); view.MyProperty = "ccc"; // propagates "ccc" to viewModel.MyProperty Assert.AreEqual("ccc", viewModel.MyProperty); viewModel.MyProperty = "ddd"; // propagates "ddd" to view.MyProperty Assert.AreEqual("ddd", view.MyProperty); }
public ControllerClass(HotelContext db) { roomDAO = new RoomDAO(db); guestDAO = new GuestDAO(db); bookingDAO = new BookingDAO(db); dictionaryDAO = new DictionaryDAO(db); this.view = new ViewClass(dictionaryDAO.GetRoomTypes(), dictionaryDAO.GetGuestStatus()); }
public ControllerClass(CinemaContext db) { hallDAO = new HallDAO(db); movieDAO = new MovieDAO(db); seanceDAO = new SeanceDAO(db); ticketDAO = new TicketDAO(db); view = new ViewClass(hallDAO.GetHalls(), hallDAO.GetSeats()); }
public ControllerClass() { hallDAO = new HallDAO(); movieDAO = new MovieDAO(); seanceDAO = new SeanceDAO(); ticketDAO = new TicketDAO(); fullTextSearch = new FullTextSearch(); view = new ViewClass(hallDAO.GetHalls(), hallDAO.GetSeats()); }
public int Add(ViewClass entity) { entity.CreateTime = DateTime.Now; entity.UpdateTime = DateTime.Now; Class @class = _repository.Add(ViewClass.ToEntity(entity)); entity.Id = @class.Id; return(entity.Id); }
public PageResult <ViewClass> GetClasses(int code, int page, int size, string[] args) { int count = 0; List <Class> list = _repository.GetClasses(code, page, size, out count, args); PageResult <ViewClass> pr = new PageResult <ViewClass>(0, "", page, size, count); pr.Objects = (from c in list select ViewClass.ToViewModel(c)).ToList(); return(pr); }
public CreateNewGameForm(ViewClass v) { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.context = v; this.Text = this.context.player.username; this.dUpDown.Text = this.dUpDown.Items[0].ToString(); }
public ViewClass Get(int id) { ViewClass vc = Impl.Get(id); if (vc.User != null) { vc.Poster = GetAvatars(vc.User.Uid.ToString())[0]; } return(vc); }
/// <summary> /// 修改活动 /// </summary> /// <param name="id">活动ID</param> /// <returns></returns> public ActionResult EditActivity(int id) { ViewClass model = new ViewClass(); ClassServiceClient client = new ClassServiceClient(); model = client.Get(id); ViewBag.Title = "编辑活动"; ViewBag.Id = id; YogaDicItemServiceClient dicClient = new YogaDicItemServiceClient(); ViewData["YogaTopic"] = (from topic in (dicClient.Dics(d => d.DicId == CommonInfo.Topic)) select new SelectListItem() { Text = topic.ItemName, Value = topic.ID.ToString(), Selected = model.TopicIds.Split(',').Contains(topic.ID.ToString()) }).ToList(); //逐层获取地理位置区域 List <DistrictModel> DistrictModelList = client.GetDistrictModel(model.AreaID); ViewBag.DistrictModelList = Newtonsoft.Json.JsonConvert.SerializeObject(DistrictModelList); //获取活动关联的老师并拼成HTML展示在页面 ClassTeacherServiceClient subClient = new ClassTeacherServiceClient(); List <ViewClassTeacher> ClassTeacherModel = subClient.GetClass_Id(id); string html = ""; if (ClassTeacherModel != null) { foreach (var item in ClassTeacherModel) { html += "<li class=teacher id=teacher_" + item.Id + "" + " teacherid=" + item.TeacherId + "><div class=teacher-info><div class=name><img src=" + item.Avatar + "> " + item.Name + "<span>" + item.Gender + "</span> <span>" + item.Country + "</span> <span>" + item.YogaSystem + "</span></div></div><div class=teacher-close> </div></li>"; } } ViewData["html"] = new MvcHtmlString(html); string centerHtml = ""; CentersServiceClient centerClient = new CentersServiceClient(); if (!string.IsNullOrWhiteSpace(model.CenterID)) { var centerList = centerClient.GetCentersListByClassCenterID(model.CenterID); foreach (var dataItem in centerList) { centerHtml += "<li class=Center id=CenterID_" + dataItem.CenterId + " CenterID=" + dataItem.CenterId + "><div class=Center-info><div class=name><img src=" + dataItem.CenterPortraint + "/> " + dataItem.CenterName + " </div></div><div class=Center-close> </div></li>"; } } ViewData["centerHtml"] = new MvcHtmlString(centerHtml); return(View(model)); }
public List <ViewClass> GetClassesByUid(string strId, int uid) { List <Class> list = _repository.GetClassesByUid(strId, uid); List <ViewClass> model = new List <ViewClass>(); foreach (var item in list) { model.Add(ViewClass.ToViewModel(item)); } return(model); }
public List <ViewClass> GetClassesByZhuanYe(int uid, int teacherId, int centerId, int type) { List <Class> list = _repository.GetClassesByZhuanYe(uid, teacherId, centerId, type); List <ViewClass> model = new List <ViewClass>(); foreach (var item in list) { model.Add(ViewClass.ToViewModel(item)); } return(model); }
public ControllerClass() { classDAO = new ClassDAO(); teacherDAO = new TeacherDAO(); pupilDAO = new PupilDAO(); lessonDAO = new LessonDAO(); junctionDAO = new JunctionDAO(); fullTextSearch = new FullTextSearch(); view = new ViewClass(classDAO.GetList(), lessonDAO.GetList()); //DAO<Junction>.RandomDB(classDAO, teacherDAO, lessonDAO, pupilDAO, junctionDAO); }
public LoggedInScreen(ViewClass v) { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; context = v; this.Text = context.player.username; lblUsername.Text = v.player.username; lblWinCount.Text = v.player.winCount.ToString(); this.RefreshList(); }
public Result Add(ViewOrder order) { Result result = CanApply(order.ClassId, order.Number); if (result.Code == 0) { ClassServiceClient cc = new ClassServiceClient(); ViewClass vc = cc.Get(order.ClassId); order.Amount = (double)vc.Price * order.Number; return(Impl.Add(order)); } else { return(result); } }
public ActionResult EditShare(int id) { ViewClass entity = new ViewClass(); entity = client.Get(id); if (entity.iShareNums == null) { entity.iShareNums = 1; } else { entity.iShareNums++; } client.Edit(entity); return(View()); }
public JsonResult Delete(int id, int UserId) { try { // TODO: Add delete logic here //活动导师 //ClassTeacherServiceClient teahclient = new ClassTeacherServiceClient(); //List<ViewClassTeacher> ctlist = teahclient.GetClass_Id(id); //if (ctlist.Count() > 0) //{ // foreach (var i in ctlist) // { // teahclient.Delete(i.Id.ToString()); // } //} ////兴趣 //InterestServiceClient insertClient = new InterestServiceClient(); //List<ViewInterestedClass> interlist = insertClient.GetListClassId(id); //if (interlist.Count() > 0) //{ // foreach (var i in interlist) // { // i.Class = null; // insertClient.Delete(i.Id.ToString()); // } //} //活动报道 ClassReportServiceClient clentRep = new ClassReportServiceClient(); if (clentRep.GetClassId(id).Count() == 0) { //活动 ClassServiceClient client = new ClassServiceClient(); ViewClass model = client.Get(id); model.IsDeleted = true; client.Edit(model); return(Json(new { code = 0 })); } return(Json(new { code = 2 })); } catch { return(Json(new { code = 1 })); } }
public JsonResult EditActivity(ViewClass entity) { ClassServiceClient client = new ClassServiceClient(); ViewClass model = client.Get(entity.Id); model.Address = entity.Address; model.AreaID = entity.AreaID; model.Banner = entity.Banner; model.ClassType = entity.ClassType; model.Content = entity.Content; model.Creater = entity.Creater; model.CreateTime = DateTime.Now; model.Discount = entity.Discount; model.Duration = entity.Duration; model.DurationUnit = entity.DurationUnit; model.InterestCount = entity.InterestCount; model.Max = entity.Max; model.Name = entity.Name; model.Price = entity.Price; model.Start = entity.Start; model.Summary = entity.Summary; model.Tags = entity.Tags; model.TopicIds = entity.TopicIds; model.CloseTime = entity.CloseTime; model.CenterID = entity.CenterID; if (entity.DurationUnit == 1) { entity.EndTime = Convert.ToDateTime(entity.Start).AddHours(entity.Duration); } else { entity.EndTime = Convert.ToDateTime(entity.Start).AddDays(entity.Duration); } ClassTeacherServiceClient subClient = new ClassTeacherServiceClient(); List <ViewClassTeacher> list = subClient.GetClass_Id(entity.Id); if (!string.IsNullOrEmpty(entity.TeacherIds) && entity.Id > 0) { subClient.EditTeachers(entity.Id, entity.TeacherIds); } client.Edit(model); return(Json(entity)); }
public void Tldr() { var viewModel = new ViewModelClass(); var view = new ViewClass(); /* Create binder */ var binder = new Binder(); /* Establish bindings. * Store the bindings in this._bindings to make sure it is not garbage collected. * This is typically done when the view appears (*not* when it is created!) */ this._bindings = binder.Bind(viewModel, view); /* Destroy bindings. * Typically when the view disappears. */ this._bindings.Dispose(); this._bindings = null; }
public JsonResult AddActivityBanner(int id, string banner) { ClassServiceClient client = new ClassServiceClient(); ViewClass entity = client.Get(id); if (entity.Id > 0) { if (entity.UserId != user.Uid) { return(Json(new Result(1, "这不是你的地盘"))); } entity.Banner = banner; int result = client.Edit(entity); if (result > 0) { return(Json(new Result(0, "保存海报成功"))); } } return(Json(new Result(0, "保存海报失败"))); }
public void DynamicRebinding() { var binder = new Binder(); /* ViewModelClass, ViewClass, ControlModelClass, ControlClass and TextControlClass all * implement interface INotifyPropertyChanged. */ var view = new ViewClass() { MyControl = new ControlClass { Label = "aaa" } }; var viewModel = new ViewModelClass() { MyControl = new ControlModelClass { Label = "bbb", Text = "ccc" } }; this._bindings = binder.Bind(viewModel, view); // viewModel.MyControl.Label is now bound to view.MyControl.Label. // Both will have the value "bbb". // viewModel.MyControl.Text is not bound to anything and will have its original value ("ccc") Assert.AreEqual("bbb", ((ControlClass)view.MyControl).Label); Assert.AreEqual("ccc", viewModel.MyControl.Text); view.MyControl = new TextControlClass { Text = "ddd" }; // viewModel.MyControl.Text gets *rebound* to view.MyControl.Text. // Both will now have value "ddd". // viewModel.MyControl.Label will still have value "bbb". Assert.AreEqual("bbb", viewModel.MyControl.Label); Assert.AreEqual("ddd", viewModel.MyControl.Text); }
public Result CanApply(int classID, int count) { ClassServiceClient cc = new ClassServiceClient(); ViewClass vc = cc.Get(classID); if (vc.ClassStatus == 2) { int hasAppliedNumber = AppliedNumber(classID, ORDER_TIME_OUT); if (hasAppliedNumber < vc.Max) { if (hasAppliedNumber + count <= vc.Max) { if (DateTime.Parse(vc.Start) > DateTime.Now) { return(new Result(0, "OK")); } else { return(new Result(1, "活动已经开始了")); } } else { return(new Result(1, string.Format("名额不足,还剩 {0} 个名额", (vc.Max - hasAppliedNumber - count)))); } } else { return(new Result(1, "报名已满")); } } else { return(new Result(1, "活动已不能报名!")); } }
public VIEWManageForm(Form parent, DBRegistrationClass drc, TreeNode tnSelected) { InitializeComponent(); this.MdiParent = parent; instance = this; ViewClass viewObject = (ViewClass)tnSelected.Tag; _localNofity.ErrorGranularity = eMessageGranularity.never; _localNofity.Register4Info(MeldungRaised); _localNofity.Register4Error(ErrorRaised); TnSelected = tnSelected; ViewObject = (ViewClass)tnSelected.Tag; DBReg = drc; txtMaxRows.Text = AppSettingsClass.Instance.SQLVariables.MaxRowsForSelect.ToString(); this.GetDataWorker.WorkerReportsProgress = true; this.GetDataWorker.WorkerSupportsCancellation = true; this.GetDataWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bwGetData_DoWork); this.GetDataWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bwGetData_ProgressChanged); this.GetDataWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bwGetData_RunWorkerCompleted); gridStore = new GridStoreClass(dgvResults); }