コード例 #1
0
        private void LoadJob()
        {
            job = new JobInstance(RegistryContext);
            job.Guid = guid;
            job.Load();

            // Check user ID
            if (job.UserGuidOwner != UserGuid)
            {
                throw new Registry.SecurityException("Access denied.");
            }

            // Get query details
            qj = JobDescriptionFactory.GetJob(job, QueryFactory);
        }
コード例 #2
0
        private void LoadJob()
        {
            job = new JobInstance(RegistryContext);
            job.Guid = guid;
            job.Load();

            // Check user ID
            if (IsAuthenticatedUser(job.UserGuidOwner))
            {
                throw new Registry.SecurityException("Access denied.");  // TODO
            }

            // Get query details
            ej = JobDescriptionFactory.GetJobDescription(job);
        }
コード例 #3
0
 public override void Deserialize(IDataReader reader)
 {
     this.newLevel        = reader.ReadByte();
     this.jobsDescription = new JobDescription();
     this.jobsDescription.Deserialize(reader);
 }
コード例 #4
0
ファイル: SqlStorage.cs プロジェクト: shanerogers/Minion
        public async Task <JobDescription> AcquireJobAsync()
        {
            var now = GetSqlSafeDate(_dateService.GetNow());

            const string sql = @"
                BEGIN TRAN

                    Update job WITH (TABLOCK, HOLDLOCK) 
                        set 
                            job.State = @NewState, 
                            UpdatedTime = @Now
                  
                    output 
                        inserted.Id, 
                        inserted.Type, 
                        inserted.DueTime, 
                        inserted.Priority, 
                        inserted.WaitCount, 
                        inserted.PrevId, 
                        inserted.NextId, 
                        inserted.BatchId, 
                        inserted.CreatedTime, 
                        inserted.UpdatedTime, 
                        inserted.InputType, 
                        inserted.InputData, 
                        inserted.State, 
                        inserted.StatusInfo,
                        inserted.ExecTime
                    
                    from Jobs as job WITH (TABLOCK, HOLDLOCK)
                        inner join (
		                    select 
			                    top 1 Id
		                    from
			                    Jobs WITH (TABLOCK, HOLDLOCK)
		                    where
			                    State = @State and
			                    WaitCount = 0 and
                                DueTime <= @Now
		                    order by
			                    DueTime asc,
			                    Priority desc,
                                _id asc
	                    ) as job_top on job_top.id = job.Id

                COMMIT";

            IEnumerable <JobDescriptionSqlModel> rows;

            using (var connection = new SqlConnection(_connectionString))
            {
                rows = await connection.OpenWithRetryAsync(conn =>
                                                           conn.QueryAsync <JobDescriptionSqlModel>(sql,
                                                                                                    new {
                    State    = (int)ExecutionState.Waiting,
                    Now      = now,
                    NewState = (int)ExecutionState.Running
                }
                                                                                                    )
                                                           );
            }

            var result = rows.FirstOrDefault();

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

            var jobDescription = new JobDescription
            {
                Id            = result.Id,
                Type          = result.Type,
                DueTime       = result.DueTime,
                Priority      = result.Priority,
                WaitCount     = result.WaitCount,
                PrevId        = result.PrevId,
                NextId        = result.NextId,
                BatchId       = result.BatchId,
                CreatedTime   = result.CreatedTime,
                UpdatedTime   = result.UpdatedTime,
                State         = result.State,
                StatusInfo    = result.StatusInfo,
                ExecutionTime = TimeSpan.FromTicks(result.ExecutionTime),
            };

            if (!string.IsNullOrEmpty(result.InputData))
            {
                jobDescription.Input = new JobInputDescription
                {
                    Type      = result.InputType,
                    InputData = JsonConvert.DeserializeObject(result.InputData, Type.GetType(result.InputType))
                }
            }
            ;

            return(jobDescription);
        }
コード例 #5
0
ファイル: proxy.cs プロジェクト: Azure/azure-powershell
 partial void OnDescriptionChanging(JobDescription value);
コード例 #6
0
 static void Postfix(StaffMenu __instance, StaffDefinition.Type staffType, StaffMenu.StaffMenuSettings ____staffMenuSettings, WorldState ____worldState, List <JobDescription>[] ____jobs, CharacterManager ____characterManager)
 {
     if (!Main.enabled)
     {
         return;
     }
     try
     {
         int num = 0;
         foreach (object obj in ____staffMenuSettings.JobsListContainer)
         {
             Transform      transform = (Transform)obj;
             JobDescription job       = ____jobs[(int)staffType][num];
             TMP_Text       component = UnityEngine.Object.Instantiate <GameObject>(____staffMenuSettings.TitleText.gameObject).GetComponent <TMP_Text>();
             component.rectTransform.SetParent(transform);
             int staffCount = ____characterManager.StaffMembers.Count((Staff s) => !s.HasResigned() && !s.HasBeenFired() && job.IsSuitable(s) && !s.JobExclusions.Contains(job));
             int roomCount  = 0;
             if (job is JobRoomDescription)
             {
                 roomCount      = ____worldState.AllRooms.Count((Room x) => x.Definition == ((JobRoomDescription)job).Room);
                 component.text = staffCount.ToString() + "/" + roomCount.ToString();
                 StaffJobIcon[] componentsInChildren = ____staffMenuSettings.JobsListContainer.gameObject.GetComponentsInChildren <StaffJobIcon>();
                 if (componentsInChildren != null && num < componentsInChildren.Length)
                 {
                     componentsInChildren[num].Tooltip.SetDataProvider(delegate(Tooltip tooltip)
                     {
                         tooltip.Text = string.Concat(new string[]
                         {
                             job.GetJobAssignmentTooltipString(),
                             "\n\nSatff Assigned: ",
                             staffCount.ToString(),
                             "\nRooms Built: ",
                             roomCount.ToString()
                         });
                     });
                 }
             }
             else if (job is JobItemDescription)
             {
                 component.text = staffCount.ToString();
                 StaffJobIcon[] componentsInChildren2 = ____staffMenuSettings.JobsListContainer.gameObject.GetComponentsInChildren <StaffJobIcon>();
                 if (componentsInChildren2 != null && num < componentsInChildren2.Length)
                 {
                     componentsInChildren2[num].Tooltip.SetDataProvider(delegate(Tooltip tooltip)
                     {
                         tooltip.Text = job.GetJobAssignmentTooltipString() + "\n\nSatff Assigned: " + staffCount.ToString();
                     });
                 }
             }
             else if (job is JobMaintenanceDescription)
             {
                 string text      = staffCount.ToString();
                 int    itemCount = (from mj in ____worldState.GetRoomItemsWithMaintenanceDescription(((JobMaintenanceDescription)job).Description)
                                     where mj.Definition.Interactions.Count((InteractionDefinition inter) => inter.Type == InteractionAttributeModifier.Type.Maintain) > 0
                                     select mj).Count <RoomItem>();
                 text           = text + "/" + itemCount.ToString();
                 component.text = text;
                 StaffJobIcon[] componentsInChildren3 = ____staffMenuSettings.JobsListContainer.gameObject.GetComponentsInChildren <StaffJobIcon>();
                 if (componentsInChildren3 != null && num < componentsInChildren3.Length)
                 {
                     componentsInChildren3[num].Tooltip.SetDataProvider(delegate(Tooltip tooltip)
                     {
                         tooltip.Text = string.Concat(new string[]
                         {
                             job.GetJobAssignmentTooltipString(),
                             "\n\nSatff Assigned: ",
                             staffCount.ToString(),
                             "\nMaintenance Items: ",
                             itemCount.ToString()
                         });
                     });
                 }
             }
             else if (job is JobUpgradeDescription)
             {
                 int    upgradeCount       = 0;
                 string machinesForUpgarde = "";
                 foreach (Room room in ____worldState.AllRooms)
                 {
                     foreach (RoomItem roomItem in room.FloorPlan.Items)
                     {
                         RoomItemUpgradeDefinition nextUpgrade = roomItem.Definition.GetNextUpgrade(roomItem.UpgradeLevel);
                         if (nextUpgrade != null && roomItem.Level.Metagame.HasUnlocked(nextUpgrade) && roomItem.GetComponent <RoomItemUpgradeComponent>() == null)
                         {
                             upgradeCount++;
                             machinesForUpgarde = machinesForUpgarde + "\n" + roomItem.Name;
                         }
                     }
                 }
                 if (!string.IsNullOrEmpty(machinesForUpgarde))
                 {
                     StaffJobIcon[] componentsInChildren4 = ____staffMenuSettings.JobsListContainer.gameObject.GetComponentsInChildren <StaffJobIcon>();
                     if (componentsInChildren4 != null && num < componentsInChildren4.Length)
                     {
                         componentsInChildren4[num].Tooltip.SetDataProvider(delegate(Tooltip tooltip)
                         {
                             tooltip.Text = string.Concat(new string[]
                             {
                                 job.GetJobAssignmentTooltipString(),
                                 "\n\nSatff Assigned: ",
                                 staffCount.ToString(),
                                 "\n",
                                 machinesForUpgarde
                             });
                         });
                     }
                 }
                 component.text = staffCount.ToString() + "/" + upgradeCount;
             }
             else
             {
                 if (!(job is JobGhostDescription) && !(job is JobFireDescription))
                 {
                     continue;
                 }
                 component.text = staffCount.ToString();
             }
             component.enableAutoSizing   = false;
             component.fontSize           = 18f;
             component.enableWordWrapping = false;
             component.overflowMode       = 0;
             component.alignment          = TextAlignmentOptions.Midline;
             component.color                          = Color.white;
             component.outlineColor                   = Color.black;
             component.outlineWidth                   = 1f;
             component.rectTransform.anchorMin        = new Vector2(0.5f, 0f);
             component.rectTransform.anchorMax        = new Vector2(0.5f, 1f);
             component.rectTransform.anchoredPosition = new Vector2(0f, -15f);
             component.rectTransform.sizeDelta        = transform.GetComponent <RectTransform>().sizeDelta;
             num++;
         }
     }
     catch (Exception ex)
     {
         Main.Logger.Error(ex.ToString() + ": " + ex.StackTrace.ToString());
     }
 }
コード例 #7
0
ファイル: PageBase.cs プロジェクト: horvatferi/graywulf
 // ---
 protected string GetExportUrl(JobDescription exportJob)
 {
     return String.Format(
         "~/Download/{0}",
         System.IO.Path.GetFileName(exportJob.Path));
 }
コード例 #8
0
        // Token: 0x060005BF RID: 1471 RVA: 0x0002276C File Offset: 0x0002096C
        public OneTimeJobResult <T> ExecuteJobAndGetResult <T>(int engineId, JobDescription jobDescription, CredentialBase jobCredential, JobResultDataFormatType resultDataFormat, string jobType) where T : class, new()
        {
            string serverName = this.engineDal.GetEngine(engineId).ServerName;

            return(this.ExecuteJobAndGetResult <T>(serverName, jobDescription, jobCredential, resultDataFormat, jobType));
        }
コード例 #9
0
 public void Deserialize(IDataReader reader)
 {
     NewLevel        = reader.ReadByte();
     JobsDescription = new JobDescription();
     JobsDescription.Deserialize(reader);
 }
コード例 #10
0
ファイル: Task3.cs プロジェクト: burnedram/ann
        private static JobResult RunJob(JobDescription job)
        {
            Matrix <double> weights = GenerateRandomWeights(job.k, -1, 1);
            Matrix <double> radial  = new Matrix <double>(1, job.k);
            Random          rng     = new Random();

            // kohonen learning phase
            for (int t = 0; t < job.iters_kohonen; t++)
            {
                int ostIndex = rng.Next(job.ost.Rows);
                RadialNumerators(radial, job.ost, weights, ostIndex);
                int j_0 = radial.IndexOfMax();
                weights[j_0, 0] += job.eta_kohonen * (job.ost[ostIndex, 0] - weights[j_0, 0]);
                weights[j_0, 1] += job.eta_kohonen * (job.ost[ostIndex, 1] - weights[j_0, 1]);
            }

            Lab1.NeuralNetwork nn = new Lab1.NeuralNetwork(job.beta, new int[] { job.k, 1 });
            nn.RandomizeBiases(-1, 1);
            nn.RandomizeWeights(-1, 1);
            Matrix <double>[] ostRadials = new Matrix <double> [job.ost.Rows];
            for (int i = 0; i < job.ost.Rows; i++)
            {
                RadialNumerators(ostRadials[i] = new Matrix <double>(1, job.k), job.ost, weights, i);
                Radial(ostRadials[i]);
            }
            var radialIndices = Enumerable.Range(0, job.ost.Rows).ToList();

            radialIndices.Shuffle();
            Matrix <double>[] trainingRadials = new Matrix <double> [(int)Math.Round(job.ost.Rows * 0.7)];
            int[][]           trainingClasses = new int[trainingRadials.Length][];
            for (int i = 0; i < trainingRadials.Length; i++)
            {
                trainingRadials[i] = ostRadials[radialIndices[i]];
                trainingClasses[i] = job.ostClasses[radialIndices[i]];
            }
            Matrix <double>[] validationRadials = new Matrix <double> [job.ost.Rows - trainingRadials.Length];
            int[][]           validationClasses = new int[validationRadials.Length][];
            for (int i = 0; i < validationRadials.Length; i++)
            {
                validationRadials[i] = ostRadials[radialIndices[trainingRadials.Length + i]];
                validationClasses[i] = job.ostClasses[radialIndices[trainingRadials.Length + i]];
            }

            // perceptron learning phase
            for (int t = 0; t < job.iters_perceptron; t++)
            {
                int ostIndex = rng.Next(trainingRadials.Length);
                nn.Train(trainingRadials[ostIndex], trainingClasses[ostIndex], job.eta_perceptron);
            }

            double trainingErrorRate   = Lab1.Task4a.ErrorRate(trainingRadials, trainingClasses, nn);
            double validationErrorRate = Lab1.Task4a.ErrorRate(validationRadials, validationClasses, nn);
            var    result = new JobResult
            {
                k                   = job.k,
                weights             = weights,
                nn                  = nn,
                radial              = radial,
                traniningErrorRate  = trainingErrorRate,
                validationErrorRate = validationErrorRate
            };

            Interlocked.Increment(ref JobsCompleted);
            return(result);
        }
