// Creates a new report... private bool createReport(HttpContext context) { int value; long agentID; bool noError = Int32.TryParse(context.Request.Params["reportType"], out value); ReportType reportType = (ReportType)value; GenericReport report = null; ajaxResponse = new AjaxResponse(); switch (reportType) { case ReportType.SHIFT_REPORT: report = new ShiftReport(); ajaxResponse.message = "Shift Report Ready"; ajaxResponse.contents = report.encodeHTMLReport(campaign, startDate, endDate, startTime, endTime); ajaxResponse.error = report.error; break; case ReportType.CALL_HISTORY_BY_PHONE_REPORT: CallHistoryByPhoneReport phoneReport = new CallHistoryByPhoneReport(); phoneReport.PhoneNumber = context.Request.Params["phonenumber"]; ajaxResponse.message = "Call History By Phone Report Ready"; ajaxResponse.contents = phoneReport.encodeHTMLReport(campaign, startDate, endDate, startTime, endTime); ajaxResponse.error = phoneReport.error; break; case ReportType.CALL_HISTORY_BY_AGENT_REPORT: CallHistoryByAgentReport agentReport = new CallHistoryByAgentReport(); Int64.TryParse(context.Request.Params["agentid"], out agentID); agentReport.AgentID = agentID; ajaxResponse.message = "Call History By Agent Report Ready"; ajaxResponse.contents = agentReport.encodeHTMLReport(campaign, startDate, endDate, startTime, endTime); ajaxResponse.error = agentReport.error; break; case ReportType.SUMMARIZED_RESULTS_REPORT: SummarizedAgentResultsReport summaryReport = new SummarizedAgentResultsReport(); Int64.TryParse(context.Request.Params["agentid"], out agentID); summaryReport.AgentID = agentID; ajaxResponse.message = "Summarized Agents Dialer Results Report Ready"; ajaxResponse.contents = summaryReport.encodeHTMLReport(campaign, startDate, endDate, startTime, endTime); ajaxResponse.error = summaryReport.error; break; case ReportType.AGENTS_DIALER_RESULTS_REPORT: AgentsDialerResultsReport dialerResultsReport = new AgentsDialerResultsReport(); Int64.TryParse(context.Request.Params["agentid"], out agentID); dialerResultsReport.AgentID = agentID; dialerResultsReport.CampaignID = campaignID; ajaxResponse.message = "Agents Dialer Results Report Ready"; ajaxResponse.contents = dialerResultsReport.encodeHTMLReport(campaign, startDate, endDate, startTime, endTime); ajaxResponse.error = dialerResultsReport.error; break; default: noError = false; break; } return(noError); }
private async Task <ShiftReport> AddShiftReport( PrototypeShiftReportResourceParameter parameter ) { await using var transaction = await _context.Database .BeginTransactionAsync() .ConfigureAwait(false); try { var shiftDate = await GetCurrentShiftDate(parameter.Shift).ConfigureAwait(false); var entity = new ShiftReport { MachineId = parameter.MachineId, ShiftDate = shiftDate, Shift = parameter.Shift, Timestamp = DateTime.Now }; await _context.ShiftReports.AddAsync(entity).ConfigureAwait(false); await transaction.CommitAsync().ConfigureAwait(false); await _context.SaveChangesAsync().ConfigureAwait(false); return(entity); } catch (Exception e) { await transaction.RollbackAsync().ConfigureAwait(false); throw new Exception(e.Message); } }
private void FillReportInfo() { DateTime from = new DateTime(_CurrentDateTimeSetter.Year, _CurrentDateTimeSetter.Month, _CurrentDateTimeSetter.Day, 0, 0, 0); DateTime to = new DateTime(_CurrentDateTimeSetter.Year, _CurrentDateTimeSetter.Month, _CurrentDateTimeSetter.Day, 23, 59, 59); ShiftReport shiftReport = OperationsBlo.GetSpecificShiftReport(from, to); if (shiftReport != null) { cb476.Checked = shiftReport.IsDamaged476; cb477.Checked = shiftReport.IsDamaged477; cb478.Checked = shiftReport.IsDamaged478; cb479.Checked = shiftReport.IsDamaged479; cb480.Checked = shiftReport.IsDamaged480; cb443.Checked = shiftReport.IsDamaged443; nuSoinAuCentre.Value = (decimal)shiftReport.SoinAuCentre; nuRescuerNumber.Value = (decimal)shiftReport.NumberOfRescuers; nuTeamNumber.Value = (decimal)shiftReport.NumberOfTeams; bool teamLeaderFound = false; foreach (Rescuer teamLeader in _TeamLeaders) { if (teamLeader.Id == (int)shiftReport.IdTeamLeader) { teamLeaderFound = true; } } if (teamLeaderFound) { ddlTeamLeader.SelectedValue = (int)shiftReport.IdTeamLeader; } txtNotes.Text = shiftReport.Notes; } else { cb476.Checked = false; cb477.Checked = false; cb478.Checked = false; cb479.Checked = false; cb480.Checked = false; cb443.Checked = false; nuRescuerNumber.Value = 0; nuTeamNumber.Value = 0; ddlTeamLeader.SelectedValue = -1; txtNotes.Text = string.Empty; } }
private static void HandleTimer(Object source, ElapsedEventArgs e) { DateTime now = DateTime.Now; DateTime rangeFrom = new DateTime(now.Year, now.Month, now.Day, 17, 45, 0); DateTime rangeTo = new DateTime(now.Year, now.Month, now.Day, 18, 10, 0); if (now >= rangeFrom && now <= rangeTo) { //17:45 - 18:10 This is the time range to prompt user to fill out the shift report information DateTime from = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0); DateTime to = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59); ShiftReport dailyShiftReport = OperationsBlo.GetSpecificShiftReport(from, to); if (dailyShiftReport == null) { bool isDailyReportEditFormOpened = false; FormCollection formCollection = Application.OpenForms; foreach (Form form in formCollection) { if (form.Name == "DailyReportEdit") { isDailyReportEditFormOpened = true; } } //If the form DailyReportEdit is not open, open it and prompt user to fill report if (isDailyReportEditFormOpened == false) { DailyReportEdit dailyReportEdit = new DailyReportEdit(); dailyReportEdit.ShowDialog(); //MessageBox.Show("الرجاء تعبئة التقرير اليومي", "تذكير", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void FillDailyShiftReport() { string teamLeader = string.Empty; lblShiftReportDate.Text = _CurrentDateTimeSetter.ToLongDateString(); DateTime from = new DateTime(_CurrentDateTimeSetter.Year, _CurrentDateTimeSetter.Month, _CurrentDateTimeSetter.Day, 0, 0, 0); DateTime to = new DateTime(_CurrentDateTimeSetter.Year, _CurrentDateTimeSetter.Month, _CurrentDateTimeSetter.Day, 23, 59, 59); ShiftReport dailyShiftReport = OperationsBlo.GetSpecificShiftReport(from, to); if (dailyShiftReport != null) { if (dailyShiftReport.IsDamaged476) { cb476.BackColor = System.Drawing.Color.Coral; } else { cb476.BackColor = SystemColors.ControlLightLight; } if (dailyShiftReport.IsDamaged477) { cb477.BackColor = System.Drawing.Color.Coral; } else { cb477.BackColor = SystemColors.ControlLightLight; } if (dailyShiftReport.IsDamaged478) { cb478.BackColor = System.Drawing.Color.Coral; } else { cb478.BackColor = SystemColors.ControlLightLight; } if (dailyShiftReport.IsDamaged479) { cb479.BackColor = System.Drawing.Color.Coral; } else { cb479.BackColor = SystemColors.ControlLightLight; } if (dailyShiftReport.IsDamaged480) { cb480.BackColor = System.Drawing.Color.Coral; } else { cb480.BackColor = SystemColors.ControlLightLight; } if (dailyShiftReport.IsDamaged443) { cb443.BackColor = System.Drawing.Color.Coral; } else { cb443.BackColor = SystemColors.ControlLightLight; } txtNumberOfRescuers.Text = dailyShiftReport.NumberOfRescuers.ToString(); txtNumberOfTeams.Text = dailyShiftReport.NumberOfTeams.ToString(); try { var oTeamLeader = _TeamLeaders.First(a => a.Id == dailyShiftReport.IdTeamLeader); if (oTeamLeader != null) { teamLeader = oTeamLeader.Name + " " + oTeamLeader.LastName; } } catch (Exception ex) { teamLeader = OperationsBlo.GetTeamLeaderName(dailyShiftReport.IdTeamLeader); } txtTeamLeader.Text = teamLeader; txtNotes.Text = dailyShiftReport.Notes; } else { cb476.BackColor = SystemColors.ControlLightLight; cb477.BackColor = SystemColors.ControlLightLight; cb478.BackColor = SystemColors.ControlLightLight; cb479.BackColor = SystemColors.ControlLightLight; cb480.BackColor = SystemColors.ControlLightLight; cb443.BackColor = SystemColors.ControlLightLight; txtNumberOfRescuers.Text = string.Empty; txtNumberOfTeams.Text = string.Empty; txtTeamLeader.Text = string.Empty; txtNotes.Text = string.Empty; } }
private void btnSave_Click(object sender, EventArgs e) { ShiftReport shiftReport; bool thereIsMissingInfo = false; int idTeamLeader = 0, numberOfRescuers = 0, numberOfTeams = 0, soinAuCentre = 0; while (thereIsMissingInfo == false) { int.TryParse(ddlTeamLeader.SelectedValue.ToString(), out idTeamLeader); if (idTeamLeader == -1) { thereIsMissingInfo = true; break; } int.TryParse(nuRescuerNumber.Value.ToString(), out numberOfRescuers); if (numberOfRescuers < 3) { thereIsMissingInfo = true; break; } int.TryParse(nuTeamNumber.Value.ToString(), out numberOfTeams); if (numberOfTeams < 1) { thereIsMissingInfo = true; break; } //Should break by default, so it goes one time through the loop break; } //bkassine - ghabbatieh (youssef naser) - cervical trauma int.TryParse(nuSoinAuCentre.Value.ToString(), out soinAuCentre); if (thereIsMissingInfo == false) { //If no missing Info, Add/Update shift report record shiftReport = new ShiftReport(); shiftReport.ShiftDate = _CurrentDateTimeSetter; shiftReport.IsDamaged476 = cb476.Checked; shiftReport.IsDamaged477 = cb477.Checked; shiftReport.IsDamaged478 = cb478.Checked; shiftReport.IsDamaged479 = cb479.Checked; shiftReport.IsDamaged480 = cb480.Checked; shiftReport.IsDamaged443 = cb443.Checked; shiftReport.SoinAuCentre = soinAuCentre; shiftReport.NumberOfRescuers = numberOfRescuers; shiftReport.NumberOfTeams = numberOfTeams; shiftReport.IdTeamLeader = idTeamLeader; shiftReport.Notes = txtNotes.Text.Trim(); OperationsBlo.AddOrUpdateShiftReport(shiftReport); //Close the form this.Close(); } else { MessageBox.Show("الرجاء تعبئة كل المعلومات", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }