/// <summary> /// Constructor for this class. /// </summary> /// <param name="id">The item ID.</param> /// <param name="name">The name of the item.</param> /// <param name="cap">The minimum capacity the player must have to loot this item.</param> /// <param name="destination">The destination of the item.</param> /// <param name="containerIndex">The minimum container number. Only applicable if destination is a container.</param> public Loot(ushort id, string name, ushort cap, Destinations destination, byte containerIndex = 0) { this.ID = id; this.Name = name; this.Cap = cap; this.Destination = destination; this.Index = containerIndex; }
public SendResults(int totalFiles, Destinations destination) { _totalFiles = totalFiles; _destination = destination; _results = new Dictionary<SendResult, int>(); foreach (SendResult k in Enum.GetValues(typeof (SendResult))) _results.Add(k, 0); }
// Example from page - http://help.k2.com/onlinehelp/k2blackpearl/DevRef/4.6.9/default.htm#How_to_set_a_users_Out_of_Office_Status.html%3FTocPath%3DRuntime%2520APIs%2520and%2520Services%7CWorkflow%7CWorkflow%2520Client%2520API%7CWorkflow%2520Client%2520API%2520Samples%7C_____10 /// <summary> /// Add OOF share for current user /// </summary> private void AddOutOfOffice() { string destinationUser = base.GetStringProperty(Constants.SOProperties.OutOfOffice.DestinationUser); ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0]; serviceObject.Properties.InitResultTable(); DataTable results = base.ServiceBroker.ServicePackage.ResultTable; using (Connection k2Con = new Connection()) { k2Con.Open(base.K2ClientConnectionSetup); WorklistShares wsColl = k2Con.GetCurrentSharingSettings(ShareType.OOF); // Throw error if multiple configurations (WorklistShare objects) detected, as this method cannot support that if (wsColl.Count > 1) { throw new ApplicationException(Constants.ErrorMessages.MultipleOOFConfigurations); } // If configuration exist already, add to it else if (wsColl.Count == 1) { WorklistShare worklistshare = wsColl[0]; int capacity = worklistshare.WorkTypes[0].Destinations.Count; string[] existingDestinations = new string[capacity]; for (int i = 0; i < capacity; i++) { existingDestinations[i] = worklistshare.WorkTypes[0].Destinations[i].Name.ToUpper().Trim(); } if (Array.IndexOf(existingDestinations, destinationUser.ToUpper().Trim()) == -1) { worklistshare.WorkTypes[0].Destinations.Add(new Destination(destinationUser, DestinationType.User)); } bool result = k2Con.ShareWorkList(worklistshare); DataRow dr = results.NewRow(); dr[Constants.SOProperties.OutOfOffice.DestinationUser] = destinationUser; results.Rows.Add(dr); ; } // New user, create configuration for OOF else { // ALL Work that remains which does not form part of any "WorkTypeException" Filter WorklistCriteria worklistcriteria = new WorklistCriteria(); worklistcriteria.Platform = "ASP"; // Send ALL Work based on the above Filter to the following User Destinations worktypedestinations = new Destinations(); worktypedestinations.Add(new Destination(destinationUser, DestinationType.User)); // Link the filters and destinations to the Work WorkType worktype = new WorkType("MyWork_" + k2Con.User.FQN, worklistcriteria, worktypedestinations); WorklistShare worklistshare = new WorklistShare(); worklistshare.ShareType = ShareType.OOF; worklistshare.WorkTypes.Add(worktype); bool result = k2Con.ShareWorkList(worklistshare); k2Con.SetUserStatus(UserStatuses.Available); DataRow dr = results.NewRow(); dr[Constants.SOProperties.OutOfOffice.DestinationUser] = destinationUser; results.Rows.Add(dr); } k2Con.Close(); } }
// Example from page - http://help.k2.com/onlinehelp/k2blackpearl/DevRef/4.6.9/default.htm#How_to_set_a_users_Out_of_Office_Status.html%3FTocPath%3DRuntime%2520APIs%2520and%2520Services%7CWorkflow%7CWorkflow%2520Client%2520API%7CWorkflow%2520Client%2520API%2520Samples%7C_____10 private void AddOutOfOffice() { string userFQN = base.GetStringProperty(Constants.Properties.OutOfOffice.UserFQN); string destinationUser = base.GetStringProperty(Constants.Properties.OutOfOffice.DestinationUser); ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0]; serviceObject.Properties.InitResultTable(); DataTable results = base.ServiceBroker.ServicePackage.ResultTable; WorkflowManagementServer mngServer = new WorkflowManagementServer(); using (mngServer.CreateConnection()) { mngServer.Open(BaseAPIConnectionString); WorklistShares wsColl = mngServer.GetCurrentSharingSettings(userFQN, ShareType.OOF); // Throw error if multiple configurations (WorklistShare objects) detected, as this method cannot support that if (wsColl.Count > 1) { throw new ApplicationException(Constants.ErrorMessages.MultipleOOFConfigurations); } // If configuration exist already, add to it if (wsColl.Count == 1) { WorklistShare worklistshare = wsColl[0]; worklistshare.WorkTypes[0].Destinations.Add(new Destination(destinationUser, DestinationType.User)); bool result = mngServer.ShareWorkList(userFQN, worklistshare); DataRow dr = results.NewRow(); dr[Constants.Properties.OutOfOffice.UserFQN] = userFQN; dr[Constants.Properties.OutOfOffice.DestinationUser] = destinationUser; dr[Constants.Properties.OutOfOffice.CallSuccess] = result; results.Rows.Add(dr); ; } // New user, create configuration for OOF else { // ALL Work that remains which does not form part of any "WorkTypeException" Filter WorklistCriteria worklistcriteria = new WorklistCriteria(); worklistcriteria.Platform = "ASP"; // Send ALL Work based on the above Filter to the following User Destinations worktypedestinations = new Destinations(); worktypedestinations.Add(new Destination(destinationUser, DestinationType.User)); // Link the filters and destinations to the Work WorkType worktype = new WorkType("MyWork", worklistcriteria, worktypedestinations); WorklistShare worklistshare = new WorklistShare(); worklistshare.ShareType = ShareType.OOF; worklistshare.WorkTypes.Add(worktype); bool result = mngServer.ShareWorkList(userFQN, worklistshare); mngServer.SetUserStatus(userFQN, UserStatuses.Available); DataRow dr = results.NewRow(); dr[Constants.Properties.OutOfOffice.UserFQN] = userFQN; dr[Constants.Properties.OutOfOffice.DestinationUser] = destinationUser; dr[Constants.Properties.OutOfOffice.CallSuccess] = result; results.Rows.Add(dr); } } }
protected override QueryStringParametersList GetQueryStringParameters() { if (Origins == null || !Origins.Any()) { throw new ArgumentException("Must specify an Origins"); } if (Destinations == null || !Destinations.Any()) { throw new ArgumentException("Must specify a Destinations"); } if (DepartureTime != null && ArrivalTime != null) { throw new ArgumentException("Must not specify both an ArrivalTime and a DepartureTime"); } if (Mode != DistanceMatrixTravelModes.transit && ArrivalTime != null) { throw new ArgumentException("Must not specify ArrivalTime for modes other than Transit"); } if (Mode != DistanceMatrixTravelModes.transit && TransitRoutingPreference != null) { throw new ArgumentException("Must not specify TransitRoutingPreference for modes other than Transit"); } if (Mode != DistanceMatrixTravelModes.transit && TransitModes != null && TransitModes.Length > 0) { throw new ArgumentException("Must not specify TransitModes for modes other than Transit"); } if ((!(Mode == null || Mode == DistanceMatrixTravelModes.driving) || DepartureTime == null) && TrafficModel != null) { throw new ArgumentException("A TrafficModel must not be specified unless the Mode is Driving and a DepartureTime is provided"); } var parameters = base.GetQueryStringParameters(); parameters.Add("origins", string.Join("|", Origins)); parameters.Add("destinations", string.Join("|", Destinations)); if (DepartureTime != null) { parameters.Add("departure_time", DepartureTime.ToString()); } if (ArrivalTime != null) { parameters.Add("arrival_time", ArrivalTime.ToString()); } if (Mode != null) { parameters.Add("mode", Mode.ToString()); } if (TrafficModel != null) { parameters.Add("traffic_model", TrafficModel.ToString()); } if (TransitRoutingPreference != null) { parameters.Add("transit_routing_preference", TransitRoutingPreference.ToString()); } if (TransitModes != null && TransitModes.Length > 0) { parameters.Add("transit_mode", string.Join("|", TransitModes.Select(a => a.ToString()))); } if (Avoid != null) { parameters.Add("avoid", Avoid.ToString()); } if (Units != null) { parameters.Add("units", Units.ToString()); } if (!string.IsNullOrWhiteSpace(Language)) { parameters.Add("language", Language); } return(parameters); }
public void postDestinations([FromBody] List <Destinations> destinations) { Destinations d = new Destinations(); d.insertToDb(destinations); }
public void SendTextTo(Destinations destination, String text = null) { var f = Utilities.CreateTemporalFileFromText(text); var res = new SendResults(1, destination); if (f != null) { var fileSet = PrimeFileSet.Create(new[] {f}, new PrimeParameters(Settings.Default)); fileSet.Destination = destination; if (destination == Destinations.Custom) { var fs = new FolderSelectDialog {Title = "Select the destination folder"}; if (!fs.ShowDialog()) return; // Conversion was cancel fileSet.CustomDestination = fs.FileName; } else fileSet.CustomDestination = _emulatorFolder; SendDataTo(fileSet); res.Add(SendResult.Success); } else { res.Add(SendResult.ErrorInvalidInput); res.ShowMsg(false, this); } }
public void OnEmptyClick() { clearCities(); chosenDestination = Destinations.empty; }
private void SendDataTo(Destinations destination) { StopReceiving(); if (openFilesDialogProgram.ShowDialog() == DialogResult.OK) { var fileSet = PrimeFileSet.Create(openFilesDialogProgram.FileNames, new PrimeParameters(Settings.Default)); fileSet.Destination = destination; if (destination == Destinations.Custom) { var fs = new FolderSelectDialog {Title = "Select the destination folder"}; if (!fs.ShowDialog()) return; // Conversion was cancel fileSet.CustomDestination = fs.FileName; } else fileSet.CustomDestination = _emulatorFolder; SendDataTo(fileSet); } }
// Example from page - http://help.k2.com/onlinehelp/k2blackpearl/DevRef/4.6.9/default.htm#How_to_set_a_users_Out_of_Office_Status.html%3FTocPath%3DRuntime%2520APIs%2520and%2520Services%7CWorkflow%7CWorkflow%2520Client%2520API%7CWorkflow%2520Client%2520API%2520Samples%7C_____10 /// <summary> /// Add OOF share for current user /// </summary> private void AddOutOfOffice() { string destinationUser = base.GetStringProperty(Constants.SOProperties.OutOfOffice.DestinationUser); ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0]; serviceObject.Properties.InitResultTable(); DataTable results = base.ServiceBroker.ServicePackage.ResultTable; using (Connection k2Con = this.ServiceBroker.K2Connection.GetWorkflowClientConnection()) { WorklistShares wsColl = k2Con.GetCurrentSharingSettings(ShareType.OOF); // Throw error if multiple configurations (WorklistShare objects) detected, as this method cannot support that if (wsColl.Count > 1) { throw new ApplicationException(Resources.MultipleOOFConfigurations); } else if (wsColl.Count == 1) // If configuration exist already, add to it { WorklistShare worklistshare = wsColl[0]; int capacity = worklistshare.WorkTypes[0].Destinations.Count; string[] existingDestinations = new string[capacity]; for (int i = 0; i < capacity; i++) { existingDestinations[i] = worklistshare.WorkTypes[0].Destinations[i].Name.ToUpper().Trim(); } if (Array.IndexOf(existingDestinations, destinationUser.ToUpper().Trim()) == -1) { worklistshare.WorkTypes[0].Destinations.Add(new Destination(destinationUser, DestinationType.User)); } bool result = k2Con.ShareWorkList(worklistshare); DataRow dr = results.NewRow(); dr[Constants.SOProperties.OutOfOffice.DestinationUser] = destinationUser; results.Rows.Add(dr);; } else // New user, create configuration for OOF { // ALL Work that remains which does not form part of any "WorkTypeException" Filter WorklistCriteria worklistcriteria = new WorklistCriteria(); worklistcriteria.Platform = "ASP"; // Send ALL Work based on the above Filter to the following User Destinations worktypedestinations = new Destinations(); worktypedestinations.Add(new Destination(destinationUser, DestinationType.User)); // Link the filters and destinations to the Work WorkType worktype = new WorkType("MyWork_" + k2Con.User.FQN, worklistcriteria, worktypedestinations); WorklistShare worklistshare = new WorklistShare(); worklistshare.ShareType = ShareType.OOF; worklistshare.WorkTypes.Add(worktype); bool result = k2Con.ShareWorkList(worklistshare); k2Con.SetUserStatus(UserStatuses.Available); DataRow dr = results.NewRow(); dr[Constants.SOProperties.OutOfOffice.DestinationUser] = destinationUser; results.Rows.Add(dr); } k2Con.Close(); } }
private void SendCodeTo(Destinations destination) { if (String.IsNullOrEmpty(editor.Text)) MessageBox.Show("Nothing to send!", "Program is empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); else _parent.SendTextTo(destination, editor.Text); }
/// <summary> /// Create or set the Out Of Office of current user /// </summary> /// <param name="wrapper">The Out Of Office criteria</param> /// <returns>Success(true) or Fail(False)</returns> public bool SetOutOfOffice(OOFWrapper wrapper) { if (wrapper.WorkType == null) { using (Connection workflowClient = this.GetWorkflowClient()) { workflowClient.SetUserStatus(Convert.ToBoolean(wrapper.Status) ? UserStatuses.Available : UserStatuses.OOF); } return(false); } using (Connection workflowClient = this.GetWorkflowClient()) { bool isNew = false; WorklistShares worklistShares = new WorklistShares(); worklistShares = workflowClient.GetCurrentSharingSettings(ShareType.OOF); WorklistShare worklistShare = null; if (worklistShares.Count > 0) { worklistShare = worklistShares[0]; worklistShare.ShareType = ShareType.OOF; } else { isNew = true; } if (worklistShare == null) { worklistShare = new WorklistShare(); worklistShare.ShareType = ShareType.OOF; isNew = true; } worklistShare.StartDate = wrapper.StartDate; worklistShare.EndDate = wrapper.EndDate; WorkTypes workTypes = worklistShare.WorkTypes; WorkType workType = new WorkType(); if (workTypes.Count > 0) { workType = workTypes[0]; } else { workType = new WorkType(); workTypes.Add(workType); } workType.Name = Guid.NewGuid().ToString(); Destinations destinations = new Destinations(); foreach (DestinationDto dest in wrapper.WorkType.Destinations) { if (SecurityLabelUtils.IsCorrectUserName(dest.LoginName)) { var destination = new K2.Destination(SecurityLabelUtils.GetNameWithLabel(dest.LoginName), DestinationType.User); destinations.Add(destination); } } workType.Destinations = destinations; workType.WorkTypeExceptions = GetWorkTypeExceptions(wrapper.WorkType.WorkTypeExceptions); worklistShare.WorkTypes = workTypes; if (isNew) { workflowClient.ShareWorkList(worklistShare); } workflowClient.UpdateWorkType(worklistShare.WorkTypes[0]); workflowClient.SetUserStatus(Convert.ToBoolean(wrapper.Status) ? UserStatuses.Available : UserStatuses.OOF); } return(true); }
public void MHE(Destinations dest, UUID client, string msg) { MessageFactory.Post(dest, msg, client); }
public static List <Vector2> FindMiddlePoints(Vector2 s, Vector2 f, Destinations d) { var points = new List <Vector2>(); var sX = Convert.ToInt32(s.X); var sY = Convert.ToInt32(s.Y); var fX = Convert.ToInt32(f.X); var fY = Convert.ToInt32(f.Y); if (d == Destinations.Down) { for (var i = sX; i <= fX; ++i) { points.Add(new Vector2(i, sY)); } } else if (d == Destinations.Up) { for (var i = sX; i >= fX; --i) { points.Add(new Vector2(i, sY)); } } else if (d == Destinations.Left) { for (var i = sY; i >= fY; --i) { points.Add(new Vector2(sX, i)); } } else if (d == Destinations.Right) { for (var i = sY; i <= fY; ++i) { points.Add(new Vector2(sX, i)); } } else if (d == Destinations.DownLeft) { var delta = fX - sX; for (var i = 0; i <= delta; ++i) { points.Add(new Vector2(sX + i, sY - i)); } } else if (d == Destinations.UpLeft) { var delta = sX - fX; for (var i = 0; i <= delta; ++i) { points.Add(new Vector2(sX - i, sY - i)); } } else if (d == Destinations.DownRight) { var delta = fX - sX; for (var i = 0; i <= delta; ++i) { points.Add(new Vector2(sX + i, sY + i)); } } else if (d == Destinations.UpRight) { var delta = sX - fX; for (var i = 0; i <= delta; ++i) { points.Add(new Vector2(sX - i, sY + i)); } } return(points); }
/// <summary> /// Constructor /// </summary> /// <param name="text">The text to send</param> /// <param name="destinations">The message destinations. Each destination should be a numerical string, including country prefix starting with 00, having a max length of 17 digits in total. The maximum number of destinations is 25000.</param> public TextSmsMessage(string text, params string[] destinations) { Text = text; Destinations.AddRange(destinations); }
/// <summary> /// Constructor /// </summary> /// <param name="destinations">The message destinations. Each destination should be a numerical string, including country prefix starting with 00, having a max length of 17 digits in total. The maximum number of destinations is 25000.</param> public TextSmsMessage(params string[] destinations) { Destinations.AddRange(destinations); }