コード例 #11
0
 public ActionResult Edit(int id, [Bind(
                                       "DocumentId," +
                                       "FirstName," +
                                       "LastName," +
                                       "DepartmentIdNumber," +
                                       "PayrollIdNumber," +
                                       "PositionNumber," +
                                       "DepartmentDivision," +
                                       "DepartmentDivisionCode," +
                                       "WorkPlaceAddress," +
                                       "AuthorUserId," +
                                       "SupervisedByEmployee," +
                                       "StartDate," +
                                       "EndDate," +
                                       "JobId," +
                                       "Categories," +
                                       "Assessment," +
                                       "Recommendation")] PPAFormViewModel form)
 {
     // if the querystring parameter id doesn't match the POSTed PPAId, return 404
     if (id != form.DocumentId)
     {
         return(NotFound());
     }
     if (!ModelState.IsValid)
     {
         // Model Validation failed, so I need to re-constitute the VM with the Job and the selected categories
         // This is done very clumsily, but I'm lazy...
         // first, reform the VM JobDescription member from the JobId in the submitted form data
         if (form.JobId != 0)
         {
             JobDescription job = new JobDescription(_repository.Jobs.FirstOrDefault(x => x.JobId == form.JobId));
             // next, loop through the submitted form categories and assign the JobDescription member's selected scores
             for (int i = 0; i < job.Categories.Count(); i++)
             {
                 job.Categories[i].SelectedScore = form.Categories[i]?.SelectedScore ?? 0;
             }
             form.Job = job;
         }
         // next, re-populate the VM drop down lists
         form.JobList      = _repository.Jobs.Select(x => new JobDescriptionListItem(x)).ToList();
         form.Users        = _repository.Users.Select(x => new UserListItem(x)).ToList();
         form.Components   = _repository.Components.ToList();
         ViewData["Title"] = "Edit PPA: Error";
         return(View(form));
     }
     else
     {
         if (form.JobId != 0)
         {
             JobDescription job = new JobDescription(_repository.Jobs.FirstOrDefault(x => x.JobId == form.JobId));
             // next, loop through the submitted form categories and assign the JobDescription member's selected scores
             for (int i = 0; i < job.Categories.Count(); i++)
             {
                 job.Categories[i].SelectedScore = form.Categories[i]?.SelectedScore ?? 0;
             }
             form.Job = job;
         }
         else
         {
             return(NotFound());
         }
         // validation success, create a new PPAGenerator and pass the repo as a parameter
         SmartPPAFactory factory = new SmartPPAFactory(_repository);
         // populate the form info into the generator
         factory.UpdatePPA(form);
         // redirect to the SaveSuccess view, passing the newly created PPA as a querystring param
         return(RedirectToAction("SaveSuccess", new { id = factory.PPA.DocumentId }));
     }
 }
コード例 #12
0
        public static bool EditJobDescription(JobDescription jobDescription)
        {
            //Processing

            return(JobDescriptionRepository.EditJobDescription(jobDescription));
        }
コード例 #13
0
        public static bool GetCompanyName(JobDescription jobDescription)
        {
            //Processing

            return(JobDescriptionRepository.getCompanyName(jobDescription));
        }
コード例 #14
0
        public static bool ProcessJobDescription(JobDescription jobDescription)
        {
            //Processing

            return(JobDescriptionRepository.AddJobDescriptionToDB(jobDescription));
        }
コード例 #15
0
 public Job(PlayedCharacter owner, JobDescription job)
 {
     Owner       = owner;
     JobTemplate = DataProvider.Instance.Get <Protocol.Data.Job>(job.jobId);
 }
コード例 #16
0
 public void JobDiscovered(JobDescription job)
 {
     JobDiscovered(job.Name, job.GetType().AssemblyQualifiedName);
 }
コード例 #17
0
 public Task <T> RunInBackground <T>(JobDescription jobDescription, Func <CancellationToken, Task <T> > jobFunc)
 {
     return(jobFunc(CancellationToken.None));
 }
コード例 #18
0
        public ActionResult Create([Bind(
                                        "FirstName," +
                                        "LastName," +
                                        "DepartmentIdNumber," +
                                        "PayrollIdNumber," +
                                        "PositionNumber," +
                                        "DepartmentDivision," +
                                        "DepartmentDivisionCode," +
                                        "WorkPlaceAddress," +
                                        "AuthorUserId," +
                                        "SupervisedByEmployee," +
                                        "StartDate," +
                                        "EndDate," +
                                        "JobId," +
                                        "Categories," +
                                        "Assessment," +
                                        "Recommendation")] PPAFormViewModel form)
        {
            if (!ModelState.IsValid)
            {
                // AS OF VERSION 1.1: Validation occurs clientside via jquery.validate
                // Model Validation failed, so I need to re-constitute the VM with the Job and the selected categories
                // This is done very clumsily, but I'm lazy...
                // first, reform the VM JobDescription member from the JobId in the submitted form data
                if (form.JobId != 0)
                {
                    JobDescription job = new JobDescription(_repository.Jobs.FirstOrDefault(x => x.JobId == form.JobId));
                    // next, loop through the submitted form categories and assign the JobDescription member's selected scores
                    for (int i = 0; i < job.Categories.Count(); i++)
                    {
                        job.Categories[i].SelectedScore = form.Categories[i]?.SelectedScore ?? 0;
                    }
                    form.Job = job;
                }

                // next, re-populate the VM drop down lists
                form.JobList    = _repository.Jobs.Select(x => new JobDescriptionListItem(x)).ToList();
                form.Users      = _repository.Users.Select(x => new UserListItem(x)).ToList();
                form.Components = _repository.Components.ToList();
                // return the View with the validation messages
                ViewData["Title"] = "Create PPA: Error";
                return(View(form));
            }
            else
            {
                // validation success, create new generator and pass repo
                SmartPPAFactory factory = new SmartPPAFactory(_repository);
                if (form.JobId != 0)
                {
                    JobDescription job = new JobDescription(_repository.Jobs.FirstOrDefault(x => x.JobId == form.JobId));
                    // next, loop through the submitted form categories and assign the JobDescription member's selected scores
                    for (int i = 0; i < job.Categories.Count(); i++)
                    {
                        job.Categories[i].SelectedScore = form.Categories[i]?.SelectedScore ?? 0;
                    }
                    form.Job = job;
                }
                else
                {
                    return(NotFound());
                }

                // call generator method to pass form data
                factory.CreatePPA(form);
                // redirect to success view with PPA as querystring param
                return(RedirectToAction("SaveSuccess", new { id = factory.PPA.DocumentId }));
            }
        }
コード例 #19
0
        public ActionResult Create(Task c)
        {
            string message = "";
            bool   status  = false;
            int    userid  = 0;

            userid            = Convert.ToInt32(Session["UserID"]);
            Session["TaskID"] = c.TaskID;
            User u         = (User)Session["UserData"];
            int  CompanyId = u.CompanyID;

            Session["UserData"] = u;
            Session["UserID"]   = u.UserId;

            ViewBag.ProgressStatus = ProgressStatus();
            ViewBag.ApprovedStatus = ApprovedStatus();

            User userdata = (User)Session["UserData"];

            if (c.EmployeeNo == null || c.EmployeeNo == String.Empty)
            {
                c.EmployeeNo = userdata.EmployeeNo;
            }
            if (c.ApprovedBy == null)
            {
                c.ApprovedBy = String.Empty;
            }
            if (c.TaskDescription == null)
            {
                c.TaskDescription = String.Empty;
            }
            if (c.TaskResultNotes == null)
            {
                c.TaskResultNotes = String.Empty;
            }
            if (c.TaskEvaluationNotes == null)
            {
                c.TaskEvaluationNotes = String.Empty;
            }
            if (c.JobTypeDescription == null)
            {
                c.JobTypeDescription = String.Empty;
            }
            if (c.QualityResult == null)
            {
                c.QualityResult = 0;
            }
            if (c.ApprovedStatus == null)
            {
                c.ApprovedStatus = 0;
            }
            if (c.ApprovedBy == null)
            {
                c.ApprovedBy = String.Empty;
            }
            if (c.UserId == null)
            {
                c.UserId = userdata.UserId;
            }
            if (c.Status == null)
            {
                c.Status = 1;
            }
            if (c.Progress == null)
            {
                c.Progress = 0;
            }
            if (c.CreditQuality == null)
            {
                c.CreditQuality = 0;
            }
            if (c.CompanyId == null)
            {
                c.CompanyId = CompanyId;
            }


            if (ModelState.IsValid)
            {
                using (DataContext dc = new DataContext())
                {
                    JobDescription jobdesc = dc.JobDescriptions.Where(j => j.JobDescId.Equals(c.JobDescTypeID)).FirstOrDefault();
                    if (c.TaskID > 0)
                    {
                        //Update
                        var v = dc.Tasks.Where(a => a.TaskID.Equals(c.TaskID)).FirstOrDefault();
                        if (v != null)
                        {
                            if (c.Status == 3) //TaskState.Completed
                            {
                                c.Progress = 100;
                            }
                            else
                            {
                                c.Progress = c.Progress;
                            }
                            v.CreditQuality = jobdesc.CreditQuality;
                        }
                        else
                        {
                            return(HttpNotFound());
                        }
                    }
                    else
                    {
                        c.TaskResultNotes = "";
                        c.ApprovedBy      = "";
                        c.ApprovedStatus  = 0;
                        c.ApprovedDate    = DateTime.Now;
                        c.UserId          = userid;
                        c.CreditQuality   = jobdesc.CreditQuality;
                        c.QualityResult   = 0;
                        c.Status          = 1; // TaskState.New;
                        c.Progress        = 0;
                        c.DateCreated     = DateTime.Now;
                        c.DateUpdated     = DateTime.Now;
                        c.EmployeeNo      = u.EmployeeNo;
                        c.CompanyId       = u.CompanyID;
                        dc.Tasks.Add(c);
                    }
                    dc.SaveChanges();
                    status = true;
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                message                 = "Error! Please try again.";
                ViewBag.Companies       = new SelectList(kController.GetAllCompany(), "CompanyId", "CompanyName");
                ViewBag.JobDescriptions = new SelectList(jdController.GetJobDescriptionByCompany(CompanyId), "JobDescId", "JobDescDescription");
            }
            ViewBag.Message = message;
            ViewBag.Status  = status;
            return(View(c));
        }
コード例 #20
0
        public async Task <JobDescription> UpdateJobDescriptionAsync(JobDescription jobDescription)
        {
            var url = string.Format(Endpoints.JobDescriptionEndpoint, jobDescription.Id);

            return(await RequestWrapper.PatchAsyncWrapper <JobDescription, JobDescription>(jobDescription, url));
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: kbochenina/Kraken
 private bool IsErrorState(JobDescription jobInfo)
 {
     if (jobInfo == null)
     {
         Console.WriteLine("Finished with error: Can't obtain monitoring information. Check you configuration!");
         return true;
     }
     if (jobInfo.State == JobState.Error)
     {
         Console.WriteLine("Finished with error: {0}\n{1}\n{2}", jobInfo.VerboseErrorComment, jobInfo.ErrorComment, jobInfo.ErrorException);
         return true;
     }
     return false;
 }
コード例 #22
0
ファイル: AccountMgr.cs プロジェクト: phox/AmbleSystem
       public static List<string> GetEmailsAccordingToJob(JobDescription job)
       {
           List<string> mails=new List<string>();
           string strsql = "select email from account where job=" + (int)job;
            DataTable dt = db.GetDataTable(strsql,"idTable");
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    mails.Add(dr[0].ToString());

                }
            }
         return mails;
       }
