void Int_Overload_Should_Result_The_Same_As_Double_Overload() { double expectedDouble = Wilson.Score((double)8, (double)32); double expectedInt = Wilson.Score(8, 32); Assert.Equal(expectedInt, expectedDouble); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "目录名称"; e.CurrentHeadRow.Cells[1].Text = "编号"; e.CurrentHeadRow.Cells[2].Text = "操作"; e.CurrentHeadRow.Cells[0].ColSpan = 2; e.CurrentHeadRow.Cells[2].ColSpan = 3; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: e.CurrentBodyRow.Cells[0].ColSpan = 2; e.CurrentBodyRow.Cells[2].Text = "重命名"; e.CurrentBodyRow.Cells[2].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[2].Url = "../New.aspx?opt=update&SortType=5&Sort_ID=" + e.CurrentBodyRow.Cells[1].Text + "&url=Public/Admin_Index.aspx"; e.CurrentBodyRow.Cells[3].Text = "删除"; e.CurrentBodyRow.Cells[3].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[3].Url = "../Delete.aspx?Sort_ID=" + e.CurrentBodyRow.Cells[1].Text + "&url=Public/Admin_Index.aspx"; e.CurrentBodyRow.Cells[4].Text = "权限设置"; e.CurrentBodyRow.Cells[4].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[4].Url = "frm_SetUser.aspx?Sort_ID=" + e.CurrentBodyRow.Cells[1].Text; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.BodyBuilderEnd: break; } }
private Maze GetMaze(int width, int height, Algorithms algorithm) { switch (algorithm) { case Algorithms.AldousBroderAvoidLinks: return(AldousBroderAvoidLinks.Create(height, width)); case Algorithms.AldousBroder: return(AldousBroder.Create(height, width)); case Algorithms.AldousBroderWilson: return(AldousBroderWilson.Create(height, width)); case Algorithms.BinaryTree: return(BinaryTree.Create(height, width)); case Algorithms.Sidewinder: return(Sidewinder.Create(height, width)); case Algorithms.Wilson: return(Wilson.Create(height, width)); case Algorithms.WilsonJb: return(WilsonJb.Create(height, width)); } throw new Exception($"Cannot get maze for algorithm '{algorithm}'"); }
public GenerateLevel(int width, int height) { offsets = new Dictionary<Directions, Vector3>() { { Directions.NorthWest, new Vector3(-1, 1, 0) }, { Directions.NorthEast, new Vector3(1, 1, 0) }, { Directions.SouthWest, new Vector3(-1, -1, 0) }, { Directions.SouthEast, new Vector3(1, -1, 0) }, { Directions.North, new Vector3(0, 1, 0) }, { Directions.South, new Vector3(0, -1, 0) }, { Directions.West, new Vector3(-1, 0, 0) }, { Directions.East, new Vector3(1, 0, 0) } }; topFaceVectors = new Vector3[] { new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, -0.5f), new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(0.5f, 0.5f, -0.5f) }; faceVectors = new Dictionary<Directions, Vector3[]>() { { Directions.North, new Vector3[]{new Vector3(0.5f,0.5f,0.5f),new Vector3(-0.5f,0.5f,0.5f),new Vector3(0.5f,0.5f,-0.5f),new Vector3(-0.5f,0.5f,-0.5f)} }, { Directions.South, new Vector3[]{new Vector3(-0.5f,-0.5f,0.5f),new Vector3(0.5f,-0.5f,0.5f),new Vector3(-0.5f,-0.5f,-0.5f),new Vector3(0.5f,-0.5f,-0.5f)} }, { Directions.West, new Vector3[]{new Vector3(-0.5f,-0.5f,0.5f),new Vector3(-0.5f,-0.5f,-0.5f),new Vector3(-0.5f,0.5f,0.5f),new Vector3(-0.5f,0.5f,-0.5f)} }, { Directions.East, new Vector3[]{new Vector3(0.5f,-0.5f,-0.5f),new Vector3(0.5f,-0.5f,0.5f),new Vector3(0.5f,0.5f,-0.5f),new Vector3(0.5f,0.5f,0.5f)} } }; atlasMap = (Material)Resources.Load("Environment/Terrain", typeof(Material)); Wilson maze = new Wilson(width, height); CreateTreeFromMaze(maze.start); GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane); plane.transform.localScale = new Vector3(height * .3f, 1, width * .3f); plane.transform.position = new Vector3(height * 1.5f-1.5f, width * -1.5f+1.5f, 0.5f); plane.transform.rotation = Quaternion.Euler(270, 0, 0); plane.renderer.material = (Material)Resources.Load("Environment/Floor", typeof(Material)); }
protected void wdTab_Info_DataExporter(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsExporter e) { BindGridView(1, wdTab_Info.VirtualItemCount); e.Set_Worksheet_Caption.Caption = "按区域统计矿井信息"; e.Set_Worksheet_Caption.CaptionFontSize = 24; e.Set_WorksheetName = "按区域统计矿井信息"; }
protected void wdTab_Info_PageIndexChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsPage e) { if (e.PageIndex > int.Parse(HFPageIndex.Value)) { fillDgv("BlockAddress", e.PageSize, e.PageIndex, "", ""); HFPageIndex.Value = e.PageIndex.ToString(); } }
public void Alternative(IAppBuilder builder) { Assembly.Load("Nancy.ViewEngines.Spark"); builder .UseShowExceptions() .UseContentType() .Map("/wilson", Wilson.App()) .Map("/wilsonasync", Wilson.App(true)) // .UseCascade(DefaultPage.App()) .RunNancy(); }
private static void TimeOneAlgorithm() { long ms = 0; Enumerable.Range(0, 10).ForEach(n => { Stopwatch sw = Stopwatch.StartNew(); Maze maze = Wilson.Create(100, 100); sw.Stop(); Debug.WriteLine(sw.ElapsedMilliseconds); ms += sw.ElapsedMilliseconds; }); Debug.WriteLine("---"); Debug.WriteLine(ms / 10); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "编号"; e.CurrentHeadRow.Cells[1].Text = "标识卡编号"; e.CurrentHeadRow.Cells[2].Text = "姓名"; e.CurrentHeadRow.Cells[3].Text = "分站编号"; e.CurrentHeadRow.Cells[4].Text = "所在区域"; e.CurrentHeadRow.Cells[5].Text = "求救时间"; e.CurrentHeadRow.Cells[6].Text = "所在部门"; e.CurrentHeadRow.Cells[7].Text = "职务"; e.CurrentHeadRow.Cells[8].Text = "时长"; break; } }
public void AnotherAlternative(IAppBuilder builder) { Assembly.Load("Nancy.ViewEngines.Spark"); builder .UseFunc <AppFunc>(ShowExceptions.Middleware) .UseType <ContentType>() .Map("/wilson", Wilson.App()) .Map("/wilsonasync", Wilson.App(true)) .Use(NancyAdapter.App()); /* * .RunCascade( * DefaultPage.App(), * NancyAdapter.App()); */ }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "标识卡编号"; e.CurrentHeadRow.Cells[1].Text = "姓名"; e.CurrentHeadRow.Cells[2].Text = "部门"; e.CurrentHeadRow.Cells[3].Text = "电话"; e.CurrentHeadRow.Cells[4].Text = "检测时间"; e.CurrentHeadRow.Cells[5].Text = "井下位置"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: break; } }
public ActionResult Index() { List <PlayerViewModel> players = new List <PlayerViewModel>(); StockEngine engine = new YahooStockEngine(); // Chris Player player = new Chris(); Investment investment = engine.GetCurrentInvestmentForPlayer(player.Name); Quote quote = engine.GetCurrentQuoteForPlayer(player.Name); PlayerViewModel model = new PlayerViewModel(investment, quote, player); players.Add(model); // Fiona player = new Fiona(); investment = engine.GetCurrentInvestmentForPlayer(player.Name); quote = engine.GetCurrentQuoteForPlayer(player.Name); model = new PlayerViewModel(investment, quote, player); players.Add(model); // Wilson player = new Wilson(); investment = engine.GetCurrentInvestmentForPlayer(player.Name); quote = engine.GetCurrentQuoteForPlayer(player.Name); model = new PlayerViewModel(investment, quote, player); players.Add(model); // Katherine player = new Katherine(); investment = engine.GetCurrentInvestmentForPlayer(player.Name); quote = engine.GetCurrentQuoteForPlayer(player.Name); model = new PlayerViewModel(investment, quote, player); players.Add(model); // Jon player = new Jon(); investment = engine.GetCurrentInvestmentForPlayer(player.Name); quote = engine.GetCurrentQuoteForPlayer(player.Name); model = new PlayerViewModel(investment, quote, player); players.Add(model); return(View(players)); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "排序号"; e.CurrentHeadRow.Cells[1].Text = "编号"; e.CurrentHeadRow.Cells[2].Text = "目录名称"; e.CurrentHeadRow.Cells[3].Text = "目录路径"; e.CurrentHeadRow.Cells[4].Text = "限制文件容量"; e.CurrentHeadRow.Cells[5].Text = "默认排序"; e.CurrentHeadRow.Cells[0].ColSpan = 2; e.CurrentHeadRow.Cells[6].Text = "操作"; e.CurrentHeadRow.Cells[6].ColSpan = 3; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: e.CurrentBodyRow.Cells[0].ColSpan = 2; if (e.CurrentBodyRow.Cells[4].Text.ToString().Equals("0")) e.CurrentBodyRow.Cells[4].Text = "大小不限"; e.CurrentBodyRow.Cells[6].Text = "编辑"; e.CurrentBodyRow.Cells[6].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[6].Url = "New.aspx?opt=1&Disk_ID=" + e.CurrentBodyRow.Cells[1].Text; e.CurrentBodyRow.Cells[7].Text = "删除"; e.CurrentBodyRow.Cells[7].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[7].Url = "Delete.aspx?Disk_ID=" + e.CurrentBodyRow.Cells[1].Text; e.CurrentBodyRow.Cells[8].Text = "权限设置"; e.CurrentBodyRow.Cells[8].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[8].Url = "SetUser_Index.aspx?Disk_ID=" + e.CurrentBodyRow.Cells[1].Text; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.BodyBuilderEnd: break; } }
public void MatchesAnotherImplementation() { for (var confidence = 0.01; confidence <= 0.99; confidence += 0.01) { var z = Normal.InvCDF( mean: 0, stddev: 1, p: 1 - (1 - confidence) / 2); for (uint total = 1; total < 100; ++total) { for (uint up = 0; up <= total; ++up) { var myScore = WilsonScore.CalculateWithZScore(up, total, z); var theirScore = Wilson.Score(up, total, z); var difference = Math.Abs(theirScore - myScore); Assert.IsTrue( difference <= 1E-15, $"Difference was {difference}: my score: {myScore}; their score: {theirScore}; up/total: {up}/{total}; confidence: {confidence}"); } } } }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "标识卡编号"; e.CurrentHeadRow.Cells[1].Text = "姓名"; e.CurrentHeadRow.Cells[2].Text = "部门"; e.CurrentHeadRow.Cells[3].Text = "职务"; e.CurrentHeadRow.Cells[4].Text = "工种"; e.CurrentHeadRow.Cells[5].Text = "类型描述"; e.CurrentHeadRow.Cells[6].Text = "异常开始时刻"; e.CurrentHeadRow.Cells[7].Text = "异常结束时刻"; e.CurrentHeadRow.Cells[8].Text = "异常持续时长"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: // 格式化持续时长 if (e.CurrentBodyRow.Cells[8].Text != string.Empty && e.CurrentBodyRow.Cells[8].Text != " ") { int iDate = int.Parse(e.CurrentBodyRow.Cells[8].Text); e.CurrentBodyRow.Cells[8].Text = (iDate / 3600).ToString() + "小时" + (iDate % 3600 / 60).ToString() + "分" + (iDate % 3600 % 60).ToString() + "秒"; } break; } }
protected void wdTab_Info_DataExporter(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsExporter e) { BindGridView("BlockAddress", 1, wdTab_Info.VirtualItemCount); e.Set_Worksheet_Caption.Caption = strMineName + " 历史报警统计"; e.Set_Worksheet_Caption.CaptionFontSize = 24; e.Set_WorksheetName = "历史报警统计"; e.Set_FileName = "历史报警统计.xls"; wdTab_Info.HeadColLength = 4; }
protected void wdTab_Info_PageOrderChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsFieldsOrder e) { string strOrderMode = ""; if (!e.OrderField.Equals("列5")) { strOrderMode = e.OrderMode == Wilson.WebClassLibrary.WTable.Enum.EnumOrderMode.Default ? "" : e.OrderMode.ToString(); } else { e.OrderField = "BlockAddress"; } BindGridView(e.OrderField + " " + strOrderMode, e.PageIndex, e.PageSize); }
protected void wdTab_Info_DataExporter(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsExporter e) { BindGridView("SelfAddID", 1, wdTab_Info.VirtualItemCount, SelectWhere()); e.Set_Worksheet_Caption.Caption = strMineName + " 历史超员报警"; e.Set_Worksheet_Caption.CaptionFontSize = 24; e.Set_WorksheetName = "历史超员报警"; e.Set_FileName = "历史超员报警.xls"; }
protected void wdTab_Info_PageOrderChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsFieldsOrder e) { string strOrderMode = e.OrderMode == Wilson.WebClassLibrary.WTable.Enum.EnumOrderMode.Default ? "" : e.OrderMode.ToString(); BindGridView(e.OrderField + " " + strOrderMode, e.PageIndex, e.PageSize, SelectWhere()); }
protected void wdTab_Info_PageSizeChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsPage e) { BindGridView("BlockAddress", e.PageIndex, e.PageSize, SelectWhere()); hidSize.Value = e.PageSize.ToString(); hidOrder.Value = "BlockAddress"; hidIndex.Value = e.PageIndex.ToString(); }
public dynamic Status(string id, int?amount, bool hq = false) { Response.Headers.Add("Access-Control-Allow-Origin", new string[] { "*" }); if (String.IsNullOrEmpty(id) || !amount.HasValue) { Response.StatusCode = 400; Dictionary <string, string> err = new Dictionary <string, string>(); err.Add("error", "either 'amount' or 'id' not defined as parameters"); return(err); } // use connection to mongodb var server = StaticGlobal.MongoDBClient.GetServer(); var database = server.GetDatabase("parkeasy"); var collectionStatus = database.GetCollection <StatusModel>("status"); var collectionParking = database.GetCollection <ParkingModel>("parking"); StatusModel status = new StatusModel(); status.ParkingId = id; status.Amount = amount.Value; status.Time = DateTime.UtcNow; status.Id = ObjectId.GenerateNewId(); status.HighQualitySample = hq; collectionStatus.Insert(status); // count up and downvotes var queryStati = new QueryDocument { { "ParkingId", id } }; int upvotes = 0; int total = 0; foreach (StatusModel stati in collectionStatus.Find(queryStati)) { if (stati.HighQualitySample == false) { if (stati.Amount > 0) { upvotes++; } total++; } } double ws = Wilson.Score(upvotes, total); // update the parking document to for denormalization purposes var query = new QueryDocument { { "_id", id } }; var update = new UpdateDocument { { "$set", new BsonDocument("FreeLikelihood", ws) } }; collectionParking.Update(query, update); // update the parking document to for denormalization purposes query = new QueryDocument { { "_id", id } }; update = new UpdateDocument { { "$set", new BsonDocument("ReceivedVotes", true) } }; collectionParking.Update(query, update); return(true); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "编号"; e.CurrentHeadRow.Cells[1].Text = "名称"; e.CurrentHeadRow.Cells[2].Text = "风机入口风量"; e.CurrentHeadRow.Cells[3].Text = "风机静压"; e.CurrentHeadRow.Cells[4].Text = "风机全压"; e.CurrentHeadRow.Cells[5].Text = "风机效率"; e.CurrentHeadRow.Cells[6].Text = "监测时刻"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: break; } }
private void Awake() { instance = this; }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "标识卡编号"; e.CurrentHeadRow.Cells[1].Text = "姓名"; e.CurrentHeadRow.Cells[2].Text = "部门"; e.CurrentHeadRow.Cells[3].Text = "职务"; e.CurrentHeadRow.Cells[4].Text = "工种"; e.CurrentHeadRow.Cells[5].Text = "下井时刻"; e.CurrentHeadRow.Cells[6].Text = "下井位置"; e.CurrentHeadRow.Cells[7].Text = "下井时长"; //if (e.CurrentHeadRow.Cells.Length > 8) // e.CurrentHeadRow.Cells[8].Text = "操作"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: if (!e.CurrentBodyRow.Cells[5].Text.Equals("")) { TimeSpan ts = DateTime.Now.Subtract(Convert.ToDateTime(e.CurrentBodyRow.Cells[5].Text.ToString())); e.CurrentBodyRow.Cells[7].Text = ts.Days.ToString() + "天" + ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分" + ts.Seconds.ToString() + "秒"; } //if (e.CurrentBodyRow.Cells.Length > 8) //{ // e.CurrentBodyRow.Cells[8].Text = "查看"; // e.CurrentBodyRow.Cells[8].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; // e.CurrentBodyRow.Cells[8].Url = "../History/KJ128_HisDistribution.aspx?BlockAddress=" + e.CurrentBodyRow.Cells[0].Text; //} break; } }
protected void wdTab_Info_PageOrderChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsFieldsOrder e) { }
public void Configuration(IAppBuilder builder) { // routes can be added for each path prefix that should be // mapped to owin RouteTable.Routes.MapOwinRoute("hello"); RouteTable.Routes.MapOwinRoute("world"); // the routes above will be map onto whatever is added to // the IAppBuilder builder that was passed into this method builder.UseGate((req, res) => { res.ContentType = "text/plain"; res.Write("Hello from " + req.PathBase + req.Path); }); // a route may also be added for a given builder method. // this can also be done from global.asax RouteTable.Routes.MapOwinRoute("wilson-async", x => x.UseShowExceptions().UseContentType("text/plain").Run(WilsonAsync.App())); // a route may also be added for a given builder method. // this can also be done from global.asax RouteTable.Routes.MapOwinRoute("wilson", x => x.UseShowExceptions().UseContentType("text/plain").Run(Wilson.App())); // a route may also be added for a given app delegate // this can also be done from global.asax RouteTable.Routes.MapOwinRoute <AppFunc>("raw", Raw); }
protected void wdTab_Info_DataExporter(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsExporter e) { }
void ConfigWilson(IAppBuilder builder) { builder.UseShowExceptions().Run(Wilson.App()); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "序号"; e.CurrentHeadRow.Cells[1].Text = "标识卡编号"; e.CurrentHeadRow.Cells[2].Text = "姓名"; e.CurrentHeadRow.Cells[3].Text = "部门"; e.CurrentHeadRow.Cells[4].Text = "职务"; e.CurrentHeadRow.Cells[5].Text = "工种"; e.CurrentHeadRow.Cells[6].Text = "下井时刻"; e.CurrentHeadRow.Cells[7].Text = "下井位置"; e.CurrentHeadRow.Cells[8].Text = "下井时长"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: e.CurrentBodyRow.Cells[6].Text = DateTime.Parse(e.CurrentBodyRow.Cells[6].Text).ToString("yyyy-MM-dd HH:mm:ss"); if (!e.CurrentBodyRow.Cells[6].Text.Equals("")) { TimeSpan ts = DateTime.Now.Subtract(Convert.ToDateTime(e.CurrentBodyRow.Cells[6].Text.ToString())); e.CurrentBodyRow.Cells[8].Text = ts.Days.ToString() + "天" + ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分" + ts.Seconds.ToString() + "秒"; } if (e.CurrentBodyRow.Cells[3].Text.Equals("矿领导")) { e.CurrentBodyRow.Cells[0].CssClass = "tdred"; e.CurrentBodyRow.Cells[1].CssClass = "tdred"; e.CurrentBodyRow.Cells[2].CssClass = "tdred"; e.CurrentBodyRow.Cells[3].CssClass = "tdred"; e.CurrentBodyRow.Cells[4].CssClass = "tdred"; e.CurrentBodyRow.Cells[5].CssClass = "tdred"; e.CurrentBodyRow.Cells[6].CssClass = "tdred"; e.CurrentBodyRow.Cells[7].CssClass = "tdred"; } break; if (e.CurrentBodyRow.Cells[5].Text.Equals("无")) { e.CurrentBodyRow.Cells[5].Text = ""; } break; } }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: wdTab_Info.Header.Rows[0].Cells[3].Text = "总计"; wdTab_Info.Header.Rows[0].Cells[4].Text = "平均值"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: if (wdTab_Info.Body != null) { TimeSpan ts = Convert.ToDateTime(txtEndTime.Value).Subtract(Convert.ToDateTime(txtInWellTime.Value)); int iRowSpans = ts.Days + 1; if (e.RowIndex % iRowSpans == 0) { //合并列 wdTab_Info.Body.Rows[e.RowIndex].Cells[3].RowSpan = iRowSpans; wdTab_Info.Body.Rows[e.RowIndex].Cells[4].RowSpan = iRowSpans; wdTab_Info.Body.Rows[e.RowIndex].Cells[0].RowSpan = iRowSpans; //总计,平均值 float isum = 0; for (int i = 0; i < iRowSpans; i++) { isum += float.Parse(((DataSet)wdTab_Info.DataSource).Tables[0].Rows[e.RowIndex + i][2].ToString()); } wdTab_Info.Body.Rows[e.RowIndex].Cells[3].Text = isum.ToString(); wdTab_Info.Body.Rows[e.RowIndex].Cells[4].Text = Math.Round((isum / (float)iRowSpans), 2).ToString(); // 当统计部门,工种,职务无数据时使用无部门,工无种,无职务 if (wdTab_Info.Body.Rows[e.RowIndex].Cells[0].Text == string.Empty) { wdTab_Info.Body.Rows[e.RowIndex].Cells[0].Text = "无" + selectType.Items[selectType.SelectedIndex].Text; } } } break; } }
protected void wdTab_Info_PageOrderChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsFieldsOrder e) { string strOrderMode = ""; if (e.OrderField.Equals("列8")) { strOrderMode = "STime"; } else { strOrderMode = e.OrderMode == Wilson.WebClassLibrary.WTable.Enum.EnumOrderMode.Default ? "" : e.OrderMode.ToString(); } BindGridView(e.OrderField + " " + strOrderMode, e.PageIndex, e.PageSize, SelectWhere()); hidOrder.Value = e.OrderField + " " + strOrderMode; }
protected void wdTab_Info_PageIndexChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsPage e) { //翻页 BindGridView(e.PageIndex, e.PageSize); }
void WilsonScore_Should_Be_Zero_If_There_Are_No_Ups() { Assert.True(Wilson.Score(0, 2) == 0); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "序号"; e.CurrentHeadRow.Cells[1].Text = "标识卡编号"; e.CurrentHeadRow.Cells[2].Text = "姓名"; e.CurrentHeadRow.Cells[3].Text = "部门"; e.CurrentHeadRow.Cells[4].Text = "班次"; e.CurrentHeadRow.Cells[5].Text = "下井时刻"; e.CurrentHeadRow.Cells[6].Text = "上井时刻"; e.CurrentHeadRow.Cells[7].Text = "持续时间"; //e.CurrentHeadRow.Cells[8].Text = "记工日期"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: e.CurrentBodyRow.Cells[6].Text = DateTime.Parse(e.CurrentBodyRow.Cells[6].Text).ToString("yyyy-MM-dd HH:mm:ss"); //e.CurrentBodyRow.Cells[8].Text = DateTime.Parse(e.CurrentBodyRow.Cells[8].Text).ToString("yyyy-MM-dd HH:mm:ss"); //if (e.CurrentBodyRow.Cells[8].Text != "") //{ // if (e.CurrentBodyRow.Cells[8].Text.Split(':')[2].ToString() == "00") // { // if (e.CurrentBodyRow.Cells[8].Text.Split(':').Length > 0) // { // e.CurrentBodyRow.Cells[8].Text = e.CurrentBodyRow.Cells[8].Text.Split(':')[0].ToString() + ":" + e.CurrentBodyRow.Cells[8].Text.Split(':')[1].ToString() + ":59"; // } // } //} //if (e.CurrentBodyRow.Cells.Length > 10) //{ // e.CurrentBodyRow.Cells[10].Text = "查看"; // e.CurrentBodyRow.Cells[10].Url = "KJ128_HisDistribution.aspx?BeginTime=" + e.CurrentBodyRow.Cells[6].Text + "&&EndTime=" + e.CurrentBodyRow.Cells[8].Text + "&&BlockAddress=" + e.CurrentBodyRow.Cells[1].Text; // e.CurrentBodyRow.Cells[10].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; //} if (e.CurrentBodyRow.Cells[3].Text.Equals("矿领导")) { e.CurrentBodyRow.Cells[0].TextColor = System.Drawing.Color.Red; e.CurrentBodyRow.Cells[1].TextColor = System.Drawing.Color.Red; e.CurrentBodyRow.Cells[2].TextColor = System.Drawing.Color.Red; e.CurrentBodyRow.Cells[3].TextColor = System.Drawing.Color.Red; e.CurrentBodyRow.Cells[4].TextColor = System.Drawing.Color.Red; e.CurrentBodyRow.Cells[5].TextColor = System.Drawing.Color.Red; e.CurrentBodyRow.Cells[6].TextColor = System.Drawing.Color.Red; e.CurrentBodyRow.Cells[7].TextColor = System.Drawing.Color.Red; } if (e.CurrentBodyRow.Cells[4].Text.Equals("无")) { e.CurrentBodyRow.Cells[4].Text = ""; } break; } }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "编号"; e.CurrentHeadRow.Cells[1].Text = "名称"; e.CurrentHeadRow.Cells[2].Text = "一级电机状态"; e.CurrentHeadRow.Cells[3].Text = "一级电机电压(V)"; e.CurrentHeadRow.Cells[4].Text = "一级电机电流(A)"; e.CurrentHeadRow.Cells[5].Text = "一级电机功率(KW)"; e.CurrentHeadRow.Cells[6].Text = "二级电机状态"; e.CurrentHeadRow.Cells[7].Text = "二级电机电压(V)"; e.CurrentHeadRow.Cells[8].Text = "二级电机电流(A)"; e.CurrentHeadRow.Cells[9].Text = "二级电机功率(KW)"; e.CurrentHeadRow.Cells[10].Text = "监测时刻"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: if (e.CurrentBodyRow.Cells[2].Text.Equals("1")) { e.CurrentBodyRow.Cells[2].Text = "开"; } else if (e.CurrentBodyRow.Cells[2].Text.Equals("0")) { e.CurrentBodyRow.Cells[2].Text = "关"; } else { e.CurrentBodyRow.Cells[2].Text = "故障"; } if (e.CurrentBodyRow.Cells[6].Text.Equals("1")) { e.CurrentBodyRow.Cells[6].Text = "开"; } else if (e.CurrentBodyRow.Cells[6].Text.Equals("0")) { e.CurrentBodyRow.Cells[6].Text = "关"; } else { e.CurrentBodyRow.Cells[6].Text = "故障"; } break; } }
protected void wdTab_Info_PageIndexChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsPage e) { //翻页 BindGridView("DataAttendance,BlockID", e.PageIndex, e.PageSize, SelectWhere()); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "超员人数"; e.CurrentHeadRow.Cells[1].Text = "超员类型"; e.CurrentHeadRow.Cells[2].Text = "报警开始时间"; e.CurrentHeadRow.Cells[3].Text = "报警结束时刻"; e.CurrentHeadRow.Cells[4].Text = "报警持续时长"; break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: // 格式化持续时长 e.CurrentBodyRow.Cells[2].Text = DateTime.Parse(e.CurrentBodyRow.Cells[2].Text).ToString("yyyy-MM-dd HH:mm:ss"); e.CurrentBodyRow.Cells[3].Text = DateTime.Parse(e.CurrentBodyRow.Cells[3].Text).ToString("yyyy-MM-dd HH:mm:ss"); if (e.CurrentBodyRow.Cells[4].Text != string.Empty && e.CurrentBodyRow.Cells[4].Text != " ") { int iDate = int.Parse(e.CurrentBodyRow.Cells[4].Text); e.CurrentBodyRow.Cells[4].Text = (iDate / 3600).ToString() + "小时" + (iDate % 3600 / 60).ToString() + "分" + (iDate % 3600 % 60).ToString() + "秒"; } break; } }
protected void wdTab_Info_PageOrderChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsFieldsOrder e) { if (e.OrderField.Equals("列10")) { Page.ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>window.history.back();</script>"); return; } string strOrderMode = e.OrderMode == Wilson.WebClassLibrary.WTable.Enum.EnumOrderMode.Default ? "" : e.OrderMode.ToString(); BindGridView(e.OrderField + " " + strOrderMode, e.PageIndex, e.PageSize, SelectWhere()); }
protected void wdTab_Info_PageSizeChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsPage e) { BindGridView("SelfAddID", e.PageIndex, e.PageSize, SelectWhere()); }
void WilsonScore_Should_Be_Higher_For_Same_Average_But_Higher_Totals(int whatever) { Assert.True(Wilson.Score(500, 1000) > Wilson.Score(1, 2)); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "标识卡编号"; e.CurrentHeadRow.Cells[1].Text = "姓名"; if (e.CurrentHeadRow.Cells.Length > 4) { e.CurrentHeadRow.Cells[4].Text = "操作"; } break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: // 格式化持续时长 if (e.CurrentBodyRow.Cells[3].Text != string.Empty && e.CurrentBodyRow.Cells[3].Text != " ") { int iDate = int.Parse(e.CurrentBodyRow.Cells[3].Text); e.CurrentBodyRow.Cells[3].Text = (iDate / 3600).ToString() + "小时" + (iDate % 3600 / 60).ToString() + "分" + (iDate % 3600 % 60).ToString() + "秒"; } if (e.CurrentBodyRow.Cells.Length > 4) { e.CurrentBodyRow.Cells[4].Text = "查看"; e.CurrentBodyRow.Cells[4].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[4].Url = hidUrl.Value + "?BlockAddress=" + e.CurrentBodyRow.Cells[0].Text + "&EmployeeName=" + Server.UrlEncode(e.CurrentBodyRow.Cells[1].Text)+"&BeginTime="+txtBeginTime.Text.Trim()+"&EndTime="+txtEndTime.Text.Trim(); if (!string.IsNullOrEmpty(txtBeginTime.Text.Trim())) { Session.Add("txtBeginTime",txtBeginTime.Text.Trim()); } if(!string.IsNullOrEmpty(txtEndTime.Text.Trim())) { Session.Add("txtEndTime",txtEndTime.Text.Trim()); } } break; } }
void WilsonScore_Should_Be_Lower_Than_Average_Score() { double expected = ((double)1 / (double)2); Assert.True(Wilson.Score(1, 2) < expected); }
protected void wdTab_Info_PageSizeChanged(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsPage e) { BindGridView("BlockAddress", e.PageIndex, e.PageSize); }
protected void wdTab_Info_DataRowDataBuilding(object sender, Wilson.WebClassLibrary.WTable.EventArg.EventArgsTableDataBuilder e) { switch (e.RowType) { case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Header: e.CurrentHeadRow.Cells[0].Text = "发布人"; e.CurrentHeadRow.Cells[0].ColSpan = 2; e.CurrentHeadRow.Cells[2].Text = "类型"; e.CurrentHeadRow.Cells[3].Text = "发布范围"; e.CurrentHeadRow.Cells[4].Text = "标题"; e.CurrentHeadRow.Cells[5].Text = "发布时间"; e.CurrentHeadRow.Cells[6].Text = "点击次数"; e.CurrentHeadRow.Cells[7].Text = "评论(条)"; e.CurrentHeadRow.Cells[8].Text = "状态"; //如果是具有管理权限 //if (strIsManage == "true") //{ if (e.CurrentHeadRow.Cells.Length > 9) { e.CurrentHeadRow.Cells[9].Text = "评论"; e.CurrentHeadRow.Cells[10].Text = "删除"; e.CurrentHeadRow.Cells[11].Text = "修改"; } //} //else //{ // e.CurrentHeadRow.Cells[8].ColSpan = 4; //} break; case Wilson.WebClassLibrary.WTable.Enum.EnumRowType.Body: e.CurrentBodyRow.Cells[0].ColSpan = 2; if (e.CurrentBodyRow.Cells[3].Text != string.Empty) { string strUserID = e.CurrentBodyRow.Cells[3].Text; e.CurrentBodyRow.Cells[3].Text = GetTureName(strUserID); } if (e.CurrentBodyRow.Cells[8].Text != string.Empty) { e.CurrentBodyRow.Cells[8].Text = e.CurrentBodyRow.Cells[8].Text == "True" ? "发布" : "<font color=red>未发布</font>"; } if (e.CurrentBodyRow.Cells[6].Text.ToString().Equals("")) { e.CurrentBodyRow.Cells[6].Text = "0"; } if (e.CurrentBodyRow.Cells[7].Text.ToString().Equals("")) { e.CurrentBodyRow.Cells[7].Text = "0"; } string strName = e.CurrentBodyRow.Cells[3].Text; if (strName != string.Empty) { string strTrueName =strName; if (strTrueName.Length > 10) { e.CurrentBodyRow.Cells[3].Text = strName.Substring(0, 10) + "..."; } else { e.CurrentBodyRow.Cells[3].Text = strTrueName; } } //if (e.CurrentBodyRow.Cells[2].Text != string.Empty) //{ // e.CurrentBodyRow.Cells[2].Text = GetTureName(e.CurrentBodyRow.Cells[2].Text); //} string strComm = e.CurrentBodyRow.Cells[9].Text; //如果是具有管理功能 //if (strIsManage == "true") //{ if (e.CurrentBodyRow.Cells.Length > 9) { if (!e.CurrentBodyRow.Cells[9].Text.Equals("2")) { //评论类型:0,实名评论;1,匿名评论;2,禁止评论 e.CurrentBodyRow.Cells[9].Text = "管理评论"; e.CurrentBodyRow.Cells[9].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[9].Url = "OA_News_Comment.aspx?Info=comm&NewsID=" + e.CurrentBodyRow.Cells[1].Text + "&commtype=" + strComm + "&IsManage=" + strIsManage; } else { e.CurrentBodyRow.Cells[9].Text = ""; } e.CurrentBodyRow.Cells[10].Text = "删除"; e.CurrentBodyRow.Cells[10].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[10].Url = "OA_News_View.aspx?Info=del&NewsID=" + e.CurrentBodyRow.Cells[1].Text+"&IsManage="+strIsManage; e.CurrentBodyRow.Cells[11].Text = "修改"; e.CurrentBodyRow.Cells[11].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[11].Url = "OA_News_View.aspx?Info=update&NewsID=" + e.CurrentBodyRow.Cells[1].Text+"&IsManage="+strIsManage; } //} //else //{ // e.CurrentBodyRow.Cells[8].ColSpan = 4; //} // 查看功能 if (e.CurrentBodyRow.Cells[4].Text != string.Empty) { e.CurrentBodyRow.Cells[4].CellType = Wilson.WebClassLibrary.WTable.Enum.EnumCellType.HyperLink; e.CurrentBodyRow.Cells[4].Url = "OA_News_Comment.aspx?Info=detail&NewsID=" + e.CurrentBodyRow.Cells[1].Text + "&commtype=" + strComm + "&IsManage=" + strIsManage; } break; } }