public void Action(string action, string fieldObject = null) { Tracking tracking = new Tracking(); string script = tracking.SetAction(action, fieldObject); AddInteraction(script); }
public void Write_Tracking_Test() { var tracking = new Tracking { Phase = "Archiving FY 2007", PhaseDetail = "Compressing file archive.dat", Progress = 12M, ElapsedSeconds = 95M, RemainingSeconds = 568M, PollingMillis = 500 }; XPathNavigator nav; using (var stream = new MemoryStream()) { new XmlContentHandler().WriteTo(tracking, stream); stream.Seek(0, SeekOrigin.Begin); #if NET_2_0 || NET_3_5 nav = new XPathDocument(stream).CreateNavigator(); #else nav = XDocument.Load(stream).CreateNavigator(); #endif } var mgr = new XmlNamespaceManager(nav.NameTable); mgr.AddNamespace("sdata", "http://schemas.sage.com/sdata/2008/1"); var node = nav.SelectSingleNode("sdata:tracking", mgr); Assert.That(node, Is.Not.Null); Assert.That(node.SelectSingleNode("sdata:phase", mgr).Value, Is.EqualTo("Archiving FY 2007")); Assert.That(node.SelectSingleNode("sdata:phaseDetail", mgr).Value, Is.EqualTo("Compressing file archive.dat")); Assert.That(node.SelectSingleNode("sdata:progress", mgr).Value, Is.EqualTo("12")); Assert.That(node.SelectSingleNode("sdata:elapsedSeconds", mgr).Value, Is.EqualTo("95")); Assert.That(node.SelectSingleNode("sdata:remainingSeconds", mgr).Value, Is.EqualTo("568")); Assert.That(node.SelectSingleNode("sdata:pollingMillis", mgr).Value, Is.EqualTo("500")); }
public ActionResult Create(ObjectId trackingId, Tracking tracking) { try { if (ModelState.IsValid) { var trackingItem = _trackableItemsCollection.AsQueryable().FirstOrDefault(ti => ti.Id == tracking.TrackingItemId); //delete customer info if tracking item does not support it if (!trackingItem.SupportsUserInformation) tracking.CustomerInformation = null; tracking.CreatedDate = DateTime.Now.Date; tracking.Id = trackingId; tracking.User = User.Identity.Name; tracking.History = new List<TrackingHistoryRecord>(){new TrackingHistoryRecord(){Comment = tracking.Comment, CreatedDate = DateTime.Now, StateId = tracking.StateId}} ; tracking.Password = trackingItem.IsSecured ? PasswordGenerator.CreateRandomPassword(8) : string.Empty; _trackingCollection.Save(tracking); } try { var username = Membership.GetUser().UserName.ToLower(); var user = _usersCollection.AsQueryable().FirstOrDefault(x => string.Equals(x.NameLowerSpace, username)); if (user.EnableSubscribersEmailNotifications) { if (tracking.CustomerInformation != null && !string.IsNullOrWhiteSpace(tracking.CustomerInformation.Email)) { var trackingItem = _trackableItemsCollection.AsQueryable().FirstOrDefault(x => x.UserId == User.Identity.Name && x.Id == tracking.TrackingItemId); var stateName = trackingItem.States.FirstOrDefault(s => s.Id == tracking.StateId).Name; SubscriberMailSettings emailSettings = new SubscriberMailSettings(); emailSettings.SourceEmailAddress = user.SmtpUserName; emailSettings.SmtpPassword = user.SmtpPassword; emailSettings.SmtpPort = user.SmtpPort; emailSettings.SmtpUrl = user.SmtpServerUrl; emailSettings.UseSsl = user.SmtpHttps; emailSettings.DestinationEmailAddress = tracking.CustomerInformation.Email; emailSettings.SourceFullName = string.Format("{0} {1}", user.FirstName, user.LastName); emailSettings.DestinationFullName = string.Format("{0} {1}", tracking.CustomerInformation.FirstName, tracking.CustomerInformation.LastName); var trackingData = QRCodeHtmlHelper.CreateQrData(tracking.TrackingNumber, tracking.Password); var qrUrl = QRCodeHtmlHelper.QRCode(null, trackingData, 150); Mailer.NotifyNewTracking(emailSettings, tracking.TrackingNumber, stateName, tracking.Comment, trackingItem.Name, qrUrl.ToString(), tracking.Password); } } } catch (Exception ex) { TempData["errorsOccured"] = string.Format("Unable to send a notification email: {0}", ex.Message); } return RedirectToAction("PrintableVersion", "Tracking", new { id = trackingId }); } catch { return View(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Bitmaptest()); Tracking track = new Tracking(); // MenuItems menu = new MenuItems(); }
public void DoWork(IRequest request, DigestFeedEntry entry) { //ReturnSample(request); //return; // If an asyncState object already exists, an exception is thrown as the performer only accepts // one call after each other. The Request receiver has to manage a queued execution. // Before calling the performers execution implementation method a new AsyncState object is created // and set to an initial tracking state. lock (_asyncStateObj) { if (null != _asyncStateObj.Tracking) throw new InvalidOperationException("The performer cannot be executed because it is already running."); ITracking tracking = new Tracking(); tracking.ElapsedSeconds = 1; tracking.Phase = TrackingPhase.INIT; tracking.PhaseDetail = "Tracking Id was: " + _requestContext.TrackingId.ToString(); tracking.PollingMillis = 100; tracking.RemainingSeconds = 100; _asyncStateObj.Tracking = tracking; } // *** Initialization for the async execution *** // - Read Feed from request stream. // - Read trackingId from request URL // convert tracking ID from request to type Guid string strTrackingId = request.Uri.TrackingID; if (String.IsNullOrEmpty(strTrackingId)) throw new RequestException("TrackingId is missing"); GuidConverter converter = new GuidConverter(); this.TrackingId = (Guid)converter.ConvertFrom(strTrackingId); if (null == entry.Digest) throw new RequestException("Digest payload missing in payload element."); Digest targetDigest = entry.Digest; // *** Do work asynchronously *** _asyncPerformer = new InternalAsyncPerformer(this); _asyncPerformer.DoWork(_requestContext.Config, targetDigest); // *** set the tracking to the request response *** this.GetTrackingState(request); }
public void ProductAdd(string code, string name, string category = null, string brand = null, string variant = null, string coupon = null, int position = 0, double price = 0, int quantity = 0) { Tracking tracking = new Tracking(); string script = tracking.TrackProductAdd( code: code, name: name, category: category, brand: brand, variant: variant, position: position, coupon: coupon, price: price, quantity: quantity); AddInteraction(script); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); if (Intent.Action == Intent.ActionSend) { // This is just an example of the data stored in the extras var uriFromExtras = Intent.GetStringExtra(Intent.ExtraText).Trim(); var alias = await SecureStorage.GetAsync("Alias"); // Check for existing query string and use & instead var uri = Tracking.AppendTrackingInfo(uriFromExtras, "social", "reddit", alias); await Clipboard.SetTextAsync(uri); await Launcher.TryOpenAsync($"https://reddit.com/submit?url={uri}"); } Finish(); }
public ActionResult QrRedirect(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tracking tracking = db.Trackings.Find(id); if (tracking == null) { return(HttpNotFound()); } if (User.IsInRole("Driver")) { return(RedirectToAction("Create", "ClientSignatures", new { id = id })); } else if (User.IsInRole("Employee")) { if (tracking.Track_Message == "Order has been Picked up") { return(RedirectToAction("ManagePackage", "Waybills", new { id = id })); } else if (tracking.Track_Message == "Order has arrived at Warehouse") { return(RedirectToAction("ManagePackageDispatch", "Waybills", new { id = id })); } ViewBag.Error = "Package tracking error. Please scan next package"; return(RedirectToAction("Store", "Waybills")); } else { return(RedirectToAction("MyTrackingSearch", new { id = id })); } }
public List <Tracking> getShipTracking(int shipmentId) { var list = new List <Tracking>(); Tracking tracking; try { using (var ctx = new transshipEntities()) { var query = (from sn in ctx.shipment_tracking join u in ctx.users on sn.userId equals u.userId where sn.shipmentId == shipmentId orderby sn.creation_date descending select new { username = u.email, userId = u.userId, trackingId = sn.trackingId, comentaries = sn.comentaries, status = sn.status, creation_date = sn.creation_date, shipmentId = sn.shipmentId }).ToList(); foreach (var n in query) { tracking = new Tracking(); tracking.username = n.username; tracking.userId = n.userId; tracking.trackingId = n.trackingId; tracking.comentaries = n.comentaries; tracking.status = n.status; tracking.creation_date = n.creation_date; tracking.shipmentId = n.shipmentId; list.Add(tracking); } return(list); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public ActionResult GuardarNextStatus(FormCollection myform) { //if (Session["usuario"] == null) //{ // Usuario usuario = (Usuario)Session["usuario"]; // ViewBag.Error = "Login o password no pueden estar vacíos"; // return RedirectToAction("Index", "Home"); //} Tracking tracking = new Tracking(); tracking.codigounico = long.Parse(myform["codigounico"].ToString()); tracking.cliente = myform["cliente"].ToString(); tracking.solicita = myform["solicita"].ToString(); tracking.fechavence = DateTime.Parse(myform["fechavence"].ToString()); tracking.status = myform["status"].ToString(); tracking.dstracking = myform["dstracking"].ToString(); switch (myform["newstatus"].ToString()) { case "Evaluacion": tracking.newstatus = "E"; break; case "Comite": tracking.newstatus = "C"; break; case "Notificar": tracking.newstatus = "N"; break; case "Cerrar": tracking.newstatus = "X"; break; } tracking.fechatracking = DateTime.Now; tracking.Insert(tracking); return(RedirectToAction("Index", "crm_menu")); }
private static void ProcessDeathStrike(object state) { Mobile defender = (Mobile)state; DeathStrikeInfo info = m_Table[defender] as DeathStrikeInfo; if (info == null) //sanity { return; } double ninjitsu = info.m_Attacker.Skills[SkillName.Ninjitsu].Fixed; int divisor = (info.m_Steps >= 5) ? 30 : 80; double baseDamage = ninjitsu / divisor; double stalkingBonus = Tracking.GetStalkingBonus(info.m_Attacker, info.m_Target); int maxDamage = (info.m_Steps >= 5) ? 62 : 22; int damage = Math.Max(0, Math.Min(maxDamage, (int)(baseDamage + stalkingBonus))); // This bonus is 8 at most. That brings the cap up to 70/30. damage += info.m_DamageBonus; if (info.m_Attacker.Weapon is BaseWeapon && ((BaseWeapon)info.m_Attacker.Weapon).MaxRange > 1) { damage /= 2; } // Damage is direct. //info.m_Target.Damage( damage, info.m_Attacker ); AOS.Damage(info.m_Target, info.m_Attacker, damage, true, 100, 0, 0, 0, 0); if (info.m_Timer != null) { info.m_Timer.Stop(); } m_Table.Remove(info.m_Target); }
public static IEnumerable <ITracking> ParseKml(XDocument kml) { XNamespace rootNamespace = kml.Root.Name.Namespace; XNamespace namespaceKml = XNamespace.Get("http://www.google.com/kml/ext/2.2"); var placemark = kml.Root.Element(rootNamespace + "Document") .Element(rootNamespace + "Placemark"); var track = placemark.Element(namespaceKml + "Track"); var timestamps = track.Elements(rootNamespace + "when") .Select(x => x.Value) .ToList(); var coords = track.Elements(namespaceKml + "coord") .Select(x => x.Value.Replace(".", ",")) .ToList(); if (timestamps.Count() != coords.Count()) { // TODO: Replace with appropriate exception throw new Exception("Coordinates don't match timestamps."); } var trackings = new List <Tracking>(); for (int i = 0; i < timestamps.Count(); i++) { var location = coords[i].Split(' '); var t = new Tracking() { Latitude = Math.Round(Convert.ToDecimal(location[1]), 6), Longitude = Math.Round(Convert.ToDecimal(location[0]), 6), Timestamp = DateTime.Parse(timestamps[i]) }; trackings.Add(t); } return(trackings); }
public Span TrackTo(VersionedSpan span, SpanTrackingMode mode) { if (span.Version == null) { throw new ArgumentException(nameof(span)); } if (span.Version.VersionNumber == this.VersionNumber) { return(span.Span); } if (span.Version.VersionNumber > this.VersionNumber) { return(Tracking.TrackSpanForwardInTime(mode, span.Span, this, span.Version)); } else { return(Tracking.TrackSpanBackwardInTime(mode, span.Span, this, span.Version)); } }
public async Task <Tracking> Delete(Tracking Tracking) { if (!await TrackingValidator.Delete(Tracking)) { return(Tracking); } try { await UOW.TrackingRepository.Delete(Tracking); await Logging.CreateAuditLog(new { }, Tracking, nameof(TrackingService)); return(Tracking); } catch (Exception ex) { await Logging.CreateSystemLog(ex, nameof(TrackingService)); } return(null); }
public void testGetTrackingByNumber5() { //courier require postalCode Tracking trackingGet1 = new Tracking("8W9JM0014847A094"); trackingGet1.slug = "arrowxl"; trackingGet1.trackingPostalCode = "BB102PN"; List <FieldTracking> fields = new List <FieldTracking>(); fields.Add(FieldTracking.id); fields.Add(FieldTracking.tracking_number); fields.Add(FieldTracking.slug); fields.Add(FieldTracking.source); Tracking tracking3 = connection.getTrackingByNumber(trackingGet1, fields, ""); Assert.AreEqual("53cf265d3dd72435213fa015", tracking3.id, "#B1"); Assert.AreEqual("api", tracking3.source, "#B2"); Assert.IsNull(tracking3.title, "#B3"); }
public void testGetLastCheckpoint2ID() { List <FieldCheckpoint> fields = new List <FieldCheckpoint>(); fields.Add(FieldCheckpoint.message); Tracking trackingGet1 = new Tracking("whatever"); trackingGet1.id = "53d1e35405e166704ea8adb9"; Checkpoint newCheckpoint1 = connection.getLastCheckpoint(trackingGet1, fields, ""); Assert.AreEqual("Network movement commenced", newCheckpoint1.message); Assert.AreEqual("0001-01-01T00:00:00+00:00", DateMethods.ToString(newCheckpoint1.createdAt)); fields.Add(FieldCheckpoint.created_at); // System.out.println("list:"+fields.toString()); Checkpoint newCheckpoint2 = connection.getLastCheckpoint(trackingGet1, fields, ""); Assert.AreEqual("Network movement commenced", newCheckpoint2.message); Assert.AreEqual("2014-07-25T04:55:49+00:00", DateMethods.ToString(newCheckpoint2.createdAt)); }
public void testGetLastCheckpoint2ID() { List <FieldCheckpoint> fields = new List <FieldCheckpoint>(); fields.Add(FieldCheckpoint.message); Tracking trackingGet1 = new Tracking("whatever"); trackingGet1.id = "555035fe74346ecd50998680"; Checkpoint newCheckpoint1 = connection.getLastCheckpoint(trackingGet1, fields, ""); Assert.IsTrue(!string.IsNullOrEmpty(newCheckpoint1.message)); Assert.AreEqual("0001-01-01T00:00:00+08:00", DateMethods.ToString(newCheckpoint1.createdAt)); fields.Add(FieldCheckpoint.created_at); Checkpoint newCheckpoint2 = connection.getLastCheckpoint(trackingGet1, fields, ""); Assert.IsTrue(!string.IsNullOrEmpty(newCheckpoint2.message)); Assert.AreNotEqual("0001-01-01T00:00:00+00:00", DateMethods.ToString(newCheckpoint2.createdAt)); Assert.IsTrue(!string.IsNullOrEmpty(DateMethods.ToString(newCheckpoint2.createdAt))); }
public int TrackTo(VersionedPosition other, PointTrackingMode mode) { if (other.Version == null) { throw new ArgumentException(nameof(other)); } if (other.Version.VersionNumber == this.VersionNumber) { return(other.Position); } if (other.Version.VersionNumber > this.VersionNumber) { return(Tracking.TrackPositionForwardInTime(mode, other.Position, this, other.Version)); } else { return(Tracking.TrackPositionBackwardInTime(mode, other.Position, this, other.Version)); } }
/// <summary> /// Translates a position back in time from the current position inside of VS to a /// version from the out of proc analysis version. /// </summary> public int TranslateBack(int position, ITextVersion currentVersion) { if (currentVersion != null && currentVersion.TextBuffer != _buffer) { Debug.Fail("mismatched buffer"); return(position < _fromVersion.Length ? position : _fromVersion.Length - 1); } var version = currentVersion ?? _buffer.CurrentSnapshot.Version; if (position >= version.Length) { position = version.Length; } return(Tracking.TrackPositionBackwardInTime( PointTrackingMode.Positive, position, version, _fromVersion )); }
// GET: Trackings/Edit/5 public ActionResult Edit(int?id) { var trackID = (from i in db.Trackings where i.Order_ID == id select i.Track_ID).FirstOrDefault(); if (trackID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tracking tracking = db.Trackings.Find(trackID); if (tracking == null) { return(HttpNotFound()); } ViewBag.Order_ID = new SelectList(db.Orders, "Order_ID", "Driver_ID", tracking.Order_ID); return(View(tracking)); }
public void Verify_Product_Add_Action_Is_Formatted_Correctly() { // Arrange Tracking tracking = new Tracking(); // Act string json = tracking.TrackProductAdd( code: "P12345", name: "Android Warhol T-Shirt", category: "Apparel", brand: "Google", coupon: null, variant: "Black", position: 1, price: 32, quantity: 1); // Inspect Debug.WriteLine(json); // Assert string fact = "ga(\"ec:addProduct\",{\"id\":\"P12345\",\"name\":\"Android Warhol T-Shirt\",\"brand\":\"Google\",\"category\":\"Apparel\",\"variant\":\"Black\",\"price\":32.0,\"quantity\":1,\"position\":1});"; Assert.AreEqual(fact, json); }
private async Task Sync_TorrentRemoved(string arg) { await _lock.WaitAsync(); try { var exists = Tracking.FirstOrDefault(x => x.Hash == arg); if (exists != null) { Tracking.Remove(exists); try { await exists.UploadedBy.FirstValidUser.SendMessageAsync($"Uploading of lesson {exists.Lesson} failed or was cancelled."); } catch (Exception ex) { Program.LogMsg(ex, "VidTorService"); } } DirectSave(InternalGenerateSave()); } finally { _lock.Release(); } }
private void load() { InternalChildren = new Drawable[] { Body = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderBody), _ => new DefaultSliderBody(), confineMode: ConfineMode.NoScaling), tailContainer = new Container <DrawableSliderTail> { RelativeSizeAxes = Axes.Both }, tickContainer = new Container <DrawableSliderTick> { RelativeSizeAxes = Axes.Both }, repeatContainer = new Container <DrawableSliderRepeat> { RelativeSizeAxes = Axes.Both }, Ball = new SliderBall(this) { GetInitialHitAction = () => HeadCircle.HitAction, BypassAutoSizeAxes = Axes.Both, AlwaysPresent = true, Alpha = 0 }, headContainer = new Container <DrawableSliderHead> { RelativeSizeAxes = Axes.Both }, }; PositionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); StackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); ScaleBindable.BindValueChanged(scale => Ball.Scale = new Vector2(scale.NewValue)); AccentColour.BindValueChanged(colour => { foreach (var drawableHitObject in NestedHitObjects) { drawableHitObject.AccentColour.Value = colour.NewValue; } }, true); Tracking.BindValueChanged(updateSlidingSample); }
public Order Copy(int poid, int?accountId = null) { //INSERT INTO dbo.PurchaseOrder (ClientID, AccountID, VendorID, CreatedDate, NeededDate, ApproverID, Oversized, ShippingMethodID, Notes, Attention, StatusID) //SELECT ClientID, AccountID, VendorID, GETDATE(), DATEADD(DAY, 7, GETDATE()), ApproverID, Oversized, ShippingMethodID, Notes, Attention, 1 // get the po to be copied var po = Require <Ordering.PurchaseOrder>(x => x.POID, poid); // po may be for a different user than current, this will get the correct vendor and approver - making copies if necessary var vendor = GetVendorForCopy(po); var approver = GetApproverForCopy(po); var copy = new Ordering.PurchaseOrder() { Client = Require <Data.Client>(x => x.ClientID, Context.CurrentUser.ClientID), AccountID = accountId ?? po.AccountID, Vendor = vendor, CreatedDate = DateTime.Now, NeededDate = DateTime.Now.AddDays(7), Approver = approver, Oversized = po.Oversized, ShippingMethod = po.ShippingMethod, Notes = po.Notes, Attention = po.Attention, Status = GetStatus(OrderStatus.Draft) }; DataSession.Insert(copy); // po may be for a different user than current, this will get the correct details - making item copies if necessary var details = GetDetailsForCopy(po, copy, vendor); DataSession.Insert(details); copy.Details = details; Tracking.Track(TrackingCheckpoints.DraftCreated, copy.CreateModel <IPurchaseOrder>(), Context.CurrentUser.ClientID); return(CreateOrder(copy)); }
public static ContactFirmViewModel ReadArchiveContactFirm() { var imported = Db.Trackings.Where(a => a.Name == _archiveRContactFirm).Any(); var cfirms = new List <ContactFirms>(); var errors = new List <KeyValuePair <string, string> >(); ReadData("~/Assets/archived_R_Contact_Firm.xls", imported, cfirms, errors); if (!imported) { var tracking = new Tracking() { Name = _archiveRContactFirm }; Db.Trackings.Add(tracking); } var viewModel = ContactFirmViewModel.Create(cfirms, errors, imported); return(viewModel); }
// GET: Trackings/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tracking tracking = db.Trackings.Find(id); if (tracking == null) { return(HttpNotFound()); } if (tracking.Description == "Delivered" || tracking.Description == "Returned" || tracking.Description == "Lost") { ViewBag.delivered = true; } else { ViewBag.delivered = false; } return(View(tracking)); }
public void StartTutorial() { Debug.Log("Start Tutorial"); solution.Hide(); var em = EffectsManager.Instance; em.PlayMusic(music); tr = TextResource.Get("tutorial").Filter("tutorial"); Tracking.Track(Tracking.LEVEL_TUTORIAL_START); movesArrow.Hide(); gui.ClearGUI(); gui.DisableListeners(); gui.movesDisplay.Hide(); controller.Execute(Command.Set, "0"); Invoke("SetupStep", 1); }
public void OnUnlockingGenerator(UnlockingGeneratorEventArgs ev) { if (ev.IsAllowed) { return; } if (Tracking.PlayersWithSubclasses.ContainsKey(ev.Player) && Tracking.PlayersWithSubclasses[ev.Player].Abilities.Contains(AbilityType.BypassKeycardReaders)) { SubClass subClass = Tracking.PlayersWithSubclasses[ev.Player]; if (Tracking.OnCooldown(ev.Player, AbilityType.BypassKeycardReaders, subClass)) { Tracking.DisplayCooldown(ev.Player, AbilityType.BypassKeycardReaders, subClass, "bypass keycard readers", Time.time); } else { Log.Debug($"Player with subclass {Tracking.PlayersWithSubclasses[ev.Player].Name} has been allowed to access locked locker", Subclass.Instance.Config.Debug); Tracking.AddCooldown(ev.Player, AbilityType.BypassKeycardReaders); ev.IsAllowed = true; } } }
protected override void OnPause() { Tracking.StopUsage(this); if (isToRunning && (modelActivity.dialog == null || !modelActivity.dialog.IsShowing)) { RunOnUiThread(delegate { if (Sincronizador.context == null || Sincronizador.context != ApplicationContext) { Sincronizador.context = ApplicationContext; } Sincronizador.TryExecSync(); }); } if ((modelActivity.dialog != null) && modelActivity.dialog.IsShowing) { modelActivity.dialog.Dismiss(); } modelActivity.dialog = null; base.OnPause(); }
/// <summary> /// Giao việc một ý kiến chỉ đạo cho cá nhân, đơn vị thực hiện /// </summary> /// <param name="request">Thông tin ý kiến chỉ đạo</param> /// <param name="requesterId">Mã người giao việc</param> /// <param name="trackerIds">Mã người theo dõi</param> /// <param name="departmentIds">Mã đơn vị thực hiện</param> /// <param name="isFinishedConfirm">Có cần xác nhận</param> public static void Assign(Request request, int requesterId, List <int> trackerIds, List <int> departmentIds, bool isFinishedConfirm) { foreach (var trackerId in trackerIds) { Tracking tracking = new Tracking(request.RequestID, trackerId); TrackingServices.Create(tracking); } foreach (var departmentId in departmentIds) { Perform perform = new Perform(requestId: request.RequestID, departmentId: departmentId, requiredDate: request.RequiredDate); perform.IsFinishedConfirm = isFinishedConfirm; PerformServices.CreatePerform(perform); } var orgRequest = GetById(request.RequestID); orgRequest.Status = 1; orgRequest.IsAssignPerform = true; orgRequest.RequesterID = requesterId; Update(orgRequest); if (request.IsProvinceRequest) { orgRequest.CreatedBy = CommonSessions.UserID; Update(orgRequest); Report report = new Report() { ReportContent = $"Đã giao cho {request.Departments?.Select(i => i.DepartmentName)?.ToList()?.DisplayInline()} thực hiện", PerformOnDate = DateTime.Now, RequestID = request.RequestID, Status = 1 }; ProvinceServiceHelper.ReceiveReport(ConfigurationManager.AppSettings["Province_Service"], report); } }
public void Verify_Full_Promotion_Click_Is_Formatted_Correctly() { // Arrange Tracking tracking = new Tracking(); // Act string json = tracking.TrackPromotionClick("PROMO1", "Summer Sale", "summer_banner_1", "top", "My Promos"); // Inspect Debug.WriteLine(json); // Assert string fact = "ga(\"ec:addPromo\",{\"id\":\"PROMO1\",\"name\":\"Summer Sale\",\"creative\":\"summer_banner_1\",\"position\":\"top\"});"; fact = fact + "\r\n"; fact = fact + "ga(\"ec:setAction\",\"promo_click\");"; fact = fact + "\r\n"; fact = fact + "ga(\"send\", \"event\", \"My Promos\", \"click\", \"Summer Sale\");"; Assert.AreEqual(fact, json); }
public ActionResult NextStatus(FormCollection myform) { //if (Session["usuario"] == null) //{ // Usuario usuario = (Usuario)Session["usuario"]; // ViewBag.Error = "Login o password no pueden estar vacíos"; // return RedirectToAction("Index", "Home"); //} Solicitud solicitud = new Solicitud(); solicitud.codigounico = long.Parse(myform["codigounico"].ToString()); solicitud.cliente = myform["cliente"].ToString(); solicitud.solicita = myform["solicita"].ToString(); solicitud.fechavence = DateTime.Parse(myform["fechavence"].ToString()); solicitud.status = myform["status"].ToString(); string viewstatus; if (myform["view"].ToString().Equals("query")) { viewstatus = "Q"; } else { viewstatus = solicitud.status; } List <Tracking> listtracking = new List <Tracking>(); Tracking tracking = new Tracking(); listtracking = tracking.View(solicitud.codigounico); ViewBag.solicitud = solicitud; ViewBag.listtracking = listtracking; ViewBag.viewstatus = viewstatus; ViewBag.Title = "Siguimiento de Casos"; return(View()); }
protected override void OnResultExecuting(ResultExecutingContext ctx) { base.OnResultExecuting(ctx); string _ipAddress; string _sessionId; _ipAddress = ctx.HttpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (string.IsNullOrEmpty(_ipAddress)) { _ipAddress = ctx.HttpContext.Request.ServerVariables["REMOTE_ADDR"]; } if (Request.Cookies["sessionKey"] != null) { _sessionId = Request.Cookies["sessionKey"].Value; } else { Response.Cookies.Add(new System.Web.HttpCookie("sessionKey", ctx.HttpContext.Session.SessionID)); Response.Cookies["sessionKey"].Expires = DateTime.Now.AddHours(12); _sessionId = ctx.HttpContext.Session.SessionID; } Tracking track = new Tracking(); track.IP = _ipAddress; track.Session = _sessionId; track.URL = ctx.HttpContext.Request.Url.PathAndQuery; track.CreatedDate = DateTime.Now; using (var db = new DIYFE.EF.DIYFEEntities()) { db.Trackings.Add(track); db.SaveChanges(); } ViewBag.PageModel = PageModel; }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { //Validates before swing ClearCurrentMove(attacker); attacker.SendLocalizedMessage(1063129); // You catch your opponent off guard with your Surprise Attack! defender.SendLocalizedMessage(1063130); // Your defenses are lowered as your opponent surprises you! defender.FixedParticles(0x37B9, 1, 5, 0x26DA, 0, 3, EffectLayer.Head); attacker.RevealingAction(); SurpriseAttackInfo info; if (m_Table.Contains(defender)) { info = (SurpriseAttackInfo)m_Table[defender]; if (info.m_Timer != null) { info.m_Timer.Stop(); } m_Table.Remove(defender); } int ninjitsu = attacker.Skills[SkillName.Ninjitsu].Fixed; int malus = ninjitsu / 60 + (int)Tracking.GetStalkingBonus(attacker, defender); info = new SurpriseAttackInfo(defender, malus); info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(8.0), new TimerStateCallback(EndSurprise), info); m_Table[defender] = info; CheckGain(attacker); }
/** * <summary> * Stores the worklog * </summary> * <param name="issue"></param> * <param name="start"></param> * <param name="end"></param> * <param name="comment"></param> * <param name="saveOnFailure"></param> * <returns></returns> */ async public Task <OperationResult> StoreWorklog(Tracking tracking, bool saveOnFailure = false) { try { if (tracking.To == default(DateTime)) { tracking.To = DateTime.Now; } var jiraIssue = await jira.Issues.GetIssueAsync(tracking.Key); double totalMinutes = Math.Round((tracking.To - tracking.Created).TotalMinutes); if (totalMinutes < 1) { totalMinutes = 1; } string total = totalMinutes.ToString() + "m"; //total = "143m"; JiraWorklog worklog = new JiraWorklog(total, tracking.Created, tracking.Comment); // add a worklog await jiraIssue.AddWorklogAsync(worklog); } catch (Exception e) { AppState.Logger.Log(this, "StoreWorklog", e.Message); if (!saveOnFailure) { return(OperationResult.FAILED); } AppState.ActiveProfile.FailedWorklogs.Add(tracking); AppState.Profiles.Save(); return(OperationResult.STORED); } return(OperationResult.SAVED); }
public void TestCreateTracking() { Tracking tracking1 = new Tracking(trackingNumberPost); tracking1.slug = slugPost; tracking1.orderIDPath = orderIDPathPost; tracking1.customerName = customerNamePost; tracking1.orderID = orderIDPost; tracking1.title = titlePost; tracking1.destinationCountryISO3 = countryDestinationPost; tracking1.addEmails(email1Post); tracking1.addEmails(email2Post); tracking1.addCustomFields("product_name", customProductNamePost); tracking1.addCustomFields("product_price", customProductPricePost); tracking1.addSmses(sms1Post); tracking1.addSmses(sms2Post); Tracking trackingPosted = connection.createTracking(tracking1); Assert.AreEqual(trackingNumberPost, trackingPosted.trackingNumber, "#A01"); Assert.AreEqual(slugPost, trackingPosted.slug, "#A02"); Assert.AreEqual(orderIDPathPost, trackingPosted.orderIDPath, "#A03"); Assert.AreEqual(orderIDPost, trackingPosted.orderID, "#A04"); Assert.AreEqual(countryDestinationPost, trackingPosted.destinationCountryISO3, "#A05"); Assert.IsTrue(trackingPosted.emails.Contains(email1Post), "#A06"); Assert.IsTrue(trackingPosted.emails.Contains(email2Post), "#A07"); Assert.AreEqual(2, trackingPosted.emails.Count, "#A08"); Assert.IsTrue(trackingPosted.smses.Contains(sms1Post), "#A09"); Assert.IsTrue(trackingPosted.smses.Contains(sms2Post), "#A10"); Assert.AreEqual(2, trackingPosted.smses.Count, "#A11"); Assert.AreEqual(customProductNamePost, trackingPosted.customFields["product_name"], "#A12"); Assert.AreEqual(customProductPricePost, trackingPosted.customFields["product_price"], "#A13"); }
/// <summary> /// Shutdown Tracking /// //TODO check which of the two stops is hanging from time to time /// </summary> public void Shutdown() { try { if (m_video != null) { try { video.stop(); m_video.Dispose(); m_video = null; } catch(Exception ex) { Debug.LogError("Error stopping video - have you forgotten openvideo.xml in your project?("+ex.Message+")"); } } if (m_tracking != null) { try { m_tracking.stop(); m_tracking.Dispose(); m_tracking = null; } catch(Exception ex) { Debug.LogError("Error stopping tracking.("+ex.Message+")"); } } } catch(System.Exception ex) { Debug.LogError("Exception: "+ ex.ToString()); } if (Debug.isDebugBuild) UnityClient.hideConsole(); }
public void Roam() { //if (wallHeight > 20) //{ if (IRSensor.Detection || wallLineHeight > 15) { for (int i = 0; i < 8; i++) Drive.Backward(1); preyRectangle = DetectObstacle(redFilter, cameraImage, new Vector2(10), ref redColourBitmap); if (wallLeftPoint.Y > wallRightPoint.Y) for (int i = 0; i < 4; i++) { Drive.RotateRight(3); } else for (int i = 0; i < 4; i++) { Drive.RotateLeft(3); } } else if ((obstacleRectangle.Height < 200 || obstacleRectangle.Width < 100))// && (wallLineRectangle.Height > 25 || wallLineRectangle.Height < 40)) for (int i = 0; i < 3; i++) Drive.Forward(1); else { if (obstacleRectangle.X > cameraDimensions.X / 8) for (int i = 0; i < 4; i++) { Drive.RotateLeft(3); } else for (int i = 0; i < 4; i++) { Drive.RotateRight(3); } //obstacleRectangle = new System.Drawing.Rectangle(0, 0, 0, 0); // PerformPredatorActions(); //searchingRotationCount = 0; Drive.Stop(); } //} trackingState = Tracking.Roaming; }
public void testGetLastCheckpoint3ID() { List<FieldCheckpoint> fields = new List<FieldCheckpoint>(); fields.Add(FieldCheckpoint.message); Tracking trackingGet1 = new Tracking("whatever"); trackingGet1.id = "5550361716f0d77344cb80ad"; Checkpoint newCheckpoint1 = connection.getLastCheckpoint(trackingGet1, fields, ""); Assert.IsTrue(!string.IsNullOrEmpty(newCheckpoint1.message)); }
public void testGetLastCheckpointID() { Tracking trackingGet1 = new Tracking("whatever"); trackingGet1.id = "5550529d74346ecd5099ab47"; Checkpoint newCheckpoint = connection.getLastCheckpoint(trackingGet1); Assert.IsTrue(!string.IsNullOrEmpty(newCheckpoint.message)); Assert.AreEqual(null, newCheckpoint.countryName); Assert.AreEqual("Delivered", newCheckpoint.tag); }
private void btnStationBroadcast_Click(object sender, EventArgs e) { //Find Station that is connected List<string> connectedConsole = new List<string>(); foreach (string console in _CallOut_CodingService.GetConnectedConsole()) { connectedConsole.Add(console); } string[] addressList = connectedConsole.ToArray(); CodingIncidentMessage testIncidentMsg = TestMessageTemplate2(); ConvertCodingtoTracker(addressList, testIncidentMsg); //Add to gateway tracker Log("Send broadcast test message"); _CallOut_CodingService.TargetMsg(addressList, testIncidentMsg); List<Tracking> trackingList = new List<Tracking>(); //Only take out the stations on the Current Station foreach (string station in connectedConsole) { Tracking newstation = new Tracking(); newstation.Station = station; newstation.Status = "Pending"; List<string> unitcallsign = new List<string>(); //To give relevant station units callsign foreach (CodingUnits unit in testIncidentMsg.DispatchUnits) { if (unit.UnitCurrentStation.Equals(station)) { unitcallsign.Add(unit.Callsign); } //For test message if (unit.UnitCurrentStation.Equals("Test")) { unitcallsign.Add(unit.Callsign); } } newstation.Unit = unitcallsign.ToArray(); trackingList.Add(newstation); //Add into tracking list } //Send ack back to CAD CADIncidentAck cadincidentack = new CADIncidentAck(); cadincidentack.CodingID = testIncidentMsg.CodingID; cadincidentack.AckTracking = trackingList.ToArray(); DateTime currentdt = DateTime.Now; cadincidentack.AckTimeStamp = currentdt; cadincidentack.AckNo = 0; cadincidentack.AckTotal = connectedConsole.Count; Log("Send Ack to CAD for broadcast test message"); _CallOut_CADService.AckCADIncidentMsg(cadincidentack); //Set Coding Entry CreateTestCodingEntry(testIncidentMsg, connectedConsole.Count.ToString()); //Set Message Entry CreateMessageEntry(testIncidentMsg, connectedConsole.Count.ToString()); }
public void Search() { for (int i = 0; i < 2; i++) if (preyScreenPosition.X < cameraDimensions.X / 2) Drive.RotateLeft(3); else Drive.RotateRight(3); searchingRotationCount++; if (searchingRotationCount > 8) trackingState = Tracking.Roaming; Drive.Stop(); }
public void Approach() { //trackingState = Tracking.OnScreen; // searchingRotationCount = 0; if (preyScreenPosition.X < 0 + cameraDimensions.X / 5) { for (int i = 0; i < 1; i++) Drive.RotateLeft20(2); Drive.Stop(); } else if (preyScreenPosition.X > cameraDimensions.X - cameraDimensions.X / 5) { for (int i = 0; i < 1; i++) Drive.RotateRight20(2); Drive.Stop(); } else if (preyRectangle.Width < 80) { trackingState = Tracking.Approaching; Drive.Forward(1); } else Drive.Stop(); }
public void PerformPredatorActions() { cameraImage = Camera.Image; obstacleRectangle = DetectObstacle(greenFilter, cameraImage, new Vector2(35), ref greenColourBitmap); preyRectangle = DetectObstacle(redFilter, cameraImage, new Vector2(10), ref redColourBitmap); wallLineRectangle = DetectObstacle(whiteFilter, cameraImage, new Vector2(100, 0), ref whiteColourBitmap); redColourBitmap = ConvertImageFormat(redColourBitmap); redColourBitmap = ApplyColour(redColourBitmap, cameraImage, System.Drawing.Color.Red); greenColourBitmap = ConvertImageFormat(greenColourBitmap); greenColourBitmap = ApplyColour(greenColourBitmap, cameraImage, System.Drawing.Color.LightGreen); whiteColourBitmap = ApplyColour(whiteColourBitmap, cameraImage, System.Drawing.Color.Cyan); whiteColourBitmap = ConvertImageFormat(whiteColourBitmap); wallLeftPoint = GetPoint(whiteColourBitmap, wallLineRectangle.X, wallLineRectangle); wallRightPoint = GetPoint(whiteColourBitmap, wallLineRectangle.X+wallLineRectangle.Width-1, wallLineRectangle); System.Drawing.Point p = GetPoint(whiteColourBitmap, wallLineRectangle.X + wallLineRectangle.Width - (wallLineRectangle.Width/2), wallLineRectangle); AForge.Imaging.Filters.HistogramEqualization hFilter = new AForge.Imaging.Filters.HistogramEqualization(); cameraImage = Greyscale(cameraImage); cameraImage = ConvertImageFormat(cameraImage); AForge.Imaging.Filters.SimplePosterization jFilter = new AForge.Imaging.Filters.SimplePosterization(); // cameraImage = jFilter.Apply(cameraImage); AForge.Imaging.Filters.Merge mFilter = new AForge.Imaging.Filters.Merge(greenColourBitmap); Bitmap mergedColourImages = mFilter.Apply(whiteColourBitmap); mFilter = new AForge.Imaging.Filters.Merge(mergedColourImages); mergedColourImages = mFilter.Apply(redColourBitmap); mFilter = new AForge.Imaging.Filters.Merge(cameraImage); cameraImage = mFilter.Apply(mergedColourImages); //cameraImage = whiteColourBitmap; if (preyRectangle != new System.Drawing.Rectangle(0, 0, 0, 0)) preyScreenPosition = preyRectangle; if (preyRectangle == new System.Drawing.Rectangle(0, 0, 0, 0) && searchingRotationCount < 8) trackingState = Tracking.Searching; else if (searchingRotationCount >= 8 && trackingState != Tracking.OnScreen) trackingState = Tracking.Roaming; else trackingState = Tracking.OnScreen; RobotCommands(); }
public void testGetLastCheckpoint2ID() { List<FieldCheckpoint> fields = new List<FieldCheckpoint>(); fields.Add(FieldCheckpoint.message); Tracking trackingGet1 = new Tracking("whatever"); trackingGet1.id = "555035fe74346ecd50998680"; Checkpoint newCheckpoint1 = connection.getLastCheckpoint(trackingGet1, fields, ""); Assert.IsTrue(!string.IsNullOrEmpty(newCheckpoint1.message)); Assert.AreEqual("0001-01-01T00:00:00+08:00", DateMethods.ToString(newCheckpoint1.createdAt)); fields.Add(FieldCheckpoint.created_at); Checkpoint newCheckpoint2 = connection.getLastCheckpoint(trackingGet1, fields, ""); Assert.IsTrue(!string.IsNullOrEmpty(newCheckpoint2.message)); Assert.AreNotEqual("0001-01-01T00:00:00+00:00", DateMethods.ToString(newCheckpoint2.createdAt)); Assert.IsTrue(!string.IsNullOrEmpty(DateMethods.ToString(newCheckpoint2.createdAt))); }
public void SendBroadcastIncidentCoding(string console, string status, string[] unitcallsign, MessageStatus messagestatus) { //Get Station tracking Tracking stationTrack = new Tracking(); stationTrack.Station = console; stationTrack.Status = status; stationTrack.Unit = unitcallsign; //Broadcast Coding status back to CAD (failed) CADIncidentCodingStatus incidentcodingstatus = new CADIncidentCodingStatus(); incidentcodingstatus.CodingID = messagestatus.CodingID; incidentcodingstatus.AckTracking = stationTrack; incidentcodingstatus.AckFrom = messagestatus.AckFrom; incidentcodingstatus.AckStatus = messagestatus.AckStatus; DateTime currentdt = DateTime.Now; incidentcodingstatus.AckTimeStamp = currentdt; incidentcodingstatus.AckNo = Int32.Parse(messagestatus.AckNo); incidentcodingstatus.AckTotal = Int32.Parse(messagestatus.AckTotal); //incidentcodingstatus.AckTotal = string.IsNullOrEmpty(messagestatus.AckTotal) ? 0 : Int32.Parse(messagestatus.AckTotal); Log("Broadcast status back to CAD"); _CallOut_CADService.BroadcastIncidentCodingStatus(incidentcodingstatus); }
public void testGetTrackingByNumber() { String trackingNumber = "3799517046"; String slug = "dhl"; Tracking trackingGet1 = new Tracking(trackingNumber); trackingGet1.slug = slug; Tracking tracking = connection.getTrackingByNumber(trackingGet1); Assert.AreEqual(trackingNumber, tracking.trackingNumber, "#A23"); Assert.AreEqual(slug, tracking.slug, "#A24"); Assert.AreEqual(null, tracking.shipmentType, "#A25"); List<Checkpoint> checkpoints = tracking.checkpoints; Checkpoint lastCheckpoint = checkpoints[checkpoints.Count - 1]; Assert.IsTrue(checkpoints != null, "A25-1"); Assert.IsTrue(checkpoints.Count > 1, "A25-2"); Assert.IsTrue(!string.IsNullOrEmpty(lastCheckpoint.message)); Assert.IsTrue(!string.IsNullOrEmpty(lastCheckpoint.countryName)); }
public void testGetTrackingByNumber2() { //slug is bad informed try { Tracking trackingGet2 = new Tracking("RC328021065CN"); connection.getTrackingByNumber(trackingGet2); //always should give an exception before this Assert.IsTrue(false, "#A26"); } catch (Exception e) { Console.WriteLine(e.Message); Assert.AreEqual("{\"meta\":{\"code\":404,\"message\":\"The URI requested is invalid or the resource requested does not exist.\",\"type\":\"NotFound\"},\"data\":{\"resource\":\"/v4/trackings//RC328021065CN\"}}", e.Message, "#A27"); } }
public void testGetTrackingByNumber3() { //if the trackingNumber is bad informed try { Tracking trackingGet3 = new Tracking("adf"); trackingGet3.slug = "fedex"; connection.getTrackingByNumber(trackingGet3); //always should give an exception before this Assert.IsTrue(false, "#A28"); } catch (Exception e) { Console.Write(e.Message); Assert.AreEqual("{\"meta\":{\"code\":4005,\"message\":\"The value of `tracking_number` is invalid.\",\"type\":\"BadRequest\"},\"data\":{}}", e.Message, "#A29"); } }
void OnEnable() { if (Debug.isDebugBuild) UnityClient.showConsole(); try { m_video = new Video(videoConfigFile); if(m_video!=null) { if(!m_video.start()) { m_video.Dispose(); m_video=null; } } m_tracking = new Tracking(trackingConfigFile); m_tracking.start(); } catch(Exception ex) { Debug.LogError("Error Manager.OnEnable - "+ex.Message); } }
public void testDeleteTracking1() { //if the slug is bad informed try { Tracking deleteTracking2 = new Tracking(trackingNumberDelete2); Assert.IsTrue(connection.deleteTracking(deleteTracking2), "#A19"); //always should give an exception before this Assert.IsTrue(false); } catch (Exception e) { Assert.AreEqual("{\"meta\":{\"code\":404,\"message\":\"The URI requested is invalid or the resource requested does not exist.\",\"type\":\"NotFound\"},\"data\":{\"resource\":\"/v4/trackings//798865638020\"}}", e.Message, "#A20"); } }
public void testPutTracking() { Tracking tracking = new Tracking("00340433836621378669"); tracking.slug = "dhl-germany"; tracking.title = "another title"; Tracking tracking2 = connection.putTracking(tracking); Assert.AreEqual("another title", tracking2.title); //test post tracking number doesn't exist Tracking tracking3 = new Tracking(trackingNumberToDetectError); tracking3.title = "another title"; try { connection.putTracking(tracking3); //always should give an exception before this Assert.AreEqual("This never should be executed", false); } catch (Exception e) { Assert.AreEqual("{\"meta\":{\"code\":404,\"message\":\"The URI requested is invalid or the resource requested does not exist.\",\"type\":\"NotFound\"},\"data\":{\"resource\":\"/v4/trackings//asdq\"}}", e.Message); } }
/* * 1) Convert from incident message into coding message * 2) Send the coding message to relevant console * 3) Send Ack back to CAD in order to update mainly codingID */ public void RcvCADIncidentMsg(ServiceReference2.DispatchedIncident CADincidentMsg) { SendOrPostCallback callback = delegate (object state) { List<string> tmpstationList = new List<string>(); List<Tracking> trackingList = new List<Tracking>(); //Only take out the stations on the Current Station foreach (ServiceReference2.DispatchedUnit uniqueunit in CADincidentMsg.ListOfUnits) { //Avoid duplicate station name in the list if (!tmpstationList.Contains(uniqueunit.CurrentStation)) { tmpstationList.Add(uniqueunit.CurrentStation); Tracking newstation = new Tracking(); newstation.Station = uniqueunit.CurrentStation; newstation.Status = "Pending"; List<string> unitcallsign = new List<string>(); //To give relevant station units callsign foreach (ServiceReference2.DispatchedUnit unit in CADincidentMsg.ListOfUnits) { if (unit.CurrentStation.Equals(uniqueunit.CurrentStation)) { unitcallsign.Add(unit.CallSign); } } newstation.Unit = unitcallsign.ToArray(); trackingList.Add(newstation); //Add into tracking list } } string[] addressList = tmpstationList.ToArray(); //Convert Incident to Coding Message and send to respective console CodingIncidentMessage codingincidentmsg = ConvertIncidentToCoding(CADincidentMsg); ConvertCodingtoTracker(addressList, codingincidentmsg); //Add to gateway tracker Log("Forward message from simulate CAD to respective console"); _CallOut_CodingService.TargetMsg(addressList, codingincidentmsg); //Send ack back to CAD CADIncidentAck cadincidentack = new CADIncidentAck(); cadincidentack.CodingID = codingincidentmsg.CodingID; cadincidentack.AckTracking = trackingList.ToArray(); DateTime currentdt = DateTime.Now; cadincidentack.AckTimeStamp = currentdt; cadincidentack.AckNo = 0; cadincidentack.AckTotal = tmpstationList.Count; Log("Send ack to simulate CAD for forward message to console"); _CallOut_CADService.AckCADIncidentMsg(cadincidentack); //Set Coding Entry CreateCodingEntry(codingincidentmsg, tmpstationList.Count.ToString()); //Set Message Entry CreateMessageEntry(codingincidentmsg, tmpstationList.Count.ToString()); }; _uiSyncContext.Post(callback, "Rcv Incident Message"); }
public void setUp() { String key = System.IO.File.ReadAllText(@"\\psf\Home\Documents\aftership-key.txt"); connection = new ConnectionAPI(key); if (firstTime) { Console.WriteLine("****************SET-UP BEGIN**************"); firstTime = false; //delete the tracking we are going to post (in case it exist) Tracking tracking = new Tracking("05167019264110"); tracking.slug = "dpd"; //first courier firstCourier.Add("slug", "india-post-int"); firstCourier.Add("name", "India Post International"); firstCourier.Add("phone", "+91 1800 11 2011"); firstCourier.Add("other_name", "भारतीय डाक, Speed Post & eMO, EMS, IPS Web"); firstCourier.Add("web_url", "http://www.indiapost.gov.in/"); //first courier in your account firstCourierAccount.Add("slug", "usps"); firstCourierAccount.Add("name", "USPS"); firstCourierAccount.Add("phone", "+1 800-275-8777"); firstCourierAccount.Add("other_name", "United States Postal Service"); firstCourierAccount.Add("web_url", "https://www.usps.com"); try { connection.deleteTracking(tracking); } catch (Exception e) { Console.WriteLine("**1" + e.Message); } Tracking tracking1 = new Tracking(trackingNumberToDetect); tracking1.slug = "dpd"; try { connection.deleteTracking(tracking1); } catch (Exception e) { Console.WriteLine("**2" + e.Message); } try { Tracking newTracking = new Tracking(trackingNumberDelete); newTracking.slug = slugDelete; connection.createTracking(newTracking); } catch (Exception e) { Console.WriteLine("**3" + e.Message); } try { Tracking newTracking1 = new Tracking("9400110897700003231250"); newTracking1.slug = "usps"; connection.createTracking(newTracking1); } catch (Exception e) { Console.WriteLine("**4" + e.Message); } Console.WriteLine("****************SET-UP FINISH**************"); } }
//Retrieve Incident Coding Status base on Query public void IncidentCodingStatus(string querycodingID) { SendOrPostCallback callback = delegate (object state) { //Gather incident coding status base on coding ID int acktotal = 0; int pendingno = 0; DateTime currentdt = DateTime.Now; bool validCodingID = false; //Update coding status (received time) foreach (CodingStatus codingstatus in _CodingStatusList) { if (codingstatus.CodingID.Equals(querycodingID)) { //There is such codingID exist validCodingID = true; //Update the updated timestamp from Console codingstatus.Updated = String.Format("{0:g}", currentdt); acktotal = Int32.Parse(codingstatus.Pending) + Int32.Parse(codingstatus.Acknowledged) + Int32.Parse(codingstatus.Rejected) + Int32.Parse(codingstatus.Failed); pendingno = Int32.Parse(codingstatus.Pending); } } if (validCodingID) { //Update message status (-1 in ack No) //Create new entry base on the coding ack message MessageStatus newMsgStatus = new MessageStatus(); newMsgStatus.CodingID = querycodingID; newMsgStatus.AckTimeStamp = String.Format("{0:g}", currentdt); newMsgStatus.AckFrom = "Gateway"; if (pendingno == 0) { newMsgStatus.AckStatus = "Completed"; } else { newMsgStatus.AckStatus = "Pending"; } newMsgStatus.AckNo = "-1"; newMsgStatus.AckTotal = acktotal.ToString(); _MessageStatusList.Add(newMsgStatus); //Response back to CAD List<Tracking> trackingList = new List<Tracking>(); foreach (GatewayTracker gatewaytrack in _GatewayTrackerList) { if (gatewaytrack.CodingID.Equals(querycodingID)) { //Only take out the stations on the Current Station foreach (KeyValuePair<string, string> station in gatewaytrack.StationStatus) { Tracking newstation = new Tracking(); newstation.Station = station.Key; newstation.Status = station.Value; List<string> unitcallsign = new List<string>(); //To give relevant station units callsign foreach (CodingUnits unit in gatewaytrack.DispatchUnits) { if (unit.UnitCurrentStation.Equals(station.Key)) { unitcallsign.Add(unit.Callsign); } //For Test message if (unit.UnitCurrentStation.Equals("Test")) { unitcallsign.Add(unit.Callsign); } } newstation.Unit = unitcallsign.ToArray(); trackingList.Add(newstation); //Add into tracking list } } } CADIncidentAck codingQueryRsponse = new CADIncidentAck(); codingQueryRsponse.CodingID = newMsgStatus.CodingID; codingQueryRsponse.AckTracking = trackingList.ToArray(); codingQueryRsponse.AckTimeStamp = currentdt; codingQueryRsponse.AckNo = Int32.Parse(newMsgStatus.AckNo); codingQueryRsponse.AckTotal = Int32.Parse(newMsgStatus.AckTotal); Log("Respond to requested ad hoc request from simulate CAD"); _CallOut_CADService.IncidentCodingStatusResponse(codingQueryRsponse); } }; _uiSyncContext.Post(callback, "Request incident coding status"); }
//------------------------------- for trying connection purpose--------------------------------------------- public void RcvDispatchedIncidentMsg(gCAD.Shared.IntegrationContract.DispatchedIncident CADincidentMsg) { SendOrPostCallback callback = delegate (object state) { List<string> tmpstationList = new List<string>(); List<Tracking> trackingList = new List<Tracking>(); //Only take out the stations on the Current Station foreach (gCAD.Shared.IntegrationContract.DispatchedUnit uniqueunit in CADincidentMsg.ListOfUnits) { //Avoid duplicate station name in the list if (!tmpstationList.Contains(uniqueunit.CurrentStation)) { tmpstationList.Add(uniqueunit.CurrentStation); Tracking newstation = new Tracking(); newstation.Station = uniqueunit.CurrentStation; newstation.Status = "Pending"; List<string> unitcallsign = new List<string>(); //To give relevant station units callsign foreach (gCAD.Shared.IntegrationContract.DispatchedUnit unit in CADincidentMsg.ListOfUnits) { if (unit.CurrentStation.Equals(uniqueunit.CurrentStation)) { unitcallsign.Add(unit.CallSign); } } newstation.Unit = unitcallsign.ToArray(); trackingList.Add(newstation); //Add into tracking list } } string[] addressList = tmpstationList.ToArray(); //Convert Incident to Coding Message and send to respective console CodingIncidentMessage codingincidentmsg = ConvertDispatchedIncidentToCoding(CADincidentMsg); ConvertCodingtoTracker(addressList, codingincidentmsg); //Add to gateway tracker Log("Forward message from Real CAD to respective console"); _CallOut_CodingService.TargetMsg(addressList, codingincidentmsg); //Send ack back to CAD foreach (Tracking station in trackingList) { string Comment = station.Station + " " + station.Status; CallAPI(CADincidentMsg.IncidentNumber, Comment); } //Set Coding Entry CreateCodingEntry(codingincidentmsg, tmpstationList.Count.ToString()); //Set Message Entry CreateMessageEntry(codingincidentmsg, tmpstationList.Count.ToString()); }; _uiSyncContext.Post(callback, "Rcv Incident Message"); }
public void testDeleteTracking2() { //if the trackingNumber is bad informed try { Tracking deleteTracking3 = new Tracking("adfa"); deleteTracking3.slug = "fedex"; Assert.IsTrue(connection.deleteTracking(deleteTracking3), "#A20"); //always should give an exception before this Assert.IsTrue(false, "#A21"); } catch (Exception e) { Assert.AreEqual("{\"meta\":{\"code\":4005,\"message\":\"The value of `tracking_number` is invalid.\",\"type\":\"BadRequest\"},\"data\":{}}", e.Message, "#A22"); } }
private void btnStationTarget_Click(object sender, EventArgs e) { //Find Station that is been checked List<string> tmpstationList = new List<string>(); foreach (DataGridViewRow row in dgvStation.Rows) { if (dgvStation.Rows[row.Index].Cells[3].Value != null) { if ((bool)dgvStation.Rows[row.Index].Cells[3].Value) { tmpstationList.Add(dgvStation.Rows[row.Index].Cells[1].Value.ToString()); //add station name } } } string[] addressList = tmpstationList.ToArray(); CodingIncidentMessage testIncidentMsg = TestMessageTemplate(); ConvertCodingtoTracker(addressList, testIncidentMsg); //Add to gateway tracker Log("Send target test message"); _CallOut_CodingService.TargetMsg(addressList, testIncidentMsg); List<Tracking> trackingList = new List<Tracking>(); //Only take out the stations on the Current Station foreach (string station in tmpstationList) { Tracking newstation = new Tracking(); newstation.Station = station; newstation.Status = "Pending"; List<string> unitcallsign = new List<string>(); //To give relevant station units callsign foreach (CodingUnits unit in testIncidentMsg.DispatchUnits) { if (unit.UnitCurrentStation.Equals(station)) { unitcallsign.Add(unit.Callsign); } //For test message if (unit.UnitCurrentStation.Equals("Test")) { unitcallsign.Add(unit.Callsign); } } newstation.Unit = unitcallsign.ToArray(); trackingList.Add(newstation); //Add into tracking list } //Send ack back to CAD CADIncidentAck cadincidentack = new CADIncidentAck(); cadincidentack.CodingID = testIncidentMsg.CodingID; cadincidentack.AckTracking = trackingList.ToArray(); DateTime currentdt = DateTime.Now; cadincidentack.AckTimeStamp = currentdt; cadincidentack.AckNo = 0; cadincidentack.AckTotal = tmpstationList.Count; Log("Send Ack to CAD for target test message"); _CallOut_CADService.AckCADIncidentMsg(cadincidentack); //Set Coding Entry CreateTestCodingEntry(testIncidentMsg, tmpstationList.Count.ToString()); //Set Message Entry CreateMessageEntry(testIncidentMsg, tmpstationList.Count.ToString()); }
public void TS_Tracking(Auth auth, Tracking request, Tracking_Logic logic, CommonResponse ecr, string[] token, string uri) { if (auth.AuthResult(token, uri)) { if (uri.IndexOf("/tracking/OrderNo") > 0) { ecr.data.results = logic.GetOmtx1List(request); } else if (uri.IndexOf("/tracking/sps") > 0) { ecr.data.results = logic.GetSpsList(request); } else if (uri.IndexOf("/tracking/count") > 0) { ecr.data.results = logic.GetCount(request); } else { ecr.data.results = logic.GetList(request); } ecr.meta.code = 200; ecr.meta.message = "OK"; } else { ecr.meta.code = 401; ecr.meta.message = "Unauthorized"; } }
public void testRetrack() { Tracking tracking = new Tracking("00340433836621378669"); tracking.slug = "dhl-germany"; try { connection.retrack(tracking); Assert.IsTrue(false); } catch (Exception e) { Console.WriteLine(e.Message); Assert.IsTrue(e.Message.Contains("4016")); Assert.IsTrue(e.Message.Contains("Retrack is not allowed. You can only retrack each shipment once.")); } }