コード例 #23
0
        /// <summary>
        /// Method that writes the XML data to the template
        /// </summary>
        /// <param name="root">A <see cref="XElement"/> containing the XML form field data.</param>
        public void WriteXMLToFields(XElement root)
        {
            JobDescription job = ExtractJobDescriptionFromXMLFormData(root);

            // Write PPA Fields
            PPA_EmployeeName.Write($"{root.Element("LastName").Value}, {root.Element("FirstName").Value}");
            PPA_PayrollId.Write(root.Element("PayrollIdNumber").Value);
            // attempt to append newline subtext for Working Title

            PPA_ClassTitle.Write(job.ClassTitle);
            Run           titleRun           = new Run();
            RunProperties titleRunProperties = new RunProperties();
            FontSize      titleRunFontSize   = new FontSize()
            {
                Val = "16"
            };

            titleRunProperties.Append(titleRunFontSize);
            titleRun.Append(titleRunProperties);
            Text titleRunText = new Text(job.WorkingTitle);

            titleRun.Append(titleRunText);

            PPA_ClassTitle.Paragraph.InsertAfterSelf(new Paragraph(titleRun));
            PPA_Grade.Write(job.Grade);
            PPA_PositionNumber.Write(root.Element("PositionNumber").Value);
            PPA_StartDate.Write(DateTime.Parse(root.Element("StartDate").Value).ToString("MM/dd/yy"));
            PPA_EndDate.Write(DateTime.Parse(root.Element("EndDate").Value).ToString("MM/dd/yy"));
            PPA_DistrictDivision.Write(root.Element("DepartmentDivision").Value);
            PPA_AgencyActivity.Write(root.Element("DepartmentDivisionCode").Value);


            // Write Job Categories and Details
            int i = 0;

            foreach (JobDescriptionCategory category in job.Categories)
            {
                PPA_Categories[i].Write(category.Title, category.Weight, category.SelectedScore, category.GetCategoryRatedScore());
                JobDescriptionTable.Append(category.GetCategoryHeaderRow());
                JobDescriptionTable.Append(category.GenerateDetailsRow());
                i++;
            }
            PPA_TotalRatingValue.Write(job.GetOverallScore().ToString());
            RunFonts checkBoxRun = new RunFonts {
                Ascii = "Wingdings"
            };
            RunProperties checkBoxRunProperties = new RunProperties();

            checkBoxRunProperties.Append(checkBoxRun);
            RunFonts checkBoxRun1 = new RunFonts {
                Ascii = "Wingdings"
            };
            RunProperties checkBoxRunProperties1 = new RunProperties();

            checkBoxRunProperties1.Append(checkBoxRun1);
            switch (job.GetOverallRating())
            {
            case "Unsatisfactory":
                PPA_UnsatisfactoryRatingCheckBox.Write("\u2713", true, checkBoxRunProperties);
                PPA_MeritNotApprovedCheckBox.Write("\u2713", true, checkBoxRunProperties1);
                break;

            case "Improvement Needed":
                PPA_NeedsImprovementRatingCheckBox.Write("\u2713", true, checkBoxRunProperties);
                PPA_MeritNotApprovedCheckBox.Write("\u2713", true, checkBoxRunProperties1);
                break;

            case "Satisfactory":
                PPA_SatisfactoryRatingCheckBox.Write("\u2713", true, checkBoxRunProperties);
                PPA_MeritApprovedCheckBox.Write("\u2713", true, checkBoxRunProperties1);
                break;

            case "Exceeds Satisfactory":
                PPA_ExceedsSatisfactoryRatingCheckBox.Write("\u2713", true, checkBoxRunProperties);
                PPA_MeritApprovedCheckBox.Write("\u2713", true, checkBoxRunProperties1);
                break;

            case "Outstanding":
                PPA_OutstandingRatingCheckBox.Write("\u2713", true, checkBoxRunProperties);
                PPA_MeritApprovedCheckBox.Write("\u2713", true, checkBoxRunProperties1);
                break;
            }

            // Write PAF form fields
            PAF_EmployeeName.Write($"{root.Element("LastName").Value}, {root.Element("FirstName").Value}");
            PAF_PayrollId.Write(root.Element("PayrollIdNumber").Value);
            PAF_StartDate.Write(DateTime.Parse(root.Element("StartDate").Value).ToString("MM/dd/yy"));
            PAF_EndDate.Write(DateTime.Parse(root.Element("EndDate").Value).ToString("MM/dd/yy"));
            PAF_ClassGrade.Write($"{job.ClassTitle} - {job.Grade}");
            PAF_DistrictDivision.Write(root.Element("DepartmentDivision").Value);
            // HTML from the RTF Textarea needs to be chunked.
            using (Stream chunkStream = PAF_Assessment_Chunk.GetStream(FileMode.Create, FileAccess.Write))
            {
                using (StreamWriter stringStream = new StreamWriter(chunkStream))
                {
                    stringStream.Write($"<html>{root.Element("Assessment").Value}</html>");
                }
            }
            AltChunk assessmentChunk = new AltChunk
            {
                Id = "assessmentChunk"
            };

            PAF_Assessment.Paragraph.InsertBeforeSelf(assessmentChunk);
            using (Stream chunkStream = PAF_Recommendations_Chunk.GetStream(FileMode.Create, FileAccess.Write))
            {
                using (StreamWriter stringStream = new StreamWriter(chunkStream))
                {
                    stringStream.Write($"<html>{root.Element("Recommendation").Value}</html>");
                }
            }
            AltChunk recommendationsChunk = new AltChunk
            {
                Id = "recommendationsChunk"
            };

            PAF_Recommendations.Paragraph.InsertBeforeSelf(recommendationsChunk);

            // Write Job Description Fields
            JOB_EmployeeName.Write($"{root.Element("LastName").Value}, {root.Element("FirstName").Value}");
            JOB_DistrictDivision.Write(root.Element("DepartmentDivision").Value);
            JOB_AgencyActivity.Write(root.Element("DepartmentDivisionCode").Value);
            JOB_PositionNumber.Write(root.Element("PositionNumber").Value);
            JOB_ClassTitle.Write(job.ClassTitle);
            JOB_Grade.Write(job.Grade);
            JOB_WorkingTitle.Write(job.WorkingTitle);
            JOB_WorkAddress.Write(root.Element("WorkPlaceAddress").Value);
            JOB_WorkingHours.Write(job.WorkingHours);
            JOB_Supervisor.Write(root.Element("AuthorName").Value);
            JOB_Supervises.Write(root.Element("SupervisedByEmployee").Value);
        }
コード例 #24
0
ファイル: AccountOperation.cs プロジェクト: hnjm/AmbleSystem
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int jobId = comboBox1.SelectedIndex;

            List <JobDescription> jobCanBeSuper = new List <JobDescription>();

            switch (jobId)
            {
            case (int)JobDescription.Boss:
                jobCanBeSuper.Add(JobDescription.Admin);
                break;

            case (int)JobDescription.Financial:
                jobCanBeSuper.Add(JobDescription.Admin);
                jobCanBeSuper.Add(JobDescription.Boss);
                jobCanBeSuper.Add(JobDescription.FinancialManager);
                break;

            case (int)JobDescription.FinancialManager:
                jobCanBeSuper.Add(JobDescription.Admin);
                jobCanBeSuper.Add(JobDescription.Boss);
                break;

            case (int)JobDescription.Logistics:
                jobCanBeSuper.Add(JobDescription.Admin);
                jobCanBeSuper.Add(JobDescription.Boss);
                jobCanBeSuper.Add(JobDescription.LogisticsManager);
                break;

            case (int)JobDescription.LogisticsManager:
                jobCanBeSuper.Add(JobDescription.Admin);
                jobCanBeSuper.Add(JobDescription.Boss);
                break;

            case (int)JobDescription.Purchaser:
                jobCanBeSuper.Add(JobDescription.Admin);
                jobCanBeSuper.Add(JobDescription.Boss);
                jobCanBeSuper.Add(JobDescription.PurchasersManager);
                break;

            case (int)JobDescription.PurchasersManager:
                jobCanBeSuper.Add(JobDescription.Admin);
                jobCanBeSuper.Add(JobDescription.Boss);
                break;

            case (int)JobDescription.Sales:
                jobCanBeSuper.Add(JobDescription.Admin);
                jobCanBeSuper.Add(JobDescription.Boss);
                jobCanBeSuper.Add(JobDescription.SalesManager);
                break;

            case (int)JobDescription.SalesManager:
                jobCanBeSuper.Add(JobDescription.Admin);
                jobCanBeSuper.Add(JobDescription.Boss);
                break;
            }



            comboBox2.Items.Clear();

            foreach (DataRow dr in dt.Rows)
            {
                int job = int.Parse(dr["job"].ToString());

                JobDescription jobD = (JobDescription)job;
                if (jobCanBeSuper.Contains(jobD))
                {
                    comboBox2.Items.Add(dr["accountName"]);
                }
            }
        }
コード例 #25
0
 public JobLevelUpMessage(byte newLevel, JobDescription jobsDescription)
 {
     NewLevel        = newLevel;
     JobsDescription = jobsDescription;
 }
コード例 #26
0
ファイル: ComposerService.cs プロジェクト: 5ha/TestRunner
        private Task <HttpResponseMessage> CallEndpoint(Endpoint endpoint, JobDescription jobDescription)
        {
            HttpClient client = new HttpClient();

            return(client.PostAsJsonAsync(endpoint.Url, jobDescription));
        }
コード例 #27
0
 public void JobDiscovered(JobDescription job) { JobDiscovered(job.Name, job.GetType().AssemblyQualifiedName); }
コード例 #28
0
ファイル: JobLevelUpMessage.cs プロジェクト: Mixi59/Cookie
 public JobLevelUpMessage(JobDescription jobsDescription, sbyte newLevel)
 {
     m_jobsDescription = jobsDescription;
     m_newLevel        = newLevel;
 }
