Exemplo n.º 1
0
        public WorkPackage(UInt64       Id,
                           String       Name,
                           ActivityType ActivityType,
                           UInt32       StartMonth,
                           UInt32       EndMonth,
                           Double       Force,
                           IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                 UInt64, Int64, String, String, Object,
                                                 UInt64, Int64, String, String, Object,
                                                 UInt64, Int64, String, String, Object> Graph)
        {
            this.Id         = Id;
            this.Name       = Name;
            this.StartMonth = StartMonth;
            this.Graph      = Graph;

            this.Vertex     = Graph.AddVertex(v => v.SetProperty("Id_",          Id).
                                                     SetProperty("Name",         Name).
                                                     SetProperty("Type",         "WorkPackage").
                                                     SetProperty("ActivityType", ActivityType).
                                                     SetProperty("StartMonth",   StartMonth).
                                                     SetProperty("EndMonth",     EndMonth).
                                                     SetProperty("Force",        Force).
                                                     SetProperty("class",        this));
        }
Exemplo n.º 2
0
		public ActivitiesResponse GetUserActivities(int page, int count, ActivityType type)
		{
			EnsureIsAuthorized();
			var parameters = BuildPagingParametersWithCount(page, count);
			if (type != ActivityType.All) parameters.Add("type", type.ToString().ToLower());
			return _restTemplate.GetForObject<ActivitiesResponse>(BuildUrl("user/activity", parameters));
		}
Exemplo n.º 3
0
        // PUT api/ActivityTypes/5
        public HttpResponseMessage PutActivityType(int id, ActivityType activitytype)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != activitytype.Id)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            db.Entry(activitytype).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
Exemplo n.º 4
0
        public void ActivityTypeDoesNotSaveWithIndicatorWith1Character()
        {
            //Invalid Indicator
            var activityType = new ActivityType
            {
                ActivityCategory = ActivityCategory,
                Indicator = "1",
                Name = ValidValueName
            };

            try
            {
                using (var ts = new TransactionScope())
                {
                    _activityTypeRepository.EnsurePersistent(activityType);

                    ts.CommitTransaction();
                }
            }
            catch (Exception)
            {
                var results = activityType.ValidationResults().AsMessageList();
                Assert.AreEqual(1, results.Count);
                results.AssertContains("Indicator: length must be between 2 and 2");
                //Assert.AreEqual("Object of type FSNEP.Core.Domain.ActivityType could not be persisted\n\n\r\nValidation Errors: Indicator, The length of the value must fall within the range \"2\" (Inclusive) - \"2\" (Inclusive).\r\n", message.Message, "Expected Exception Not encountered");
                throw;
            }
        }
Exemplo n.º 5
0
        public Activity(string name, string path, string args, string t)
        {
            _name = name;
            _pathfile = path;
            _argument = args;

            if (t.CompareTo("Wallpaper") == 0)
            {
                _type = ActivityType.Wallpaper;
            }
            else
            {
                if (t.CompareTo("ExeFile") == 0)
                {
                    _type = ActivityType.ExeFile;
                }
                else
                {
                    if (t.CompareTo("BatchFile") == 0)
                    {
                        _type = ActivityType.BatchFile;
                    }
                }
            }
        }
        private void InitializeComponent()
        {
            AddBrandInfo.Click += new EventHandler(AddBrandInfo_Click);

            ActivityType ate = new ActivityType();
            brandclass.BuildTree(tpb.GetAllCategoryList(), "name", "cid");
        }
Exemplo n.º 7
0
        public static bool IsAccessAllowed(string Controller, string Action, CustomPrincipal User, string IP, ActivityType activity)
        {
            IMenuService menuService = UnityConfigurator.GetConfiguredContainer().Resolve<IMenuService>();

            if (User != null)
            {
                //default controller for all user
                if (Controller.ToLower().Contains("account") || Controller.ToLower().Contains("home"))
                {
                    return true;
                }
                else
                {
                    bool allowed = false;
                    //check if user have access to controller
                    //ensure that 1 form/modul = 1 controller
                    allowed = menuService.isAccessAllowed(Controller, User.RoleId);

                    //if activity type is supplied, check the activity permission too
                    if (activity != ActivityType.None)
                    {
                        allowed = allowed && menuService.isAccessAllowed(Controller, activity.ToString(), User.RoleId);
                    }

                    return allowed;
                }
            }
            else
            {
                return false;
            }
        }
        public void LoadActivityInf(int id)
        {
            #region 加载活动信息

            ActivityInfo actInfo = Activities.GetActivityInfo(id);
            act_title.Text = actInfo.Atitle;
            postdatetimeStart.SelectedDate = Convert.ToDateTime(actInfo.Begintime);
            postdatetimeEnd.SelectedDate = Convert.ToDateTime(actInfo.Endtime);
            act_style.Text = actInfo.Stylecode;
            act_script.Text = actInfo.Scriptcode;
            templatenew.Text = actInfo.Desccode;
            seotitle.Text = actInfo.Seotitle;
            seokeyword.Text = actInfo.Seokeyword;
            seodesc.Text = actInfo.Seodesc;
            act_status.SelectedValue = actInfo.Enabled.ToString();
            act_rssimg.Text = actInfo.RssImg;

            ActivityType ate = new ActivityType();
            typeid.Items.Clear();
            typeid.Items.Add(new ListItem("全部", "0"));
            foreach (string atname in Enum.GetNames(ate.GetType()))
            {
                int s_value = Convert.ToInt16(Enum.Parse(ate.GetType(), atname));
                string s_text = EnumCatch.GetActivityType(s_value);
                typeid.Items.Add(new ListItem(s_text, s_value.ToString()));
            }
            typeid.SelectedValue = actInfo.Atype.ToString();

            #endregion
        }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a score for a game level or quiz
 /// </summary>
 /// <param name="p">The Player Name</param>
 /// <param name="t">The Activity Type</param>
 /// <param name="s"></param>
 /// <param name="title"></param>
 public Score(String p, ActivityType t, int s, String title)
 {
     _date = DateTime.Now;
     Value = s;
     Type = t;
     PlayerName = p;
     ItemTitle = title;
 }
Exemplo n.º 10
0
 protected ActivityBase(IGameLog log, Player player, string message, ActivityType type)
 {
     Log = log;
     Player = player;
     Message = message;
     Type = type;
     Id = Guid.NewGuid();
 }
 internal ActivityTypeGetResponse(
     CoreRegistrationModel.ActivityTypeGetResponse internalResponse,
     DataFactoryManagementClient client)
     : this()
 {
     DataFactoryOperationUtilities.CopyRuntimeProperties(internalResponse, this);
     this.ActivityType =
         ((ActivityTypeOperations)client.ActivityTypes).Converter.ToWrapperType(internalResponse.ActivityType);
 }
Exemplo n.º 12
0
 public async Task<List<SegmentSummary>> Explore(LatLng southWest, LatLng northEast, ActivityType activityType = ActivityType.Ride)
 {
     var request = new RestRequest(EndPoint + "/explore", Method.GET);
     request.AddParameter("bounds",
         string.Format("{0},{1},{2},{3}", southWest.Latitude.ToString(CultureInfo.InvariantCulture), southWest.Longitude.ToString(CultureInfo.InvariantCulture),
         northEast.Latitude.ToString(CultureInfo.InvariantCulture), northEast.Longitude.ToString(CultureInfo.InvariantCulture)));
     var response = await _client.RestClient.Execute<SegmentCollection>(request);
     return response.Data.Segments;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Uploads an activity.
        /// </summary>
        /// <param name="file">The path to the activity file on your local hard disk.</param>
        /// <param name="dataFormat">The format of the file.</param>
        /// <param name="activityType">The type of the activity.</param>
        /// <returns>The status of the upload.</returns>
        public async Task<UploadStatus> UploadActivityAsync(StorageFile file, DataFormat dataFormat, ActivityType activityType = ActivityType.Ride)
        {
            String format = String.Empty;

            switch (dataFormat)
            {
                case DataFormat.Fit:
                    format = "fit";
                    break;
                case DataFormat.FitGZipped:
                    format = "fit.gz";
                    break;
                case DataFormat.Gpx:
                    format = "gpx";
                    break;
                case DataFormat.GpxGZipped:
                    format = "gpx.gz";
                    break;
                case DataFormat.Tcx:
                    format = "tcx";
                    break;
                case DataFormat.TcxGZipped:
                    format = "tcx.gz";
                    break;
            }
           
            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Add("Authorization", String.Format("Bearer {0}", Authentication.AccessToken));

            MultipartFormDataContent content = new MultipartFormDataContent();

            byte[] fileBytes = null;
            using (IRandomAccessStreamWithContentType stream = await file.OpenReadAsync())
            {
                fileBytes = new byte[stream.Size];
                using (DataReader reader = new DataReader(stream))
                {
                    await reader.LoadAsync((uint)stream.Size);
                    reader.ReadBytes(fileBytes);
                }
            }

            var byteArrayContent = new ByteArrayContent(fileBytes);

            content.Add(byteArrayContent, "file", file.Name);

            HttpResponseMessage result = await client.PostAsync(
                String.Format("https://www.strava.com/api/v3/uploads?data_type={0}&activity_type={1}",
                format,
                activityType.ToString().ToLower()),
                content);

            String json = await result.Content.ReadAsStringAsync();

            return Unmarshaller<UploadStatus>.Unmarshal(json);
        }
Exemplo n.º 14
0
        protected ActivityBase(IGameLog log, Player player, string message, ActivityType type, ICard source)
        {
            Log = log;
            Player = player;
            Message = message;
            Type = type;
            Id = Guid.NewGuid();
            Hint = ActivityHint.None;

            Source = source == null ? string.Empty : source.Name;
        }
Exemplo n.º 15
0
 /// <summary>
 /// 根据类型获取活动信息
 /// </summary>
 /// <param name="nums"></param>
 /// <param name="atype"></param>
 public static List<ActivityInfo> GetActvitiesByType(int nums, ActivityType atype)
 {
     List<ActivityInfo> actlist = new List<ActivityInfo>();
     IDataReader reader = DatabaseProvider.GetInstance().GetActvitiesByType(nums, atype);
     while (reader.Read())
     {
         actlist.Add(LoadSingleActivityInfo(reader));
     }
     reader.Close();
     return actlist;
 }
Exemplo n.º 16
0
        /// <summary>
        /// Creates a manual entry on Strava.
        /// </summary>
        /// <param name="name">The name of the activity.</param>
        /// <param name="type">The type of the activity.</param>
        /// <param name="dateTime">The time when the activity was started.</param>
        /// <param name="elapsedSeconds">The elapsed time in seconds.</param>
        /// <param name="description">The description (otpional).</param>
        /// <param name="distance">The distance of the activity (optional).</param>
        public async Task<Activity> CreateActivityAsync(String name, ActivityType type, DateTime dateTime, int elapsedSeconds, String description, float distance = 0f)
        {
            String t = type.ToString().ToLower();
            String timeString = dateTime.ToString("o");

            String postUrl = String.Format("https://www.strava.com/api/v3/activities?name={0}&type={1}&start_date_local={2}&elapsed_time={3}&description={4}&distance={5}&access_token={6}",
                name, t, timeString, elapsedSeconds, description, distance.ToString(CultureInfo.InvariantCulture), Authentication.AccessToken);
            
            String json = await Http.WebRequest.SendPostAsync(new Uri(postUrl));
            return Unmarshaller<Activity>.Unmarshal(json);
        }
Exemplo n.º 17
0
 public void Post(string message, ActivityType tag, Uri url = null)
 {
     var activity = new Activity
     {
         Message = message,
         Tag = tag,
         Url = url != null ? url.ToString() : null,
         UserProfileId = _userProfileRepository.Get(x=>x.UserLogin==Thread.CurrentPrincipal.Identity.Name).Id,
         Time = DateTime.UtcNow
     };
     _activityRepository.UpdateAndCommit(activity);
 }
Exemplo n.º 18
0
        public List<Activity> GetActivities(int contactId, DateTime startDate, DateTime endDate, ActivityType type, int? count)
        {
            RestRequest request = new RestRequest(Method.GET)
                                      {
                                          RequestFormat = DataFormat.Json,
                                          Resource = string.Format("/data/activities/contact/{0}?startDate={1}&endDate={2}&type={3}&count={4}",
                                                            contactId, ConvertToUnixEpoch(startDate), ConvertToUnixEpoch(endDate), type, count)
                                      };

            IRestResponse<List<Activity>> response = _client.Execute<List<Activity>>(request);

            return response.Data;
        }
 private void InitializeComponent()
 {
     this.SaveSearchCondition.Click += new EventHandler(this.SaveSearchCondition_Click);
     ActivityType ate = new ActivityType();
     typeid.Items.Clear();
     typeid.Items.Add(new ListItem("全部", "0"));
     foreach (string atname in Enum.GetNames(ate.GetType()))
     {
         int s_value = Convert.ToInt16(Enum.Parse(ate.GetType(), atname));
         string s_text = EnumCatch.GetActivityType(s_value);
         typeid.Items.Add(new ListItem(s_text, s_value.ToString()));
     }
 }
Exemplo n.º 20
0
        // POST api/ActivityTypes
        public HttpResponseMessage PostActivityType(ActivityType activitytype)
        {
            if (ModelState.IsValid)
            {
                db.ActivityTypes.Add(activitytype);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, activitytype);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = activitytype.Id }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }
        public static void CreateActivity(ActivityType type, string targetId, ActivityTargetType targetType, string loggedUserId)
        {
            var data = new CRMData(new CRMDbContext());

            var activity = new Activity()
            {
                UserId = loggedUserId,
                Type = type,
                TargetId = targetId,
                TargetType = targetType,
                CreatedOn = DateTime.Now
            };

            data.Activities.Add(activity);

            data.SaveChanges();
        }
Exemplo n.º 22
0
 public int Hire(Tile tile, int numberOfWorkersToHire, ActivityType employmentType, IActivityTarget target)
 {
     if (numberOfWorkersToHire > tile.TotalInactive)
         return 0;
     else {
         //tile.Workers += numberOfWorkersToHire;
         int numberOfWorkersHired = 0;
         foreach (var person in tile.People) {
             if (person.CanWork && !person.IsActive
                 && numberOfWorkersHired < numberOfWorkersToHire) {
                 Hire (tile, person, employmentType, target);
                 numberOfWorkersHired++;
             }
         }
         return numberOfWorkersHired;
     }
 }
Exemplo n.º 23
0
        /// <summary>
        /// Uploads an activity.
        /// </summary>
        /// <param name="filePath">The path to the activity file on your local hard disk.</param>
        /// <param name="dataFormat">The format of the file.</param>
        /// <param name="activityType">The type of the activity.</param>
        /// <returns>The status of the upload.</returns>
        public async Task<UploadStatus> UploadActivityAsync(String filePath, DataFormat dataFormat, ActivityType activityType = ActivityType.Ride)
        {
            String format = String.Empty;

            switch (dataFormat)
            {
                case DataFormat.Fit:
                    format = "fit";
                    break;
                case DataFormat.FitGZipped:
                    format = "fit.gz";
                    break;
                case DataFormat.Gpx:
                    format = "gpx";
                    break;
                case DataFormat.GpxGZipped:
                    format = "gpx.gz";
                    break;
                case DataFormat.Tcx:
                    format = "tcx";
                    break;
                case DataFormat.TcxGZipped:
                    format = "tcx.gz";
                    break;
            }

            FileInfo info = new FileInfo(filePath);

            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Add("Authorization", String.Format("Bearer {0}", Authentication.AccessToken));

            MultipartFormDataContent content = new MultipartFormDataContent();

            content.Add(new ByteArrayContent(File.ReadAllBytes(info.FullName)), "file", info.Name);

            HttpResponseMessage result = await client.PostAsync(
                String.Format("https://www.strava.com/api/v3/uploads?data_type={0}&activity_type={1}",
                format,
                activityType.ToString().ToLower()),
                content);

            String json = await result.Content.ReadAsStringAsync();

            return Unmarshaller<UploadStatus>.Unmarshal(json);
        }
Exemplo n.º 24
0
        private static bool IsValidKey(string key, ActivityType nodeType, Diagram diagram)
        {
            if (string.IsNullOrEmpty(key))
            {
                return false;
            }

            if (nodeType == ActivityType.Initial || nodeType == ActivityType.Completed)
            {
                return true;
            }

            if (!DiagramUtils.GetTemplateKeys(diagram).Contains(key))
            {
                return true;
            }

            return false;
        }
Exemplo n.º 25
0
        /// <summary>
        /// Adds an <see cref="CH.Froorider.Codeheap.StateMachine.Activities.IActivity"/> to this state. The <see cref="ActivityType"/> defines if
        /// it should be added as an enty,exit or do activtiy.
        /// </summary>
        /// <param name="activity">The activity as an instance of <see cref="IActivity"/>.</param>
        /// <param name="typeOfActivity">One of the values of <see cref="ActivityType"/>.</param>
        /// <exception cref="ArgumentException">Is thrown when this <see cref="IState"/> already has an <see cref="IActivity"/> of type <see cref="ActivityType"/>.</exception>
        /// <exception cref="ArgumentNullException">Is thrown when <paramref name="activity"/> is a <see langword="null"/> reference.</exception>
        internal void AddActivity(IActivity activity, ActivityType typeOfActivity)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }

            switch (typeOfActivity)
            {
                case ActivityType.Entry:
                case ActivityType.Do:
                case ActivityType.Exit:
                    this.activities.Add(typeOfActivity, activity);
                    break;
                case ActivityType.Undefined:
                default:
                    throw new NotImplementedException("Activities of type " + typeOfActivity + " are not implemented.");
            }
        }
Exemplo n.º 26
0
 /// <summary>
 /// 每日活跃度
 /// </summary>
 /// <param name="at"></param>
 /// <param name="count"></param>
 public void AddAcivity(ActivityType at, int count)
 {
     PlayerEx ac;
     if (!Value.TryGetValueT("Activity", out ac))
         return;
     Variant v = ac.Value;
     if (v == null) return;
     List<string> list = ActivityManager.ActivityList((int)at);
     if (list.Count > 0)
     {
         Variant fv = v.GetValueOrDefault<Variant>("Finish");
         foreach (string key in list)
         {
             if (fv.ContainsKey(key))
             {
                 fv[key] = fv.GetIntOrDefault(key) + count;
             }
         }
         ac.Save();
         Call(ClientCommand.UpdateActorR, new PlayerExDetail(ac));
     }
 }
Exemplo n.º 27
0
 public void SaveActivityType(ActivityType activityType)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (activityType.ActivityTypeID == 0) {
             context.ActivityTypes.AddObject(activityType);
         }
         else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("ActivityTypes", activityType);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, activityType);
             }
         }
         context.SaveChanges();
     }
 }
        /// <summary>
        /// Used to create a file that contains all of the account activity of a certain type for the specified day.
        /// </summary>
        /// <param name="activityDate">
        /// The date of the activity data to be collected.<see cref="DateTime"/>
        /// </param>
        /// <param name="activityType">
        /// The tyoe of activity to be collected.<see cref="ActivityType"/>
        /// </param>
        /// <returns>
        /// The fully qualified name of the downloaded file (YYYY-MM-DD_activitytype.xml)
        /// </returns>
        public String AccountActivity(DateTime activityDate, ActivityType activityType)
        {
            DateTime now = DateTime.Now;
            // validate that activityDate is not in the future
            if(activityDate > now)
            {
                log.Info("Activity Date cannot be in the future. ActivityDate: " + activityDate + " Date Now: " + now);
                throw new MessageGearsClientException("Parmameter: ActivityDate. Value: " + activityDate + " Error Message: This field cannot be a date in the future.");
            }

            DateTime start = now;
            String fileName = properties.DownloadDirectory + activityDate.Year + "-" + activityDate.Month + "-" + activityDate.Day + "_" + activityType + "_" + properties.MyMessageGearsAccountId + ".xml";
            // build POST data
            StringBuilder data = new StringBuilder ();
            data.Append ("Action=" + HttpUtility.UrlEncode ("AccountActivity"));
            appendCredentials(ref data);
            data.Append("&ActivityDate=" + HttpUtility.UrlEncode (activityDate.Year + "-" + activityDate.Month + "-" + activityDate.Day));
            data.Append ("&ActivityType=" + HttpUtility.UrlEncode (activityType.ToString()));

            // invoke endpoint - either writing the contents to a temporary file or throwing exception if error are encountered
            invokeAccountActivity(data, fileName);
            TimeSpan ts = DateTime.Now - start;
            FileInfo fi = new FileInfo(fileName);
            long mbyte = 1024 * 1024;
            if(fi.Length >= mbyte)
            {
                log.Info(string.Format("Downloaded file {0} of size {1:n} MB in {2:00}:{3:00}:{4:00},{5:000}", fi.Name, (float)fi.Length/mbyte, (int)ts.TotalHours, ts.Minutes, ts.Seconds, ts.Milliseconds));
            }
            else if(fi.Length >= 1024)
            {
                log.Info(string.Format("Downloaded file {0} of size {1:n} KB in {2:00}:{3:00}:{4:00},{5:000}", fi.Name, (float)fi.Length/1024, (int)ts.TotalHours, ts.Minutes, ts.Seconds, ts.Milliseconds));
            }
            else
            {
                log.Info(string.Format("Downloaded file {0} of size {1:##0} Bytes in {2:00}:{3:00}:{4:00},{5:000}", fi.Name, fi.Length, (int)ts.TotalHours, ts.Minutes, ts.Seconds, ts.Milliseconds));
            }
            return fileName;
        }
