Exemplo n.º 1
0
        private async void AddJob()
        {
            ShowNewJobScreen = false;
            var jobData = new CreateFmJobData {
                Title = newJobTitle, Description = newJobDescription, ProcessId = SelectedProcess.Id
            };

            var addJobActivity = new Activity {
                Name = $"Adding job {newJobTitle}", ProgressText = "Creating tar file"
            };

            ActivityList.Add(addJobActivity);

            IProgress <string> progress = new Progress <string>(s => { Dispatcher.CurrentDispatcher.Invoke(() => { addJobActivity.ProgressText = s; }); });

            var tarFilePath = await Task.Run(() => FileHelper.CreateTarGz("InputData", InputDirectory, progress));

            var uploadedFiles = await api.UploadFiles(new[] { tarFilePath }, SelectedProcess.Id, NewJobTitle, progress);

            progress.Report($"Creating job \"{NewJobTitle}\"");
            jobData.RelativeS3Path = uploadedFiles[0].RemotePath.Split(new[] { '/' }, 3)[2];
            await api.CreateJob(jobData);

            progress.Report($"Job \"{NewJobTitle}\" is created");

            ActivityList.Remove(addJobActivity);
            //UpdateJobs();
        }
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            if (Resources.GrazeFoodStore() != null)
            {
                this.InitialiseHerd(true, true);
                // create activity for each pasture type (and common land) and breed at startup
                // do not include common land pasture..
                foreach (GrazeFoodStoreType pastureType in Resources.GrazeFoodStore().Children.Where(a => a.GetType() == typeof(GrazeFoodStoreType) || a.GetType() == typeof(CommonLandFoodStoreType)))
                {
                    RuminantActivityGrazePasture ragp = new RuminantActivityGrazePasture();
                    ragp.GrazeFoodStoreModel = pastureType;
                    ragp.Clock  = Clock;
                    ragp.Parent = this;
                    ragp.Name   = "Graze_" + (pastureType as Model).Name;
                    ragp.OnPartialResourcesAvailableAction = this.OnPartialResourcesAvailableAction;
                    ragp.ActivityPerformed += BubblePaddock_ActivityPerformed;
                    ragp.Resources          = this.Resources;
                    ragp.InitialiseHerd(true, true);

                    foreach (RuminantType herdType in Resources.RuminantHerd().Children)
                    {
                        RuminantActivityGrazePastureHerd ragpb = new RuminantActivityGrazePastureHerd
                        {
                            GrazeFoodStoreModel = pastureType,
                            RuminantTypeModel   = herdType,
                            HoursGrazed         = HoursGrazed,
                            Parent = ragp,
                            Name   = ragp.Name + "_" + herdType.Name,
                            OnPartialResourcesAvailableAction = this.OnPartialResourcesAvailableAction
                        };
                        if (ragpb.Resources == null)
                        {
                            ragpb.Resources = this.Resources;
                        }
                        if (ragpb.Clock == null)
                        {
                            ragpb.Clock = this.Clock;
                        }
                        ragpb.InitialiseHerd(true, true);
                        if (ragp.ActivityList == null)
                        {
                            ragp.ActivityList = new List <CLEMActivityBase>();
                        }
                        ragp.ActivityList.Add(ragpb);
                        ragpb.ResourceShortfallOccurred += GrazeAll_ResourceShortfallOccurred;
                        ragpb.ActivityPerformed         += BubblePaddock_ActivityPerformed;
                    }
                    if (ActivityList == null)
                    {
                        ActivityList = new List <CLEMActivityBase>();
                    }
                    ActivityList.Add(ragp);
                }
            }
            else
            {
                Summary.WriteWarning(this, "No GrazeFoodStore is available for the ruminant grazing activity!");
            }
        }
Exemplo n.º 3
0
        public async void OnAppearing()
        {
            var database = new ActivityDatabase();

//			ActivityList = new ObservableCollection<Activities> (await database.GetAll ());

            ActivityList.Add(new Activities("Cook Dinner", "Kitchen", 1, false));
        }
Exemplo n.º 4
0
 public void AddActivity(Activity activity)
 {
     if (activity.StartTime.Date != Date.Date)
     {
         throw new ArgumentOutOfRangeException("Cannot add activity for date " + activity.StartTime.Date +
                                               " to a training day of date " + Date.Date);
     }
     ActivityList.Add(activity);
 }
Exemplo n.º 5
0
 public void AddActivity(Activity activity)
 {
     ActivityList.Add(activity);
     ActivityPersistency.SaveActivity(activity);
     foreach (var dates in activity.Dates)
     {
         var date = new ActivityDate(activity.ID, dates.ToString());
         DatesPersistency.SaveDates(date);
     }
 }