コード例 #29
0
ファイル: PageBase.cs プロジェクト: theresadower/graywulf
        // ---

        protected string GetExportUrl(JobDescription exportJob)
        {
            return(String.Format(
                       "~/Download/{0}",
                       System.IO.Path.GetFileName(exportJob.Path)));
        }
コード例 #30
0
ファイル: JobLevelUpMessage.cs プロジェクト: Mixi59/Cookie
 public override void Deserialize(ICustomDataInput reader)
 {
     m_newLevel        = reader.ReadSByte();
     m_jobsDescription = new JobDescription();
     m_jobsDescription.Deserialize(reader);
 }
コード例 #31
0
 public JobLevelUpMessage(byte newLevel, JobDescription jobsDescription)
 {
     this.newLevel        = newLevel;
     this.jobsDescription = jobsDescription;
 }
コード例 #32
0
 public void Invoking(JobDescription jobdef) { Invoking(InvocationContext.GetCurrentInvocationId(), jobdef.Name, jobdef.Runtime); }
コード例 #33
0
ファイル: Job.cs プロジェクト: volgar1x/BehaviorIsManaged
 public Job(PlayedCharacter owner, JobDescription job)
 {
     Owner = owner;
     SetJob(job);
 }
コード例 #34
0
ファイル: StoreTests.cs プロジェクト: shanerogers/Minion
        public async Task Acquire_Job_With_Input()
        {
            //Arrange
            var data = new TestData
            {
                Text   = "text",
                Number = 123
            };

            var date = new DateTime(2018, 1, 2, 3, 4, 5);

            DateService.GetNow().Returns(date);

            var job1 = new JobDescription
            {
                Id    = Guid.NewGuid(),
                Input = new JobInputDescription
                {
                    InputData = data,
                    Type      = typeof(TestData).AssemblyQualifiedName
                },
                State       = ExecutionState.Waiting,
                DueTime     = new DateTime(2017, 1, 2, 3, 4, 5),
                Type        = "type",
                Priority    = 100,
                PrevId      = Guid.NewGuid(),
                NextId      = Guid.NewGuid(),
                BatchId     = Guid.NewGuid(),
                CreatedTime = new DateTime(2016, 1, 2, 3, 4, 5),
                WaitCount   = 0,
                StatusInfo  = "status"
            };

            var jobs = new List <JobDescription>
            {
                job1
            };

            //Act
            await Store.AddJobsAsync(jobs);

            var result = await Store.AcquireJobAsync();

            //Assert
            var inputResult = (TestData)result.Input.InputData;

            Assert.Equal(data.Text, inputResult.Text);
            Assert.Equal(data.Number, inputResult.Number);

            Assert.Equal(job1.Id, result.Id);
            Assert.Equal(ExecutionState.Running, result.State);
            Assert.Equal(job1.DueTime, result.DueTime);
            Assert.Equal(job1.Type, result.Type);
            Assert.Equal(job1.Priority, result.Priority);
            Assert.Equal(job1.PrevId, result.PrevId);
            Assert.Equal(job1.NextId, result.NextId);
            Assert.Equal(job1.BatchId, result.BatchId);
            Assert.Equal(job1.CreatedTime, result.CreatedTime);
            Assert.Equal(job1.WaitCount, result.WaitCount);
            Assert.Equal(job1.StatusInfo, result.StatusInfo);
            Assert.Equal(date, result.UpdatedTime);
        }
