public static void Main(string[] args) { Automobile jeep = new Automobile(); ServiceStation station = new ServiceStation(); RepairDelegate wheelAligment = new RepairDelegate(station.AlignWheels); RepairDelegate paint = new RepairDelegate(station.PaintCar); RepairDelegate changeOil = new RepairDelegate(station.ChangeOil); RepairDelegate carInspection = new RepairDelegate(station.CarInspection); RepairDelegate changeWheels = new RepairDelegate(station.ChangeWheel); RepairDelegate repairBody = new RepairDelegate(station.RepairBody); AllRepairDelegate allRepair = new AllRepairDelegate (wheelAligment + paint + changeOil + carInspection + changeWheels + repairBody); jeep.ShowDoneWork(); paint(jeep); changeOil(jeep); repairBody(jeep); jeep.ShowDoneWork(); allRepair(jeep); jeep.ShowDoneWork(); }
private void SetNextTarget() { if (actionQueue.Count != 0) { nextTarget = actionQueue.Dequeue(); String targetTag = nextTarget.gameObject.tag; PlayerState targetState = GetNextState(targetTag); if (targetState != currentState) { playerMovement.SetTarget(nextTarget.gameObject); SetState(PlayerState.Moving); playerMovement.StartMoving(); } //it's the same service station where the player is standing else { //activate the service without walking nextTarget.gameObject.GetComponent <ServiceStation>().ActivateService(); } } else { nextTarget = null; } playerActionQueueText.SetText(nextTarget, actionQueue); }
private void SetNextTarget() { if (actionQueue.Count != 0) { nextTarget = actionQueue.Dequeue(); movement.SetTarget(nextTarget.gameObject); } movement.StartMoving(); }
private void Awake() { //TODO populate from NPCSpawner toilet = GameObject.FindGameObjectWithTag("Bathroom").GetComponent <ServiceStation>(); popcorn = GameObject.FindGameObjectWithTag("PopcornStall").GetComponent <ServiceStation>(); exit = GameObject.FindGameObjectWithTag("Exit").GetComponent <ServiceStation>(); movement = gameObject.GetComponent <Movement>(); actionQueue = new Queue <ServiceStation>(); }
private void LoadInputForm() { ServiceStation station = stationsView.GetFocusedRow() as ServiceStation; if (station != null) { StationInputForm form = new StationInputForm(); form.ShowDialog(); } }
public static bool IsExistValue(this ServiceStation serviceStation, string tableName, string columnName, string columnValue, string whereClause, string connectId) { bool result = false; SPParam spParam = new { }.ToSPParam(); spParam["TableName"] = tableName; spParam["ColumnName"] = columnName; spParam["Value"] = columnValue; spParam["WhereClause"] = whereClause; var ret = BuilderFactory.DefaultBulder(connectId).ExecuteScalar("SP_Pub_IsExistValue", spParam); result = Convert.ToBoolean(ret); return(result); }
public ModelInvokeResult <ServiceStationPK> Update(string strStationId, ServiceStation serviceStation) { ModelInvokeResult <ServiceStationPK> result = new ModelInvokeResult <ServiceStationPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); Guid?_StationId = strStationId.ToGuid(); if (_StationId == null) { result.Success = false; result.ErrorCode = 59996; return(result); } serviceStation.StationId = _StationId; /***********************begin 自定义代码*******************/ serviceStation.OperatedBy = NormalSession.UserId.ToGuid(); serviceStation.OperatedOn = DateTime.Now; serviceStation.DataSource = GlobalManager.DIKey_00012_ManualEdit; var param = serviceStation.ToStringObjectDictionary(false); if (string.IsNullOrEmpty(serviceStation.AreaId2)) { param["AreaId2"] = DBNull.Value; } if (string.IsNullOrEmpty(serviceStation.AreaId3)) { param["AreaId3"] = DBNull.Value; } /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = serviceStation.GetUpdateMethodName(), ParameterObject = param, Type = SqlExecuteType.UPDATE }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); result.instance = new ServiceStationPK { StationId = _StationId }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
/// <summary> /// Adds a new object to the <see cref="targets"/> queue if it is not full /// </summary> /// <param name="newTarget">The object being added</param> /// <returns>Shows if the add was successful</returns> public bool AddToQueue(ServiceStation serviceStation) { if (actionQueue.Count < MAXSIZE) { actionQueue.Enqueue(serviceStation); playerActionQueueText.SetText(nextTarget, actionQueue); if (currentState != PlayerState.Moving) { SetNextTarget(); } return(true); } return(false); }
public void SetText(ServiceStation nextTarget, Queue <ServiceStation> actionQueue) { string newText = ""; if (nextTarget != null) { newText = nextTarget.gameObject.tag + "\n"; } foreach (ServiceStation s in actionQueue) { newText += s.gameObject.tag + "\n"; } text.text = newText; }
public void CloseForDay_should_be_called_once() { // Arrange var mockGateUtility = new Mock <IGateUtility>(); mockGateUtility.Setup(x => x.CloseGate()); // Act var sut = new ServiceStation(mockGateUtility.Object); sut.CloseForDay(); // Assert mockGateUtility.Verify(x => x.CloseGate(), Times.Once); }
public void OpenForService_should_call_OpenGate_once() { // Arrange var mockGateUtility = new Mock <IGateUtility>(); mockGateUtility.Setup(x => x.OpenGate()); // Act var sut = new ServiceStation(mockGateUtility.Object); sut.OpenForService(); // Assert mockGateUtility.Verify(x => x.OpenGate(), Times.Once); }
private static void ApplyVisitors(List <IVehicle> vehicles) { var service = new ServiceStation(); var visitors = new List <IVehicleVisitor> { service }; foreach (var vehicle in vehicles) { foreach (var vehicleVisitor in visitors) { vehicle.Accept(vehicleVisitor); } } }
public InvokeResult NullifySelected(string strStationIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrStationIds = strStationIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrStationIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new ServiceStation().GetUpdateMethodName(); foreach (string strStationId in arrStationIds) { ServiceStation serviceStation = new ServiceStation { StationId = strStationId.ToGuid(), Status = 0 }; /***********************begin 自定义代码*******************/ serviceStation.OperatedBy = NormalSession.UserId.ToGuid(); serviceStation.OperatedOn = DateTime.Now; serviceStation.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = statementName, ParameterObject = serviceStation.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Charset = "utf-8"; HttpPostedFile file = context.Request.Files["Filedata"]; if (file != null) { string AreaId = context.Request.Form["AreaId"]; IList <StringObjectDictionary> datas = NPOIManager.GetSheetData(file.InputStream, 0, true); List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); ServiceStation station = new ServiceStation() { DataSource = GlobalManager.DIKey_00012_UploadFile, OperatedBy = NormalSession.UserId.ToGuid(), OperatedOn = DateTime.Now, AreaId = AreaId }; foreach (var data in datas) { station.StationId = Guid.NewGuid(); station.StationType = context.Request.Form["StationType"]; StringObjectDictionary sod = station.ToStringObjectDictionary(false); IDictionary <string, object> dataItem = sod.MixInObject(data, false, e0571.web.core.Other.CaseSensitive.NORMAL); statements.Add(new IBatisNetBatchStatement { StatementName = station.GetCreateMethodName(), ParameterObject = dataItem, Type = SqlExecuteType.INSERT }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); //下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失 context.Response.Write("1"); } else { context.Response.Write("0"); } }
public InvokeResult DeleteSelected(string strStationIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrStationIds = strStationIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrStationIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new ServiceStation().GetDeleteMethodName(); foreach (string strStationId in arrStationIds) { ServiceStationPK pk = new ServiceStationPK { StationId = strStationId.ToGuid() }; DeleteCascade(statements, pk); statements.Add(new IBatisNetBatchStatement { StatementName = statementName, ParameterObject = pk, Type = SqlExecuteType.DELETE }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public void Update() { if (!paused && started) { spendedTime += Time.deltaTime; } int sec = (int)spendedTime % 60; int min = (int)spendedTime / 60; string time = min.ToString("0") + ":" + sec.ToString("00") + " Expected Delivery Time: " + expecMin.ToString("0") + ":" + expecSec.ToString("00"); if (ui != null) { ui.transform.GetChild(3).GetComponent <Text>().text = time; } Debug.Log(ServiceStation.name); if (completed) { ui.transform.GetChild(6).gameObject.SetActive(false); paused = true; Finisher(false); Debug.Log(ServiceStation.name); for (int i = 0; i < ServiceStation.transform.GetChild(3).childCount; i++) { ServiceStation.transform.GetChild(3).GetChild(i).gameObject.SetActive(true); } ServiceStation.GetComponent <Animator>().SetTrigger("Work"); countDownDistance = true; completed = false; } if (countDownDistance) { DistanceTime -= Time.deltaTime; } if (DistanceTime < 0) { for (int i = 0; i < ServiceStation.transform.GetChild(3).childCount; i++) { ServiceStation.transform.GetChild(3).GetChild(i).gameObject.SetActive(false); } ServiceStation.GetComponent <Animator>().SetTrigger("Stop"); } if (remainingTime < 0) { paused = true; Finisher(true); } if (ui) { Color blue = ui.transform.GetChild(6).GetChild(0).GetComponent <Image>().color; if (isItAvaiable()) { blue.a = 1; ui.transform.GetChild(6).GetChild(0).GetComponent <Image>().color = blue; ui.transform.GetChild(6).GetComponent <BasicButton>().enabled = true; } else { blue.a = 0.2f; ui.transform.GetChild(6).GetChild(0).GetComponent <Image>().color = blue; ui.transform.GetChild(6).GetComponent <BasicButton>().enabled = false; } } }
private void Save(string action) { try { ServiceStation serviceStation = new ServiceStation(); ResultServiceStations resultServiceStations = new ResultServiceStations(); string bodyString = ""; string serviceStationJS = ""; string returnMessage = ""; Cursor.Current = Cursors.WaitCursor; HttpClient client = new HttpClient(); client.Timeout = TimeSpan.FromMinutes(15); string urlParameters = ""; string URL = ""; HttpResponseMessage response = new HttpResponseMessage(); // Validations Rules .... if (EnablePDFCheckBox.Checked) { if (string.IsNullOrEmpty(WatchFolderComboBox.Text) || string.IsNullOrEmpty(TargetFolderComboBox.Text)) { //continueOperation = false; toolTip1.ToolTipTitle = "Warning ..."; if (string.IsNullOrEmpty(WatchFolderComboBox.Text)) { toolTip1.Show("You need to set a value for the Watch Folder.", WatchFolderComboBox, 5000); } else { toolTip1.Show("You need to set a value for the Watch Folder.", TargetFolderComboBox, 5000); } return; } if (WatchFolderComboBox.Text == TargetFolderComboBox.Text) { // Do nothing // For PDF Conversion, Watch Folder and Target Folder could be the same } if (EnableWeekendCheckBox.Checked) { if (WeekendStartDateTimePicker.Value >= WeekendEndDateTimePicker.Value) { toolTip1.ToolTipTitle = "Invalid Range."; WeekendStartDateTimePicker.Focus(); toolTip1.Show("Invalid Range Values. Begin Time must be less than End Time value.", WeekendStartDateTimePicker, 5000); WeekendStartDateTimePicker.Focus(); WeekendStartDateTimePicker.Select(); return; } } if (EnableWorkdayCheckBox.Checked) { if (WorkdayStartDateTimePicker.Value >= WorkdayEndDateTimePicker.Value) { toolTip1.ToolTipTitle = "Invalid Range."; WorkdayStartDateTimePicker.Focus(); toolTip1.Show("Invalid Range Values. Begin Time must be less than End Time value.", WorkdayStartDateTimePicker, 5000); WorkdayStartDateTimePicker.Focus(); WorkdayStartDateTimePicker.Select(); return; } } if (string.IsNullOrEmpty(MaxNumBatchesUpDown.Text)) { toolTip1.ToolTipTitle = "Warning ..."; toolTip1.Show("You need to set a value for the Max Number of Batches to be processed for this PDF Station.", MaxNumBatchesUpDown, 5000); return; } else { if (Convert.ToInt32(MaxNumBatchesUpDown.Text) == 0) { toolTip1.ToolTipTitle = "Warning ..."; toolTip1.Show("Max Number of Batches cannot be 0.", MaxNumBatchesUpDown, 5000); return; } } // Set PDF fields for Update/New transaction serviceStation.PDFStationFlag = true; serviceStation.MaxNumberBatches = Convert.ToInt32(MaxNumBatchesUpDown.Text); serviceStation.WeekendFlag = EnableWeekendCheckBox.Checked; serviceStation.WeekendStartTime = Convert.ToString(WeekendStartDateTimePicker.Value); serviceStation.WeenkendEndTime = Convert.ToString(WeekendEndDateTimePicker.Value); serviceStation.WorkdayFlag = EnableWorkdayCheckBox.Checked; serviceStation.WorkdayStartTime = Convert.ToString(WorkdayStartDateTimePicker.Value); serviceStation.WorkdayEndTime = Convert.ToString(WorkdayEndDateTimePicker.Value); ComboBoxItem comboItem = (ComboBoxItem)WatchFolderComboBox.SelectedItem; serviceStation.WatchFolderID = Convert.ToInt32(comboItem.Tag); comboItem = (ComboBoxItem)TargetFolderComboBox.SelectedItem; serviceStation.TargetFolderID = Convert.ToInt32(comboItem.Tag); } else { // reset PDF fields for Update/New transaction serviceStation.PDFStationFlag = false; serviceStation.MaxNumberBatches = 0; serviceStation.WeekendFlag = false; serviceStation.WeekendStartTime = ""; serviceStation.WeenkendEndTime = ""; serviceStation.WorkdayFlag = false; serviceStation.WorkdayStartTime = ""; serviceStation.WorkdayEndTime = ""; serviceStation.WatchFolderID = 0; serviceStation.TargetFolderID = 0; serviceStation.BackupFolderID = 0; } serviceStation.StationName = StationNameTextBox.Text; // Check if Service Station Name if and only if the Transactioon type is "New Service Sttaion" if (Data.GlovalVariables.transactionType == "New") { // Get Service Stations URL = BaseURL + "GeneralSettings/GetServiceStations"; urlParameters = ""; client.BaseAddress = new Uri(URL); response = client.GetAsync(urlParameters).Result; using (HttpContent content = response.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultServiceStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); } if (response.IsSuccessStatusCode) { if (resultServiceStations.RecordsCount != 0) { foreach (var item in resultServiceStations.ReturnValue) { if (StationNameTextBox.Text == item.StationName.Trim()) { // Station Name Found toolTip1.ToolTipTitle = "Warning ..."; toolTip1.Show("The Service Station Name entered already exist in the Database.", StationNameTextBox, 5000); return; } } } else { // The Station Name enter does not exist in the Database // so continue } } else { MessageBox.Show("Error:" + "\r\n" + resultServiceStations.Message.Replace(". ", "\r\n") + resultServiceStations.Message, "New Service Station Transaction ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Add service station to the Database serviceStationJS = JsonConvert.SerializeObject(serviceStation, Newtonsoft.Json.Formatting.Indented); URL = BaseURL + "GeneralSettings/NewServiceStation"; bodyString = "'" + serviceStationJS + "'"; HttpContent body_for_new = new StringContent(bodyString); body_for_new.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response_for_new = client.PostAsync(URL, body_for_new).Result; using (HttpContent content = response_for_new.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultServiceStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); } if (response_for_new.IsSuccessStatusCode) { // Set the value of the new Field to a gloval variable if (resultServiceStations.ReturnCode == -1) { MessageBox.Show("Warning:" + "\r\n" + resultServiceStations.Message.Replace(". ", "\r\n"), "New Service Station Transaction ...", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Data.GlovalVariables.newServiceStaionList.Add(serviceStation.StationName); if (action == "SaveAndExit") { this.Close(); } else { ClearForm(); } } } else { MessageBox.Show("Error:" + "\r\n" + resultServiceStations.Message.Replace(". ", "\r\n") + resultServiceStations.Exception, "New Service Station Transaction ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { // Transaction Type = Update // Update Service station information serviceStation.StationID = Data.GlovalVariables.currentServiceStationID; serviceStationJS = JsonConvert.SerializeObject(serviceStation, Newtonsoft.Json.Formatting.Indented); URL = BaseURL + "GeneralSettings/UpdateServiceStation"; bodyString = "'" + serviceStationJS + "'"; HttpContent body_for_new = new StringContent(bodyString); body_for_new.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response_for_update = client.PostAsync(URL, body_for_new).Result; using (HttpContent content = response_for_update.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultServiceStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); } if (response_for_update.IsSuccessStatusCode) { if (action == "SaveAndExit") { this.Close(); } else { // Do nothing } } else { MessageBox.Show("Error:" + "\r\n" + resultServiceStations.Message.Replace(". ", "\r\n"), "Update Service Station Transaction ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { //MainForm.ErrorMessage(ex); nlogger.Fatal(General.ErrorMessage(ex)); MessageBox.Show(General.ErrorMessage(ex), "Error ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadData() { //StationsListView.Items.Clear(); string returnMessage = ""; Cursor.Current = Cursors.WaitCursor; HttpClient client = new HttpClient(); client.Timeout = TimeSpan.FromMinutes(15); string urlParameters = ""; string URL = ""; HttpResponseMessage response = new HttpResponseMessage(); // Get Working Folders ResultWorkingFolders resultWorkingFolders = new ResultWorkingFolders(); URL = BaseURL + "GeneralSettings/GetWorkingFolders"; urlParameters = ""; client.BaseAddress = new Uri(URL); response = client.GetAsync(urlParameters).Result; using (HttpContent content = response.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultWorkingFolders = JsonConvert.DeserializeObject <ResultWorkingFolders>(returnMessage); } // Add Watch and target folders in Combo Boxes if (resultWorkingFolders.RecordsCount != 0) { foreach (var item in resultWorkingFolders.ReturnValue) { WatchFolderComboBox.Items.Add(new ComboBoxItem(Convert.ToString(item.FolderID), item.Path)); TargetFolderComboBox.Items.Add(new ComboBoxItem(Convert.ToString(item.FolderID), item.Path)); } } if (Data.GlovalVariables.transactionType == "New") { StationNameTextBox.Enabled = true; } else { StationNameTextBox.Enabled = false; // Get Current Service Information client = new HttpClient(); client.Timeout = TimeSpan.FromMinutes(15); URL = Data.GlovalVariables.BaseURL + "GeneralSettings/GetServiceStationByID"; urlParameters = "?stationID=" + Data.GlovalVariables.currentServiceStationID; client.BaseAddress = new Uri(URL); response = client.GetAsync(urlParameters).Result; if (response.IsSuccessStatusCode) { using (HttpContent content = response.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; ResultServiceStations resultServiceStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); if (resultServiceStations.ReturnCode == 0) { ServiceStation station = new ServiceStation(); station = resultServiceStations.ReturnValue.First(); originalServiceStation = station; StationNameTextBox.Text = station.StationName; if (station.PDFStationFlag) { PDFGroupBox.Enabled = true; EnablePDFCheckBox.Checked = true; } else { PDFGroupBox.Enabled = false; EnablePDFCheckBox.Checked = false; } MaxNumBatchesUpDown.Text = Convert.ToString(station.MaxNumberBatches); if (station.WeekendFlag) { EnableWeekendCheckBox.Checked = true; WeekendStartDateTimePicker.Value = Convert.ToDateTime(station.WeekendStartTime); WeekendEndDateTimePicker.Value = Convert.ToDateTime(station.WeenkendEndTime); } else { EnableWeekendCheckBox.Checked = false; WeekendStartDateTimePicker.ResetText(); WeekendStartDateTimePicker.Enabled = false; WeekendEndDateTimePicker.ResetText(); WeekendEndDateTimePicker.Enabled = false; } if (station.WorkdayFlag) { EnableWorkdayCheckBox.Checked = true; WorkdayStartDateTimePicker.Value = Convert.ToDateTime(station.WorkdayStartTime); WorkdayEndDateTimePicker.Value = Convert.ToDateTime(station.WorkdayEndTime); } else { EnableWorkdayCheckBox.Checked = false; WorkdayStartDateTimePicker.ResetText(); WorkdayStartDateTimePicker.Enabled = false; WorkdayEndDateTimePicker.ResetText(); WorkdayEndDateTimePicker.Enabled = false; } foreach (ComboBoxItem item in WatchFolderComboBox.Items) { if (item.Tag == Convert.ToString(station.WatchFolderID)) { WatchFolderComboBox.Text = item.Text; break; } } foreach (ComboBoxItem item in TargetFolderComboBox.Items) { if (item.Tag == Convert.ToString(station.TargetFolderID)) { TargetFolderComboBox.Text = item.Text; break; } } } } } else { MessageBox.Show("Error:" + "\r\n" + response.ReasonPhrase + "\r\n" + response.RequestMessage, "Transaction Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }