/// <summary> /// 测试移交 /// </summary> public void TestShift() { //创建. workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fl.No, null, null, WebUser.No, null, 0, null); //执行发送. BP.WF.Dev2Interface.Node_SendWork(fl.No, workID); //执行移交. BP.WF.Dev2Interface.Node_Shift(workID, "zhoushengyu", "移交测试"); #region 检查预期结果 sql = "SELECT * FROM WF_EmpWorks WHERE WorkID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { throw new Exception("@移交后待办丢失。"); } if (dt.Rows.Count != 1) { throw new Exception("@应该只有一个人处于待办状态。"); } if (dt.Rows[0]["FK_Emp"].ToString() != "zhoushengyu") { throw new Exception("@没有移交给 zhoushengyu"); } ShiftWork sw = new ShiftWork(); int i = sw.Retrieve(ShiftWorkAttr.WorkID, workID, ShiftWorkAttr.FK_Node, 2302, ShiftWorkAttr.ToEmp, "zhoushengyu"); if (i == 0) { throw new Exception("@没有写入移交数据在WF_ShiftWork表中 zhoushengyu"); } if (i != 1) { throw new Exception("@移交数据写入了多次,在WF_ShiftWork表中 zhoushengyu"); } #endregion 检查预期结果 }
public static void Progress() { GameFiber.StartNew(delegate { Game.DisplayNotification("[~b~Police~s~Life~r~S~s~]: ~b~Please wait ..."); GameFiber.Sleep(5000); PlayerAuthenticate.Login(); CreateStations.CreateGasStations(); while (true) { try { var player = Game.LocalPlayer.Character; if (player != null) { if (player.IsAlive) { HungerFactory.ConsumptionsHitPoints(myPlayer); DrawTexture.changePlayerLifeTexture(myPlayer); CalloutManagement.checkisCalloutRunning(); if (ScreenWidth != Game.Resolution.Width || ScreenHeight != Game.Resolution.Height) { //Reinitalisiere Texturen, wenn Auflösung sich ändert ScreenWidth = Game.Resolution.Width; ScreenHeight = Game.Resolution.Height; DrawTexture.initTextures(); } } if (player.IsInAnyVehicle(false)) { var currentVehicle = player.CurrentVehicle; if (currentVehicle != null) { currentVehicle.Metadata.BrakeEnable = (Game.IsKeyDownRightNow(ReadIniFile.HandBrakeKey) ? true : false); if (Game.IsKeyDown(ReadIniFile.ToggleEngineKey)) { currentVehicle.IsEngineOn = !currentVehicle.IsEngineOn; } if (Game.IsKeyDown(Keys.F9)) { if (!DrawTexture.getTextureVisible("policeRadio")) { var policeRadio = DrawTexture.getDrawObject("policeRadio"); if (policeRadio != null) { if (policeRadio.texture == null) { policeRadio.texture = DrawTexture.getTextureFromResource(Resources.policeradio); policeRadio.x = policeRadio.texture.Size.Width * 2; policeRadio.y = Game.Resolution.Height - policeRadio.texture.Size.Height; policeRadio.width = policeRadio.texture.Size.Width; policeRadio.height = policeRadio.texture.Size.Height; } DrawTexture.setTextureVisible("policeRadio", true); } else { Game.DisplayNotification("[~b~Police~s~Life~r~S~s~]: ~r~PoliceRadio Texture Initialization Error"); } } else { DrawTexture.setTextureVisible("policeRadio", false); } } if (Game.IsKeyDown(ReadIniFile.IndicatorLeftKey)) { if (currentVehicle.Metadata.IndicatorLeft != null && currentVehicle.Metadata.IndicatorLeft) { currentVehicle.Metadata.IndicatorLeft = false; currentVehicle.Metadata.IndicatorRight = false; DrawTexture.blinkTimer.Stop(); DrawTexture.blinkStatus = false; currentVehicle.IndicatorLightsStatus = VehicleIndicatorLightsStatus.Off; } else { currentVehicle.Metadata.IndicatorLeft = true; currentVehicle.Metadata.IndicatorRight = false; DrawTexture.blinkTimer.Start(); currentVehicle.IndicatorLightsStatus = VehicleIndicatorLightsStatus.LeftOnly; } } else if (Game.IsKeyDown(ReadIniFile.IndicatorRightKey)) { if (currentVehicle.Metadata.IndicatorRight != null && currentVehicle.Metadata.IndicatorRight) { currentVehicle.Metadata.IndicatorRight = false; currentVehicle.Metadata.IndicatorLeft = false; DrawTexture.blinkTimer.Stop(); DrawTexture.blinkStatus = false; currentVehicle.IndicatorLightsStatus = VehicleIndicatorLightsStatus.Off; } else { currentVehicle.Metadata.IndicatorRight = true; currentVehicle.Metadata.IndicatorLeft = false; DrawTexture.blinkTimer.Start(); currentVehicle.IndicatorLightsStatus = VehicleIndicatorLightsStatus.RightOnly; } } else if (Game.IsKeyDown(ReadIniFile.IndicatorBothKey)) { if (currentVehicle.Metadata.IndicatorRight != null && currentVehicle.Metadata.IndicatorRight && currentVehicle.Metadata.IndicatorLeft != null && currentVehicle.Metadata.IndicatorLeft) { currentVehicle.Metadata.IndicatorRight = false; currentVehicle.Metadata.IndicatorLeft = false; DrawTexture.blinkTimer.Stop(); DrawTexture.blinkStatus = false; currentVehicle.IndicatorLightsStatus = VehicleIndicatorLightsStatus.Off; } else { currentVehicle.Metadata.IndicatorRight = true; currentVehicle.Metadata.IndicatorLeft = true; DrawTexture.blinkTimer.Start(); currentVehicle.IndicatorLightsStatus = VehicleIndicatorLightsStatus.Both; } } } // If the player increases the first time in the vehicle if (playerEnterVehicle == false) { playerEnterVehicle = true; // Then there is no longer the first time dbVehicle = DBVehicleManager.SelectVehicle(player); // When he got no DBVehicle if (dbVehicle == null) { // We use DBVehicle - We store the vehicle in the database DBVehicleManager.InsertVehicle(DBVehicleFactory.GetRandomVehicle(player.CurrentVehicle.LicensePlate)); dbVehicle = DBVehicleManager.SelectVehicle(player); } // We know this vehicle, this vehicle is in our database if (dbVehicle != null) { } GameFiber.Yield(); } // We start to calculate the tank fuelConsumption.PlayerIsDriving(player, dbVehicle); // Displays only the tank level when the player moves more than 5Kmh if (DrawTexture.getTextureVisible("SpeedoMeter") == false && NativeFunction.CallByName <int>("GET_FOLLOW_PED_CAM_VIEW_MODE") != 4 && !player.IsDead) { //Enable Speedo if in Vehicle DrawTexture.toggleSpeedoTexture(true); } else if (NativeFunction.CallByName <int>("GET_FOLLOW_PED_CAM_VIEW_MODE") == 4 && !player.IsDead) { if (ReadIniFile.viewInCockpit) { //Enable Speedo if in Vehicle and Cockpit View if enabled DrawTexture.toggleSpeedoTexture(true); } else { //Disable Speedo if in Vehicle and Cockpit View if wanted DrawTexture.toggleSpeedoTexture(false); } } else if (DrawTexture.getTextureVisible("SpeedoMeter") == true && player.IsDead) { //Disable Speedo, because Player Dead DrawTexture.toggleSpeedoTexture(false); } DrawTexture.changeSpeedoTexture(dbVehicle); } if (!player.IsInAnyVehicle(false) && playerEnterVehicle) { // Then we set this field to False // So the next boarding is his first time playerEnterVehicle = false; DrawTexture.toggleSpeedoTexture(false); // Memory the vehicle tank when the player leaves the vehicle DBVehicleManager.UpdateVehicle(dbVehicle, dbVehicle.tankful); GameFiber.Yield(); } if (Game.IsKeyDownRightNow(ReadIniFile.ViewOverlayKey)) { DrawTexture.setTextureVisible("Hungery", true); DrawText.DrawMoneyStatus(); if (DutyState && ShiftWork.inShiftWork) { DrawText.DrawShiftWorkStatus(); } } else { DrawTexture.setTextureVisible("Hungery", false); } if (DutyState) { if (Game.IsKeyDown(Keys.F7)) { /* if (!DrawTexture.getTextureVisible("policeRadio")) * { * DrawTexture.setTextureVisible("policeRadio", true); * DrawTexture.setTextureVisible("policeRadioInner", true); * } * else * { * DrawTexture.setTextureVisible("policeRadio", false); * DrawTexture.setTextureVisible("policeRadioInner", false); * } * Vehicle v = null; * vehicles.TryTake(out v); * if(v != null) * { * Game.LocalPlayer.Character.Position = v.RearPosition; * }*/ } var position = player.Position; for (int i = 0; i < CreateStations.stations.Count; i++) { // If the position of the player to a station is less than if (position.DistanceTo(CreateStations.stations[i].position) <= 30) { CreateStations.stations[i].TryUse(player, dbVehicle, myPlayer); } if (position.DistanceTo(CreateStations.stations[i].position) <= 3000f) { CreateStations.stations[i].iconBlip.Alpha = 1.0f; } else { CreateStations.stations[i].iconBlip.Alpha = 0.0f; } } foreach (Vector3 sPed in ShiftWork.shiftPed) { if (Vector3.Distance(sPed, position) <= 1 && !ShiftWork.inShiftWork) { Game.DisplayHelp("Want to start your shift work? ~g~(" + (new KeysConverter()).ConvertToString(ReadIniFile.ShiftWorkStartKey) + ") Yes~s~ - ~r~(" + (new KeysConverter()).ConvertToString(ReadIniFile.ShiftWorkCancelKey) + ") No"); if (Game.IsKeyDown(ReadIniFile.ShiftWorkStartKey)) { ShiftWork.arrestedPeds = 0; ShiftWork.inShiftWork = true; ShiftWork.Start(); LiveTicker.AddTicker("I started my shift work"); } break; } else if (Vector3.Distance(sPed, position) <= 1 && ShiftWork.inShiftWork) { Game.DisplayHelp("Want to cancel your shift work? ~g~(" + (new KeysConverter()).ConvertToString(ReadIniFile.ShiftWorkStartKey) + ") Yes~s~ - ~r~(" + (new KeysConverter()).ConvertToString(ReadIniFile.ShiftWorkCancelKey) + ") No"); if (Game.IsKeyDown(ReadIniFile.ShiftWorkStartKey)) { ShiftWork.inShiftWork = false; LiveTicker.AddTicker("I canceled my shift work"); ShiftWork.timer.Stop(); NotificationManager.addNotification("[~b~Police~s~Life~r~S~s~]: Your shift was ~r~canceled by yourself"); } break; } } // if the player is in a shiftwork if (ShiftWork.inShiftWork) { if (player.IsDead && !playerDeath) { playerDeath = true; ShiftWork.inShiftWork = false; LiveTicker.AddTicker("Dies while his shift work"); ShiftWork.timer.Stop(); NotificationManager.addNotification("[~b~Police~s~Life~r~S~s~]: The shift work was ~r~terminated~s~ because ~r~you died."); } } if (player.IsAlive && playerDeath) { playerDeath = false; } } } }catch (Exception ex) { Game.LogTrivial(ex.ToString()); } GameFiber.Yield(); } }); GameFiber.StartNew(delegate { while (true) { var player = Game.LocalPlayer.Character; if (player != null) { if (PlayerAuthenticate.isLogged) { LiveTicker.SendTickerToServer(); var nearbyPeds = player.GetNearbyPeds(10); if (nearbyPeds.Count() > 0) { int arrested = 0; var position = player.Position; foreach (Ped np in nearbyPeds) { if (!np.IsValid()) { continue; } if (np.IsDead) { continue; } if (Vector3.Distance(np.Position, position) <= 20) { if (Functions.IsPedArrested(np) && Functions.GetPedArrestingOfficer(np) == player) { if (!arrestedPeds.Contains(np)) { arrestedPeds.Add(np); if (ShiftWork.inShiftWork) { ShiftWork.arrestedPeds += 1; } arrested++; } } } } if (arrested > 0) { ExperienceManager.addArrestedPeds(arrested, ShiftWork.inShiftWork); } } if (arrestedPeds.Count() > 0) { for (int i = arrestedPeds.Count - 1; i >= 0; i--) { if (!arrestedPeds[i].IsValid()) { arrestedPeds.RemoveAt(i); continue; } if (!arrestedPeds[i].IsDead) { continue; } ExperienceManager.UpdateExp(-20, "Suspect Died in your presence"); arrestedPeds.RemoveAt(i); } } } } NotificationManager.TakeNotification(); GameFiber.Sleep(2000); } }); }
void Forward_Click(object sender, EventArgs e) { Button btn = sender as Button; switch (btn.ID) { case NamesOfBtn.Cancel: this.Response.Redirect("../MyFlow.aspx?FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow + "&WorkID=" + this.WorkID + "&FID=" + this.FID, true); //this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "e", "<script language=javascript>history.go(-1);</script>", true); return; default: break; } try { string msg = this.Top.GetTextBoxByID("TB_Doc").Text; if (msg == "请输入移交原因...") { throw new Exception("@您必须输入移交原因。"); } string sql = ""; sql = " SELECT No,Name FROM Port_Emp WHERE FK_Dept='" + this.FK_Dept + "'"; DataTable dt = DBAccess.RunSQLReturnTable(sql); string toEmp = ""; foreach (DataRow dr in dt.Rows) { if (dr["No"].ToString() == WebUser.No) { continue; } RadioButton rb = this.Top.GetRadioButtonByID("RB_" + dr["No"]); if (rb == null || rb.Checked == false) { continue; } toEmp = dr["No"].ToString(); } if (toEmp == "") { this.Alert("请选择要移交的人员。"); return; } string info = BP.WF.Dev2Interface.Node_Shift(this.FK_Flow, this.FK_Node, this.WorkID, this.FID, toEmp, msg); this.Session["info"] = info; this.Response.Redirect(BP.WF.Glo.CCFlowAppPath + "WF/MyFlowInfo.aspx?DoType=Msg&FK_Flow=" + this.FK_Flow, true); return; } catch (Exception ex) { ShiftWork fw = new ShiftWork(); fw.CheckPhysicsTable(); Log.DefaultLogWriteLineWarning(ex.Message); this.Alert("工作移交出错:" + ex.Message); } }