コード例 #35
0
        public static object GetInstance(uint typeId)
        {
            object obj = null;

            switch (typeId)
            {
            case 11:
                obj = new Types.Version();
                break;

            case 25:
                obj = new GameServerInformations();
                break;

            case 55:
                obj = new EntityLook();
                break;

            case 54:
                obj = new SubEntity();
                break;

            case 110:
                obj = new CharacterMinimalInformations();
                break;

            case 163:
                obj = new CharacterMinimalPlusLookInformations();
                break;

            case 193:
                obj = new CharacterMinimalPlusLookAndGradeInformations();
                break;

            case 45:
                obj = new CharacterBaseInformations();
                break;

            case 212:
                obj = new CharacterToRecolorInformation();
                break;

            case 86:
                obj = new CharacterHardcoreInformations();
                break;

            case 63:
                obj = new EntityMovementInformations();
                break;

            case 60:
                obj = new EntityDispositionInformations();
                break;

            case 107:
                obj = new IdentifiedEntityDispositionInformations();
                break;

            case 217:
                obj = new FightEntityDispositionInformations();
                break;

            case 127:
                obj = new GuildInformations();
                break;

            case 204:
                obj = new ActorRestrictionsInformations();
                break;

            case 201:
                obj = new ActorAlignmentInformations();
                break;

            case 183:
                obj = new PaddockContentInformations();
                break;

            case 184:
                obj = new MountInformationsForPaddock();
                break;

            case 202:
                obj = new ActorExtendedAlignmentInformations();
                break;

            case 135:
                obj = new AlignmentBonusInformations();
                break;

            case 142:
                obj = new PrismSubAreaInformation();
                break;

            case 152:
                obj = new PrismConquestInformation();
                break;

            case 187:
                obj = new TaxCollectorName();
                break;

            case 96:
                obj = new TaxCollectorBasicInformations();
                break;

            case 4:
                obj = new CharacterBaseCharacteristic();
                break;

            case 215:
                obj = new CharacterSpellModification();
                break;

            case 8:
                obj = new CharacterCharacteristicsInformations();
                break;

            case 117:
                obj = new FightExternalInformations();
                break;

            case 43:
                obj = new FightCommonInformations();
                break;

            case 44:
                obj = new FightTeamMemberInformations();
                break;

            case 13:
                obj = new FightTeamMemberCharacterInformations();
                break;

            case 6:
                obj = new FightTeamMemberMonsterInformations();
                break;

            case 177:
                obj = new FightTeamMemberTaxCollectorInformations();
                break;

            case 20:
                obj = new FightOptionsInformations();
                break;

            case 116:
                obj = new AbstractFightTeamInformations();
                break;

            case 33:
                obj = new FightTeamInformations();
                break;

            case 115:
                obj = new FightTeamLightInformations();
                break;

            case 31:
                obj = new GameFightMinimalStats();
                break;

            case 41:
                obj = new FightLoot();
                break;

            case 16:
                obj = new FightResultListEntry();
                break;

            case 189:
                obj = new FightResultFighterListEntry();
                break;

            case 191:
                obj = new FightResultAdditionalData();
                break;

            case 192:
                obj = new FightResultExperienceData();
                break;

            case 190:
                obj = new FightResultPvpData();
                break;

            case 24:
                obj = new FightResultPlayerListEntry();
                break;

            case 216:
                obj = new FightResultMutantListEntry();
                break;

            case 84:
                obj = new FightResultTaxCollectorListEntry();
                break;

            case 206:
                obj = new AbstractFightDispellableEffect();
                break;

            case 208:
                obj = new FightDispellableEffectExtendedInformations();
                break;

            case 209:
                obj = new FightTemporaryBoostEffect();
                break;

            case 210:
                obj = new FightTriggeredEffect();
                break;

            case 207:
                obj = new FightTemporarySpellBoostEffect();
                break;

            case 211:
                obj = new FightTemporaryBoostWeaponDamagesEffect();
                break;

            case 214:
                obj = new FightTemporaryBoostStateEffect();
                break;

            case 205:
                obj = new GameFightSpellCooldown();
                break;

            case 7:
                obj = new Item();
                break;

            case 49:
                obj = new SpellItem();
                break;

            case 76:
                obj = new ObjectEffect();
                break;

            case 74:
                obj = new ObjectEffectString();
                break;

            case 70:
                obj = new ObjectEffectInteger();
                break;

            case 82:
                obj = new ObjectEffectMinMax();
                break;

            case 73:
                obj = new ObjectEffectDice();
                break;

            case 72:
                obj = new ObjectEffectDate();
                break;

            case 75:
                obj = new ObjectEffectDuration();
                break;

            case 71:
                obj = new ObjectEffectCreature();
                break;

            case 81:
                obj = new ObjectEffectLadder();
                break;

            case 179:
                obj = new ObjectEffectMount();
                break;

            case 178:
                obj = new MountClientData();
                break;

            case 168:
                obj = new ItemDurability();
                break;

            case 85:
                obj = new GameActionMarkedCell();
                break;

            case 123:
                obj = new GoldItem();
                break;

            case 124:
                obj = new ObjectItemMinimalInformation();
                break;

            case 119:
                obj = new ObjectItemQuantity();
                break;

            case 134:
                obj = new ObjectItemNotInContainer();
                break;

            case 37:
                obj = new ObjectItem();
                break;

            case 120:
                obj = new ObjectItemToSell();
                break;

            case 164:
                obj = new ObjectItemToSellInBid();
                break;

            case 198:
                obj = new ObjectItemInRolePlay();
                break;

            case 197:
                obj = new ObjectItemWithLookInRolePlay();
                break;

            case 199:
                obj = new OrientedObjectItemWithLookInRolePlay();
                break;

            case 185:
                obj = new PaddockItem();
                break;

            case 121:
                obj = new SellerBuyerDescriptor();
                break;

            case 122:
                obj = new BidExchangerObjectInfo();
                break;

            case 52:
                obj = new StartupActionAddObject();
                break;

            case 106:
                obj = new IgnoredInformations();
                break;

            case 105:
                obj = new IgnoredOnlineInformations();
                break;

            case 78:
                obj = new FriendInformations();
                break;

            case 92:
                obj = new FriendOnlineInformations();
                break;

            case 77:
                obj = new FriendSpouseInformations();
                break;

            case 93:
                obj = new FriendSpouseOnlineInformations();
                break;

            case 88:
                obj = new GuildMember();
                break;

            case 87:
                obj = new GuildEmblem();
                break;

            case 80:
                obj = new InteractiveElement();
                break;

            case 108:
                obj = new StatedElement();
                break;

            case 200:
                obj = new MapObstacle();
                break;

            case 213:
                obj = new PartyUpdateCommonsInformations();
                break;

            case 90:
                obj = new PartyMemberInformations();
                break;

            case 97:
                obj = new JobCrafterDirectorySettings();
                break;

            case 194:
                obj = new JobCrafterDirectoryEntryPlayerInfo();
                break;

            case 195:
                obj = new JobCrafterDirectoryEntryJobInfo();
                break;

            case 196:
                obj = new JobCrafterDirectoryListEntry();
                break;

            case 101:
                obj = new JobDescription();
                break;

            case 102:
                obj = new SkillActionDescription();
                break;

            case 103:
                obj = new SkillActionDescriptionTimed();
                break;

            case 99:
                obj = new SkillActionDescriptionCollect();
                break;

            case 100:
                obj = new SkillActionDescriptionCraft();
                break;

            case 104:
                obj = new SkillActionDescriptionCraftExtended();
                break;

            case 98:
                obj = new JobExperience();
                break;

            case 111:
                obj = new HouseInformations();
                break;

            case 112:
                obj = new HouseInformationsExtended();
                break;

            case 170:
                obj = new HouseInformationsForGuild();
                break;

            case 132:
                obj = new PaddockInformations();
                break;

            case 130:
                obj = new PaddockBuyableInformations();
                break;

            case 133:
                obj = new PaddockAbandonnedInformations();
                break;

            case 131:
                obj = new PaddockPrivateInformations();
                break;

            case 150:
                obj = new GameContextActorInformations();
                break;

            case 141:
                obj = new GameRolePlayActorInformations();
                break;

            case 157:
                obj = new HumanInformations();
                break;

            case 153:
                obj = new HumanWithGuildInformations();
                break;

            case 154:
                obj = new GameRolePlayNamedActorInformations();
                break;

            case 159:
                obj = new GameRolePlayHumanoidInformations();
                break;

            case 36:
                obj = new GameRolePlayCharacterInformations();
                break;

            case 3:
                obj = new GameRolePlayMutantInformations();
                break;

            case 129:
                obj = new GameRolePlayMerchantInformations();
                break;

            case 146:
                obj = new GameRolePlayMerchantWithGuildInformations();
                break;

            case 180:
                obj = new GameRolePlayMountInformations();
                break;

            case 147:
                obj = new TaxCollectorStaticInformations();
                break;

            case 148:
                obj = new GameRolePlayTaxCollectorInformations();
                break;

            case 167:
                obj = new TaxCollectorInformations();
                break;

            case 166:
                obj = new TaxCollectorInformationsInWaitForHelpState();
                break;

            case 186:
                obj = new ProtectedEntityWaitingForHelpInfo();
                break;

            case 169:
                obj = new TaxCollectorFightersInformation();
                break;

            case 165:
                obj = new AdditionalTaxCollectorInformations();
                break;

            case 144:
                obj = new MonsterInGroupInformations();
                break;

            case 140:
                obj = new GroupMonsterStaticInformations();
                break;

            case 160:
                obj = new GameRolePlayGroupMonsterInformations();
                break;

            case 155:
                obj = new NpcStaticInformations();
                break;

            case 156:
                obj = new GameRolePlayNpcInformations();
                break;

            case 161:
                obj = new GameRolePlayPrismInformations();
                break;

            case 143:
                obj = new GameFightFighterInformations();
                break;

            case 158:
                obj = new GameFightFighterNamedInformations();
                break;

            case 46:
                obj = new GameFightCharacterInformations();
                break;

            case 50:
                obj = new GameFightMutantInformations();
                break;

            case 151:
                obj = new GameFightAIInformations();
                break;

            case 29:
                obj = new GameFightMonsterInformations();
                break;

            case 203:
                obj = new GameFightMonsterWithAlignmentInformations();
                break;

            case 48:
                obj = new GameFightTaxCollectorInformations();
                break;

            case 174:
                obj = new MapCoordinates();
                break;

            case 176:
                obj = new MapCoordinatesExtended();
                break;

            case 175:
                obj = new AtlasPointsInformations();
                break;

            default:
                throw new Exception("Type with id " + typeId + " is unknown.");
            }
            return(obj);
        }
