public void ActionOnReport(int? expenseId, Employee employee,ReportStatus status) { //IEmployeeService employeeService = new EmployeeService(); //Employee employee = employeeService.GetEmployee((int)Membership.GetUser().ProviderUserKey); using (EMEntitiesContext ctx = new EMEntitiesContext()) { var report = (from ExpReport in ctx.ExpenseReports where ExpReport.ExpenseId == expenseId select ExpReport).FirstOrDefault(); //if (action == "Approve") //{ report.ApprovedDate = DateTime.Now; //report.Status = "ApprovedBySupervisor"; report.Status = status.ToString(); report.ApprovedById = employee.UserId; ctx.SaveChanges(); //} //else //{ // report.ApprovedDate = DateTime.Now; // report.Status = "RejectedBySupervisor"; // report.ApprovedById = employee.UserId; // ctx.SaveChanges(); //} } }
/// <summary> /// Get all ReportList of specified Status /// </summary> /// <param name="reportStatus"></param> /// <returns></returns> public List<Report> GetReportsOfStatus(ReportStatus reportStatus) { Console.WriteLine("Retreiving reports of type: " + reportStatus); const int take = 100; var skip = 0; var reports = new List<Report>(); var done = false; do { var response = Client.Send<GetReportsResponse>(new GetReports { ReportStatus = reportStatus, Skip = skip, Take = take }); reports.AddRange(response.Reports); skip += take; // Unless we get the same number of reports back as requested by take, we can assume we are done. if (response.Reports.Length != take) done = true; } while (!done); return reports; }
/// <summary> /// Initializes a new instance of the <see cref="AdvancedMessageBox"/> class. /// </summary> /// <param name="message">The message.</param> /// <param name="reportStatus">The report status.</param> /// <param name="isYesorNo">if set to <c>true</c> [is yesor no].</param> public InformationBox(string message, ReportStatus reportStatus, string headerText) : this() { message = message.Replace(".", ".\n"); this.richTextBox1.Text = message; this.label1.Text = headerText; this.pictureBox1.Image = imageList1.Images[(int)reportStatus]; }
public ScanFileMonitor(ReportStatus reportStatusFn, ScanDocHandler scanDocHandler) { _reportStatusFn = reportStatusFn; _scanDocHandler = scanDocHandler; // Monitor thread _bwFileMonitorThread = new BackgroundWorker(); _bwFileMonitorThread.WorkerSupportsCancellation = true; _bwFileMonitorThread.WorkerReportsProgress = true; _bwFileMonitorThread.DoWork += new DoWorkEventHandler(FileMonitorThread_DoWork); }
/// <summary> /// Initializes a new instance of the <see cref="AdvancedMessageBox"/> class. /// </summary> /// <param name="message">The message.</param> /// <param name="reportStatus">The report status.</param> /// <param name="isYesorNo">if set to <c>true</c> [is yesor no].</param> public AdvancedMessageBox(string message, ReportStatus reportStatus, bool isYesorNo = false) : this() { message = message.Replace(".", ".\n"); if (message.Length > 80) { this.Width += 60; } this.lblMessage.Text = message; this.pictureBox1.Image = imageList1.Images[(int)reportStatus]; if (isYesorNo) { this.btnOk.Text = "&Yes"; this.btnNo.Visible = true; } }
public ScanDocHandler(ReportStatus reportStatusFn, DocTypesMatcher docTypesMatcher, ScanDocHandlerConfig scanConfig, string dbConnectionStr) { // Setup _reportStatusFn = reportStatusFn; _docTypesMatcher = docTypesMatcher; _scanConfig = scanConfig; // Init db InitDatabase(dbConnectionStr); // Create info cache etc _scanDocInfoCache = new ScanDocInfoCache(this); _scanDocLikelyDocType = new ScanDocLikelyDocType(this, _docTypesMatcher); // Init the background worker used for processing docs _fileProcessBkgndWorker.WorkerSupportsCancellation = true; _fileProcessBkgndWorker.WorkerReportsProgress = true; _fileProcessBkgndWorker.DoWork += new DoWorkEventHandler(FileProcessDoWork); _fileProcessBkgndWorker.ProgressChanged += new ProgressChangedEventHandler(FileProcessProgressChanged); _fileProcessBkgndWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(FileProcessRunWorkerCompleted); }
public void Log(ReportStatus status, string logReport) { _test.Log(GetLogStatus(status), logReport); }
/// <summary> /// Add rows to the People report /// </summary> /// <param name="writer">Writer to write the CSV rows to</param> public void PeopleReport(ArrayList SetnbsToSkip, StreamWriter writer, ReportStatus StatusCallback, ReportMessage MessageCallback) { // Write the header row -- this must be generated dynamically // based on the values in PeopleReportSections // write the keys writer.Write("setnb,year"); // write a set of column names for each element in PeopleReportSections for (int i = 0; i < PeopleReportSections.Length; i++) { string values = PeopleReportSections[i].ToLower().Trim(); string[] BaseColumnNames = { "pubcount", "wghtd_pubcount", "pubcount_pos1", "wghtd_pubcount_pos1", "pubcount_posN", "wghtd_pubcount_posN", "pubcount_posM", "wghtd_pubcount_posM", "pubcount_posNTL", "wghtd_pubcount_posNTL", "pubcount_pos2", "wghtd_pubcount_pos2" }; if (values == "all") { // all bins -- use the base column names as-is writer.Write("," + String.Join(",", BaseColumnNames)); } else { // string any +'s from the value type, so "1+2+3" turns into "123" values = values.Replace("+", ""); // replace pubcount_posM with 123pubcount_posM // replace wghtd_pubcount_pos1 with wghtd_123pubcount_pos1 for (int j = 0; j < BaseColumnNames.Length; j++) { string Column; if (BaseColumnNames[j].Contains("wghtd_")) { Column = BaseColumnNames[j].Replace("wghtd_", "wghtd_" + values); } else { Column = values + BaseColumnNames[j]; } writer.Write("," + Column); } } } writer.WriteLine(); // Write the row for each person People people = new People(DB, PeopleTable); int Total = people.PersonList.Count; int Number = 0; foreach (Person person in people.PersonList) { Number++; StatusCallback(Number, Total, person, false); // Skip the person if the Setnb is in SetnbsToSkip if ((SetnbsToSkip == null) || (!SetnbsToSkip.Contains(person.Setnb))) { // Get the person's publications. If there are no publications for // the person, this will throw an error. Publications pubs; try { pubs = new Publications(DB, person, PeoplePublicationsTable, false); } catch (Exception ex) { MessageCallback(ex.Message); pubs = null; } // Sort the list of publications if (pubs != null) { PublicationComparer Comparer = new PublicationComparer(); Comparer.DB = DB; Comparer.person = person; Comparer.publicationTypes = PubTypes; Array.Sort(pubs.PublicationList, Comparer); // Find the minimum and maximum years int YearMinimum = pubs.PublicationList[0].Year; int YearMaximum = pubs.PublicationList[0].Year; if (pubs.PublicationList != null) { foreach (Publication pub in pubs.PublicationList) { if (pub.Year < YearMinimum) { YearMinimum = pub.Year; } if (pub.Year > YearMaximum) { YearMaximum = pub.Year; } } } // Write each row for (int Year = YearMinimum; Year <= YearMaximum; Year++) { StatusCallback(Year - YearMinimum, YearMaximum - YearMinimum, person, true); writer.WriteLine(ReportRow(person, pubs, Year)); } } } else { MessageCallback("Skipping " + person.Last + " (" + person.Setnb + ")"); } } }
public void SetStatus(string datakey, ReportStatus status, string detail) { int index = this.Find(datakey); this.SetStatus(index, status, datakey, detail); }
/// <inheritdoc/> protected void OnReportStatus(EventArgs e) { ReportStatus?.Invoke(this, e); }
private void TestReportActivity <TReport>(Func <IEmployer, bool> createActivity, bool sendToAccountManager, bool sendToClient, bool sendToSecondaryClients) where TReport : EmployerReport, new() { // Create everyone. var administrator = CreateAdministrator(); var organisation = CreateOrganisation(administrator.Id); var employer = CreateEmployer(organisation); // Define the report. var report = new TReport { ClientId = organisation.Id, SendToAccountManager = sendToAccountManager, SendToClient = sendToClient, }; _reportsCommand.CreateReport(report); // Create activity to report on. var isActivity = createActivity(employer); var status = new ReportStatus(report, isActivity); // No contact details set. if (sendToClient) { if (!sendToAccountManager) { // Check that no email is sent to the client if no contact details set. Execute(); _emailServer.AssertNoEmailSent(); } // Set the contact details. organisation.ContactDetails = new ContactDetails { FirstName = ClientFirstName, LastName = ClientLastName, EmailAddress = ClientEmail }; if (sendToSecondaryClients) { organisation.ContactDetails.SecondaryEmailAddresses = SecondaryClientEmail; } _organisationsCommand.UpdateOrganisation(organisation); } // Run the report. Execute(); MockEmail administratorEmail = null; MockEmail clientEmail = null; MockEmail secondaryClientEmail = null; var emails = _emailServer.GetEmails().ToList(); if (sendToAccountManager) { Assert.IsTrue(emails.Count > 0); administratorEmail = emails[0]; emails.RemoveAt(0); } if (sendToClient) { Assert.IsTrue(emails.Count > 0); clientEmail = emails[0]; emails.RemoveAt(0); } if (sendToSecondaryClients) { Assert.IsTrue(emails.Count > 0); secondaryClientEmail = emails[0]; emails.RemoveAt(0); } Assert.AreEqual(0, emails.Count); if (administratorEmail != null) { AssertAdministratorEmail(administratorEmail, administrator, organisation, status); } if (clientEmail != null) { AssertClientEmail(clientEmail, administrator, organisation, status); } if (secondaryClientEmail != null) { AssertSecondaryClientEmail(secondaryClientEmail, administrator, organisation, status); } }
public ReportMessage(bool success, string message, ReportStatus status) { this.Success = success; this.Message = message; this.Status = status; }
/// <summary> /// Thread pool callback used to ensure location COM API is instantiated from /// multi-thread apartment, and register for location events. /// </summary> /// <param name="state"></param> private void CreateHandler(object state) { lock (this.InternalSyncObject) { try { m_location = new COMLocation() as ILocation; } catch (COMException) { Utility.Trace("Failed to CoCreate ILocation COM object."); } if (null != m_location) { Utility.Trace("Successfully created ILocation COM object"); // // Mapping to platform accuracy // GeoPositionAccuracy desiredAccuracy = (GeoPositionAccuracy)state; DesiredAccuracy accuracy = (desiredAccuracy == GeoPositionAccuracy.Default) ? DesiredAccuracy.DefaultAccuracy : DesiredAccuracy.HighAccuracy; Guid reportKey = LocationReportKey.LatLongReport; m_location.SetDesiredAccuracy(ref reportKey, accuracy); // // Always listen for latlong reports // if (m_location.RegisterForReport(this, ref reportKey, 0) == 0) { m_latLongRegistered = true; } // // Check the latlong status. If latlong reports are not supported, then register // for civic address reports. // m_location.GetReportStatus(ref reportKey, ref m_latLongStatus); if (ReportStatus.NotSupported == m_latLongStatus) { reportKey = LocationReportKey.CivicAddressReport; if (m_location.RegisterForReport(this, ref reportKey, 0) == 0) { m_civicAddrRegistered = true; m_location.GetReportStatus(ref reportKey, ref m_civicAddrStatus); } } // // set the current status to the available report type status // ReportStatus status = (ReportStatus.NotSupported != m_latLongStatus) ? m_latLongStatus : m_civicAddrStatus; m_curStatus = m_geoStatusMap[(int)status]; ChangePermissionFromReportStatus(status); } else { m_curStatus = GeoPositionStatus.Disabled; } } }
public void ProcessReport(int? expenseId, Employee employee, ReportStatus status) { using (EMEntitiesContext ctx = new EMEntitiesContext()) { var report = (from ExpReport in ctx.ExpenseReports where ExpReport.ExpenseId == expenseId select ExpReport).FirstOrDefault(); report.ProcessedDate = DateTime.Now; report.Status = status.ToString(); report.ProcessedById = employee.UserId; ctx.SaveChanges(); } }
public void SetStatus(int index, ReportStatus status, string datakey, string detail) { if ((index >= 0) && ((this.Count > 0) && (index < this.Count))) { if (detail != null) { this.lstReport.Items[index].SubItems[this.clmDetail.Index].Text = detail; } if (datakey != null) { this.lstReport.Items[index].SubItems[this.clmDataKey.Index].Text = datakey; } this.UpdateStatus(index, status); } }
public override bool ImplementsAndHandledMessage(BadgerJaus.Messages.Message message, Component component) { switch (message.GetCommandCode()) { case JausCommandCode.CONFIRM_CONTROL: hasControl = true; // update the connection icon for the correct component to yellow and write to the logger if (destinationAddress.getComponent() == 1) connectionDetails.direct = ConnectionOption.AWAITING_STATUS; if (destinationAddress.getComponent() == 2) connectionDetails.remote = ConnectionOption.AWAITING_STATUS; if (destinationAddress.getComponent() == 3) connectionDetails.ai = ConnectionOption.AWAITING_STATUS; _eventAggregator.GetEvent<ConnectionDetailsEvent>().Publish(connectionDetails); _eventAggregator.GetEvent<LoggerEvent>().Publish("Control confirmed!"); return true; case JausCommandCode.REPORT_STATUS: ReportStatus status = new ReportStatus(); status.SetFromJausMessage(message); int sourceComponent = message.GetSource().getComponent(); // update the connection icon for the correct component to red or green accordingly if (sourceComponent == 1) { if (status.GetStatus() == (int)ComponentState.STATE_SHUTDOWN) { componentOneActive = false; connectionDetails.direct = ConnectionOption.DISCONNECTED; } else if (status.GetStatus() == (int)ComponentState.STATE_READY) { componentOneActive = true; connectionDetails.direct = ConnectionOption.CONNECTED; } } else if (sourceComponent == 2) { if (status.GetStatus() == (int)ComponentState.STATE_SHUTDOWN) { componentTwoActive = false; connectionDetails.remote = ConnectionOption.DISCONNECTED; } else if (status.GetStatus() == (int)ComponentState.STATE_READY) { componentTwoActive = true; connectionDetails.remote = ConnectionOption.CONNECTED; } } else if (sourceComponent == 3) { if (status.GetStatus() == (int)ComponentState.STATE_SHUTDOWN) { componentThreeActive = false; connectionDetails.ai = ConnectionOption.DISCONNECTED; } else if (status.GetStatus() == (int)ComponentState.STATE_READY) { componentThreeActive = true; connectionDetails.ai = ConnectionOption.CONNECTED; } } _eventAggregator.GetEvent<ConnectionDetailsEvent>().Publish(connectionDetails); // write to the console if there has been a change in isReady activity if (componentOneActive || componentTwoActive || componentThreeActive) { if (!isReady) _eventAggregator.GetEvent<LoggerEvent>().Publish("Component switched to online in BadgerControlDrive"); isReady = true; } else { if (isReady) _eventAggregator.GetEvent<LoggerEvent>().Publish("Component switched to offline in BadgerControlDrive"); isReady = false; } return true; default: return false; } }
public int StatusCount(ReportStatus status) { int num = 0; for (int i = 0; i < this.Count; i++) { if (status == ReportStatus.None) { if (string.IsNullOrEmpty(this.lstReport.Items[i].ImageKey)) { num++; } } else if (this.lstReport.Items[i].ImageKey == this.StatusImageKey(status)) { num++; } } return num; }
public void Add(string path, ReportStatus status, string datakey, string detail) { this.Add(path); int index = this.Count - 1; this.SetStatus(index, status, datakey, detail); }
private void UpdateStatus(int index, ReportStatus status) { this.lstReport.Items[index].ImageKey = this.StatusImageKey(status); this.lstReport.Items[index].SubItems[this.clmStatus.Index].Text = this.StatusString(status); }
/// <summary> /// Update Products Inventory ///<param name="Inventorytbl">Inventorytbl</param> ///<param name="userid">userid</param> ///<param name="reportid">reportid</param> ///<param name="recordtype">recordtype</param> ///<param name="status">status</param> /// </summary> /// <returns></returns> public static String UpdateProductInventoryData(DataTable Inventorytbl, Int32 userid, Int32 reportid, int recordtype, ReportStatus status, out String emailtoNotify) { String res = ""; emailtoNotify = ""; SqlCommand cmd = new SqlCommand(); try { cmd.CommandText = @"Sbsp_UpdateProductInventory"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@tblProducts", Inventorytbl); cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = userid; cmd.Parameters.Add("@ReportID", SqlDbType.Int).Value = reportid; cmd.Parameters.Add("@Status", SqlDbType.Int).Value = status; cmd.Parameters.Add("@RecordType", SqlDbType.Int).Value = recordtype; SqlParameter UserNotify = new SqlParameter("@Email", SqlDbType.VarChar, 100); UserNotify.Direction = ParameterDirection.Output; cmd.Parameters.Add(UserNotify); DataAccess.ExecuteScalarCommandForBulk(cmd); emailtoNotify = Convert.ToString(UserNotify.Value); } catch (SqlException ex) { res = ex.Message; LogAPI.WriteLog("UpdateProductInventoryData-" + reportid + ": " + ex.Message, userid.ToString()); } catch (Exception ex) { res = ex.Message; LogAPI.WriteLog("UpdateProductInventoryData-" + reportid + ": " + ex.Message, userid.ToString()); } finally { if (cmd != null) { cmd.Dispose(); } } return(res); }
private void StatusQueueTest(int numberOfProcesses, int processLimit, ReportStatus status) { }
public FormCamera(Context contxt, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus reportStatus, string typeFlag, string type, List <ReportElement> elementList) : base(contxt) { imageDownloadArray = new List <string>(); if (cameraPreviewView == null) { cameraPreviewView = new List <GridView>(); } else { for (int i = 0; i < cameraPreviewView.Count; i++) { if (IMAGE_PREVIEW_Header_ID + element.Id == cameraPreviewView[i].Id || IMAGE_PREVIEW_Info_ID + element.Id == cameraPreviewView[i].Id) { cameraPreviewView.RemoveAt(i); } } } if (cameraIndicatorView == null) { cameraIndicatorView = new List <ImageView>(); } else { for (int i = 0; i < cameraIndicatorView.Count; i++) { if (IMAGE_INDICATOR_ID + element.Id == cameraIndicatorView[i].Id) { cameraIndicatorView.RemoveAt(i); } } } imageJPGFile = new ImageFile(); context = contxt; resource = context.Resources; sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(context); sharedPreferencesEditor = sharedPreferences.Edit(); InitImageLoader(); LinearLayout imageLay = new LinearLayout(context); imageLay.Orientation = Orientation.Vertical; var addImageButton = new ImageButton(context); addImageButton.Id = element.Id; addImageButton.SetPadding(20, 5, 5, 5); RelativeLayout.LayoutParams paramsForImageButton = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); paramsForImageButton.AddRule(LayoutRules.AlignParentLeft); addImageButton.LayoutParameters = paramsForImageButton; GridView gridGallery = new ExpandingGrid(context); RelativeLayout.LayoutParams paramsForgridGallery = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent); paramsForgridGallery.AddRule(LayoutRules.Above, addImageButton.Id); gridGallery.LayoutParameters = paramsForgridGallery; gridGallery.SetNumColumns(6); List <CustomGallery> dataT = new List <CustomGallery>(); string sdCardPath2 = Environment.ExternalStorageDirectory.AbsolutePath; foreach (var VARIABLE in element.Values) { CustomGallery item = new CustomGallery(); item.SdCardPath = "/storage/emulated/0/Checkd/" + VARIABLE.Value; dataT.Add(item); String fileExist = Path.Combine(sdCardPath2, "Checkd/" + VARIABLE.Value); File existFile = new File(fileExist); if (!existFile.Exists()) { imageDownloadArray.Add(VARIABLE.Value); } } MultipleImageDownloader(imageDownloadArray); MiniGallerAdapter adapter = new MiniGallerAdapter(Application.Context, imageLoader); if (dataT.Count != 0) { adapter.AddAll(dataT); } gridGallery.Adapter = adapter; if (typeFlag == "Info") { int artificial_Preview_ID = IMAGE_PREVIEW_Info_ID + element.Id; gridGallery.Id = artificial_Preview_ID; cameraPreviewView.Add(gridGallery); } else { int artificial_header_Preview_ID = IMAGE_PREVIEW_Header_ID + element.Id; gridGallery.Id = artificial_header_Preview_ID; cameraPreviewView.Add(gridGallery); } gridGallery.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args) { List <CustomGallery> items = new List <CustomGallery>(); MiniGallerAdapter adapter3 = (MiniGallerAdapter)gridGallery.Adapter; items = adapter3.getList(); Object obj = items[args.Position].SdCardPath; String value = obj.ToString().Substring(obj.ToString().LastIndexOf('/') + 1); GalleryImagePreview(value); }; imageLay.AddView(gridGallery); imageLay.AddView(addImageButton); RelativeLayout theme = new FormTheme(context, element.Title); LinearLayout btnLayer = new LinearLayout(context); btnLayer.Orientation = Orientation.Vertical; String img = element.Value; String sdCardPath = Environment.ExternalStorageDirectory.AbsolutePath; String filePath = Path.Combine(sdCardPath, "Checkd/" + img); File file = new File(filePath); addImageButton.SetImageResource(Resource.Drawable.android_camera_grey); addImageButton.SetBackgroundResource(0); ImageView indicatorImage = (ImageView)theme.GetChildAt(1); activateElementInfo(element, theme); int artificial_ID = IMAGE_INDICATOR_ID + element.Id; indicatorImage.Id = artificial_ID; cameraIndicatorView.Add(indicatorImage); addImageButton.Click += (sender2, e) => ImageSelectionChoiceDialog(sender2, e, element.Id + "", type); if (!element.Value.Equals("")) { indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); } if (ownerID == 0 || ownerID == userID) { if (verifiedID != 0) { addImageButton.Enabled = false; addImageButton.Clickable = false; if (reportStatus == ReportStatus.Rejected) { addImageButton.Enabled = true; addImageButton.Clickable = true; } } else { addImageButton.Enabled = true; addImageButton.Clickable = true; } } else { addImageButton.Enabled = false; addImageButton.Clickable = false; } isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false); if (isArcheived) { addImageButton.Clickable = false; addImageButton.Enabled = false; addImageButton.Click += null; } btnLayer.AddView(theme); btnLayer.AddView(imageLay); btnLayer.SetPadding(45, 10, 45, 20); AddView(btnLayer); }
public FormMultiLineEditText(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus) : base(context) { resource = context.Resources; contextx = context; OwnerID = ownerID; VerifierID = verifiedID; theme = new FormTheme(context, element.Title); Orientation = Orientation.Vertical; sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(context); sharedPreferencesEditor = sharedPreferences.Edit(); Popup = new InformationPopup(context); reportStatus = Reportstatus; isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false); EditText editText = new EditText(context); editText.Id = element.Id; editText.Text = element.Value; editText.SetBackgroundResource(Resource.Drawable.custom_edit_text_color); editText.InputType = Android.Text.InputTypes.TextFlagCapSentences; //editText.SetSingleLine(true); ImageView indicatorImage = (ImageView)theme.GetChildAt(1); //activateElementInfo(element); Popup.activateElementInfo(theme, element); editText.TextChanged += (sender, e) => { if (!editText.Text.Equals("")) { indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); } else { indicatorImage.SetImageResource(0); } sharedPreferencesEditor.PutBoolean("ReportEditFlag", true); sharedPreferencesEditor.Commit(); }; //when opening a Draft or Archive if (!editText.Text.Equals("")) { indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); } TextView elementSplitLine = new TextView(context); elementSplitLine.TextSize = 0.5f; elementSplitLine.SetBackgroundColor(Color.ParseColor(resource.GetString(Resource.Color.grey))); if (OwnerID == 0 || OwnerID == userID) { if (VerifierID != 0) { editText.Enabled = false; editText.SetTextColor(Resources.GetColor(Resource.Color.grey)); if (reportStatus == ReportStatus.Rejected) { editText.Enabled = true; editText.SetTextColor(Resources.GetColor(Resource.Color.black)); } } else { editText.Enabled = true; editText.SetTextColor(Resources.GetColor(Resource.Color.black)); } } else { editText.Enabled = false; editText.SetTextColor(Resources.GetColor(Resource.Color.grey)); } if (isArcheived) { editText.Enabled = false; editText.SetTextColor(Resources.GetColor(Resource.Color.grey)); } AddView(theme); AddView(editText); SetPadding(45, 10, 45, 20); }
public FormSlider(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus) : base(context) { resource = context.Resources; contextx = context; OwnerID = ownerID; VerifierID = verifiedID; Popup = new InformationPopup(context); reportStatus = Reportstatus; if (element.Value == "") { element.Value = "0"; } theme = new FormTheme(context, element.Title); RelativeLayout countHolder = new RelativeLayout(context); Orientation = Orientation.Vertical; sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(context); sharedPreferencesEditor = sharedPreferences.Edit(); EditText counterEditText = new EditText(context); counterEditText.Text = element.Value; counterEditText.TextSize = 30; counterEditText.InputType = Android.Text.InputTypes.ClassNumber; counterEditText.SetTextColor(Color.ParseColor((resource.GetString(Resource.Color.green_primary)))); counterEditText.Gravity = GravityFlags.CenterHorizontal; counterEditText.SetPadding(10, 0, 10, 0); counterEditText.SetBackgroundResource(Resource.Drawable.back); counterEditText.SetWidth(200); RelativeLayout.LayoutParams paramsForSliderCounter = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); paramsForSliderCounter.AddRule(LayoutRules.CenterHorizontal); counterEditText.LayoutParameters = paramsForSliderCounter; //causes layout update counterEditText.SetPadding(20, 5, 20, 5); countHolder.AddView(counterEditText); ImageView indicatorImageView = (ImageView)theme.GetChildAt(1); indicatorImageView.SetImageResource(0); //activateElementInfo(element); Popup.activateElementInfo(theme, element); SeekBar slider = new SeekBar(context); slider.Progress = Integer.ParseInt(element.Value); slider.SetPadding(45, 15, 45, 20); slider.Id = element.Id; slider.Max = 31; isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false); slider.ProgressChanged += (sender, e) => { if (e.FromUser) { counterEditText.Text = $"{e.Progress}"; if (counterEditText.Text.Equals("0")) { indicatorImageView.SetImageResource(0); } else { indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); sharedPreferencesEditor.PutBoolean("ReportEditFlag", true); sharedPreferencesEditor.Commit(); } } }; counterEditText.TextChanged += (sender, e) => { if (!counterEditText.Text.Equals("0")) { indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); if (Integer.ParseInt(counterEditText.Text) > 31 || Integer.ParseInt(counterEditText.Text) < 0) { sliderValuePopUp(context); counterEditText.Text = "0"; slider.Progress = 0; } slider.Progress = Integer.ParseInt(counterEditText.Text); } else { indicatorImageView.SetImageResource(0); } }; //when opening a Draft or Archive if (!counterEditText.Text.Equals("0")) { indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); } if (OwnerID == 0 || OwnerID == userID) { if (VerifierID != 0) { slider.Enabled = false; counterEditText.Enabled = false; if (reportStatus == ReportStatus.Rejected) { slider.Enabled = true; counterEditText.Enabled = true; } } else { slider.Enabled = true; counterEditText.Enabled = true; } } else { slider.Enabled = false; counterEditText.Enabled = false; } if (isArcheived) { slider.Enabled = false; counterEditText.Enabled = false; } AddView(theme); AddView(countHolder); AddView(slider); SetPadding(45, 10, 45, 20); }
public FormDate(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus) : base(context) { resource = context.Resources; OwnerID = ownerID; VerifierID = verifiedID; theme = new FormTheme(context, element.Title); Orientation = Orientation.Vertical; sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(context); sharedPreferencesEditor = sharedPreferences.Edit(); Popup = new InformationPopup(context); contextx = context; isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false); reportStatus = Reportstatus; dateFrame = new RelativeLayout(context); dateDisplay = new EditText(context); dateDisplay.Id = element.Id; RelativeLayout.LayoutParams dateFrameParametere = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); dateFrame.LayoutParameters = dateFrameParametere; //datedisplay RelativeLayout.LayoutParams paramsOfDateDisplay = new RelativeLayout.LayoutParams(500, RelativeLayout.LayoutParams.WrapContent); paramsOfDateDisplay.AddRule(LayoutRules.AlignParentLeft); RelativeLayout.LayoutParams paramsOfWeekDisplay = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent); paramsOfWeekDisplay.AddRule(LayoutRules.AlignParentBottom); paramsOfWeekDisplay.AddRule(LayoutRules.Below, dateDisplay.Id); ImageView indicatorImage = (ImageView)theme.GetChildAt(1); Popup.activateElementInfo(theme, element); dateDisplay = new EditText(context); dateDisplay.Id = element.Id; dateDisplay.SetTextColor(Color.Black); dateDisplay.LayoutParameters = paramsOfDateDisplay; dateDisplay.SetBackgroundResource(Resource.Drawable.custom_edit_text_color); dateDisplay.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; dateDisplay.Touch += (s, e) => { var handled = false; if (e.Event.Action == MotionEventActions.Down) { createDateDialog(context); handled = true; } else if (e.Event.Action == MotionEventActions.Up) { // do other stuff handled = true; } e.Handled = handled; }; //button RelativeLayout.LayoutParams paramsOfClearButton = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); //paramsOfClearButton.AddRule(LayoutRules.CenterVertical); paramsOfClearButton.AddRule(LayoutRules.RightOf, dateDisplay.Id); clearDateButton = new Button(context); clearDateButton.Text = "Clear"; clearDateButton.TextSize = 12; clearDateButton.SetTextColor(Resources.GetColor(Resource.Color.theme_color)); clearDateButton.SetBackgroundResource(0); clearDateButton.LayoutParameters = paramsOfClearButton; //clearDateButton.SetBackgroundResource(Resource.Drawable.clear_button); clearDateButton.Click += delegate { clearDate(); }; if (string.IsNullOrEmpty(element.Value)) { dateDisplay.Text = ""; indicatorImage.SetImageResource(0); clearDateButton.Visibility = ViewStates.Gone; } else { indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); dateDisplay.Text = dateLogic(element.Value); //have to set week } dateDisplay.TextChanged += (sender, e) => { if (!dateDisplay.Text.Equals("")) { indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); clearDateButton.Visibility = ViewStates.Visible; } else { indicatorImage.SetImageResource(0); clearDateButton.Visibility = ViewStates.Gone; } sharedPreferencesEditor.PutBoolean("ReportEditFlag", true); sharedPreferencesEditor.Commit(); }; weekDisplay = new TextView(context); weekDisplay.SetWidth(80); weekDisplay.SetPadding(40, 0, 0, 0); if (element.Value == "") { //donothing } else { DateTime dateTime = Convert.ToDateTime(element.Value); weekDisplay.Text = resource.GetString(Resource.String.week) + getWeekNo(dateTime); } weekDisplay.SetTextColor(Color.Black); weekDisplay.LayoutParameters = paramsOfWeekDisplay; date = DateTime.Today; if (OwnerID == 0 || OwnerID == userID) { if (VerifierID != 0) { clearDateButton.Enabled = false; clearDateButton.Visibility = ViewStates.Gone; dateDisplay.Enabled = false; dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey)); weekDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey)); if (reportStatus == ReportStatus.Rejected) { clearDateButton.Enabled = true; clearDateButton.Visibility = ViewStates.Gone; dateDisplay.Enabled = true; dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.black)); weekDisplay.SetTextColor(Resources.GetColor(Resource.Color.black)); } } else { clearDateButton.Enabled = true; clearDateButton.Visibility = ViewStates.Gone; dateDisplay.Enabled = true; dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.black)); weekDisplay.SetTextColor(Resources.GetColor(Resource.Color.black)); } } else { clearDateButton.Enabled = false; clearDateButton.Visibility = ViewStates.Gone; dateDisplay.Enabled = false; dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey)); weekDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey)); } if (isArcheived) { clearDateButton.Enabled = false; clearDateButton.Visibility = ViewStates.Gone; dateDisplay.Enabled = false; dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey)); } dateFrame.AddView(dateDisplay); dateFrame.AddView(clearDateButton); dateFrame.AddView(weekDisplay); AddView(theme); AddView(dateFrame); SetPadding(45, 10, 45, 20); }
public void SaveDraft(ConfirmationReportViewModel report) { Status = ReportStatus.Draft; PopulateReport(report); CheckInvariants(); }
public void ActionOnReport(int? expenseId, Employee employee, ReportStatus status) { }
public void Save(ConfirmationReportViewModel report) { this.Status = ReportStatus.Completed; PopulateReport(report); CheckInvariants(); }
private string StatusString(ReportStatus status) { string str = null; if (status == ReportStatus.Wait) { return Resources.ResourceManager.GetString("CORE113"); } if (status == ReportStatus.Sent) { return Resources.ResourceManager.GetString("CORE114"); } if (status == ReportStatus.Error) { return Resources.ResourceManager.GetString("CORE115"); } if (status == ReportStatus.Delete) { str = Resources.ResourceManager.GetString("CORE116"); } return str; }
public static void UpdateStatus(int reportGenerationQueueId, ReportStatus status) { var dao = DataAccessFactory.Create<GenerationDao>(); dao.Find<ReportGenerationQueue>(rgq => rgq.ReportGenerationQueueId == reportGenerationQueueId).ReportGenerationStatus = status; dao.SubmitChanges(); }
public ReportStatus UpdateReportStatus(ReportStatus reportStatus) { return(Channel.UpdateReportStatus(reportStatus)); }
public ReportData(ReportStatus reportStatus) { ReportStatus = reportStatus; }
/// <summary> /// Write the MeSH Heading report /// </summary> /// <param name="writer">Writer to send the report to</param> public void MeSHHeadingReport(StreamWriter writer, ReportStatus StatusCallback, ReportMessage MessageCallback) { // Write the header writer.WriteLine("setnb,year,heading,count"); // The MeSH Heading report has one row per person per year per heading People people = new People(DB, PeopleTable); int Total = people.PersonList.Count; int Count = 0; foreach (Person person in people.PersonList) { // Report status Count++; StatusCallback(Count, Total, person, false); // Catch any errors, report them, and continue try { // Find the minimum and maximum year for the person int MinYear = 0; int MaxYear = 0; Publications pubs = new Publications(DB, person, PeoplePublicationsTable, false); Hashtable years = new Hashtable(); if (pubs.PublicationList != null) { foreach (Publication pub in pubs.PublicationList) { if (MinYear == 0 || MinYear > pub.Year) { MinYear = pub.Year; } if (MaxYear == 0 || MaxYear < pub.Year) { MaxYear = pub.Year; } // Go through each of the MeSH headings and count how many // occurrences of each heading are in each year. Store each // count in a hashtable keyed by heading, which in turn is // stored in a hashtable keyed by year. if (!years.ContainsKey(pub.Year)) { years[pub.Year] = new Hashtable(); } Hashtable yearHeadings = (Hashtable)years[pub.Year]; if (pub.MeSHHeadings != null) { foreach (string Heading in pub.MeSHHeadings) { if (!yearHeadings.ContainsKey(Heading)) { yearHeadings[Heading] = 0; } yearHeadings[Heading] = ((int)yearHeadings[Heading]) + 1; } } } } // Write the heading rows for each year for (int Year = MinYear; Year <= MaxYear; Year++) { // Write the rows for that person's year to the writer if (years.ContainsKey(Year)) { Hashtable yearHeadings = (Hashtable)years[Year]; if (yearHeadings != null) { foreach (string Heading in yearHeadings.Keys) { StringWriter swriter = new StringWriter(); swriter.Write(person.Setnb); // setnb Reports.WriteCSV(Year.ToString(), swriter); // year Reports.WriteCSV(Heading, swriter); // heading Reports.WriteCSV(yearHeadings[Heading].ToString(), swriter); // count writer.WriteLine(swriter.ToString()); } } } } } catch (Exception ex) { MessageCallback(ex.Message); } } }
public ReportData(ReportStatus reportStatus, Exception exception) { ReportStatus = reportStatus; Exception = exception; }
/// <summary> /// Update Report Status ///<param name="reportid">reportid</param> ///<param name="reporttype">reporttype</param> ///<param name="status">status</param> ///<param name="responsestatus">responsestatus</param> /// </summary> /// <returns></returns> public static String UpdateReportStatusData(Int32 IsSnapType, Int32 reportid, int reporttype, ReportStatus statustype, ResponseStatus responsestatus) { String res = ""; SqlCommand cmd = new SqlCommand(); try { cmd.CommandText = "UpdateReportDataStatus"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ReportId", SqlDbType.Int).Value = reportid; cmd.Parameters.Add("@StatusType", SqlDbType.Int).Value = (int)statustype; cmd.Parameters.Add("@IsSnap", SqlDbType.Int).Value = (int)IsSnapType; cmd.Parameters.Add("@Status", SqlDbType.Int).Value = (int)responsestatus; cmd.Parameters.Add("@Type", SqlDbType.Int).Value = reporttype; cmd.Parameters.Add("@Date", SqlDbType.DateTime).Value = DateTime.Now; DataAccess.ExecuteCommand(cmd); } catch (SqlException ex) { res = ex.Message; LogAPI.WriteLog("UpdateReportStatusData-" + reportid + ": " + ex.Message); } catch (Exception ex) { res = ex.Message; LogAPI.WriteLog("UpdateReportStatusData-" + reportid + ": " + ex.Message); } finally { if (cmd != null) { cmd.Dispose(); } } return(res); }
public ReportData(ReportStatus reportStatus, string _Message) { ReportStatus = reportStatus; this.Message = _Message; }
/// <summary> /// Update search term Inventory(sales,clicks,spend) ///<param name="Inventorytbl">Inventorytbl</param> ///<param name="userid">userid</param> ///<param name="reportid">reportid</param> ///<param name="status">status</param> /// </summary> /// <returns></returns> public static String UpdateSearchTermInventoryData(DataTable Inventorytbl, Int32 userid, Int32 reportid, ReportStatus status) { String res = ""; SqlCommand cmd = new SqlCommand(); try { cmd.CommandText = @"Sbsp_UpdateSearchtermInventory"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@tblSearchterm", Inventorytbl); cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = userid; cmd.Parameters.Add("@ReportId", SqlDbType.Int).Value = reportid; cmd.Parameters.Add("@Status", SqlDbType.Int).Value = status; cmd.Parameters.Add("@RecordType", SqlDbType.Int).Value = (int)RecordType.SearchTerm; DataAccess.ExecuteScalarCommandForBulk(cmd); } catch (SqlException ex) { res = ex.Message; LogAPI.WriteLog("UpdateSearchTermInventoryData-" + reportid + ": " + ex.Message, userid.ToString()); } catch (Exception ex) { res = ex.Message; LogAPI.WriteLog("UpdateSearchTermInventoryData-" + reportid + ": " + ex.Message, userid.ToString()); } finally { if (cmd != null) { cmd.Dispose(); } } return(res); }
/// <summary> /// Updates the queued report status. /// </summary> /// <param name="service">The service.</param> /// <param name="reportGenerationQueueId">The report generation queue id.</param> /// <param name="reportStatus">The report status.</param> /// <param name="message">The message.</param> public static void UpdateQueuedReportStatus( IReportQueueStatusService service, int reportGenerationQueueId, ReportStatus reportStatus, string message) { UpdateQueuedReportStatus( service, reportGenerationQueueId, reportStatus, new List<string>(new[] { message }), message); }
/// <summary> /// Performs the main processing work. /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> protected override async Task RunAsync(CancellationToken cancellationToken) { try { IReliableQueue <ReportProcessingStep> processQueue = await this.StateManager.GetOrAddAsync <IReliableQueue <ReportProcessingStep> >(ProcessingQueueName); IReliableDictionary <string, ReportStatus> statusDictionary = await this.StateManager.GetOrAddAsync <IReliableDictionary <string, ReportStatus> >(StatusDictionaryName); // First time setup: queue up all the processing steps and create an initial processing status if one doesn't exist already // Note that this will execute every time a replica is promoted to primary, // so we need to check to see if it's already been done because we only want to initialize once. using (ITransaction tx = this.StateManager.CreateTransaction()) { ConditionalValue <ReportStatus> tryGetResult = await statusDictionary.TryGetValueAsync(tx, this.reportContext.Name, LockMode.Update); if (!tryGetResult.HasValue) { await processQueue.EnqueueAsync(tx, new ReportProcessingStep("Creating")); await processQueue.EnqueueAsync(tx, new ReportProcessingStep("Evaluating")); await processQueue.EnqueueAsync(tx, new ReportProcessingStep("Reticulating")); for (int i = 0; i < processingMultiplier * queueLengthMultiplier; ++i) { cancellationToken.ThrowIfCancellationRequested(); await processQueue.EnqueueAsync(tx, new ReportProcessingStep($"Processing {i}")); } await processQueue.EnqueueAsync(tx, new ReportProcessingStep("Sanitizing")); await processQueue.EnqueueAsync(tx, new ReportProcessingStep("Mystery Step")); await processQueue.EnqueueAsync(tx, new ReportProcessingStep("Finalizing")); await processQueue.EnqueueAsync(tx, new ReportProcessingStep("Complete")); await statusDictionary.AddAsync(tx, this.reportContext.Name, new ReportStatus(0, processingMultiplier *queueLengthMultiplier + 7, "Not started.", String.Empty)); } await tx.CommitAsync(); } // start processing and checkpoint between each step so we don't lose any progress in the event of a fail-over while (true) { cancellationToken.ThrowIfCancellationRequested(); try { // Get the next step from the queue with a peek. // This keeps the item on the queue in case processing fails. ConditionalValue <ReportProcessingStep> dequeueResult; using (ITransaction tx = this.StateManager.CreateTransaction()) { dequeueResult = await processQueue.TryPeekAsync(tx, LockMode.Default); } if (!dequeueResult.HasValue) { // all done! break; } ReportProcessingStep currentProcessingStep = dequeueResult.Value; ServiceEventSource.Current.ServiceMessage( this.Context, $"Processing step: {currentProcessingStep.Name}"); // Get the current processing step ConditionalValue <ReportStatus> dictionaryGetResult; using (ITransaction tx = this.StateManager.CreateTransaction()) { dictionaryGetResult = await statusDictionary.TryGetValueAsync(tx, this.reportContext.Name, LockMode.Default); } // Perform the next processing step. // This is potentially a long-running operation, therefore it is not executed within a transaction. ReportStatus currentStatus = dictionaryGetResult.Value; ReportStatus newStatus = await this.ProcessReport(currentStatus, currentProcessingStep, cancellationToken); // Once processing is done, save the results and dequeue the processing step. // If an exception or other failure occurs at this point, the processing step will run again. using (ITransaction tx = this.StateManager.CreateTransaction()) { dequeueResult = await processQueue.TryDequeueAsync(tx); await statusDictionary.SetAsync(tx, this.reportContext.Name, newStatus); await tx.CommitAsync(); } ServiceEventSource.Current.ServiceMessage( this.Context, $"Processing step: {currentProcessingStep.Name} complete."); } catch (TimeoutException) { // transient error. Retry. ServiceEventSource.Current.ServiceMessage(this.Context, "TimeoutException in RunAsync."); } catch (FabricTransientException fte) { // transient error. Retry. ServiceEventSource.Current.ServiceMessage(this.Context, "FabricTransientException in RunAsync: {0}", fte.Message); } catch (FabricNotReadableException) { // retry or wait until not primary ServiceEventSource.Current.ServiceMessage(this.Context, "FabricNotReadableException in RunAsync."); } // delay between each to step to prevent starving other processing service instances. await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken); } ServiceEventSource.Current.ServiceMessage( this.Context, $"Processing complete!"); } catch (OperationCanceledException) { // time to quit throw; } catch (FabricNotPrimaryException) { // time to quit return; } catch (Exception ex) { // all other exceptions: log and re-throw. ServiceEventSource.Current.ServiceMessage(this.Context, "Exception in RunAsync: {0}", ex.Message); throw; } }
/// <summary> /// Updates the queued report status. /// I would prefer this to be an instance method on the GenerationDao (but this is ok for now) /// </summary> /// <param name="service">The service.</param> /// <param name="reportGenerationQueueId">The report generation queue id.</param> /// <param name="reportStatus">The report status.</param> /// <param name="executionLog">The execution log.</param> /// <param name="queryText">The query text.</param> public static void UpdateQueuedReportStatus( IReportQueueStatusService service, int reportGenerationQueueId, ReportStatus reportStatus, List<string> executionLog, string queryText) { string executionLogStr = string.Empty; string queryTextStr = string.Empty; if (reportStatus == ReportStatus.Completed || reportStatus == ReportStatus.Failed) { executionLogStr = " Execution Log : " + executionLog.Concatenate(System.Environment.NewLine); queryTextStr = "QueryText: " + queryText; } else if (reportStatus == ReportStatus.Cancelled) { executionLogStr = "-- Report cancelled due to deactivated ReportType"; queryTextStr = "-- Report cancelled due to deactivated ReportType"; } service.UpdateReportGenerationQueue(new ReportGenerationQueueStatusDto() { ReportGenerationQueueId = reportGenerationQueueId, ReportStatus = reportStatus, QueryText = queryTextStr, ExecutionLog = executionLogStr }); }
protected void TestStatus(int reportGenerationQueueId, ReportStatus status, string message) { new ProcessRunner(() => //new ReportQueueStatusWCFService() moony new ReportQueueStatusDBService() ).UpdateStatus(reportGenerationQueueId, status, message); }
/// <summary> /// Update the queued report status in the database /// </summary> /// <param name="reportStatus">The report status to write to the database</param> protected void UpdateQueuedReportStatus(ReportStatus reportStatus) { UpdateQueuedReportStatus( this._ReportQueueStatusService, this.ReportParameter.ReportGenerationQueueId, reportStatus, this.ExecutionLog, this.QueryText); }
/// <summary> /// Thread pool callback used to ensure location COM API is instantiated from /// multi-thread apartment, and register for location events. /// </summary> /// <param name="state"></param> private void CreateHandler(object state) { lock (this.InternalSyncObject) { try { m_location = new COMLocation(); } catch (COMException) { Utility.Trace("Failed to CoCreate ILocation COM object."); } if (null != m_location) { Utility.Trace("Done creating ILocation COM object"); // // Mapping to platform accuracy // GeoLocationAccuracy desiredAccuracy = (GeoLocationAccuracy)state; DesiredAccuracy accuracy = (desiredAccuracy == GeoLocationAccuracy.Low) ? DesiredAccuracy.DefaultAccuracy : DesiredAccuracy.HighAccuracy; Guid reportKey = LocationReportKey.LatLongReport; m_location.SetDesiredAccuracy(ref reportKey, accuracy); // // Always listen for latlong reports // if (m_location.RegisterForReport(this, ref reportKey, 0) == 0) { m_latLongRegistered = true; } // // Check the latlong status. If latlong reports are not supported, then register // for civic address reports. // m_location.GetReportStatus(ref reportKey, ref m_latLongStatus); if (ReportStatus.NotSupported == m_latLongStatus) { reportKey = LocationReportKey.CivicAddressReport; if (m_location.RegisterForReport(this, ref reportKey, 0) == 0) { m_civicAddrRegistered = true; m_location.GetReportStatus(ref reportKey, ref m_civicAddrStatus); } } // // set the current status to the available report type status // ReportStatus status = (ReportStatus.NotSupported != m_latLongStatus) ? m_latLongStatus : m_civicAddrStatus; m_curStatus = m_geoStatusMap[(int)status]; } Utility.DebugAssert(m_eventCreateDone != null, "m_eventCreateDone is null"); ManualResetEvent eventDone = m_eventCreateDone; if (eventDone != null) { eventDone.Set(); } } }
//private ReportDataService reportDataService; public FormSignature(Context context, ReportElement element, string section, int userID, int ownerID, int verifierID, string formType, ReportStatus statusReport, List <ReportElement> elementList) : base(context) { contextx = context; ISharedPreferences sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(context); ISharedPreferencesEditor sharedPreferencesEditor = sharedPreferences.Edit(); cameraIndicatorView = new List <ImageView>(); cameraPreviewView = new List <GridView>(); //reportDataService = rds; RelativeLayout theme = new FormTheme(context, element.Title); LinearLayout btnLayer = new LinearLayout(context); btnLayer.Orientation = Orientation.Vertical; var sign = new ImageButton(context); sign.Id = element.Id; var line = new ImageView(context); line.SetBackgroundResource(Resource.Drawable.dottedlines); LayoutParams parmsofline = new LayoutParams( ViewGroup.LayoutParams.MatchParent, 1); line.LayoutParameters = parmsofline; LayoutParams parms = new LayoutParams(ViewGroup.LayoutParams.WrapContent, 300); sign.LayoutParameters = parms; string img = element.Value; string sdCardPath = Environment.ExternalStorageDirectory.AbsolutePath; string sigPath = Path.Combine(sdCardPath, "Checkd/" + img); File file = new File(sigPath); sign.SetBackgroundResource(Resource.Drawable.ic_signature); //sign.SetBackgroundResource(0); if (img == "empty" || string.IsNullOrEmpty(img)) { sign.Tag = ""; } else { sign.Tag = img; if (file.Exists()) { SetImage(sigPath, sign); } else { DownloadImage(img, sigPath, sign); } } ImageView indicatorImage = (ImageView)theme.GetChildAt(1); activateElementInfo(element, theme); int artificial_ID = SIGNATURE_INDICATOR_ID + element.Id; indicatorImage.Id = artificial_ID; cameraIndicatorView.Add(indicatorImage); cameraPreviewView.Add(new GridView(contextx)); if (!element.Value.Equals("")) { indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); } if (ownerID == 0 || ownerID == userID) { if (verifierID != 0) { sign.Enabled = false; sign.Clickable = false; if (statusReport == ReportStatus.Rejected) { sign.Enabled = true; sign.Clickable = true; } } else { sign.Enabled = true; sign.Clickable = true; } } else { sign.Enabled = false; sign.Clickable = false; } sign.Click += (sender, e) => { sharedPreferencesEditor.PutString("ImageButtonID", element.Id + ""); sharedPreferencesEditor.PutString("ImageButtonType", section); sharedPreferencesEditor.Commit(); string filePath = Path.Combine(sdCardPath, "Checkd/signature_" + Guid.NewGuid() + ".jpg"); Intent intent = new Intent(context, typeof(SignatureActivity)); intent.PutExtra("URI", filePath); intent.PutExtra("ElementList", JsonConvert.SerializeObject(elementList)); ((Activity)contextx).StartActivityForResult(intent, 2); }; isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false); if (isArcheived) { sign.Clickable = false; } btnLayer.AddView(theme); btnLayer.AddView(sign); btnLayer.AddView(line); btnLayer.SetPadding(45, 10, 45, 20); AddView(btnLayer); }
private void TestMultipleReports(Func <IEmployer, bool> createClientActvity, Func <IEmployer, bool> createJobBoardActivity, bool sendToAccountManager) { // Create everyone. var administrator = CreateAdministrator(); var organisation = CreateOrganisation(administrator.Id); organisation.ContactDetails = new ContactDetails { FirstName = ClientFirstName, LastName = ClientLastName, EmailAddress = ClientEmail }; _organisationsCommand.UpdateOrganisation(organisation); var employer = CreateEmployer(organisation); // Define the reports. var resumeSearchActivityReport = new ResumeSearchActivityReport { ClientId = organisation.Id, SendToAccountManager = sendToAccountManager, SendToClient = true, }; _reportsCommand.CreateReport(resumeSearchActivityReport); var jobBoardActivityReport = new JobBoardActivityReport { ClientId = organisation.Id, SendToAccountManager = sendToAccountManager, SendToClient = true, }; _reportsCommand.CreateReport(jobBoardActivityReport); // Create activity to report on. var isResumeSearchActivity = createClientActvity(employer); var isJobBoardActivity = createJobBoardActivity(employer); var clientStatus = new ReportStatus(resumeSearchActivityReport, isResumeSearchActivity); var jobBoardStatus = new ReportStatus(jobBoardActivityReport, isJobBoardActivity); // Run the reports. Execute(); if (sendToAccountManager) { if ((isResumeSearchActivity && isJobBoardActivity) || (!isResumeSearchActivity && !isJobBoardActivity)) { var emails = _emailServer.AssertEmailsSent(2); AssertAdministratorEmail(emails[0], administrator, organisation, clientStatus, jobBoardStatus); AssertClientEmail(emails[1], administrator, organisation, clientStatus, jobBoardStatus); } else { var emails = _emailServer.AssertEmailsSent(3); AssertAdministratorEmail(emails[0], administrator, organisation, jobBoardStatus); AssertClientEmail(emails[1], administrator, organisation, clientStatus, jobBoardStatus); AssertAdministratorEmail(emails[2], administrator, organisation, clientStatus); } } else { var emails = _emailServer.AssertEmailsSent(1); AssertClientEmail(emails[0], administrator, organisation, clientStatus, jobBoardStatus); } }
/// <summary> /// Approve or Declines a report for Supervisor /// </summary> /// <param name="expenseId">Expense Id of the report</param> /// <param name="employee">Supervisor</param> /// <param name="status">Approve or Decline</param> public void ActionOnReport(int? expenseId,Employee employee,ReportStatus status) { reportDAL.ActionOnReport(expenseId, employee, status); }
/// <summary> /// Generate the report. /// </summary> public void Generate() { if (Status == ReportStatus.Generating) return; HtmlStringWriter.GetStringBuilder().Clear(); Status = ReportStatus.Generating; Build(); Status = ReportStatus.Completed; }
/// <summary> /// Approve or Declines a report for Accounts /// </summary> /// <param name="expenseId">Expense Id of the report</param> /// <param name="employee">Accounts person</param> /// <param name="status">Approve or Decline</param> public void ProcessReport(int? expenseId, Employee employee, ReportStatus status) { reportDAL.ProcessReport(expenseId, employee, status); }
public FormDropDown(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus ReportStatus) : base(context) { contextx = context; resource = context.Resources; OwnerID = ownerID; VerifierID = verifiedID; elementThis = element; theme = new FormTheme(context, element.Title); Orientation = Orientation.Vertical; sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(context); sharedPreferencesEditor = sharedPreferences.Edit(); firstTime = true; Popup = new InformationPopup(context); reportStatus = ReportStatus; selection = 0; isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false); dropDownValues = new List <KeyValue>(); dropDownFrame = new LinearLayout(context); dropDownFrame.Orientation = Orientation.Vertical; indicatorImage = (ImageView)theme.GetChildAt(1); //activateElementInfo(element); Popup.activateElementInfo(theme, element); if (element.IsMultiSelect) { dropDownValues = element.Values; } else { KeyValue x = new KeyValue(); x.Name = "Choose One"; x.Value = "false"; dropDownValues.Add(x); dropDownValues.AddRange(element.Values); } if (element.IsMultiSelect) { CreateMultiDropDown(context, indicatorImage, userID); } else { CreateDropDown(context, indicatorImage, element, userID); } AddView(theme); AddView(dropDownFrame); SetPadding(45, 10, 45, 20); }
private async void SaveReport(ReportStatus status, string note) { ReportDataDto reportDataDto = GetReportDataDto(m_reportData); var statusObject = TimeLineObjectCreator(status, note); reportDataDto.ItemDtos = reportDataDto.ItemDtos ?? new List <ItemDto>(); reportDataDto.StatusTimeLines = new List <StatusTimeLineDto> { statusObject }; if (Utility.IsInternetAvailable(Application.Context)) { reportDataDto.NotSynced = false; if (status == ReportStatus.ArchivedAsAccepted) { reportDataDto.ReportStatus = status; reportDataDto.IsArchived = true; } else if (status == ReportStatus.Rejected) { reportDataDto.ReportStatus = status; } try { reportService = new ReportService(userSession.AccessToken); await reportService.PostReport(reportDataDto); if (type == "accept") { Utility.DisplayToast(Application.Context, "Report has been Accepted"); } else if (type == "decline") { Utility.DisplayToast(Application.Context, "Report has been Declined"); } sharedPreferences.Edit().PutBoolean(Resources.GetString(Resource.String.IsReportUpdate), false).Commit(); sharedPreferencesEditor.PutBoolean("BackPressed", false); sharedPreferencesEditor.Commit(); Activity.Finish(); } catch (CustomHttpResponseException customHttpResponseException) { if (customHttpResponseException.StatusCode == HttpStatusCode.Unauthorized) { Log.Error("Authentication Exception - VerifyReportFragment", customHttpResponseException.ToString()); Activity.Finish(); Activity.StartActivity(typeof(LoginActivity)); } else { Log.Error(customHttpResponseException.StatusCode + " - VerifyReportFragment", customHttpResponseException.ToString()); Utility.DisplayToast(Application.Context, "Error : " + customHttpResponseException.StatusCode + "\nAn error occurred while connecting to the application server"); } } } else { Utility.DisplayToast(Application.Context, Resources.GetString(Resource.String.no_internet_message)); } }
public void ProcessReport(int? expenseId, Employee employee, ReportStatus status) { }
/// <summary> /// Updates the status. /// </summary> /// <param name="reportGenerationQueueId">The report generation queue id.</param> /// <param name="status">The status.</param> /// <param name="message">The message.</param> public void UpdateStatus(int reportGenerationQueueId, ReportStatus status, string message) { this._ReportQueueStatusServiceFactory().UpdateReportGenerationQueue(new ReportGenerationQueueStatusDto() { ReportGenerationQueueId = reportGenerationQueueId, ReportStatus = status, QueryText = message }); }
public virtual extern HRESULT GetReportStatus([In] ref Guid reportType, out ReportStatus pStatus);
private string StatusImageKey(ReportStatus status) { string str = null; if (status == ReportStatus.Wait) { return "Wait"; } if (status == ReportStatus.Sent) { return "Sent"; } if (status == ReportStatus.Error) { return "Error"; } if (status == ReportStatus.Delete) { str = "Delete"; } return str; }
private string GetIndicator(ReportStatus reportStatus) { switch (reportStatus) { case ReportStatus.ReportStepPassed: return("C"); case ReportStatus.ReportStepFailed: return("R"); case ReportStatus.ReportStepSkipped: return("W"); case ReportStatus.ReportStepManualExecuted: return("L"); case ReportStatus.ReportInterfaceDeviation: return("B"); case ReportStatus.ReportLogInfo: return("D"); case ReportStatus.ReportDebug: return("F"); case ReportStatus.ReportReportInfo: return("M"); case ReportStatus.ReportReportWarning: return("P"); case ReportStatus.ReportDioRetry: return("S"); case ReportStatus.ReportMeasurement: return("X"); case ReportStatus.ReportCommand: return("I"); case ReportStatus.ReportVersionInfo: return("V"); case ReportStatus.ControlMarker: return("T"); case ReportStatus.FlowStartTestBatchInfo: return("G"); case ReportStatus.FlowEndTestBatchInfo: return("G"); case ReportStatus.FlowControlStatement: return("O"); case ReportStatus.SetoolMessage: return(string.Empty); default: return("F"); } }
/// By Ryan Moe /// Edited: Julian Nguyen(4/30/13) /// <summary> /// Default constructor. /// Defaults to success. /// </summary> public ErrorReport() { reportStatus = ReportStatus.SUCCESS; description = String.Empty; warnings = new List<string>(); }
private void UpdateGameGrid(RvFile tDir) { gameGridSource = tDir; _updatingGameGrid = true; ClearGameGrid(); List <RvFile> gameList = new List <RvFile>(); _gameGridColumnXPositions = new int[(int)RepStatus.EndValue]; for (int j = 0; j < tDir.ChildCount; j++) { RvFile tChildDir = tDir.Child(j); if (!tChildDir.IsDir) { continue; } if (txtFilter.Text.Length > 0 && !tChildDir.Name.Contains(txtFilter.Text)) { continue; } ReportStatus tDirStat = tChildDir.DirStatus; bool gCorrect = tDirStat.HasCorrect(); bool gMissing = tDirStat.HasMissing(); bool gUnknown = tDirStat.HasUnknown(); bool gInToSort = tDirStat.HasInToSort(); bool gFixes = tDirStat.HasFixesNeeded(); bool show = chkBoxShowCorrect.Checked && gCorrect && !gMissing && !gFixes; show = show || chkBoxShowMissing.Checked && gMissing; show = show || chkBoxShowFixed.Checked && gFixes; show = show || gUnknown; show = show || gInToSort; show = show || tChildDir.GotStatus == GotStatus.Corrupt; show = show || !(gCorrect || gMissing || gUnknown || gInToSort || gFixes); if (!show) { continue; } gameList.Add(tChildDir); int columnIndex = 0; for (int l = 0; l < RepairStatus.DisplayOrder.Length; l++) { if (l >= 13) { columnIndex = l; } if (tDirStat.Get(RepairStatus.DisplayOrder[l]) <= 0) { continue; } int len = DigitLength(tDirStat.Get(RepairStatus.DisplayOrder[l])) * 7 + 26; if (len > _gameGridColumnXPositions[columnIndex]) { _gameGridColumnXPositions[columnIndex] = len; } columnIndex++; } } int t = 0; for (int l = 0; l < (int)RepStatus.EndValue; l++) { int colWidth = _gameGridColumnXPositions[l]; _gameGridColumnXPositions[l] = t; t += colWidth; } gameGrid = gameList.ToArray(); GameGrid.RowCount = gameGrid.Length; if (GameGrid.RowCount > 0) { GameGrid.Rows[0].Selected = false; } _updatingGameGrid = false; UpdateSelectedGame(); }
/// <summary> /// "Processes" a report /// </summary> /// <param name="currentStatus"></param> /// <param name="currentProcessingStep"></param> /// <param name="cancellationToken"></param> /// <returns></returns> internal async Task <ReportStatus> ProcessReport(ReportStatus currentStatus, ReportProcessingStep currentProcessingStep, CancellationToken cancellationToken) { await Task.Delay(TimeSpan.FromSeconds(new Random().Next(5, 15)), cancellationToken); return(new ReportStatus(currentStatus.Step + 1, currentProcessingStep.Name)); }
public void StartProcessFilingOfDoc(ReportStatus reportStatusCallback, ReportStatus filingCompleteCallback, ScanDocInfo sdi, FiledDocInfo fdi, string emailPassword, out string rsltText) { _docFilingReportStatus = reportStatusCallback; _filingCompleteCallback = filingCompleteCallback; // Start the worker thread to do the copy and move if (!_fileProcessBkgndWorker.IsBusy) { object[] args = new object[] { sdi, fdi, emailPassword }; _fileProcessBkgndWorker.RunWorkerAsync(args); rsltText = "Processing file ..."; } else { rsltText = "Busy ... please wait"; } _docFilingStatusStr = rsltText; }
protected override async Task RunAsync(CancellationToken cancellationToken) { IReliableConcurrentQueue <ReportProcessingStep> processQueue = await this.StateManager.GetOrAddAsync <IReliableConcurrentQueue <ReportProcessingStep> >(ProcessingQueueName); IReliableDictionary <string, ReportStatus> statusDictionary = await this.StateManager.GetOrAddAsync <IReliableDictionary <string, ReportStatus> >(StatusDictionaryName); // queue up all the processing steps and create an initial processing status if one doesn't exist already using (ITransaction tx = this.StateManager.CreateTransaction()) { ConditionalValue <ReportStatus> tryGetResult = await statusDictionary.TryGetValueAsync(tx, this.reportContext.Name, LockMode.Update); if (!tryGetResult.HasValue) { foreach (string processingStep in processingSteps) { cancellationToken.ThrowIfCancellationRequested(); await processQueue.EnqueueAsync(tx, new ReportProcessingStep(processingStep)); } await statusDictionary.AddAsync(tx, this.reportContext.Name, new ReportStatus(0, "Not started.")); } await tx.CommitAsync(); } // start processing and checkpoint between each step so we don't lose any progress in the event of a fail-over while (true) { cancellationToken.ThrowIfCancellationRequested(); try { using (ITransaction tx = this.StateManager.CreateTransaction()) { ConditionalValue <ReportProcessingStep> dequeueResult = await processQueue.TryDequeueAsync(tx, cancellationToken); if (!dequeueResult.HasValue) { // all done! break; } ReportProcessingStep currentProcessingStep = dequeueResult.Value; ServiceEventSource.Current.ServiceMessage( this.Context, $"Processing step: {currentProcessingStep.Name}"); // This takes a shared lock rather than an update lock // because this is the only place the row is written to. // If there were other writers, then this should be an update lock. ConditionalValue <ReportStatus> dictionaryGetResult = await statusDictionary.TryGetValueAsync(tx, this.reportContext.Name, LockMode.Default); ReportStatus currentStatus = dictionaryGetResult.Value; ReportStatus newStatus = await this.ProcessReport(currentStatus, currentProcessingStep, cancellationToken); await statusDictionary.SetAsync(tx, this.reportContext.Name, newStatus); await tx.CommitAsync(); } } catch (TimeoutException) { // transient error. Retry. ServiceEventSource.Current.ServiceMessage(this.Context, "TimeoutException in RunAsync."); } catch (FabricTransientException fte) { // transient error. Retry. ServiceEventSource.Current.ServiceMessage(this.Context, "FabricTransientException in RunAsync: {0}", fte.Message); } catch (FabricNotPrimaryException) { // not primary any more, time to quit. return; } catch (FabricNotReadableException) { // retry or wait until not primary ServiceEventSource.Current.ServiceMessage(this.Context, "FabricNotReadableException in RunAsync."); } catch (Exception ex) { // all other exceptions: log and re-throw. ServiceEventSource.Current.ServiceMessage(this.Context, "Exception in RunAsync: {0}", ex.Message); throw; } // delay between each to step to prevent starving other processing service instances. await Task.Delay(TimeSpan.FromSeconds(10), cancellationToken); } ServiceEventSource.Current.ServiceMessage( this.Context, $"Processing complete!"); }