Exemplo n.º 6
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            // create activity for each pasture type and breed at startup
            foreach (GrazeFoodStoreType pastureType in Resources.GrazeFoodStore().Children)
            {
                RuminantActivityGrazePasture ragp = new RuminantActivityGrazePasture();
                ragp.GrazeFoodStoreModel = pastureType;
                ragp.Clock  = Clock;
                ragp.Parent = this;
                ragp.Name   = "Graze_" + pastureType.Name;
                ragp.OnPartialResourcesAvailableAction = this.OnPartialResourcesAvailableAction;
                ragp.ActivityPerformed += BubblePaddock_ActivityPerformed;

                foreach (RuminantType herdType in Resources.RuminantHerd().Children)
                {
                    RuminantActivityGrazePastureHerd ragpb = new RuminantActivityGrazePastureHerd
                    {
                        GrazeFoodStoreModel = pastureType,
                        RuminantTypeModel   = herdType,
                        HoursGrazed         = HoursGrazed,
                        Parent = ragp,
                        Name   = ragp.Name + "_" + herdType.Name,
                        OnPartialResourcesAvailableAction = this.OnPartialResourcesAvailableAction
                    };
                    if (ragpb.Resources == null)
                    {
                        ragpb.Resources = this.Resources;
                    }
                    if (ragpb.Clock == null)
                    {
                        ragpb.Clock = this.Clock;
                    }
                    ragpb.InitialiseHerd(true, true);
                    if (ragp.ActivityList == null)
                    {
                        ragp.ActivityList = new List <CLEMActivityBase>();
                    }
                    ragp.ActivityList.Add(ragpb);
                    ragpb.ResourceShortfallOccurred += GrazeAll_ResourceShortfallOccurred;
                    ragpb.ActivityPerformed         += BubblePaddock_ActivityPerformed;
                }
                if (ActivityList == null)
                {
                    ActivityList = new List <CLEMActivityBase>();
                }
                ActivityList.Add(ragp);
            }
        }
Exemplo n.º 7
0
        public void GetActivityPatient()
        {
            DBClass.openConnection();
            //) CAST(DateOfBirth AS date), convert(Date, DateOfBirth, 23)
            //select distinct convert(VARCHAR, DataDiagnosis, 23) , NotesDiagnosis, LastNameTherapist from therapists, diagnosis where(diagnosis.IDPatient = '2') and therapists.LastNameTherapist = (select LastNameTherapist from therapists where IDTherapist = '2')
            DBClass.sql = "select distinct IDActivities, convert(VARCHAR, DateActivity, 23) , ActivityNote, LastNameTherapist " +
                          "from therapists, activities " +
                          "where (activities.IDTherapy = '" + data[0] + "') and therapists.LastNameTherapist = (select LastNameTherapist from therapists where IDTherapist = '2')";
            DBClass.cmd.CommandType = CommandType.Text;
            DBClass.cmd.CommandText = DBClass.sql;

            DBClass.da = new SqlDataAdapter(DBClass.cmd);
            DBClass.dt = new DataTable();
            DBClass.da.Fill(DBClass.dt);

            // wyciągamy dane
            int j = 0;

            ActivityList.Clear();
            using (SqlDataReader reader = DBClass.cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    for (j = 0; j <= reader.FieldCount - 1; j++) // Looping throw colums
                    {
                        data[j] = reader.GetValue(j).ToString();
                    }
                    if (data[7] == null)
                    {
                        data[7] = "";
                    }
                    ActivityList.Add(new ActivityModel
                    {
                        IDActivity        = (data[0]),
                        DataActivity      = data[1],
                        NotesActivity     = data[2],
                        LastNameTherapist = data[3]
                    });
                    //Console.WriteLine("IDTherapist - " + data[7] + data[8]);
                }
            }
        }
Exemplo n.º 8
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            // This method will only fire if the user has added this activity to the UI
            // Otherwise all details will be provided from GrazeAll code [CLEMInitialiseActivity]

            GrazeFoodStoreModel = Resources.FindResourceType <GrazeFoodStore, GrazeFoodStoreType>(this, GrazeFoodStoreTypeName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop);

            //Create list of children by breed
            foreach (RuminantType herdType in Resources.FindResourceGroup <RuminantHerd>().FindAllChildren <RuminantType>())
            {
                RuminantActivityGrazePastureHerd ragpb = new RuminantActivityGrazePastureHerd
                {
                    GrazeFoodStoreModel = GrazeFoodStoreModel,
                    RuminantTypeModel   = herdType,
                    Parent = this,
                    Clock  = this.Clock,
                    Name   = "Graze_" + (GrazeFoodStoreModel as Model).Name + "_" + herdType.Name
                };

                ragpb.SetLinkedModels(Resources);

                if (ragpb.Clock == null)
                {
                    ragpb.Clock = this.Clock;
                }

                ragpb.InitialiseHerd(true, true);

                if (ActivityList == null)
                {
                    ActivityList = new List <CLEMActivityBase>();
                }

                ActivityList.Add(ragpb);
                ragpb.ResourceShortfallOccurred += Paddock_ResourceShortfallOccurred;
                ragpb.ActivityPerformed         += BubbleHerd_ActivityPerformed;
            }
        }
        public async void LoadAsync()
        {
            try
            {
                if (IsLoad == true)
                {
                    return;
                }
                IsLoad = true;
                var result = await _blRouter.GetActivityListAsync(_dateTime);

                ActivityList.Clear();
                foreach (var item in result)
                {
                    ActivityList.Add(item);
                }
                IsLoad = false;
            }
            catch (Exception e)
            {
                IsLoad = false;
            }
        }
