public IList <TrainType> GetTrainStandardTypeInfo(int postID, int flag) { IList <TrainType> trainTypeList = new List <TrainType>(); Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "USP_TRAIN_TYPE_G"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "p_traintype_id", DbType.Int32, 0); db.AddInParameter(dbCommand, "p_post_id", DbType.Int32, postID); db.AddInParameter(dbCommand, "p_flag", DbType.Int32, flag); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { TrainType trainType = CreateModelObject(dataReader); trainTypeList.Add(trainType); } } return(trainTypeList); }
private void BindGrid2() { CoursewareBLL coursewareBLL = new CoursewareBLL(); IList <RailExam.Model.Courseware> coursewareList = new List <RailExam.Model.Courseware>(); if (!string.IsNullOrEmpty(Request.QueryString.Get("id"))) { TrainTypeBLL trainTypeBLL = new TrainTypeBLL(); TrainType trainType = trainTypeBLL.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainAimID"].ToString())); coursewareList = coursewareBLL.GetCoursewaresByTrainTypeIDPath(trainType.IDPath, 1); } else { coursewareList = coursewareBLL.GetCoursewaresByCoursewareTypeOnline(PrjPub.CurrentLoginUser.StationOrgID, Convert.ToInt32(ViewState["TrainAimID"].ToString()), "%", true, 5); } if (coursewareList.Count > 0) { foreach (RailExam.Model.Courseware courseware in coursewareList) { if (courseware.CoursewareName.Length <= 15) { courseware.CoursewareName = "<a onclick=EditCourseware(" + courseware.CoursewareID + ") href=# title=" + courseware.CoursewareName + " > " + courseware.CoursewareName + " </a>"; } else { courseware.CoursewareName = "<a onclick=EditCourseware(" + courseware.CoursewareID + ") href=# title=" + courseware.CoursewareName + " > " + courseware.CoursewareName.Substring(0, 15) + "..." + " </a>"; } } gvCourse.DataSource = coursewareList; gvCourse.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { TrainEmployeeBLL objTrainEmployeeBll = new TrainEmployeeBLL(); string str = Request.QueryString.Get("id"); if (str != null && str != "") { ViewState["TrainTypeID"] = str; } else { if (PrjPub.StudentID == null) { Response.Write("<script>alert('已超时,请注销后重新登录!');window.close();</script>"); return; } ViewState["TrainTypeID"] = objTrainEmployeeBll.GetTrainEmployeeByEmployeeID(PrjPub.CurrentStudent.EmployeeID).TrainTypeID.ToString(); } if (ViewState["TrainTypeID"].ToString() == "0") { Response.Write("<script>alert('请选择培训类别!');window.close();</script>"); return; } TrainTypeBLL objTrainTypeBll = new TrainTypeBLL(); TrainType objTrainType = objTrainTypeBll.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainTypeID"].ToString())); lblDescription.Text = objTrainType.Description; lblMemo.Text = objTrainType.Memo; BindGrid1(); BindGrid2(); }
public ActionResult Create([Bind(Include = "Id,Name,Capacity,IsActive")] TrainType trainType, List <TrainTypeTravelClass> trainTypeTravelClasses) { if (ModelState.IsValid) { //check capacity if (trainTypeTravelClasses != null) { int travelClassesCount = trainTypeTravelClasses.Sum(x => x.NumberOfSeats).Value; if (travelClassesCount > trainType.Capacity) { ModelState.AddModelError("Capacity", "The sum of travel class seats should not exceed the capacity"); var travelClasses = db.TravelClasses.AsEnumerable <TravelClass>(); ViewBag.TravelClasses = travelClasses; return(View(trainType)); } } db.TrainTypes.Add(trainType); db.SaveChanges(); //Set TrainTypeId in trainTypeTravelClasses foreach (var item in trainTypeTravelClasses) { item.TrainTypeId = trainType.Id; } db.TrainTypeTravelClasses.AddRange(trainTypeTravelClasses); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(trainType)); }
public static void AssertDefaultTrains(this Opt testSubject, TrainType trainType, TrainAlgo trainAlgo) { AssertDefaults(testSubject); testSubject.Mode.Should().Be((int)OptMode.Train); testSubject.Type.Should().Be(trainType.GetDescription()); testSubject.Algo.Should().Be(trainAlgo.GetDescription()); }
public PartialViewResult GetScheduleTravelClassEdit(Schedule schedule) { TrainType trainType = schedule.TrainType; ViewBag.ScheduleTravelClasses = schedule.ScheduleTravelClasses.AsEnumerable(); return(PartialView("_ScheduleTravelClassEdit", trainType)); }
/// <param name="origin">API response that was processed to make this statement</param> /// <param name="id">Identifies the train</param> /// <param name="from">Identifies the train</param> /// <param name="to">Station the train arrives to</param> /// <param name="type">Type of the train on this subrelation</param> public TrainSubrelationStatement(APIResponse origin, TrainIdStatement id, StationIdStatement from, StationIdStatement to, TrainType type) : base(origin) { Id = id; From = from; To = to; Type = type; }
public ActionResult DeleteConfirmed(int id) { TrainType trainType = db.TrainTypes.Find(id); //db.TrainTypes.Remove(trainType); db.Entry(trainType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
private void BeginTrain(TrainItem[] trainItems, int group, int wordsCount, TrainType type) { this.trainItems = trainItems; this.group = group; this.wordsCount = wordsCount; this.type = type; index = 0; state = TrainState.Training; }
public ActionResult Edit([Bind(Include = "Id,Name,Capacity,IsActive")] TrainType trainType) { if (ModelState.IsValid) { db.Entry(trainType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(trainType)); }
public ExerciseTypeStepanovAndRecentMemory(TrainType locType) { if (locType != TrainType.RecentMemory && locType != TrainType.Stepanov) { this.type = TrainType.None; } else { this.type = locType; } }
public TrainerCPU(TrainType trainType, IOptimizer optimizer) { TrainOptimizer = optimizer; RandomSeed = 12; TrainTypeSetting = trainType; BatchSize = batchSize; random = new Random(RandomSeed); L1Regularization = 0; L2Regularization = 0; }
public TrainerCPU(TrainType trainType) { TrainOptimizer = new Optimizers.RMSProp(); RandomSeed = 12; TrainTypeSetting = trainType; BatchSize = batchSize; random = new Random(RandomSeed); L1Regularization = 0; L2Regularization = 0; }
// Trains public void SteamTrainPressed() { if (trainSelected != TrainType.Steam || !isTrain) { hidePrevious(); isBuilding = false; isTrack = false; } trainSelected = TrainType.Steam; isTrain = true; currentlyBuilding = true; }
private bool _trainStatShared(short id, TrainType type) { if (!m_client.ConnectedAndInitialized || !Initialized) { return(false); } Packet pkt = new Packet(PacketFamily.StatSkill, PacketAction.Add); pkt.AddChar((byte)type); pkt.AddShort(id); return(m_client.SendPacket(pkt)); }
// GET: TrainTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TrainType trainType = db.TrainTypes.Find(id); if (trainType == null) { return(HttpNotFound()); } return(View(trainType)); }
public Vlak(string cisloVlaku, TrainType typ, JizdniRad cesta, string kolej, string nastupiste, Company drazniFirma, string aktualniStanice, string nazev) { cislo = cisloVlaku; druh = typ; jizda = cesta; kolejVlaku = kolej; nastupisteVlaku = nastupiste; firma = drazniFirma; if (cilVlaku == null) { cilVlaku = jizda.trasa[jizda.trasa.Length - 1]; } cas = cesta.casy[aktualniStanice].casOdjezdu; nazevVlaku = nazev; }
public Train(GameWorld world, TrainSpawn trainSpawn) { this.world = world; this.tile = world.GetTile(trainSpawn.X, trainSpawn.Y) ?? throw new Exception($"Train at invalid position: [{trainSpawn.X}, {trainSpawn.Y}]"); this.spawnTile = tile; this.progressInsideTile = 0.5f; this.direction = trainSpawn.Direction; this.tileEnterDirection = direction.Opposite(); this.positionHistory = new PositionStateHistory(1000, GetSnapshot()); this.type = trainSpawn.Type; this.color = trainSpawn.Color; this.cars = trainSpawn.InitialCars; this.initialCars = this.cars; this.speed = trainSpawn.Type.GetSpeed(); }
protected void tvTrainTypeChangeCallBack_Callback(object sender, CallBackEventArgs e) { TrainTypeBLL objTrainType = new TrainTypeBLL(); TrainType traintype = objTrainType.GetTrainTypeInfo(int.Parse(e.Parameters[0])); int cout = traintype.ParentID == 0 ? tvTrainType.Nodes.Count : tvTrainType.FindNodeById(traintype.ParentID.ToString()).Nodes.Count; if (e.Parameters[1] == "MoveUp") { if (traintype.OrderIndex <= cout && traintype.OrderIndex >= 2) { traintype.OrderIndex--; objTrainType.UpdateTrainType(traintype); traintype = objTrainType.GetTrainTypeInfo(int.Parse(tvTrainType.FindNodeById(e.Parameters[0]).PreviousSibling.ID)); traintype.OrderIndex++; objTrainType.UpdateTrainType(traintype); } } if (e.Parameters[1] == "MoveDown") { if (traintype.OrderIndex <= cout - 1 && traintype.OrderIndex >= 1) { traintype.OrderIndex++; objTrainType.UpdateTrainType(traintype); traintype = objTrainType.GetTrainTypeInfo(int.Parse(tvTrainType.FindNodeById(e.Parameters[0]).NextSibling.ID)); traintype.OrderIndex--; objTrainType.UpdateTrainType(traintype); } } if (e.Parameters[1] == "Insert") { IList <RailExam.Model.TrainType> objList = objTrainType.GetTrainTypeByWhereClause("1=1", "Train_Type_ID desc"); hfMaxID.Value = objList[0].TrainTypeID.ToString(); hfMaxID.RenderControl(e.Output); } else if (e.Parameters[1] == "Delete") { hfMaxID.Value = e.Parameters[2]; hfMaxID.RenderControl(e.Output); } tvTrainType.Nodes.Clear(); BindTrainTypeTree(); tvTrainType.RenderControl(e.Output); }
/// <summary> /// Initializes a new instance of <see cref="MetroLinkDetails"/> /// </summary> /// <param name="lineEndTime">line end time</param> /// <param name="lineStartTime">line start time</param> /// <param name="trainType">Train type</param> /// <param name="lineImage">line image</param> /// <param name="name">Line name</param> /// <param name="destinationStation">Destination station</param> /// <param name="sourceStation">Source station</param> /// <param name="saturdayService">Saturday service</param> /// <param name="sundayService">Sunday service</param> /// <param name="yearOfOperation">Year of Operation</param> public MetroLinkDetails(DateTime lineEndTime, DateTime lineStartTime, TrainType trainType, LineImage lineImage, string name, string destinationStation, string sourceStation, bool saturdayService, bool sundayService, int yearOfOperation) : base(name, destinationStation, sourceStation, saturdayService, sundayService, yearOfOperation) { LineEndTime = lineEndTime; LineImage = lineImage; TrainType = trainType; LineStartTime = lineStartTime; }
public ExerciseAttempt(TrainType type, DateTime dateStart, double time, bool autoCheck, string question, string answer, bool answerIsRight, string userAnswer) { this.type = type; this.DateStart = dateStart; this.Time = time; this.AutoAnswerCheck = autoCheck; this.Question = question; this.Answer = answer; this.answerIsRight = answerIsRight; if (!answerIsRight) { this.UserAnswer = userAnswer; } }
public IList <TrainType> GetTrainTypeInfo(int trainTypeID, int parentID, int levelNum, string iDPath, int orderIndex, string typeName, string description, bool isTemplate, bool isPromotion, string Memo, int startRowIndex, int maximumRows, string orderBy) { IList <TrainType> trainTypeList = new List <TrainType>(); Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "USP_TRAIN_TYPE_S"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); if (isTemplate == true) { db.AddInParameter(dbCommand, "p_is_template", DbType.Int32, 1); } if (parentID != 0) { db.AddInParameter(dbCommand, "p_parent_id", DbType.Int32, parentID); } db.AddInParameter(dbCommand, "p_start_row_index", DbType.Int32, startRowIndex); db.AddInParameter(dbCommand, "p_page_size", DbType.Int32, maximumRows); db.AddInParameter(dbCommand, "p_order_by", DbType.String, GetMappingOrderBy(orderBy)); db.AddOutParameter(dbCommand, "p_count", DbType.Int32, 4); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { TrainType trainType = CreateModelObject(dataReader); trainTypeList.Add(trainType); } } return(trainTypeList); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (PrjPub.CurrentLoginUser == null) { Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!"); return; } if (!string.IsNullOrEmpty(Request.QueryString.Get("id"))) { ViewState["TrainAimID"] = Request.QueryString.Get("id"); TrainTypeBLL trainTypeBLL = new TrainTypeBLL(); TrainType trainType = trainTypeBLL.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainAimID"].ToString())); lblDescription.Text = trainType.Description; lblMemo.Text = trainType.Memo; } else { ViewState["TrainAimID"] = Request.QueryString.Get("id1"); PostBLL postBll = new PostBLL(); Post post = postBll.GetPost(Convert.ToInt32(ViewState["TrainAimID"].ToString())); lblDescription.Text = post.Description; lblMemo.Text = post.Memo; } BindGrid1(); BindGrid2(); } string strRefresh = Request.Form.Get("Refresh"); if (!string.IsNullOrEmpty(strRefresh)) { BindGrid1(); BindGrid2(); } //string strDeleteID = Request.Form.Get("DeleteID"); //if (strDeleteID != null & strDeleteID != "") //{ // DeleteExercise(strDeleteID); // BindGrid1(); // BindGrid2(); //} }
/// <summary> /// Инструмент обучения. /// </summary> /// <param name="dataSet">Обучающая выборка.</param> /// <param name="trainType">Тип обучения.</param> /// <param name="hyperParameters">Гиперпараметры.</param> /// <param name="topology">Топология сети.</param> public TrainUtil(DataSet dataSet, TrainType trainType, HyperParameters hyperParameters, Topology topology) { if (!trainType.Equals(TrainType.Backpropagation)) { throw new NotImplementedException(); } if (!topology.IsClosed) { throw new Exception("Топология сети не замкнута! Обучение невозможно!"); } _trainType = trainType; _dataSet = dataSet; _hyperParameters = hyperParameters; _topology = topology; }
/// <summary> /// Создание экземпляра попытки по XmlNode. /// </summary> /// <param name="xmlNode"></param> /// <returns></returns> public static ExerciseAttempt CreateFromXml(XmlNode xmlNode) { ExerciseAttempt result = new ExerciseAttempt(); XmlAttribute attr; attr = xmlNode.Attributes[xmlFieldTrainType]; if (attr != null && !string.IsNullOrEmpty(attr.Value)) { TrainType type = (TrainType)Enum.Parse(typeof(TrainType), attr.Value); switch (type) { case TrainType.Date: result = new ExerciseAttemptDate(); break; case TrainType.NetTrain: result = new ExerciseAttemptNetTrain(); break; case TrainType.ConsecutiveAssociations: result = new ExerciseAttemptAssociationsСonsecutive(); break; case TrainType.NumberAssociations: result = new ExerciseAttemptAssociationsNumber(); break; case TrainType.AssociationsPair: result = new ExerciseAttemptAssociationsPair(); break; default: result = new ExerciseAttempt(); break; } } result.LoadAttributesFromXml(xmlNode); return(result); }
public void AddSegement(bool[] trains, TrainType[] Types, bool[] CoinsValues, int [] bonus) { bool[] TrainsConfirmed = new bool[RoadLenght]; TrainType[] TypeConfirmed = new TrainType[RoadLenght]; bool[] CoinValueConfirmed = new bool[RoadLenght]; int[] BonusConfirmed = new int[RoadLenght]; for (int i = 0; i < RoadLenght; i++) { TrainsConfirmed[i] = trains[i]; TypeConfirmed[i] = Types[i]; CoinValueConfirmed[i] = CoinsValues[i]; BonusConfirmed[i] = bonus[i]; } TrainConfirmed.Add(TrainsConfirmed); trainTypes.Add(TypeConfirmed); CoinsConfirmed.Add(CoinValueConfirmed); this.BonusConfirmed.Add(BonusConfirmed); }
public IList <TrainType> GetTrainTypeByWhereClause(string whereClause, string orderby) { IList <TrainType> trainTypeList = new List <TrainType>(); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("USP_TrainType_WhereClause"); db.AddInParameter(dbCommand, "p_sql", DbType.String, whereClause); db.AddInParameter(dbCommand, "p_order_by", DbType.String, orderby); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { TrainType trainType = CreateModelObject(dataReader); trainTypeList.Add(trainType); } } return(trainTypeList); }
public IList <TrainType> GetTrainTypes() { IList <TrainType> trainTypeList = new List <TrainType>(); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("USP_GET_ALL"); db.AddInParameter(dbCommand, "p_table_name", DbType.String, "TRAIN_TYPE"); db.AddInParameter(dbCommand, "p_order_by", DbType.String, "LEVEL_NUM, ORDER_INDEX ASC"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { TrainType trainType = CreateModelObject(dataReader); trainTypeList.Add(trainType); } } return(trainTypeList); }
private string GetTrainTypeNames(string strName, int nID) { string strTrainTypeName = string.Empty; if (nID != 0) { TrainTypeDAL trainTypeDAL = new TrainTypeDAL(); TrainType trainType = trainTypeDAL.GetTrainTypeInfo(nID); if (trainType.ParentID != 0) { strTrainTypeName = GetTrainTypeNames("/" + trainType.TypeName, trainType.ParentID) + strName; } else { strTrainTypeName = trainType.TypeName + strName; } } return(strTrainTypeName); }
private string GetType(string strName, int nID) { string str = ""; if (nID != 0) { TrainTypeBLL objTrainTypeBll = new TrainTypeBLL(); TrainType objTrainType = objTrainTypeBll.GetTrainTypeInfo(nID); if (objTrainType.ParentID != 0) { str = GetType(" - " + objTrainType.TypeName, objTrainType.ParentID) + strName; } else { str = objTrainType.TypeName + strName; } } return(str); }
public Train(TrainType type) { Type = type; }
private bool _trainStatShared(short id, TrainType type) { if (!m_client.ConnectedAndInitialized || !Initialized) return false; Packet pkt = new Packet(PacketFamily.StatSkill, PacketAction.Add); pkt.AddChar((byte)type); pkt.AddShort(id); return m_client.SendPacket(pkt); }