public void ReceiveRequest(string globalId, string receivedNotes) { var rows = _tpr.TechnologyProblemsTable.AsEnumerable().Where(r => r.Field <string>("GlobalID") == globalId); if (!rows.Any()) { return; } var techProblem = rows.First(); var techProblemId = Convert.ToInt32(techProblem["TechnologyProblemID"]); var receivedDate = App.BaseClass.GetDateFromSqlServer(); var receiverWorkerId = AdministrationClass.CurrentWorkerId; _tpr.FillReceivedInfo(techProblemId, receivedDate, receiverWorkerId, receivedNotes); AdministrationClass.AddNewAction(18); var requestDate = Convert.ToDateTime(techProblem["RequestDate"]); var requestWorkerId = Convert.ToInt32(techProblem["RequestWorkerID"]); var workerName = new IdToNameConverter().Convert(receiverWorkerId, typeof(string), "ShortName", new CultureInfo("ru-RU")) .ToString(); var newsText = string.Format(ReceivedText, workerName, receivedDate); NewsHelper.AddTextToNews(requestDate, requestWorkerId, newsText); }
private void AddCompletionInfo(DataRow dataRow) { var crashMachineId = Convert.ToInt32(dataRow["TechnologyProblemID"]); var completionDate = App.BaseClass.GetDateFromSqlServer(); string completionNote = null; if (!string.IsNullOrEmpty(CompletEditNoteTextBox.Text)) { completionNote = CompletEditNoteTextBox.Text; } _tpr.CompleteRequest(crashMachineId, completionDate, _curWorkerId, completionNote); AdministrationClass.AddNewAction(19); var requestDate = Convert.ToDateTime(dataRow["RequestDate"]); var requestWorkerId = Convert.ToInt32(dataRow["RequestWorkerID"]); var workerName = _workerNameConverter.Convert(_curWorkerId, typeof(string), "ShortName", new CultureInfo("ru-RU")) .ToString(); var newsText = string.Format(RequestClosedText, workerName, completionDate); NewsHelper.AddTextToNews(requestDate, requestWorkerId, newsText); _mw = Window.GetWindow(this) as MainWindow; if (_mw != null) { var techProbPage = _mw.MainFrame.Content as XamlFiles.TechnologyProblemPage; if (techProbPage != null) { techProbPage.OpenPopup(dataRow["GlobalID"]); } } }
//private void AddReceivedInfo(DataRow dataRow) //{ // int crashMachineId = Convert.ToInt32(dataRow["CrashMachineID"]); // DateTime receivedDate = App.BaseClass.GetDateFromSqlServer(); // string receivedNote = null; // if (!string.IsNullOrEmpty(receivedEditNoteTextBox.Text)) // receivedNote = receivedEditNoteTextBox.Text; // _sec.FillReceivedInfo(crashMachineId, receivedDate, _curWorkerId, receivedNote); // var requestDate = Convert.ToDateTime(dataRow["RequestDate"]); // var requestWorkerId = Convert.ToInt32(dataRow["RequestWorkerID"]); // string workerName = string.Empty; // workerName = // _workerNameConverter.Convert(_curWorkerId, typeof (string), "ShortName", new CultureInfo("ru-RU")) // .ToString(); // var newsText = string.Format(ReceivedText, workerName, receivedDate); // NewsHelper.AddTextToNews(requestDate, requestWorkerId, newsText); //} //private void AddCompletionInfo(DataRow dataRow) //{ // int crashMachineId = Convert.ToInt32(dataRow["CrashMachineID"]); // DateTime completionDate = App.BaseClass.GetDateFromSqlServer(); // string completionNote = null; // if (!string.IsNullOrEmpty(completEditNoteTextBox.Text)) // completionNote = completEditNoteTextBox.Text; // _sec.FillCompletionInfo(crashMachineId, completionDate, _curWorkerId, completionNote); // var requestDate = Convert.ToDateTime(dataRow["RequestDate"]); // var requestWorkerId = Convert.ToInt32(dataRow["RequestWorkerID"]); // string workerName = string.Empty; // workerName = _workerNameConverter.Convert(_curWorkerId, typeof(string), "ShortName", new CultureInfo("ru-RU")).ToString(); // var newsText = string.Format(RequestClosedText, workerName, completionDate); // NewsHelper.AddTextToNews(requestDate, requestWorkerId, newsText); //} private void AddLaunchInfo(DataRow dataRow) { var crashMachineId = Convert.ToInt32(dataRow["CrashMachineID"]); var launchDate = App.BaseClass.GetDateFromSqlServer(); string launchNote = null; if (!string.IsNullOrEmpty(launchEditNoteTextBox.Text)) { launchNote = launchEditNoteTextBox.Text; } _sec.FillLaunchInfo(crashMachineId, launchDate, _curWorkerId, launchNote); AdministrationClass.AddNewAction(11); var requestDate = Convert.ToDateTime(dataRow["RequestDate"]); var requestWorkerId = Convert.ToInt32(dataRow["RequestWorkerID"]); var workerName = _workerNameConverter.Convert(_curWorkerId, typeof(string), "ShortName", new CultureInfo("ru-RU")) .ToString(); var newsText = string.Format(RequestClosedText, workerName, launchDate); NewsHelper.AddTextToNews(requestDate, requestWorkerId, newsText); _mw = Window.GetWindow(this) as MainWindow; if (_mw != null) { var servEquipPage = _mw.MainFrame.Content as XamlFiles.ServiceEquipmentPage; if (servEquipPage != null) { servEquipPage.OpenPopup(dataRow["GlobalID"]); } } }
private void OnDontConfirmWorkerRequestButtonClick(object sender, RoutedEventArgs e) { var workerRequestId = Convert.ToInt64(_workerRequest["WorkerRequestID"]); var currentDate = App.BaseClass.GetDateFromSqlServer(); var mainWorkerNotes = !string.IsNullOrEmpty(MainWorkerNotesTextBox.Text) ? MainWorkerNotesTextBox.Text : null; _workerRequestsClass.SetConfirmationInfo(workerRequestId, mainWorkerNotes, false, currentDate); AdministrationClass.AddNewAction(83); var creationDate = Convert.ToDateTime(_workerRequest["CreationDate"]); var workerId = Convert.ToInt64(_workerRequest["WorkerID"]); var newsText = string.Format("\n\nЗаявка откланена: {0} дата: {1} \nПримечание: {2}", new IdToNameConverter().Convert(AdministrationClass.CurrentWorkerId, "ShortName"), currentDate, string.IsNullOrEmpty(mainWorkerNotes) ? "отсутствует" : mainWorkerNotes); NewsHelper.AddTextToNews(creationDate, (int)workerId, newsText); OnClosePageButtonClick(null, null); }