Exemplo n.º 29
0
        public static void FileActivityCallback(ActivityType Activity, [MarshalAs(UnmanagedType.LPWStr)] string FileName)
        {
            if(Window != null)
            {
                string activityname = "Unknown";

                switch(Activity)
                {
                case ActivityType.StartWatch: activityname = "Watch"; break;
                case ActivityType.EndWatch: activityname = "End Watch"; break;
                case ActivityType.Create: activityname = "Create"; break;
                case ActivityType.Delete: activityname = "Delete"; break;
                case ActivityType.Change: activityname = "Change"; break;
                case ActivityType.NameFrom: activityname = "Rename From"; break;
                case ActivityType.NameTo: activityname = "Rename To"; break;
                }

                string[] columns = {activityname, FileName};
                ListViewItem item = new ListViewItem(columns);
                MainWindow.AddItemDelegate d = new MainWindow.AddItemDelegate(Window.AddActivityItem);
                Window.Invoke(d, new object[] { item });
            }
        }
Exemplo n.º 30
0
        public async Task<UploadStatus> Upload(ActivityType activityType, DataType dataType, System.IO.Stream input, string fileName, string name = null, string description = null,
            bool @private = false, bool commute = false)
        {
            var request = new RestRequest("/api/v3/uploads?data_type={data_type}&activity_type={activity_type}&private={private}&commute={commute}", Method.POST);
            if (name != null)
            {
                request.Resource += "&name={name}";
                request.AddParameter("name", name, ParameterType.UrlSegment);
            }
            if (description != null)
            {
                request.Resource += "&description={description}";
                request.AddParameter("description", description, ParameterType.UrlSegment);
            }

            request.ContentCollectionMode = ContentCollectionMode.MultiPart;
            request.AddParameter("data_type", dataType, ParameterType.UrlSegment);
            request.AddParameter("activity_type", EnumHelper.ToString(activityType), ParameterType.UrlSegment);
            request.AddParameter("private", @private ? 1 : 0, ParameterType.UrlSegment);
            request.AddParameter("commute", commute ? 1 : 0, ParameterType.UrlSegment);
            request.AddFile("file", input, Uri.EscapeDataString(fileName));
            var response = await _client.RestClient.Execute<UploadStatus>(request);
            return response.Data;
        }
        /// <summary>
        /// This is the first method that should be called to start the bot instance. With the token provided we can initialize the bot and start logging in to fire it.
        /// </summary>
        /// <param name="strToken"></param>
        /// <param name="strBotGameName"></param>
        /// <param name="eActivityType"></param>
        /// <param name="eUserStatus"></param>
        public static void SetUpBotInstance(string strToken, string strBotGameName = null, ActivityType eActivityType = ActivityType.CustomStatus, UserStatus eUserStatus = UserStatus.Online)
        {
            if (!IsSetupCompleted)
            {
                m_strToken       = strToken;
                m_strBotGameName = strBotGameName;
                m_eActivityType  = eActivityType;
                m_eUsterStatus   = eUserStatus;

                InitAsync();
                IsSetupCompleted = true;
            }
            else
            {
                ThrowErrorMessage("You can only have one bot instance running. You can only call this method once.");
            }
        }
 public async Task <ActionResult <ActivityType> > CreateActivityType([FromBody] ActivityType NewActivityType)
 {
     return(await _activityTypeRepository.AddActivityType(NewActivityType));
 }
 public ActivityType Add(ActivityType ActivityType)
 {
     // add new activity type
     _activityTypeRepo.Add(ActivityType);
     return(ActivityType);
 }
Exemplo n.º 34
0
        public async Task GetTriggersForActivityBlueprintAsyncReturnsTriggersForEachBookmarkInSupportedBookmarkProviders(IBookmarkHasher bookmarkHasher,
                                                                                                                         IBookmarkProvider bookmarkProvider1,
                                                                                                                         IBookmarkProvider unsupportedBookmarkProvider,
                                                                                                                         IBookmarkProvider bookmarkProvider2,
                                                                                                                         ICreatesActivityExecutionContextForActivityBlueprint activityExecutionContextFactory,
                                                                                                                         [Frozen] IActivityBlueprint activityBlueprint,
                                                                                                                         [WithAutofixtureResolution, Frozen] IServiceProvider serviceProvider,
                                                                                                                         [Frozen] IWorkflowBlueprint workflowBlueprint,
                                                                                                                         [OmitOnRecursion, Frozen] WorkflowInstance workflowInstance,
                                                                                                                         [Frozen] WorkflowExecutionContext workflowExecutionContext,
                                                                                                                         [NoAutoProperties] ActivityExecutionContext activityExecutionContext,
                                                                                                                         ActivityType activityType,
                                                                                                                         IBookmark bookmark1,
                                                                                                                         IBookmark bookmark2,
                                                                                                                         IBookmark bookmark3,
                                                                                                                         IBookmark bookmark4)
        {
            var sut = new TriggersForActivityBlueprintAndWorkflowProvider(bookmarkHasher,
                                                                          new[] { bookmarkProvider1, unsupportedBookmarkProvider, bookmarkProvider2 },
                                                                          activityExecutionContextFactory);

            Mock.Get(activityExecutionContextFactory)
            .Setup(x => x.CreateActivityExecutionContext(activityBlueprint, workflowExecutionContext, default))
            .Returns(activityExecutionContext);
            Mock.Get(activityBlueprint).SetupGet(x => x.Type).Returns(activityType.TypeName);
            Mock.Get(bookmarkProvider1)
            .Setup(x => x.SupportsActivityAsync(It.Is <BookmarkProviderContext>(c => c.ActivityType == activityType), default))
            .Returns(() => ValueTask.FromResult(true));
            Mock.Get(unsupportedBookmarkProvider)
            .Setup(x => x.SupportsActivityAsync(It.Is <BookmarkProviderContext>(c => c.ActivityType == activityType), default))
            .Returns(() => ValueTask.FromResult(false));
            Mock.Get(bookmarkProvider2)
            .Setup(x => x.SupportsActivityAsync(It.Is <BookmarkProviderContext>(c => c.ActivityType == activityType), default))
            .Returns(() => ValueTask.FromResult(true));
            Mock.Get(bookmarkProvider1)
            .Setup(x => x.GetBookmarksAsync(It.IsAny <BookmarkProviderContext>(), default))
            .Returns(() => ValueTask.FromResult <IEnumerable <IBookmark> >(new [] { bookmark1, bookmark2 }));
            Mock.Get(bookmarkProvider2)
            .Setup(x => x.GetBookmarksAsync(It.IsAny <BookmarkProviderContext>(), default))
            .Returns(() => ValueTask.FromResult <IEnumerable <IBookmark> >(new [] { bookmark3, bookmark4 }));

            var result = await sut.GetTriggersForActivityBlueprintAsync(activityBlueprint,
                                                                        workflowExecutionContext,
                                                                        new Dictionary <string, ActivityType> {
                { activityType.TypeName, activityType }
            });

            Assert.True(result.Any(x => x.Bookmark == bookmark1), "Result contains a trigger for bookmark 1");
            Assert.True(result.Any(x => x.Bookmark == bookmark2), "Result contains a trigger for bookmark 2");
            Assert.True(result.Any(x => x.Bookmark == bookmark3), "Result contains a trigger for bookmark 3");
            Assert.True(result.Any(x => x.Bookmark == bookmark4), "Result contains a trigger for bookmark 4");
            Assert.True(result.Count() == 4, "Result has 4 items");
        }
