public static void SetGridDefault(Feng.Windows.Forms.MyTemplateForm mainForm, Feng.Grid.DataUnboundGrid grid) { grid.GetColumnManageRow().AllowColumnReorder = false; grid.SelectionMode = System.Windows.Forms.SelectionMode.One; grid.SelectionBackColor = System.Drawing.Color.LightSkyBlue; grid.GetColumnManageRow().ShowFixedColumnSplitter = Xceed.Grid.ShowFixedColumnSplitter.WhenFixedColumnsExist; grid.DisplayManager.SearchManager.EnablePage = false; mainForm.EnableInvalidateAfterSearch(grid.DisplayManager.SearchManager, grid); mainForm.EnableSearchProgressForm(grid.DisplayManager.SearchManager); grid.SingleClickEdit = true; }
/// <summary> /// /// </summary> /// <param name="languageName"></param> public ScriptForm(Feng.Scripts.Host host) { InitializeComponent(); 打开OToolStripButton.Image = Feng.Windows.ImageResource.Get("Feng", "Icons.Document.Open.png").Reference; 保存SToolStripButton.Image = Feng.Windows.ImageResource.Get("Feng", "Icons.Document.Save.png").Reference; 复制CToolStripButton.Image = Feng.Windows.ImageResource.Get("Feng", "Icons.Document.Copy.png").Reference; 粘贴PToolStripButton.Image = Feng.Windows.ImageResource.Get("Feng", "Icons.Document.Paste.png").Reference; this.txtScript.KeyDown += new System.Windows.Forms.KeyEventHandler(this.richTextBox1_KeyDown); this.txtScript.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress); txtScript.BackColor = _backColor; txtScript.ForeColor = _inputColor; txtScript.ShortcutsEnabled = true; m_host = host; _history = new CommandHistory(); ResetConsole(); m_host.Scope.SetVariable("scriptTextBox", this.txtScript); m_host.Runtime.Globals.SetVariable("prompt", PromptString); }
private static void SimulateMt(WekaEA2 ea, DateTime startDate, DateTime endDate, Feng.Data.DbHelper dbHelper) { long minTime = WekaUtils.GetTimeFromDate(startDate); long maxTime = WekaUtils.GetTimeFromDate(endDate); var dtD1 = dbHelper.ExecuteDataTable(string.Format("SELECT * FROM {0}_{3} WHERE TIME >= {1} AND TIME < {2} ORDER BY TIME", ea.m_symbol, minTime, maxTime, TestParameters2.CandidateParameter.MainPeriod)); var dtM1 = dbHelper.ExecuteDataTable(string.Format("SELECT * FROM {0}_M1 WHERE TIME >= {1} AND TIME < {2} ORDER BY TIME", ea.m_symbol, minTime, maxTime)); int idxD1 = 0; double[] pp = new double[TestParameters.CandidateParameter4Db.AllIndNames.Count + 6 + 5]; for (int i = 0; i < dtM1.Rows.Count; ++i) { long nowTime = (long)dtM1.Rows[i]["Time"]; FillPp(pp, dtM1.Rows[i]); ea.OnNewBar(nowTime, 60, pp); if (idxD1 >= dtD1.Rows.Count) break; long nowD1Time = (long)dtD1.Rows[idxD1]["Time"]; if (nowTime >= nowD1Time) { FillPp(pp, dtD1.Rows[idxD1]); ea.OnNewBar(nowD1Time, (int)(TestParameters2.MainPeriodOfHour * 60 * 60), pp); idxD1++; } } }
void DisplayManager_PositionChanging(object sender, Feng.CancelEventArgs e) { e.Cancel = !m_cm.TryCancelEdit(); }
public override void PreparingOperate(Feng.OperateArgs e) { if (string.IsNullOrEmpty(this.编号)) { this.编号 = PrimaryMaxIdGenerator.GetMaxId("财务_调节款", "编号", 8, PrimaryMaxIdGenerator.GetIdYearMonth()).ToString(); } }
private void SaveGpsData(Feng.IRepository rep, TrackPoint entity) { if (rep == null) { s_trackPointDao.Save(entity); } else { s_trackPointDao.Save(rep, entity); } }
////[WebMethod()] //public Track StartRecording(string gpsId, DateTime startTime) //{ // Logger.Info(string.Format("{0} StartRecording at {1}", gpsId, startTime)); // vehicleName = ProcessVehicleName(vehicleName); // using (Feng.IRepository rep = new Feng.NH.Repository("zkzx.model.config")) // { // try // { // rep.BeginTransaction(); // var track = GetNowTrack(gpsId, startTime, true, rep); // rep.CommitTransaction(); // return track; // } // catch (Exception) // { // rep.RollbackTransaction(); // return null; // } // } //} private static IList<Track> GetTracksFromGpsId(string gpsId, Feng.IRepository rep) { var tracks = rep.List<Feng.Track>("from Track g where g.VehicleName = :gpsId and EndTime is null and StartTime is not null order by StartTime desc", new Dictionary<string, object> { { "gpsId", gpsId } }); return tracks; }
private static Track GetNowTrack(Feng.IRepository rep, string gpsId, System.DateTime nowTime, bool newTrack) { //if (Math.Abs((nowTime - System.DateTime.Now).TotalHours) > 1) // return null; IList<Track> tracks = GetTracksFromGpsId(gpsId, rep); Track nowTrack = null; bool existTrack = false; for (int i = 0; i < tracks.Count - 1; ++i) { var lastTrackPoint = TrackPointDao.GetLastestTrackPoint(tracks[i]); DateTime useDate; if (lastTrackPoint != null) useDate = lastTrackPoint.GpsTime; else useDate = System.DateTime.Now; if (i == 0)// && Math.Abs((nowTime - useDate).TotalHours) < 12) { nowTrack = tracks[i]; existTrack = true; Logger.Warn(string.Format("Use exist track of {0}", tracks[i].ID)); } else { tracks[i].EndTime = useDate; s_trackDao.Update(rep, tracks[i]); Logger.Warn(string.Format("track {0} is ended because of new start", tracks[i].ID)); } } if (!existTrack && newTrack) { nowTrack = NewTrack(gpsId); nowTrack.StartTime = nowTime; s_trackDao.Save(rep, nowTrack); Logger.Info(string.Format("Start new track.")); } if (nowTrack == null) { Logger.Info("nowTrack is null!"); } return nowTrack; }