コード例 #36
0
        public ActionResult Edit(Task c, HttpPostedFileBase file)
        {
            User userdata  = (User)Session["UserData"];
            int  CompanyId = userdata.CompanyID;
            int  id        = Convert.ToInt32(Session["TaskID"]);

            Session["TaskID"]   = Convert.ToInt32(id);
            Session["UserData"] = userdata;
            Session["UserID"]   = userdata.UserId;

            Task task = new Task();

            task = GetTaskByID(id);

            ViewBag.Companies       = new SelectList(kController.GetAllCompany(), "CompanyId", "CompanyName");
            ViewBag.JobDescriptions = new SelectList(jdController.GetJobDescriptionByCompany(CompanyId), "JobDescId", "JobDescDescription");
            ViewBag.ProgressStatus  = ProgressStatus();
            ViewBag.ApprovedStatus  = ApprovedStatus();

            if (c.TaskID != task.TaskID)
            {
                c.TaskID = task.TaskID;
            }

            if (c.UserId != task.UserId)
            {
                c.UserId = task.UserId;
            }

            if (c.EmployeeNo != task.EmployeeNo)
            {
                c.EmployeeNo = task.EmployeeNo;
            }

            if ((c.TaskDescription != task.TaskDescription) && (c.TaskDescription == null || c.TaskDescription == String.Empty))
            {
                c.TaskDescription = task.TaskDescription;
            }

            if ((c.TaskResultNotes != task.TaskResultNotes) && (c.TaskResultNotes == null || c.TaskResultNotes == String.Empty))
            {
                c.TaskResultNotes = task.TaskResultNotes;
            }

            if ((c.TaskEvaluationNotes != task.TaskEvaluationNotes) && (c.TaskEvaluationNotes == null || c.TaskEvaluationNotes == String.Empty))
            {
                c.TaskEvaluationNotes = task.TaskEvaluationNotes;
            }

            if ((c.JobTypeDescription != task.JobTypeDescription) && (c.JobTypeDescription == null || c.JobTypeDescription == String.Empty))
            {
                c.JobTypeDescription = task.JobTypeDescription;
            }

            if ((c.JobTypeDescription != task.JobTypeDescription) && (c.JobTypeDescription == null || c.JobTypeDescription == String.Empty))
            {
                c.JobTypeDescription = task.JobTypeDescription;
            }

            if ((c.CompanyId != task.CompanyId) && (c.CompanyId == null || c.CompanyId == 0))
            {
                c.CompanyId = task.CompanyId;
            }

            if ((c.Status != task.Status) && (c.Status == null || c.Status == 0))
            {
                c.Status = task.Status;
            }

            if ((c.CompanyId != task.CompanyId) && (c.CompanyId == null || c.CompanyId == 0))
            {
                c.CompanyId = task.CompanyId;
            }

            if ((c.ApprovedStatus != task.ApprovedStatus) && (c.ApprovedStatus == null || c.ApprovedStatus == 0))
            {
                c.ApprovedStatus = task.ApprovedStatus;
            }

            if ((c.QualityResult != task.QualityResult) && (c.QualityResult == null || c.QualityResult == 0))
            {
                c.QualityResult = task.QualityResult;
            }

            if (c.EmployeeNo == null || c.EmployeeNo == String.Empty)
            {
                c.EmployeeNo = userdata.EmployeeNo;
            }
            if (c.ApprovedBy == null)
            {
                c.ApprovedBy = String.Empty;
            }
            if (c.TaskDescription == null)
            {
                c.TaskDescription = String.Empty;
            }
            if (c.TaskResultNotes == null)
            {
                c.TaskResultNotes = String.Empty;
            }
            if (c.TaskEvaluationNotes == null)
            {
                c.TaskEvaluationNotes = String.Empty;
            }
            if (c.JobTypeDescription == null)
            {
                c.JobTypeDescription = String.Empty;
            }
            if (c.QualityResult == null)
            {
                c.QualityResult = 0;
            }
            if (c.ApprovedStatus == null)
            {
                c.ApprovedStatus = 0;
            }
            if (c.ApprovedBy == null)
            {
                c.ApprovedBy = String.Empty;
            }
            if (c.UserId == null)
            {
                c.UserId = userdata.UserId;
            }
            if (c.Status == null)
            {
                c.Status = 1;
            }
            if (c.Progress == null)
            {
                c.Progress = 0;
            }
            if (c.QualityResult == null)
            {
                c.QualityResult = 0;
            }
            if (c.CompanyId == null)
            {
                c.CompanyId = CompanyId;
            }

            if (ModelState.IsValid)
            {
                using (DataContext dc = new DataContext())
                {
                    JobDescription jobdesc = dc.JobDescriptions.Where(j => j.JobDescId.Equals(c.JobDescTypeID)).FirstOrDefault();
                    var            v       = dc.Tasks.Where(a => a.TaskID.Equals(c.TaskID)).FirstOrDefault();
                    if (v != null)
                    {
                        if (c.Status == 3) //TaskState.Completed
                        {
                            c.Progress = 100;
                        }

                        c.CreditQuality = jobdesc.CreditQuality;
                        c.DateUpdated   = DateTime.Now;
                        if (c.ApprovedStatus == 1)
                        {
                            c.ApprovedDate = DateTime.Now;
                        }
                        else
                        {
                            c.ApprovedStatus = 0;
                            c.ApprovedDate   = Convert.ToDateTime("01/12/1899");
                            c.ApprovedBy     = "";
                        }
                    }
                    dc.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(c));
            }
        }
コード例 #37
0
 public JobLevelUpMessage(byte NewLevel, JobDescription JobsDescription)
 {
     this.NewLevel        = NewLevel;
     this.JobsDescription = JobsDescription;
 }
コード例 #38
0
ファイル: StoreTests.cs プロジェクト: shanerogers/Minion
        public async Task Acquire_Job_Should_Get_Job_With_Highest_Priority_First()
        {
            var job1 = new JobDescription
            {
                Id        = Guid.NewGuid(),
                WaitCount = 0,
                Priority  = 0,
                State     = ExecutionState.Waiting,
                Type      = "type"
            };
            var job2 = new JobDescription
            {
                Id        = Guid.NewGuid(),
                WaitCount = 0,
                Priority  = 200,
                State     = ExecutionState.Waiting,
                Type      = "type"
            };
            var job3 = new JobDescription
            {
                Id        = Guid.NewGuid(),
                WaitCount = 0,
                Priority  = 1000,
                State     = ExecutionState.Waiting,
                Type      = "type"
            };
            var job4 = new JobDescription
            {
                Id        = Guid.NewGuid(),
                WaitCount = 0,
                Priority  = 100,
                State     = ExecutionState.Waiting,
                Type      = "type"
            };

            var jobs = new List <JobDescription>
            {
                job1,
                job2,
                job3,
                job4
            };

            await Store.AddJobsAsync(jobs);

            var r1 = await Store.AcquireJobAsync();

            var r2 = await Store.AcquireJobAsync();

            var r3 = await Store.AcquireJobAsync();

            var r4 = await Store.AcquireJobAsync();

            var r5 = await Store.AcquireJobAsync();

            Assert.Equal(job3.Id, r1.Id);
            Assert.Equal(job2.Id, r2.Id);
            Assert.Equal(job4.Id, r3.Id);
            Assert.Equal(job1.Id, r4.Id);
            Assert.Null(r5);
        }