Exemplo n.º 35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Audit"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 public Audit(Visit visit, ActivityType activityType)
     : base(visit, activityType)
 {
 }
Exemplo n.º 36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LabSpecimen"/> class.
 /// </summary>
 /// <param name="clinicalCase">The clinical case.</param>
 /// <param name="activityType">Type of the activity.</param>
 /// <param name="provenance">The provenance.</param>
 /// <param name="activityDateTimeRange">The activity date time range.</param>
 protected internal LabSpecimen(ClinicalCase clinicalCase, ActivityType activityType, Provenance provenance, DateTimeRange activityDateTimeRange)
     : base(clinicalCase, activityType, provenance, activityDateTimeRange)
 {
     _labTests = new List <LabTest>();
 }
Exemplo n.º 37
0
 public void MapValues()
 {
     foreach (var activityGraph in ActivityGraphList)
     {
         activityGraph.ActivityGraph.TryMapValue();
     }
     foreach (var activityLocationMapping in ActivityLocationMappings)
     {
         activityLocationMapping.Activity.TryMapValue();
         activityLocationMapping.Item.TryMapValue();
         activityLocationMapping.Location.TryMapValue();
         activityLocationMapping.Objective.TryMapValue();
     }
     foreach (var activityMode in ActivityModes)
     {
         activityMode.TryMapValue();
     }
     ActivityType.TryMapValue();
     foreach (var challenge in Challenges)
     {
         challenge.Objective.TryMapValue();
         foreach (var dummyReward in challenge.DummyRewards)
         {
             dummyReward.Item.TryMapValue();
         }
     }
     Destination.TryMapValue();
     DirectActivityMode.TryMapValue();
     foreach (var modifier in Modifiers)
     {
         modifier.ActivityModifier.TryMapValue();
     }
     Place.TryMapValue();
     foreach (var playlistItem in PlaylistItems)
     {
         playlistItem.Activity.TryMapValue();
         playlistItem.DirectActivityMode.TryMapValue();
         foreach (var playlistItemActivityMode in playlistItem.ActivityModes)
         {
             playlistItemActivityMode.TryMapValue();
         }
     }
     foreach (var reward in Rewards)
     {
         foreach (var rewardItem in reward.RewardItems)
         {
             rewardItem.Item.TryMapValue();
         }
     }
     foreach (var loadout in Loadouts)
     {
         foreach (var requirement in loadout.Requirements)
         {
             requirement.EquipmentSlot.TryMapValue();
             foreach (var item in requirement.AllowedEquippedItems)
             {
                 item.TryMapValue();
             }
         }
     }
 }
Exemplo n.º 38
0
 public IActivity CreateActivity(int time, ActivityType type)
 {
     return(new Activity(time, type));
 }
Exemplo n.º 39
0
 public EngineCommandActivity(string name, ActivityType type) : base(name, type)
 {
 }
Exemplo n.º 40
0
 public Reading()
 {
     Title = "Reading Activity";
     Pages = 0;
     Type  = ActivityType.Reading;
 }
Exemplo n.º 41
0
        public void getUniqueCoordinatesByType(IEnumerable <VisualActivity> activities, ActivityType type)
        {
            if (activities == null)
            {
                throw new ArgumentNullException("Activities is null");
            }

            var activitiesForType = from activity in activities
                                    where activity.Summary.Type == type
                                    select activity;

            VisualActivities = activitiesForType;

            foreach (var visualActivity in VisualActivities)
            {
                if (visualActivity == null || visualActivity.StartLat == null || visualActivity.StartLong == null)
                {
                    continue;
                }

                updateNumVisits(visualActivity);
                addCoordinate(visualActivity);
            }

            foreach (var coordinate in NumVisits.Keys)
            {
                Pin pin = new Pin();
                pin.Location = coordinate;
                pin.Text     = Convert.ToString(NumVisits[coordinate]);
                Pins.Add(pin);
            }
        }
Exemplo n.º 42
0
        public ICollection <Coordinate> getCoordinatesByType(IEnumerable <VisualActivity> activities, ActivityType type)
        {
            if (activities == null)
            {
                throw new ArgumentNullException("Activities is null");
            }

            var activitiesForType = from activity in activities
                                    where activity.Summary.Type == type
                                    select activity;

            //var activitiesForType = activities
            //    .Where(a => a.Summary.Type == type)
            //    .Select(a_type => { return a_type; });

            VisualActivities = activitiesForType;
            extractCoordinates();
            return(Coordinates);
        }
Exemplo n.º 43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LabSpecimen"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal LabSpecimen(Visit visit, ActivityType activityType)
     : base(visit, activityType)
 {
     _labTests = new List <LabTest>();
 }
Exemplo n.º 44
0
 public SleepActivity(ActivityType type) : base(type)
 {
 }
Exemplo n.º 45
0
 public Splash(string namewithparameters, ActivityType type)
 {
     Name = namewithparameters;
     Type = type;
 }
Exemplo n.º 46
0
 public static ActivityTypeLookupModel Create(ActivityType activityType)
 {
     return(Projection.Compile().Invoke(activityType));
 }
