private StackLayout GenerateLessonStack(StudyHour studyLesson) { var day = DateTime.Now.DayOfWeek; var span = new FormattedString(); span.Spans.Add(new Span { Text = ClassTypeEnums.ToFriendlyShortString(studyLesson.Lesson.Type) + "\t", FontSize = 10 }); span.Spans.Add(new Span { Text = "s. " + studyLesson.Lesson.Classroom, FontSize = 8 }); var lessonStack = new StackLayout() { Spacing = 1 }; if (studyLesson.Lesson.Day == day) { lessonStack.BackgroundColor = todayCellColor; } else { lessonStack.BackgroundColor = cellColor; } if (!isOffline) { lessonStack.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(() => ExecuteShowPlan(studyLesson.Lesson.Course, lessonStack)) }); } lessonStack.Children.Add(new Label() { Text = studyLesson.Lesson.Course.Name, FontSize = 12, FontAttributes = FontAttributes.Bold, TextColor = Color.White }); lessonStack.Children.Add(new Label() { FormattedText = span, VerticalTextAlignment = TextAlignment.End, TextColor = Color.White }); return(lessonStack); }
public ApiResult GetAllTableTypeFlow(ClassTypeEnums ClassType) { return(new FlowBLL().GetAllTableTypeFlow(ClassType)); }
public ApiResult GetFullTableList(ClassTypeEnums ClassType) { return(new BaseBLL().GetFullTableList(ClassType)); }
public ApiResult GetFullTableList(ClassTypeEnums ClassType) { ApiResult result = new ApiResult(); string message = string.Empty; try { List <object> returnlist = new List <object>(); using (FLDbContext db = new FLDbContext()) { List <Flow> FlowList = db.Flow.ToList(); List <BaseDateFlow> BaseDateFlowList = db.BaseDateFlow.Where(t => t.ClassType == ClassType).OrderBy(t => t.FlowID).ToList(); List <FullFlowList> FullFlowList = new List <FullFlowList>(); foreach (BaseDateFlow BaseDateFlow in BaseDateFlowList) { var userlist = from user in db.SysUser join userrole in db.UserRole on user.ID equals userrole.UserID join baseflowrole in db.BaseFlowRole on userrole.RoleID equals baseflowrole.RoleID where user.IsAccountDisabled != true && baseflowrole.FlowID == BaseDateFlow.FlowID select new { user.RealName, UserID = user.ID, //FlowName = flow.Name }; FullFlowList.Add(new FullFlowList { FlowID = BaseDateFlow.FlowID, FlowName = FlowList.FirstOrDefault(t => t.ID == BaseDateFlow.FlowID).Name, TableType = BaseDateFlow.TableType, UserList = userlist.ToList(), BeginDate = BaseDateFlow.BeginDate.ToString("HH:mm"), EndDate = BaseDateFlow.EndDate.ToString("HH:mm"), RemindDate = BaseDateFlow.RemindDate.ToString("HH:mm"), }); } FullFlowList = FullFlowList.Where(t => t.TableType == TableTypeEnums.切削液浓度点检表).ToList(); foreach (TableTypeEnums TableType in Enum.GetValues(typeof(TableTypeEnums))) { returnlist.Add(new { Name = Enum.GetName(typeof(TableTypeEnums), TableType), ID = TableType, FullFlowList = FullFlowList.Where(t => t.TableType == TableType).ToList() }); } } result = ApiResult.NewSuccessJson(returnlist); } catch { result = ApiResult.NewErrorJson("请检查网络状态或联系系统管理员"); } if (!string.IsNullOrEmpty(message)) { result = ApiResult.NewErrorJson(message); } return(result); }
public void TestMethod1() { try { using (IFMPDBContext db = new IFMPDBContext()) { int BaseClass = 5; int adddays = 1; ClassTypeEnums ClassType = ClassTypeEnums.早班; List <TableType> TableTypeList = db.TableType.Where(t => t.IsDel != true).ToList(); List <Flow> FlowList = db.Flow.ToList(); FlowList = FlowList.Where(t => TableTypeList.Select(m => m.ID).Contains(t.TableTypeID)).ToList(); List <BaseClassUser> BaseClassUserList = db.BaseClassUser.ToList(); List <BaseDateFlow> BaseDateFlowList = db.BaseDateFlow.ToList(); //TASK 添加 foreach (TableType TableType in TableTypeList) { Task Task = new Task(); Task.ClassType = ClassType; Task.CreateDate = DateTime.Now; Task.CreateUserID = 290; Task.IsDel = false; Task.TableTypeID = TableType.ID; Task.TaskName = DateTime.Now.AddDays(adddays).ToString("MM-dd") + Enum.GetName(typeof(ClassTypeEnums), Task.ClassType) + TableType.Name; db.Task.Add(Task); db.SaveChanges(); List <Flow> SelFlowList = FlowList.Where(t => t.TableTypeID == TableType.ID).ToList(); foreach (Flow SelFlow in SelFlowList) { List <BaseClassUser> SelBaseClassUserList = BaseClassUserList.Where(t => t.FlowID == SelFlow.ID && t.BaseClassID == BaseClass).ToList(); BaseDateFlow BaseDateFlow = BaseDateFlowList.FirstOrDefault(t => t.ClassType == ClassType && t.FlowID == SelFlow.ID); foreach (BaseClassUser SelBaseClassUser in SelBaseClassUserList) { TaskFlow TaskFlow = new TaskFlow(); //TaskFlow. TaskFlow.ApplyType = ApplyTypeEnums.未交; TaskFlow.BaseClassID = SelBaseClassUser.BaseClassID; TaskFlow.BeginDate = new BaseUtils().GetTodayDate(DateTime.Now.AddDays(adddays), BaseDateFlow.BeginDate); TaskFlow.EndDate = new BaseUtils().GetTodayDate(DateTime.Now.AddDays(adddays), BaseDateFlow.EndDate); if (TaskFlow.EndDate < TaskFlow.BeginDate) { TaskFlow.EndDate = TaskFlow.EndDate.AddDays(1); } TaskFlow.FlowID = SelFlow.ID; TaskFlow.IsReminded = false; TaskFlow.TaskID = Task.ID; TaskFlow.RemindDate = new BaseUtils().GetTodayDate(DateTime.Now.AddDays(adddays), BaseDateFlow.RemindDate); if (TaskFlow.RemindDate < TaskFlow.BeginDate) { TaskFlow.RemindDate = TaskFlow.RemindDate.AddDays(1); } TaskFlow.UserID = SelBaseClassUser.UserID; db.TaskFlow.Add(TaskFlow); } } db.SaveChanges(); } //List<User> UserList = db.User.Where(t=>); //BaseUtils test = new BaseUtils(); //bool result = test.GetRegex("23.7°", RegexType.度数); //result = test.GetRegex("23.7", RegexType.度数); //result = test.GetRegex("我°", RegexType.度数); //result = test.GetRegex("°", RegexType.度数); //result = test.GetRegex("23.7°°", RegexType.度数); //List<BaseDateFlow> BaseDateFlowList = db.BaseDateFlow.Where(t => t.FlowID > 107 && t.FlowID < 118).ToList(); //foreach (BaseDateFlow BaseDateFlow in BaseDateFlowList) //{ // BaseDateFlow newdata = new BaseDateFlow(); // BaseUtils.DeepCopy(newdata, BaseDateFlow); // if (BaseDateFlow.FlowID != 117) // { // newdata.FlowID = (newdata.FlowID + 24) > 137 ? (newdata.FlowID + 25) : (newdata.FlowID + 24); // } // else // { // newdata.FlowID = 140; // } // newdata.TableTypeID = 20; // db.BaseDateFlow.Add(newdata); //} //db.SaveChanges(); //List<TableColumn> TableColumnList = db.TableColumn.Where(t => t.TableTypeID == 4).ToList(); //foreach (TableColumn TableColumn in TableColumnList) //{ // TableColumn NewTableColumn = new TableColumn(); // BaseUtils.DeepCopy(NewTableColumn, TableColumn); // NewTableColumn.TableTypeID = 23; // db.TableColumn.Add(NewTableColumn); //} //db.SaveChanges(); //List<Flow> FlowList = db.Flow.Where(t => t.TableTypeID == 17).ToList(); //foreach (Flow Flow in FlowList) //{ // Flow NewFlow = new Flow(); // BaseUtils.DeepCopy(NewFlow, Flow); // NewFlow.TableTypeID = 20; // db.Flow.Add(NewFlow); //} //db.SaveChanges(); //flow 43-47删除 //DDUtils test = new DDUtils(); //test.NewPostFile(); //TaskNotice(); } } catch { } }