Exemplo n.º 10
0
        protected override async Task InitializationAsync()
        {
            var activityHomePageDetailResult = await OfoApi.GetActivityHomePageDetailAsync();

            if (await CheckOfoApiResult(activityHomePageDetailResult))
            {
                var activityHomePageDetail = activityHomePageDetailResult.Data;
                if (activityHomePageDetail?.AdList?.Count > 0)
                {
                    activityHomePageDetail.AdList.ForEach(item =>
                    {
                        ActivityList.Add(new ActivityCenterActivityItemViewModel()
                        {
                            ActivityId   = item.activityId,
                            ClickCommand = ActivityClickCommand,
                            ImgName      = item.ImgName,
                            ImgUrl       = item.ImgUrl,
                            JumpUrl      = item.JumpUrl,
                        });
                    });
                }
                if (activityHomePageDetail?.OperationList?.Count > 0)
                {
                    activityHomePageDetail.OperationList.ForEach(item =>
                    {
                        OperationList.Add(item);
                    });
                }
                if (activityHomePageDetail?.FocusList?.Count > 0)
                {
                    activityHomePageDetail.FocusList.ForEach(item =>
                    {
                        FocusList.Add(item);
                    });
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// To Get Activity Details
        /// </summary>
        /// <returns></returns>
        public ActivityList GetActivity()
        {
            OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_GET_MST_CDAP_ACTIVITY";

            cmd             = new OracleCommand(proc, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader dr            = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ActivityBO       objActivityBO = null;
            ActivityList     Activity      = new ActivityList();

            while (dr.Read())
            {
                objActivityBO = new ActivityBO();
                objActivityBO.Cdap_activityid   = (Convert.ToInt32(dr.GetValue(dr.GetOrdinal("Id"))));
                objActivityBO.Cdap_activityname = dr.GetValue(dr.GetOrdinal("Name")).ToString();
                Activity.Add(objActivityBO);
            }
            dr.Close();
            return(Activity);
        }
Exemplo n.º 12
0
 public void AddAvailable(ExerciceVM item)
 {
     ActivityList.Add(item);
 }
Exemplo n.º 13
0
 public void AddActivity(BaseActivity activity)
 {
     ActivityList.Add(activity);
 }
Exemplo n.º 14
0
 public void AddToQueue(Activity activity)
 {
     ActivityList.Add(activity);
 }
Exemplo n.º 15
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            GrazeFoodStore grazeFoodStore = Resources.FindResourceGroup <GrazeFoodStore>();

            if (grazeFoodStore != null)
            {
                this.InitialiseHerd(true, true);
                // create activity for each pasture type (and common land) and breed at startup
                // do not include common land pasture..
                foreach (GrazeFoodStoreType pastureType in grazeFoodStore.Children.Where(a => a.GetType() == typeof(GrazeFoodStoreType) || a.GetType() == typeof(CommonLandFoodStoreType)))
                {
                    RuminantActivityGrazePasture ragp = new RuminantActivityGrazePasture
                    {
                        GrazeFoodStoreModel = pastureType,
                        Clock  = clock,
                        Parent = this,
                        Name   = "Graze_" + (pastureType as Model).Name,
                        OnPartialResourcesAvailableAction = this.OnPartialResourcesAvailableAction
                    };
                    ragp.ActivityPerformed += BubblePaddock_ActivityPerformed;
                    ragp.SetLinkedModels(Resources);
                    ragp.InitialiseHerd(true, true);

                    foreach (RuminantType herdType in HerdResource.FindAllChildren <RuminantType>())
                    {
                        RuminantActivityGrazePastureHerd ragpb = new RuminantActivityGrazePastureHerd
                        {
                            GrazeFoodStoreModel = pastureType,
                            RuminantTypeModel   = herdType,
                            HoursGrazed         = HoursGrazed,
                            Parent = ragp,
                            Name   = ragp.Name + "_" + herdType.Name,
                            OnPartialResourcesAvailableAction = this.OnPartialResourcesAvailableAction
                        };

                        ragpb.SetLinkedModels(Resources);

                        if (ragpb.Clock == null)
                        {
                            ragpb.Clock = this.clock;
                        }

                        ragpb.InitialiseHerd(true, true);
                        if (ragp.ActivityList == null)
                        {
                            ragp.ActivityList = new List <CLEMActivityBase>();
                        }

                        ragp.ActivityList.Add(ragpb);
                        ragpb.ResourceShortfallOccurred += GrazeAll_ResourceShortfallOccurred;
                        ragpb.ActivityPerformed         += BubblePaddock_ActivityPerformed;
                    }
                    if (ActivityList == null)
                    {
                        ActivityList = new List <CLEMActivityBase>();
                    }
                    ActivityList.Add(ragp);
                }
            }
            else
            {
                Summary.WriteMessage(this, $"No GrazeFoodStore is available for the ruminant grazing activity [a={this.Name}]!", MessageType.Warning);
            }
        }
Exemplo n.º 16
0
 public void Add(object activity)
 {
     ActivityList.Add((ExerciceVM)activity);
 }