Esempio n. 1
0
        /// <summary>
        /// Metodo que elimina de la base de datos la informacion de una carga de trabajo
        /// </summary>
        /// <returns>Retorna una entero</returns>
        /// <param name="workloadToDelete">Carga de trabajo a eliminar</param>
        public int DeleteWorkload(Workload workloadToDelete)
        {
            List <ParameterDB> parameters = new List <ParameterDB>();

            try
            {
                parameters.Add(new ParameterDB(TimesheetResources.id, SqlDbType.Int, workloadToDelete.id.ToString(), false));
                ExecuteStoredProcedure(TimesheetResources.DeleteWorkloadStoredProcedure, parameters);
                int result = 200;
                return(result);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (NullReferenceException ex)
            {
                throw ex;
            }
            catch (ArgumentNullException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Método que modifica de la base de datos el estatus de una carga de trabajo
        /// </summary>
        /// <returns>Retorna un entero</returns>
        /// <param name="workloadToUpdate">Carga de trabajo a la cual se le va a modificar el estatus</param>
        public int UpdateWorkloadStatus(Workload workloadToUpdate)
        {
            List <ParameterDB> parameters = new List <ParameterDB>();

            try
            {
                parameters.Add(new ParameterDB(TimesheetResources.id, SqlDbType.Int, workloadToUpdate.id.ToString(), false));
                parameters.Add(new ParameterDB(TimesheetResources.status, SqlDbType.VarChar, workloadToUpdate.status, false));
                parameters.Add(new ParameterDB(TimesheetResources.exitvalue, SqlDbType.Int, true));
                List <ResultDB> results = ExecuteStoredProcedure(TimesheetResources.UpdateWorkloadStatusStoredProcedure, parameters);
                int             result  = Int32.Parse(results[0].value);
                return(result);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (NullReferenceException ex)
            {
                throw ex;
            }
            catch (ArgumentNullException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool submitWorkload(workload work)
        {
            if (exceptionqueue.Count() >= exceptionmaxlen)
            {
                throw new Exception("Exception list too long. Call popException() or clearExceptions().");
            }
            if (workloads.Count >= queue_max_len)
            {
                return(false);//队列超长,停止发送
            }

            Workload wl = new Workload()
            {
                claimed = false, work = work, id = Guid.NewGuid()
            };

            lock (workloads)
            {
                workloads.Add(wl);
            }

            if (busythread == mainpool.Count)//全忙
            {
                if (mainpool.Count < max_size)
                {                                    //池未满
                    mainpool.Add(new pThread(this)); //加线程
                }
            }
            return(true);
        }
Esempio n. 4
0
        public async Task <IActionResult> PutWorkload([FromRoute] int id, [FromBody] Workload workload)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != workload.Id)
            {
                return(BadRequest());
            }

            _context.Entry(workload).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WorkloadExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 5
0
        /// <summary>Snippet for CreateWorkload</summary>
        public void CreateWorkload()
        {
            // Snippet: CreateWorkload(string, Workload, CallSettings)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
            // Initialize request argument(s)
            string   parent   = "organizations/[ORGANIZATION]/locations/[LOCATION]";
            Workload workload = new Workload();
            // Make the request
            Operation <Workload, CreateWorkloadOperationMetadata> response = assuredWorkloadsServiceClient.CreateWorkload(parent, workload);

            // Poll until the returned long-running operation is complete
            Operation <Workload, CreateWorkloadOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Workload result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Workload, CreateWorkloadOperationMetadata> retrievedResponse = assuredWorkloadsServiceClient.PollOnceCreateWorkload(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Workload retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 6
0
        public WorkLoadForm(Workload _workload)
        {
            InitializeComponent();
            this.workload = _workload;


            foreach (var item in Univer.Teachers)
            {
                string fio = item.Value.LastName + " " + item.Value.FirstName[0] + ". " + item.Value.MiddleName[0] + ".";
                comboBoxTeacher.Items.Add(fio);
            }

            foreach (var item in Univer.Disciplines)
            {
                comboBoxDiscipline.Items.Add(item.Value.Name);
            }

            string FIO = workload.teacher.LastName + " " + workload.teacher.FirstName[0] + ". " + workload.teacher.MiddleName[0] + ".";

            comboBoxTeacher.SelectedItem = FIO;

            comboBoxDiscipline.SelectedItem = workload.discipline.Name;

            textBoxGroupeName.Text = workload.groupName;
        }
Esempio n. 7
0
        /// <summary>Snippet for CreateWorkloadAsync</summary>
        public async Task CreateWorkloadResourceNamesAsync()
        {
            // Snippet: CreateWorkloadAsync(LocationName, Workload, CallSettings)
            // Additional: CreateWorkloadAsync(LocationName, Workload, CancellationToken)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = await AssuredWorkloadsServiceClient.CreateAsync();

            // Initialize request argument(s)
            LocationName parent   = LocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
            Workload     workload = new Workload();
            // Make the request
            Operation <Workload, CreateWorkloadOperationMetadata> response = await assuredWorkloadsServiceClient.CreateWorkloadAsync(parent, workload);

            // Poll until the returned long-running operation is complete
            Operation <Workload, CreateWorkloadOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Workload result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Workload, CreateWorkloadOperationMetadata> retrievedResponse = await assuredWorkloadsServiceClient.PollOnceCreateWorkloadAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Workload retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 8
0
        public WorkLoadForm()
        {
            InitializeComponent();
            workload = new Workload();

            textBoxGroupeName.Text      = "Название группы";
            textBoxGroupeName.ForeColor = Color.Gray;

            comboBoxTeacher.Text      = "Преподаватель";
            comboBoxTeacher.ForeColor = Color.Gray;

            comboBoxDiscipline.Text      = "Предмет";
            comboBoxDiscipline.ForeColor = Color.Gray;

            foreach (var item in Univer.Teachers)
            {
                string FIO = item.Value.LastName + " " + item.Value.FirstName[0] + ". " + item.Value.MiddleName[0] + ".";
                comboBoxTeacher.Items.Add(FIO);
            }

            foreach (var item in Univer.Disciplines)
            {
                comboBoxDiscipline.Items.Add(item.Value.Name);
            }
        }
Esempio n. 9
0
        private void Import(Tasks _newTask, Bugnet.DatabaseContentDataSet.BugTimeEntryRow _te, Bugnet.DatabaseContentDataSet.BugCommentDataTable _comments, Entities _entt)
        {
            int _bugId = 0;

            try
            {
                _bugId = _te.BugTimeEntryId;
                Resources _author = GetOrAdd <Resources>(_entt.Resources, m_ResourcesDictionaryBugNet, _te.CreatedUserId);
                Workload  _new    = new Workload()
                {
                    Hours                   = Convert.ToDouble(_te.Duration),
                    ReadOnly                = false,
                    Title                   = _newTask.Title,//_comments[ _te.BugCommentId ].Comment,
                    WeekNumber              = WeekNumber(_te.WorkDate),
                    Workload2ProjectTitle   = _newTask.Task2ProjectTitle,
                    Workload2ResourcesTitle = _author,
                    Workload2StageTitle     = _newTask.Task2ProjectTitle == null ? null : _newTask.Task2ProjectTitle.Project2StageTitle,
                    Workload2TaskTitle      = _newTask,
                    WorkloadDate            = _te.WorkDate,
                    Year = _te.WorkDate.Year
                };
                _entt.Workload.InsertOnSubmit(_new);
                _entt.SubmitChanges();
            }
            catch (Exception _ex)
            {
                Console.WriteLine(String.Format("Error importing BugTimeEntryRow of id: {0}, because of {1}", _bugId, _ex.Message));
            };
        }
Esempio n. 10
0
        private Dictionary <string, Job> CreateJobsFromWorkload(Workload workload)
        {
            Dictionary <string, Job> jobs = new Dictionary <string, Job>();
            Random rng = new Random(System.Environment.TickCount);

            foreach (Workload.Task ti in workload.Work.Items)
            {
                double CORECF = 1;
                foreach (var cpu in Environment.Cpus)
                {
                    if (cpu.Id == ti.CpuId)
                    {
                        foreach (var core in cpu.Cores)
                        {
                            if (core.Id == ti.CoreId)
                            {
                                CORECF = core._CF;
                            }
                        }
                    }
                }



                int        et      = rng.Next(ti.BCET, ti.WCET);
                List <int> periods = ti.Periods.Select(x => x.Value).ToList();
                Job        j       = new Job(ti.Id, ti.Name, periods.First(), ti.Deadline, et, ti.EarliestActivation, ti.MaxJitter, ti.CpuId, ti.CoreId, CORECF, Evaluator, periods, ti.Cil);
                j.Offset             = ti.Offset;
                j.DeadlineAdjustment = ti.DeadlineAdjustment;
                jobs.Add(ti.Name, j);
            }

            return(jobs);
        }
Esempio n. 11
0
        internal static void SetAuditConfigurationRule(Workload workload, OrganizationIdParameter organizationId, MultiValuedProperty <AuditableOperations> auditOpsToSet, out IEnumerable <ErrorRecord> pipelineErrors)
        {
            Guid guid;

            if (!AuditPolicyUtility.GetRuleGuidFromWorkload(workload, out guid))
            {
                pipelineErrors = new List <ErrorRecord>();
                return;
            }
            Command command = new Command("Get-AuditConfigurationRule");

            if (organizationId != null)
            {
                command.Parameters.Add("Organization", organizationId);
            }
            command.Parameters.Add("Identity", guid.ToString());
            Command command2 = new Command("Set-AuditConfigurationRule");

            command2.Parameters.Add("AuditOperation", auditOpsToSet);
            AuditConfigUtility.InvokeCommands(new List <Command>
            {
                command,
                command2
            }, out pipelineErrors);
        }
Esempio n. 12
0
        public void AddOrUpdateWorkload(Workload workload)
        {
            using (var scope = Db.BeginWork())
            {
                var disciplineWorkload = workload.LocalWorkload;
                if (disciplineWorkload != null)
                {
                    workload.LocalWorkloadId = disciplineWorkload.Id;
                }
                workload.LocalWorkload = null;

                var employee = workload.Employee;
                if (employee != null)
                {
                    workload.EmployeeId = employee.Id;
                }
                workload.Employee = null;

                _workloadRepository.AddOrUpdate(workload);
                scope.SaveChanges();

                workload.Employee      = employee;
                workload.LocalWorkload = disciplineWorkload;
            }
        }
Esempio n. 13
0
        /// <summary>Snippet for CreateWorkload</summary>
        public void CreateWorkloadRequestObject()
        {
            // Snippet: CreateWorkload(CreateWorkloadRequest, CallSettings)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
            // Initialize request argument(s)
            CreateWorkloadRequest request = new CreateWorkloadRequest
            {
                ParentAsLocationName = LocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
                Workload             = new Workload(),
                ExternalId           = "",
            };
            // Make the request
            Operation <Workload, CreateWorkloadOperationMetadata> response = assuredWorkloadsServiceClient.CreateWorkload(request);

            // Poll until the returned long-running operation is complete
            Operation <Workload, CreateWorkloadOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Workload result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Workload, CreateWorkloadOperationMetadata> retrievedResponse = assuredWorkloadsServiceClient.PollOnceCreateWorkload(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Workload retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 14
0
        public IEnumerable <Measurement> GetMeasurements()
        {
            double overhead    = Overhead == null ? 0.0 : new Statistics(Overhead.Select(m => m.Nanoseconds)).Mean;
            var    mainStats   = new Statistics(Workload.Select(m => m.Nanoseconds));
            int    resultIndex = 0;

            foreach (var measurement in Workload)
            {
                if (mainStats.IsActualOutlier(measurement.Nanoseconds, outlierMode))
                {
                    continue;
                }
                double value = Math.Max(0, measurement.Nanoseconds - overhead);
                if (IsSuspiciouslySmall(value))
                {
                    value = 0;
                }

                yield return(new Measurement(
                                 measurement.LaunchIndex,
                                 IterationMode.Workload,
                                 IterationStage.Result,
                                 ++resultIndex,
                                 measurement.Operations,
                                 value,
                                 encoding));
            }
        }
Esempio n. 15
0
        public void DeleteById(int id)
        {
            Workload emp = GetById(id);

            dbconn.Workloads.Remove(emp);
            dbconn.SaveChanges();
        }
Esempio n. 16
0
 private GenericStateMachineEngine.ActionResult Update()
 {
     try
     {
         int      _idx  = m_GridView.SelectedIndex;
         Entities _edc  = m_DataContext.DataContext;
         Workload _wkl  = _edc.Workload.GetAtIndex <Workload>(m_GridView.SelectedDataKey.Value.ToString());
         Tasks    _task = m_TaskDropDown.GetSelected <Tasks>(m_DataContext.DataContext.Task);
         _wkl.Title                 = m_WorkloadDescriptionTextBox.Text;
         _wkl.EndDate               = m_WorkloadEndDateTimeControl.SelectedDate;
         _wkl.StartDate             = m_WorkloadStartDateTimeControl.SelectedDate;
         _wkl.Workload2ProjectTitle = SelectedProject;
         _wkl.Workload2StageTitle   = SelectedProject == null ? null : SelectedProject.Project2StageTitle;
         _wkl.Workload2TaskID       = _task;
         _task.CalculateWorkload();
         m_DataContext.DataContext.SubmitChanges();
         FillupWorkflowGridView(_edc);
         m_GridView.SelectedIndex = _idx;
         UpdateWorkload();
         FillupGridViewProjectSummary(_edc);
     }
     catch (ApplicationError _ae)
     {
         return(GenericStateMachineEngine.ActionResult.Exception(_ae, "GenericStateMachineEngine.ActionResult"));
     }
     catch (Exception _ex)
     {
         return(GenericStateMachineEngine.ActionResult.Exception(_ex, "GenericStateMachineEngine.ActionResult"));
     }
     return(GenericStateMachineEngine.ActionResult.Success);
 }
Esempio n. 17
0
 internal static void ValidateWorkloadParameter(Workload workload)
 {
     if (workload != Workload.Exchange && workload != Workload.SharePoint && workload != (Workload.Exchange | Workload.SharePoint))
     {
         throw new InvalidCompliancePolicyWorkloadException();
     }
 }
Esempio n. 18
0
 public AuditConfig(Workload wl = Workload.None)
 {
     this.Identity = new ConfigObjectId(Guid.NewGuid().ToString());
     this.Workload = wl;
     this.Setting  = AuditSwitchStatus.None;
     this.PolicyDistributionStatus = PolicyApplyStatus.Error;
     this.DistributionResults      = new MultiValuedProperty <PolicyDistributionErrorDetails>();
 }
 public PsUnifiedPolicyNotification(Workload workload, string identity, IEnumerable <SyncChangeInfo> syncChangeInfos, bool fullSync)
 {
     this.Workload        = workload;
     this.Identity        = new ConfigObjectId(identity);
     this.SyncChangeInfos = new MultiValuedProperty <string>(from x in syncChangeInfos
                                                             select x.ToString());
     this.FullSync = fullSync;
 }
Esempio n. 20
0
 public CompliancePolicySyncNotificationClient(Workload workload, ICredentials credentials, Uri syncSvcUrl)
 {
     ArgumentValidator.ThrowIfNull("credentials", credentials);
     ArgumentValidator.ThrowIfNull("syncSvcUrl", syncSvcUrl);
     this.Workload    = workload;
     this.credentials = credentials;
     this.syncSvcUrl  = syncSvcUrl;
 }
Esempio n. 21
0
 public ActionResult Edit([Bind(Include = "ID,Name")] Workload workload)
 {
     if (ModelState.IsValid)
     {
         workloadBusinessManager.Update(workload);
     }
     return(View(workload));
 }
 private void WriteSyncVerbose(List <ChangeNotificationData> syncData, Workload workload, bool isObjectLevelSync)
 {
     base.WriteVerbose(Strings.VerboseRetryDistributionNotifyingWorkload(workload.ToString(), isObjectLevelSync ? "object" : "delta"));
     foreach (ChangeNotificationData changeNotificationData in syncData)
     {
         base.WriteVerbose(Strings.VerboseRetryDistributionNotificationDetails(changeNotificationData.Id.ToString(), changeNotificationData.ChangeType.ToString(), changeNotificationData.ObjectType.ToString()));
     }
 }
Esempio n. 23
0
 public string ItemExists(int itemID, int taskNumber, string type)
 {
     try
     {
         return(Workload.ItemExists(itemID, taskNumber, type).ToString());
     }
     catch (Exception) { return("false"); }
 }
Esempio n. 24
0
 internal static Workload GetEffectiveWorkload(Workload auditWorkload)
 {
     if (auditWorkload != Workload.OneDriveForBusiness)
     {
         return(auditWorkload);
     }
     return(Workload.SharePoint);
 }
Esempio n. 25
0
 public string EmailHotlist()
 {
     try
     {
         return(Workload.EmailHotlist().ToString());
     }
     catch (Exception) { return("false"); }
 }
Esempio n. 26
0
 internal static MultiValuedProperty <AuditableOperations> GetAuditOperations(Workload workload, AuditSwitchStatus auditSwitch)
 {
     if (auditSwitch == AuditSwitchStatus.On)
     {
         return(AuditConfigUtility.auditMap[workload].Item2);
     }
     return(AuditConfigUtility.auditMap[workload].Item1);
 }
Esempio n. 27
0
 public static bool ItemExists(int itemID, string type)
 {
     try
     {
         return(Workload.ItemExists(itemID, -1, type));
     }
     catch (Exception) { return(false); }
 }
Esempio n. 28
0
 public void AddWorkload(Workload workload)
 {
     using (var scope = Db.BeginWork())
     {
         _workloadRepository.Add(workload);
         scope.SaveChanges();
     }
 }
Esempio n. 29
0
        public Workload Add(Workload emp)
        {
            Workload addedEmp = dbconn.Workloads.Add(emp);

            dbconn.SaveChanges();

            return(addedEmp);
        }
Esempio n. 30
0
    public static string LoadMetrics(int workItemTaskID)
    {
        var result = WTS.WTSPage.CreateDefaultResult();

        DataSet ds = Workload.WorkItem_Task_Metrics_Get(workItemTaskID);

        return(WTS.WTSPage.SerializeResult(ds));
    }
Esempio n. 31
0
 public decimal GetWeight(Workload workload, Expertise expertise)
 {
     var retValue = this.GetWorkloadValue(workload) * this.GetExpertiseWeight(expertise);
     return retValue;
 }
Esempio n. 32
0
 public decimal GetWorkloadValue(Workload workload)
 {
     switch (workload)
     {
         case Workload.Heavy:
             return 10;
         case Workload.Average:
             return 4;
         case Workload.Light:
             return 2;
         default:
             return 1;
     }
 }