public MyResult Create(string par0, string par1) { Assembly asmb = Assembly.GetAssembly(typeof(ServiceReturn)); Type type = asmb.GetType(par0); object obj = JsonConvert.DeserializeObject(par1, type); object newObj = DBBase.Create(obj); if (type == typeof(ETask)) { ETask task = (ETask)obj; if (MySession.UserID != task.ExecutorID && task.ExecutorID != 0) { EUser myuser = DBBase.Get <EUser>(MySession.UserID); EUser excuteuser = DBBase.Get <EUser>(task.ExecutorID); List <string> ulist = new List <string>(); ulist.Add(excuteuser.PushClientID); PushMessageToList.PushToList(task.Title, "指派人" + myuser.Name, ulist, true); } } else if (type == typeof(EPlan)) { EPlan plan = (EPlan)obj; EProject project = DBBase.Get <EProject>(plan.ProjectID); EUserSearch userSearch = new EUserSearch() { IsDefault = false, Name = project.Name + "-" + plan.Name, UserID = MySession.UserID, ProjectID = plan.ProjectID, PlanID = plan.ID }; DBBase.Create(userSearch); } return(ServiceResult(newObj)); }
protected override void Init() { base.Init(); EventListener.Get(BtnQuickTaskAdd.gameObject).onClick = OnQuickTaskAdd; PlanListView.OnItemClicked = OnTaskClicked; EventListener.Get(ShowComplatedTask.gameObject).onClick = ShowComplatedTaskClicked; UserSearch = this.GetPar <EUserSearch>(0); if (UserSearch != null) { PageTitle.Init(UserSearch.Name, App.Instance.Theme.TitleBgColor, App.Instance.Theme.TitleFontColor, null, MenuClicked); PageTitle.AddButton("", App.Instance.ImageManger.ImageList[0], TaskSearch); BindData(); } else { UserSearch_Service.GetDefault(t => { UserSearch = t.GetData() as EUserSearch; if (UserSearch == null) { PageTitle.Init("全部任务", App.Instance.Theme.TitleBgColor, App.Instance.Theme.TitleFontColor, null, MenuClicked); } else { PageTitle.Init(UserSearch.Name, App.Instance.Theme.TitleBgColor, App.Instance.Theme.TitleFontColor, null, MenuClicked); } PageTitle.AddButton("", App.Instance.ImageManger.ImageList[0], TaskSearch); BindData(); }); } }
void OnItemClicked(GameObject g) { string idstr = g.name.Split('_')[1]; UserSearch_Service.GetByID(int.Parse(idstr), c => { EUserSearch uSearch = c.GetData() as EUserSearch; App.Instance.PageGroup.ShowPage("Page_Task", true, uSearch); }); }
protected override void Init() { base.Init(); Step = 1; NewSearch = new EUserSearch() { UserID = Session.UserID }; PageTitle.Init("创建查询", Color.gray, App.Instance.Theme.TitleFontColor, BtnBack); EventListener.Get(PreBtn.gameObject).onClick = OnPreBtnClicked; EventListener.Get(NextBtn.gameObject).onClick = OnNextBtnClicked; EventListener.Get(SubmitBtn.gameObject).onClick = OnSubmitBtnClicked; BindStep(); }
private void InitUser(EUser user) { EProject defaultProject = new EProject() { Name = "默认项目", CreateTime = DateTime.Now, CreaterID = user.ID }; defaultProject = ProjectController.CreateProject(defaultProject, user.ID); EPlan defaultPlan = new EPlan() { ProjectID = defaultProject.ID, Name = "默认计划", BeginTime = DateTime.Now, EndTime = DateTime.Now }; defaultPlan = (EPlan)DBBase.Create(defaultPlan); EUserSearch userSearch = new EUserSearch() { IsDefault = true, Name = "默认项目计划", UserID = user.ID, ProjectID = defaultPlan.ProjectID, PlanID = defaultPlan.ID }; DBBase.Create(userSearch); }