Exemplo n.º 47
0
        protected override void Seed(LexiconLMS.Models.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            // Add the Teacher and Student roles NOTE: THIS SHOULD BE PART OF DB INITIALIZATION
            var store   = new RoleStore <IdentityRole>(context);
            var manager = new RoleManager <IdentityRole>(store);

            if (!context.Roles.Any(r => r.Name == "Teacher"))
            {
                var admin = new IdentityRole {
                    Name = "Teacher"
                };
                manager.Create(admin);
            }
            if (!context.Roles.Any(r => r.Name == "Student"))
            {
                var member = new IdentityRole {
                    Name = "Student"
                };
                manager.Create(member);
            }
            context.SaveChanges();

            // Add ActivityTypes NOTE: THIS SHOULD BE PART OF DB INITIALIZATION
            context.ActivityTypes.AddOrUpdate(t => t.Id, new ActivityType {
                Type = "Lecture"
            });
            context.ActivityTypes.AddOrUpdate(t => t.Id, new ActivityType {
                Type = "E-Learning"
            });
            context.ActivityTypes.AddOrUpdate(t => t.Id, new ActivityType {
                Type = "Exercise"
            });
            context.ActivityTypes.AddOrUpdate(t => t.Id, new ActivityType {
                Type = "Code-Along"
            });
            context.ActivityTypes.AddOrUpdate(t => t.Id, new ActivityType {
                Type = "Assignment"
            });
            context.SaveChanges();

            ActivityType lecture    = context.ActivityTypes.FirstOrDefault(c => c.Type == "Lecture");
            ActivityType elearning  = context.ActivityTypes.FirstOrDefault(c => c.Type == "E-Learning");
            ActivityType exercise   = context.ActivityTypes.FirstOrDefault(c => c.Type == "Exercise");
            ActivityType codeAlong  = context.ActivityTypes.FirstOrDefault(c => c.Type == "Code-Along");
            ActivityType assignment = context.ActivityTypes.FirstOrDefault(c => c.Type == "Assignment");

            // Add course(s)
            context.Courses.AddOrUpdate(o => o.Name, new Course
            {
                Name        = ".NET Intro",
                Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum semper dapibus dui. Aliquam vehicula sapien mauris, vel interdum elit pharetra quis. Nulla facilisi. Sed iaculis dictum arcu eu interdum.",
                StartDate   = DateTime.Today,
                EndDate     = DateTime.Today.AddMonths(1)
            });
            context.Courses.AddOrUpdate(o => o.Name, new Course
            {
                Name        = "Java Intro",
                Description = "Duis ac felis commodo, tempor urna sed, hendrerit ipsum. Phasellus porttitor, quam vitae tincidunt laoreet, nulla tortor ornare magna, eu tristique eros diam sed nibh. Suspendisse vitae tortor magna.",
                StartDate   = DateTime.Today,
                EndDate     = DateTime.Today.AddMonths(1)
            });
            context.SaveChanges();

            // Add Module(s)
            Course course1 = context.Courses.FirstOrDefault(c => c.Name == ".NET Intro");
            Course course2 = context.Courses.FirstOrDefault(c => c.Name == "Java Intro");

            context.Modules.AddOrUpdate(o => o.Name, new Module
            {
                Name        = "C#",
                Description = "Duis ac felis commodo, tempor urna sed, hendrerit ipsum. Phasellus porttitor, quam vitae tincidunt laoreet, nulla tortor ornare magna, eu tristique eros diam sed nibh. Suspendisse vitae tortor magna.",
                StartDate   = DateTime.Today,
                EndDate     = DateTime.Today.AddDays(15),
                CourseId    = course1.Id,
                Course      = course1
            });
            context.Modules.AddOrUpdate(o => o.Name, new Module
            {
                Name        = "C# Continued",
                Description = "Duis ac felis commodo, tempor urna sed, hendrerit ipsum. Phasellus porttitor, quam vitae tincidunt laoreet, nulla tortor ornare magna, eu tristique eros diam sed nibh. Suspendisse vitae tortor magna.",
                StartDate   = DateTime.Today.AddDays(16),
                EndDate     = DateTime.Today.AddMonths(1),
                CourseId    = course1.Id,
                Course      = course1
            });
            context.Modules.AddOrUpdate(o => o.Name, new Module
            {
                Name        = "Java Introduction",
                Description = "Duis ac felis commodo, tempor urna sed, hendrerit ipsum. Phasellus porttitor, quam vitae tincidunt laoreet, nulla tortor ornare magna, eu tristique eros diam sed nibh. Suspendisse vitae tortor magna.",
                StartDate   = DateTime.Today,
                EndDate     = DateTime.Today.AddDays(15),
                CourseId    = course2.Id,
                Course      = course2
            });
            context.SaveChanges();

            // Add activitie(s)
            Module module1 = context.Modules.FirstOrDefault(c => c.Name == "C#");
            Module module2 = context.Modules.FirstOrDefault(c => c.Name == "C# Continued");
            Module module3 = context.Modules.FirstOrDefault(c => c.Name == "Java Introduction");

            context.Activities.AddOrUpdate(o => o.Name, new Activity
            {
                Name        = "Introduction",
                Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.Vestibulum semper dapibus dui.Aliquam vehicula sapien mauris, vel interdum elit pharetra quis.Nulla facilisi.",
                StartDate   = DateTime.Today,
                EndDate     = DateTime.Today,
                TypeId      = 1,
                Type        = lecture,
                CourseId    = module1.CourseId,
                ModuleId    = module1.Id,
                Module      = module1
            });
            context.Activities.AddOrUpdate(o => o.Name, new Activity
            {
                Name        = "OOP",
                Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.Vestibulum semper dapibus dui.Aliquam vehicula sapien mauris, vel interdum elit pharetra quis.Nulla facilisi.",
                StartDate   = DateTime.Today.AddDays(1),
                EndDate     = DateTime.Today.AddDays(1),
                TypeId      = 1,
                Type        = lecture,
                CourseId    = module1.CourseId,
                ModuleId    = module1.Id,
                Module      = module1
            });
            context.Activities.AddOrUpdate(o => o.Name, new Activity
            {
                Name        = "Overview",
                Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.Vestibulum semper dapibus dui.Aliquam vehicula sapien mauris, vel interdum elit pharetra quis.Nulla facilisi.",
                StartDate   = DateTime.Today.AddDays(16),
                EndDate     = DateTime.Today.AddDays(16),
                TypeId      = 1,
                Type        = lecture,
                CourseId    = module2.CourseId,
                ModuleId    = module2.Id,
                Module      = module2
            });
            context.Activities.AddOrUpdate(o => o.Name, new Activity
            {
                Name        = "Parking Garage 1.0",
                Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.Vestibulum semper dapibus dui.Aliquam vehicula sapien mauris, vel interdum elit pharetra quis.Nulla facilisi.",
                StartDate   = DateTime.Today.AddDays(17),
                EndDate     = DateTime.Today.AddDays(17),
                TypeId      = 5,
                Type        = assignment,
                CourseId    = module2.CourseId,
                ModuleId    = module2.Id,
                Module      = module2
            });
            context.Activities.AddOrUpdate(o => o.Name, new Activity
            {
                Name        = "Java Programing",
                Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.Vestibulum semper dapibus dui.Aliquam vehicula sapien mauris, vel interdum elit pharetra quis.Nulla facilisi.",
                StartDate   = DateTime.Today,
                EndDate     = DateTime.Today.AddDays(2),
                TypeId      = 2,
                Type        = elearning,
                CourseId    = module3.CourseId,
                ModuleId    = module3.Id,
                Module      = module3
            });
            context.SaveChanges();

            // Add some users
            var uStore   = new UserStore <ApplicationUser>(context);
            var uManager = new UserManager <ApplicationUser>(uStore);

            // Add a teacher
            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                var user = new ApplicationUser {
                    UserName = "******", Email = "*****@*****.**"
                };
                uManager.Create(user, "Teacher_001");
                user = uManager.FindByEmail("*****@*****.**");
                uManager.AddToRole(user.Id, "Teacher");
                context.SaveChanges();
            }
            // Add a student
            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                var user = new ApplicationUser {
                    UserName = "******", Email = "*****@*****.**"
                };
                user.Course = context.Courses.FirstOrDefault(c => c.Name == ".NET Intro");
                uManager.Create(user, "Student_001");
                user = uManager.FindByEmail("*****@*****.**");
                uManager.AddToRole(user.Id, "Student");
                context.SaveChanges();
            }

            // Add another student
            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                //Användarnamnet för studenten
                var user = new ApplicationUser {
                    UserName = "******", Email = "*****@*****.**"
                };
                user.Course = context.Courses.FirstOrDefault(c => c.Name == ".NET Intro");
                uManager.Create(user, "Student_002");   //Lösenord för studenten
                user = uManager.FindByEmail("*****@*****.**");
                uManager.AddToRole(user.Id, "Student");
                context.SaveChanges();
            }
        }
