public List <AllStatus> GetAllStatus() { //string connectionString = @"Data Source=DESKTOP-AGFJ699\SQLSERVER;Initial Catalog=BitBook;Integrated Security=true"; // write insert command SqlConnection connection = new SqlConnection(connectionString); //string query = "select UserAccount.FirstNale,Profile.Status from UserAccount join Profile ON Profile.UserId=UserAccount.UserId"; //string query = "select UserAccount.UserId,UserAccount.FirstNale,Profile.Status from UserAccount join Profile ON Profile.UserId=UserAccount.UserId"; string query = "select DISTINCT UserAccount.UserId,UserAccount.FirstNale,Profile.Status from UserAccount join Profile ON Profile.UserId=UserAccount.UserId join Friend ON Profile.UserId=Friend.UserId where temp='" + 2 + "'"; SqlCommand command = new SqlCommand(query, connection); List <AllStatus> statuslist = new List <AllStatus>(); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { AllStatus aStatus = new AllStatus(); //aStatus.StatusId = Convert.ToInt32(reader["StatusId"].ToString()); aStatus.UserName = reader["FirstNale"].ToString(); aStatus.Status = reader["Status"].ToString(); aStatus.UserId = Convert.ToInt32(reader["UserId"].ToString()); statuslist.Add(aStatus); } connection.Close(); return(statuslist); }
protected override void SetSelectedModel() { try { if (Models != null) { Model = Models.CurrentItem as Period; UpdateViewState(Edit.Mode.Editing); } if (Model != null) { if (AllStatus != null) { ObservableCollection <Status> status = (ObservableCollection <Status>)AllStatus.SourceCollection; if (status != null) { Status selectedStatus = status.Where(s => s.Name == Model.Status.Name).SingleOrDefault(); if (selectedStatus != null) { AllStatus.MoveCurrentTo(selectedStatus); } } } if (Types != null) { ObservableCollection <PeriodType> periodTypes = (ObservableCollection <PeriodType>)Types.SourceCollection; if (periodTypes != null) { PeriodType selectedType = periodTypes.Where(p => p.Id == Model.Type.Id).SingleOrDefault(); if (selectedType != null) { Types.MoveCurrentTo(selectedType); } } } if (Years != null) { ObservableCollection <Value> years = (ObservableCollection <Value>)Years.SourceCollection; if (years != null) { Value selectedYear = years.Where(y => y.Id == Model.Year).SingleOrDefault(); if (selectedYear != null) { Years.MoveCurrentTo(selectedYear); } } } } } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
//返回主画面Json_AllStatus public JsonResult DRAQ127_AllStatus(string DeviceId) { ViewBag.DeviceId = DeviceId; String str = "select * from RealTimePlantData where LineID='" + DeviceId + "'"; AllStatus list = db.DeviceAllStatus(str); return(Json(new { msg = "success", data = list }, JsonRequestBehavior.AllowGet)); }
protected override void InitState() { AllStatus.Add(ActorStateType.Attack, new AttackState()); AllStatus.Add(ActorStateType.Idle, new IdleState()); AllStatus.Add(ActorStateType.Outro, new OutroState()); CurrentState = new IdleState(); StatusTurns.Add(ActorStateType.Idle, new List <ActorStateType>()); StatusTurns[ActorStateType.Idle].Add(ActorStateType.Attack); StatusTurns.Add(ActorStateType.Attack, new List <ActorStateType>()); StatusTurns[ActorStateType.Attack].Add(ActorStateType.Idle); }