Exemplo n.º 48
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IndividualCounseling"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal IndividualCounseling(Visit visit, ActivityType activityType)
     : base(visit, activityType)
 {
 }
        public Activity ParseStartOrEndActivity(XElement allFileElement, string inputAndOutputNameSpace, ActivityType activityType)
        {
            string activityName = string.Empty;

            if (activityType == ActivityType.startType)
            {
                activityName = "startName";
            }
            else if (activityType == ActivityType.endType)
            {
                activityName = "endName";
            }

            var elementNameElement = allFileElement.Element(XmlnsConstant.tibcoProcessNameSpace + activityName);

            if (elementNameElement == null)
            {
                return(null);
            }

            var activity = new Activity(elementNameElement.Value, activityType);

            var xElement = allFileElement.Element(XmlnsConstant.tibcoProcessNameSpace + activityType.ToString());

            if (xElement != null)
            {
                if (xElement.Attribute("ref") == null)
                {
                    var activityParameters = this.xsdParser.Parse(xElement.Nodes(), inputAndOutputNameSpace);
                    activity.Parameters   = activityParameters;
                    activity.ObjectXNodes = xElement.Nodes();
                }
                else
                {
                    var inputReferences = xElement.Attribute("ref").Value.Split(':');

                    activity.Parameters = new List <ClassParameter>
                    {
                        new ClassParameter
                        {
                            Name = inputReferences[1],
                            // TODO : find out to convert prefix in type
                            Type = inputReferences[1]
                        }
                    };
                }
            }

            var returnBindingElement = allFileElement.Element(XmlnsConstant.tibcoProcessNameSpace + "returnBindings");

            if (activityType == ActivityType.endType && returnBindingElement != null)
            {
                activity.InputBindings = returnBindingElement.Nodes();
            }

            return(activity);
        }
Exemplo n.º 50
0
        internal void PopulateData()
        {
            using (var context = new AppDbContext(options, null))
            {
                if (context.ActivityType.Count() < 1)
                {
                    var p1 = new ActivityType {
                        ActivityTypeID = 1, ActivityTypeName = "activity type 1",
                    };
                    var p2 = new ActivityType {
                        ActivityTypeID = 2, ActivityTypeName = "activity type 2",
                    };
                    context.ActivityType.Add(p1);
                    context.ActivityType.Add(p2);

                    context.SaveChanges();
                }

                if (context.InvestigationNote.Count() < 1)
                {
                    var p1 = new InvestigationNote {
                        InvestigationNoteID = 1, NoteText = "InvestigationNote 1",
                    };
                    var p2 = new InvestigationNote {
                        InvestigationNoteID = 2, NoteText = "InvestigationNote 2",
                    };
                    context.InvestigationNote.Add(p1);
                    context.InvestigationNote.Add(p2);

                    context.SaveChanges();
                }

                if (context.InvestigationStatus.Count() < 1)
                {
                    var p1 = new InvestigationStatus {
                        InvestigationStatusID = 1, InvestigationStatusDescription = "InvestigationStatus 1",
                    };
                    var p2 = new InvestigationStatus {
                        InvestigationStatusID = 2, InvestigationStatusDescription = "InvestigationStatus 2",
                    };
                    context.InvestigationStatus.Add(p1);
                    context.InvestigationStatus.Add(p2);

                    context.SaveChanges();
                }

                if (context.InvestigationActivity.Count() < 1)
                {
                    var p1 = new InvestigationActivity {
                        InvestigationActivityID = 1, FromValue = "InvestigationActivity 1",
                    };
                    var p2 = new InvestigationActivity {
                        InvestigationActivityID = 2, FromValue = "InvestigationActivity 2",
                    };
                    context.InvestigationActivity.Add(p1);
                    context.InvestigationActivity.Add(p2);

                    context.SaveChanges();
                }
            }
        }
 public void Remove(ActivityType ActivityType)
 {
     // delete activity type
     _activityTypeRepo.Remove(ActivityType);
 }
Exemplo n.º 52
0
 //Create
 public ActivityType Add(ActivityType type)
 {
     _activityTypeRepo.Add(type);
     return(type);
 }
Exemplo n.º 53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RadiologyOrder"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal RadiologyOrder(
     Visit visit,
     ActivityType activityType)
     : base(visit, activityType)
 {
 }
Exemplo n.º 54
0
 public static async void SetPlaying(string message, DiscordSocketClient client, ActivityType activityType = ActivityType.Playing)
 {
     await client.SetGameAsync($"{message} | {client.Guilds.Count} guilds, {client.Guilds.Sum(guild => guild.Users.Count) - 1} users", null, activityType);
 }
 internal static Activity InternalFindParentActivityInType(Activity activity, Dictionary <string, Activity> allActivities, ActivityType expectedParentType, bool isFirstForwardOccur, ExecutionInfo execution)
 {
     if (activity != null && allActivities != null)
     {
         if (isFirstForwardOccur && activity.ActivityType == expectedParentType)
         {
             return(activity);
         }
         int         i         = INIT_ACTIVITY_TREE_DEPTH;
         Activity    activity2 = activity;
         TraceRecord directParentActivityTransferInTrace = GetDirectParentActivityTransferInTrace(activity.Id, null, allActivities, execution);
         for (; i < MAX_ACTIVITY_TREE_DEPTH; i++)
         {
             if (directParentActivityTransferInTrace == null)
             {
                 break;
             }
             if (!allActivities.ContainsKey(directParentActivityTransferInTrace.ActivityID))
             {
                 break;
             }
             if (allActivities[directParentActivityTransferInTrace.ActivityID].ActivityType == expectedParentType)
             {
                 if (isFirstForwardOccur)
                 {
                     return(allActivities[directParentActivityTransferInTrace.ActivityID]);
                 }
                 activity2 = allActivities[directParentActivityTransferInTrace.ActivityID];
             }
             directParentActivityTransferInTrace = GetDirectParentActivityTransferInTrace(allActivities[directParentActivityTransferInTrace.ActivityID].Id, null, allActivities, execution);
         }
         if (!isFirstForwardOccur && activity2 != null && activity2.ActivityType == expectedParentType)
         {
             return(activity2);
         }
     }
     return(null);
 }
Exemplo n.º 56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Dast10"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal Dast10(
     Visit visit,
     ActivityType activityType)
     : base(visit, activityType)
 {
 }
Exemplo n.º 57
0
        //Update
        public ActivityType Update(ActivityType updatedType)
        {
            var type = _activityTypeRepo.Update(updatedType);

            return(type);
        }
Exemplo n.º 58
0
        public async Task <IEnumerable <LogChange> > getLogChangesByType(string userId, TimeLine timeLineArg = null, ActivityType typeOfDocument = ActivityType.None, int count = 100)
        {
            var options = new QueryRequestOptions {
                PartitionKey = new PartitionKey(userId)
            };

            var      collectionParams = new List <Tuple <string, object> >();
            string   sqlQuery         = @"SELECT * FROM c";
            bool     isWhereAlready   = false;
            TimeLine timeline         = timeLineArg.StartToEnd;

            if (userId.isNot_NullEmptyOrWhiteSpace())
            {
                if (!isWhereAlready)
                {
                    sqlQuery      += @" WHERE ";
                    isWhereAlready = true;
                }
                else
                {
                    sqlQuery += " AND ";
                }
                var sqlParam = new Tuple <string, object> ("@UserId", userId);
                collectionParams.Add(sqlParam);
                sqlQuery += @" c.UserId = @UserId ";
            }

            if (typeOfDocument != ActivityType.None && typeOfDocument.ToString().isNot_NullEmptyOrWhiteSpace())
            {
                if (!isWhereAlready)
                {
                    sqlQuery      += " WHERE ";
                    isWhereAlready = true;
                }
                else
                {
                    sqlQuery += " AND ";
                }
                var sqlParam = new Tuple <string, object>("@TypeOfEvent", typeOfDocument.ToString());
                collectionParams.Add(sqlParam);
                sqlQuery += " c.TypeOfEvent = @TypeOfEvent ";
            }

            if (timeline != null)
            {
                if (!isWhereAlready)
                {
                    sqlQuery      += " WHERE ";
                    isWhereAlready = true;
                }
                else
                {
                    sqlQuery += " AND ";
                }

                var sqlParamStart = new Tuple <string, object>("@JsTimeOfCreationStart", timeline.Start.ToUnixTimeMilliseconds());
                collectionParams.Add(sqlParamStart);
                var sqlParamEnd = new Tuple <string, object>("@JsTimeOfCreationEnd", timeline.End.ToUnixTimeMilliseconds());
                collectionParams.Add(sqlParamEnd);
                sqlQuery += " c.JsTimeOfCreation >= @JsTimeOfCreationStart and c.JsTimeOfCreation < @JsTimeOfCreationEnd ";
            }


            sqlQuery += @" order by  c.JsTimeOfCreation desc ";
            sqlQuery += @" offset 0 limit " + count + " ";


            QueryDefinition queryDefinition = new QueryDefinition(sqlQuery);

            collectionParams.ForEach((param) =>
            {
                queryDefinition = queryDefinition.WithParameter(param.Item1, param.Item2);
            });

            var       database  = Client.GetDatabase(dbName);
            Container container = database.GetContainer(collectionName);

            List <LogChange> retValue = new List <LogChange>();

            using (FeedIterator <LogChange> resultSet = container.GetItemQueryIterator <LogChange>(
                       queryDefinition,
                       requestOptions: new QueryRequestOptions()
            {
                PartitionKey = new PartitionKey("Account1"),
                MaxItemCount = 1
            }))
            {
                while (resultSet.HasMoreResults)
                {
                    FeedResponse <LogChange> response = await resultSet.ReadNextAsync();

                    LogChange logChange = response.First();
                    Console.WriteLine($"\n Log change UserId is : {logChange.UserId}; Id: {logChange.Id};");
                    retValue.AddRange(response);
                }
            }


            //var querySpec = new SqlQuerySpec
            //{
            //    QueryText = sqlQuery,
            //    Parameters = new SqlParameterCollection(
            //        collectionParams
            //    )
            //};



            //var documentCollectionUri = UriFactory.CreateDocumentCollectionUri(dbName, collectionName);
            //var query = Client.CreateDocumentQuery<Document>(documentCollectionUri, querySpec, options).AsDocumentQuery();
            //List<LogChange> retValue = new List<LogChange>();

            //while (query.HasMoreResults)
            //{
            //    var documents = await query.ExecuteNextAsync<Document>().ConfigureAwait(false);
            //    foreach (var loadedDocument in documents)
            //    {
            //        LogChange logChange = new LogChange();
            //        byte[] allBytesbefore = loadedDocument.GetPropertyValue<byte[]>("ZippedLog");
            //        logChange.ZippedLog = allBytesbefore;
            //        logChange.Id = loadedDocument.GetPropertyValue<string>("Id");
            //        logChange.UserId = loadedDocument.GetPropertyValue<string>("UserId");
            //        logChange.TypeOfEvent = loadedDocument.GetPropertyValue<string>("TypeOfEvent");
            //        logChange.TimeOfCreation = loadedDocument.GetPropertyValue<DateTimeOffset>("TimeOfCreation");
            //        logChange.JsTimeOfCreation = loadedDocument.GetPropertyValue<ulong>("JsTimeOfCreation");
            //        retValue.Add(logChange);
            //    }
            //}
            return(retValue);
        }
Exemplo n.º 59
0
 public User(string firstName, string lastName, int age, string username, string password, ActivityType favType)
 {
     ActiveAcc     = true;
     FirstName     = firstName;
     LastName      = lastName;
     Age           = age;
     Username      = username;
     Password      = password;
     Reading       = 0;
     Exercising    = 0;
     Working       = 0;
     OtherHobbies  = 0;
     FavouriteType = favType;
 }
Exemplo n.º 60
0
 //Delete
 public void Remove(ActivityType type)
 {
     _activityTypeRepo.Remove(type);
 }