public List<Requirement> GetRequirements(string projectID) { List<Requirement> tempList = new List<Requirement>(); Requirement req = new Requirement(); using (var sc = new SQLCommand("RMsisDB")) { sc.CommandText.AppendFormat("SELECT * from {0} where {1} = {2}", sc.WrapObjectName("Requirement"), sc.WrapObjectName("project_id"), projectID); using (var dr = sc.ExecuteReader()) { while (dr.Read()) { req = new Requirement(); req.ID = dr.GetValue(RMSIS_REQ_ID_LOCATION).ToString(); req.Description = dr.GetValue(RMSIS_REQ_DESC_LOCATION).ToString(); tempList.Add(req); } } } return tempList; }
/// <summary> /// Initializes a new instance of the <see cref="SchemaEntityAttribute"/> class. /// </summary> /// <param name="prefix">The prefix of the Xml attribute.</param> /// <param name="ns">The namespace of the Xml attribute.</param> /// <param name="localName">The local name of the Xml attribute.</param> /// <param name="requirement">Indicates whether the attribute is required in the XLIFF document.</param> public SchemaEntityAttribute(string prefix, string ns, string localName, Requirement requirement) { ArgValidator.Create(localName, "localName").IsNotNullOrWhitespace(); this.Name = new XmlNameInfo(prefix, ns, localName); this.Requirement = requirement; }
public ActionResult Create(Requirement requirement) { if (ModelState.IsValid) { db.Requirements.Add(requirement); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PrefixID = new SelectList(db.Prefixes, "PrefixID", "Name", requirement.PrefixID); ViewBag.TargetID = new SelectList(db.Targets, "TargetID", "Name", requirement.TargetID); return View(requirement); }
public ActionResult Create(RequirementViewModel viewModel) { var model = new Requirement() { Name = viewModel.Name, DealId = viewModel.DealId, Priority = (RequirementPriority)Enum.Parse(typeof(RequirementPriority), viewModel.Priority) }; this.requirements.Create(model); this.requirements.SaveChanges(); return this.RedirectToAction("Index", "Home", new { area = "Deals" }); }
public Success(int id, int x, int y, Text description, Item item, Requirement.Requirements[] requirements, int nbParents, params Success[] sons) { this.achived = false; this.id = id; this.posX = x; this.posY = y; this.description = description; this.icon = item.Icon; this.shadow = GetShadow(item.Icon); this.requirements = requirements; this.nbParentsLeft = nbParents; this.nbParentMax = nbParents; this.sons = sons; }
private static void GetTestRecords(out List<Widget> widgets, out List<Requirement> requirements) { //WidgetA 1x //WidgetB 3x widgets = new List<Widget>(); Widget widgetA = new Widget() { Name = "Doritos", Category = "Chips", Quantity = 1 }; Widget widgetB = new Widget() { Name = "Snickers", Category = null, Quantity = 3 }; widgets.AddRange(new[] { widgetA, widgetB }); //CategoryA 1x //WidgetB 3x requirements = new List<Requirement>(); Requirement requirement1 = new Requirement() { WidgetName = null, Category = "Chips", Quantity = 1 }; Requirement requirement2 = new Requirement() { WidgetName = "Snickers", Category = null, Quantity = 3 }; requirements.AddRange(new[] { requirement1, requirement2 }); }
private void ValidateRequirement(Requirement requirement, bool isCreate) { var project = _contextProvider.Projects.AsNoTracking() .FirstOrDefault(p => p.ProjectId == requirement.ProjectId); if (project == null) throw new NotFoundException("Project not found."); var validTypes = _contextProvider.RequirementTypes .AsNoTracking(); if (validTypes.All(t => t.RequirementTypeId != requirement.RequirementTypeId)) throw new ValidationException("Invalid Requirement Type."); if (!isCreate) { var existing = project.Requirements .FirstOrDefault(r => r.RequirementId == requirement.RequirementId); if (existing == null) throw new NotFoundException(string.Format("Requirement {0} not found.", requirement.Title)); } else { var duplicate = project.Requirements .FirstOrDefault(r => r.ProjectId != requirement.ProjectId && r.Title.Equals(requirement.Title, StringComparison.InvariantCultureIgnoreCase) && r.Description.Equals(requirement.Description, StringComparison.InvariantCultureIgnoreCase) && r.RequirementTypeId == requirement.RequirementTypeId); if (duplicate != null) throw new ValidationException("Requirement with same title and description exists."); } if (string.IsNullOrWhiteSpace(requirement.Title)) throw new ValidationException("Missing Title."); if (requirement.Title.Length > 100) throw new ValidationException("Title cannot exceed 100 characters."); if (requirement.Description != null && requirement.Description.Length > 300) throw new ValidationException("Description cannot exceed 300 characters."); }
public override ParseErrorExpression BuildTrigger(TriggerBuilderContext context, InterpreterScope scope, FunctionCallExpression functionCall) { var address = ((IntegerConstantExpression)functionCall.Parameters.ElementAt(1)).Value; var index = ((IntegerConstantExpression)functionCall.Parameters.First()).Value; if (index < 0 || index > 31) { return(new ParseErrorExpression("index must be between 0 and 31", functionCall.Parameters.First())); } address += index / 8; index %= 8; FieldSize size; switch (index) { default: case 0: size = FieldSize.Bit0; break; case 1: size = FieldSize.Bit1; break; case 2: size = FieldSize.Bit2; break; case 3: size = FieldSize.Bit3; break; case 4: size = FieldSize.Bit4; break; case 5: size = FieldSize.Bit5; break; case 6: size = FieldSize.Bit6; break; case 7: size = FieldSize.Bit7; break; } var requirement = new Requirement(); requirement.Left = new Field { Size = size, Type = FieldType.MemoryAddress, Value = (uint)address }; context.Trigger.Add(requirement); return(null); }
/// <summary> /// CreateRequirement /// </summary> /// <param name="code"></param> /// <param name="iconName"></param> /// <param name="dictionary"></param> /// <param name="insurance"></param> /// <param name="transaction"></param> /// <returns></returns> private static async Task <int> CreateRequirement(string code, string iconName, decimal insurance, Dictionary dictionary, IDbTransaction transaction = null) { var item = _unitOfWork.RequirementRepository.Get("Code='" + code + "'"); if (item == null) { var dictionaryId = await _unitOfWork.DictionaryRepository.AddAsync(dictionary, transaction, true, false); item = new Requirement { DateCreated = DateTime.Now, DateModified = DateTime.Now, UserIdCreated = 1000, IconName = iconName, Insurance = insurance, Code = code, DictionaryId = dictionaryId }; return(await _unitOfWork.RequirementRepository.AddAsync(item)); } if (!item.DictionaryId.HasValue) { item.DictionaryId = await _unitOfWork.DictionaryRepository.AddAsync(dictionary, transaction, true, false); } if (item.DictionaryId == null) { return(item.Id); } var currentDictionary = await _unitOfWork.DictionaryRepository.GetAsync(item.DictionaryId.Value); dictionary.Id = currentDictionary.Id; dictionary.DateModified = DateTime.Now; await _unitOfWork.DictionaryRepository.UpdateAsync(dictionary, transaction, true, null, false); item.DictionaryId = dictionary.Id; await _unitOfWork.RequirementRepository.UpdateAsync(item, transaction); return(item.Id); }
bool CheckRequirement(Requirement requirement) { switch (requirement.function) { case Functions.Less: { if (GetParameterValue(requirement.p1) >= GetParameterValue(requirement.p2)) { return(false); } return(true); } case Functions.LessEqual: { if (GetParameterValue(requirement.p1) > GetParameterValue(requirement.p2)) { return(false); } return(true); } case Functions.Equal: { if (GetParameterValue(requirement.p1) != GetParameterValue(requirement.p2)) { return(false); } return(true); } case Functions.MoreEqual: { if (GetParameterValue(requirement.p1) < GetParameterValue(requirement.p2)) { return(false); } return(true); } case Functions.More: { if (GetParameterValue(requirement.p1) <= GetParameterValue(requirement.p2)) { return(false); } return(true); } case Functions.HasScales: { if (!PlayerSaveData.reference.trainData.conditions.HasScales) { return(false); } return(true); } default: { Debug.Log("unexpected function name in requirements in xml!"); return(false); } } }
public void VerifyThatDialogViewModelCanLoadIfLanguageCodeIsNull() { var definition = new Definition() { LanguageCode = null, Content = null }; var requirement = new Requirement(); var clone = requirement.Clone(false); clone.Definition.Add(definition); var transactionContext = TransactionContextResolver.ResolveContext(this.siteDirectory); var transaction = new ThingTransaction(transactionContext, null); transaction.CreateOrUpdate(clone); Assert.DoesNotThrow(() => new DefinitionDialogViewModel(definition, transaction, this.session.Object, true, ThingDialogKind.Create, null, clone, null)); }
public ActionResult UploadAttachment(HttpPostedFileBase Attachment) { int requirementId = Convert.ToInt16(Request["RequirementId"]); Requirement r = db.Requirements.FirstOrDefault(e => e.RequirementId == requirementId); if (Attachment != null) { string path = Server.MapPath("~/Content/Files/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string ext = Path.GetExtension(Attachment.FileName); try { Attachment.SaveAs(path + Attachment.FileName); } catch (Exception ex) { TempData["upload"] = 0; TempData["errorMessage"] = ex.Message; return(RedirectToAction("Details", new { @id = requirementId })); } string savePath = "/Content/Files/" + Attachment.FileName; RequirementAttachment ra = new RequirementAttachment(); ra.RequirementId = requirementId; ra.Name = Attachment.FileName; ra.Location = savePath; ra.DateCreated = DateTime.UtcNow.AddHours(8); db.RequirementAttachments.Add(ra); db.SaveChanges(); return(RedirectToAction("Details", new { @id = requirementId })); } return(RedirectToAction("Details", new { @id = requirementId })); }
private void CheckTaskCompletion(int projectId, Requirement requirement) { MySqlCommand command = new MySqlCommand("SELECT COUNT(0) AS totalTasks, SUM(IF(stage=4,1,0)) AS completed FROM tasks WHERE requirementId=@requirementId AND projectId=@projectId", _connection); command.Parameters.Add("@projectId", MySqlDbType.Int32).Value = projectId; command.Parameters.Add("@requirementId", MySqlDbType.Int32).Value = requirement.Id; using (IDataReader reader = command.ExecuteReader()) { if (reader.Read()) { int totalTasks = int.Parse(reader["totalTasks"].ToString()); if (totalTasks > 0) { int completed = int.Parse(reader["completed"].ToString()); requirement.Completed = totalTasks == completed; } } } }
/// <summary> /// Add a <see cref="SimpleParameterValue"/> to a <see cref="Requirement"/> /// </summary> /// <param name="requirement">The <see cref="Requirement"/></param> /// <param name="value">The <see cref="AttributeValue"/></param> private void SetParameterValue(Requirement requirement, AttributeValue value) { if (this.datatypeDefMap[value.AttributeDefinition.DatatypeDefinition].ParameterType == null) { throw new InvalidOperationException("The datatype-definition of an AttributeValue that is mapped to a Parameter-Value shall be mapped to a ParameterType."); } var theValue = this.GetAttributeValue(value); var valueArray = new string[] { theValue }; // TODO get mapped scale var simpleParameter = new SimpleParameterValue { ParameterType = this.datatypeDefMap[value.AttributeDefinition.DatatypeDefinition].ParameterType }; simpleParameter.Value = new ValueArray <string>(valueArray); requirement.ParameterValue.Add(simpleParameter); }
protected override void PutItemAtLocation(ItemInfo itemInfo, ItemLocation itemLocation) { itemLocation.SetItem(itemInfo); if (!placedItems.ContainsKey(itemInfo)) { placedItems.Add(itemInfo, itemLocation); } if (NewRequirementIsUnlocked(itemInfo.Unlocks)) { availableRequirements |= itemInfo.Unlocks; RecalculateAvailableItemLocations(); } else { availableItemLocations.Remove(itemLocation); } }
void SetManifestInfoInternal(IManifest manifest) { lblProductId.Text = "Product ID: " + manifest.ProductId; lblTitle.Text = "Title: " + manifest.Title; lblVersion.Text = "Version: " + manifest.Version; lblPlatformVersion.Text = "Platform version: " + Util.GetEnumDescription(manifest.PlatformVersion); lblAuthor.Text = "Author: " + manifest.Author; tbxCapabilities.Clear(); tbxRequirements.Clear(); tbxScreenResolutions.Clear(); tbxFileTypes.Clear(); tbxURIs.Clear(); foreach (var capability in manifest.Capabilities) { tbxCapabilities.AppendText(capability.Id + ": " + capability.Description + "\r\n"); } foreach (var requirement in manifest.Requirements) { tbxRequirements.AppendText(string.Format("{0}: {1}\r\n", requirement.Id, requirement.Description)); } foreach (var screenResolution in manifest.ScreenResolutions) { tbxScreenResolutions.AppendText(string.Format("{0}: {1}\r\n", screenResolution.ToString(), Util.GetEnumDescription(screenResolution))); } if (manifest.PlatformVersion != PlatformVersion.Version71) { ShowExcessTabs(); foreach (var fileType in manifest.SupportedFileTypes) { tbxFileTypes.AppendText(fileType + "\r\n"); } foreach (var uri in manifest.AssociatedURIs) { tbxURIs.AppendText(uri + "\r\n"); } } else { var requirement = Requirement.GetRequirement("ID_REQ_MEMORY_90"); tbxRequirements.AppendText(string.Format("{0}: {1}\r\n", requirement.Id, requirement.Description)); HideExcessTabs(); } }
public void DeleteConfirmed(int id) { Requirement requirement = _db.Requirements.Find(id); if (requirement != null) { if (ValidateRequirement(requirement) == false) { return; } requirement.IsDeleted = true; _db.Entry(requirement).State = EntityState.Modified; _db.SaveChanges(); } Response.Redirect(Request.UrlReferrer.AbsoluteUri); }
// GET: Requirement/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Requirement requirement = await _db.Requirements.FindAsync(id); if (requirement == null) { return(HttpNotFound()); } if (ValidateRequirement(requirement) == false) { return(Content("Действие невозможно, т.к. заявка закрыта")); } return(View(requirement)); }
public void SetUp() { this.simpleParameterValueRuleChecker = new SimpleParameterValueRuleChecker(); this.modelReferenceDataLibrary = new ModelReferenceDataLibrary(); this.engineeringModelSetup = new EngineeringModelSetup(); this.engineeringModel = new EngineeringModel(); this.iteration = new Iteration(); this.requirementsSpecification = new RequirementsSpecification(); this.requirement = new Requirement(); this.simpleParameterValue = new SimpleParameterValue(); this.engineeringModelSetup.RequiredRdl.Add(this.modelReferenceDataLibrary); this.engineeringModel.EngineeringModelSetup = this.engineeringModelSetup; this.engineeringModel.Iteration.Add(this.iteration); this.iteration.RequirementsSpecification.Add(this.requirementsSpecification); this.requirementsSpecification.Requirement.Add(this.requirement); this.requirement.ParameterValue.Add(this.simpleParameterValue); }
internal Requirement FetchAndUpdate(Requirement item) { Requirement fetched = Get(item.ID); fetched.Title = item.Title; fetched.Status = item.Status; if (item.Comments != null) { foreach (var comment in item.Comments) { if (comment.ID <= 0) { fetched.Comments.Add(comment); } else { fetched.Comments.Where(c => c.ID == comment.ID).Single().Comment = comment.Comment; } } } if (item.Tasks != null) { TaskBF bf = new TaskBF(db); foreach (var task in item.Tasks) { if (task.IsNew) { fetched.Tasks.Add(task); } else { var temp = fetched.Tasks.Where(t => t.ID == task.ID).Single(); temp = bf.FetchAndUpdate(task); } } } MarkNotIsNew(fetched); return(fetched); }
public async Task <ActionResult <Requirement> > CreateRequirement(RequirementCriteria item) { Requirement result = new Requirement(); using (dbtramiteContext db = new dbtramiteContext()) { result.Name = item.Name; result.Description = item.Description; result.PaperWorkId = item.PaperWorkId; result.PaperworkLink = item.PaperworkLink; result.PaperWorkReceptionId = item.PaperWorkReceptionId; result.CreatedBy = "1"; result.IsActive = 1; result.CreatedAt = DateTime.Now; db.Add(result); db.SaveChanges(); } return(result); }
public void GivenTheFollowingRequirementAddInput(Table table) { Assert.IsNotNull(table); foreach (var row in table.Rows) { _description = row["Description"]; break; } Assert.IsNotNull(_description); _addItem = new Requirement { CommunityId = _communityId, RequirementTypeId = _requirementTypeId, Description = _description, CreatedOn = DateTime.UtcNow }; }
public async Task <Requirement> EditRequirement(Requirement requirement) { // fluent validation if (requirement == null) { return(null); } else { var _requirement = await _context.Requirements.FindAsync(requirement.Id); _requirement = requirement; _context.Entry(_requirement).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _context.SaveChangesAsync(); return(requirement); } }
public void SetUp() { this.requirementRuleChecker = new RequirementRuleChecker(); this.requirementsSpecification = new RequirementsSpecification(); this.requirement_1 = new Requirement { Iid = Guid.Parse("0816f4b2-7715-47be-88c1-514530bca0c2") }; this.requirement_2 = new Requirement { Iid = Guid.Parse("998f7f11-0153-4331-b7ee-33e36b278d3a") }; this.requirement_3 = new Requirement { Iid = Guid.Parse("ca3a7e32-4862-42c9-8435-b4f7dbdfac83") }; this.requirementsSpecification.Requirement.Add(this.requirement_1); this.requirementsSpecification.Requirement.Add(this.requirement_2); this.requirementsSpecification.Requirement.Add(this.requirement_3); }
/// <summary> /// Deletes a specific requirement by its id /// </summary> /// <param name="requirementId">The id of the requirement which should be deleted</param> /// <returns>The deleted requirement</returns> public static async Task <Requirement> DeleteRequirement(int requirementId) { string url = baseUrl + "requirements/" + requirementId.ToString(); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("Authorization", "Bearer " + ServiceManager.GetService <LearningLayersOidcService>().AccessToken); Response resp = await Rest.DeleteAsync(url, headers, -1, true); if (!resp.Successful) { Debug.LogError(resp.ResponseCode + ": " + resp.ResponseBody); return(null); } else { Requirement requirement = JsonUtility.FromJson <Requirement>(resp.ResponseBody); return(requirement); } }
public IActionResult Post([FromBody] Requirement req) { if (req == null) { return(BadRequest()); } else if (req.Id == 0) { _req.AddRequirement(req); return(Ok()); } else { _req.UpdateRequirement(req); return(Ok()); } }
public async Task <IActionResult> Create(Requirement requirement) { if (User.IsInRole("Cliente") && User.Identity.IsAuthenticated) { if (ModelState.IsValid) { context.Add(requirement); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } var currentUser = await userManager.FindByEmailAsync(User.Identity.Name); var clients = await userManager.GetUsersInRoleAsync("Cliente"); ViewData["OwnerId"] = new SelectList(clients, "Id", "FullName", requirement.OwnerId); ViewData["ProjectId"] = new SelectList(context.Projects .Include(o => o.Owner) .Where(p => p.OwnerId == currentUser.Id), "Id", "Name", requirement.ProjectId); ViewData["StatusId"] = new SelectList(context.Statuses, "Id", "Name", requirement.StatusId); return(View(requirement)); } else { if (ModelState.IsValid) { context.Add(requirement); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } var clients = await userManager.GetUsersInRoleAsync("Cliente"); ViewData["OwnerId"] = new SelectList(clients, "Id", "FullName", requirement.OwnerId); ViewData["ProjectId"] = new SelectList(context.Projects, "Id", "Name", requirement.ProjectId); ViewData["StatusId"] = new SelectList(context.Statuses, "Id", "Name", requirement.StatusId); return(View(requirement)); } }
public async Task RunAsync() { if (!User.Current.IsLoggedIn) { return; } await LoadLookupsAsync(); if (Selected is null) { Selected = await _requirementsDataService.CreateModelAsync( User.Current.AuthToken, (ex) => Feedback.Show(ex, Formats.Danger)); } else { Selected = await _requirementsDataService.EditModelAsync( User.Current.AuthToken, (ex) => Feedback.Show(ex, Formats.Danger), Selected); } RunForm(); if (_isEscaped) { return; } if (Selected.IsNew) { Selected = await _requirementsDataService.StoreModelAsync( User.Current.AuthToken, (ex) => Feedback.Show(ex, Formats.Danger), Selected); } else { Selected = await _requirementsDataService.UpdateModelAsync( User.Current.AuthToken, (ex) => Feedback.Show(ex, Formats.Danger), Selected); } Feedback.Show(true); }
public ActionResult AddDate(Requirement requirement, string JobDescription, string ComProfile) { int compnayId = Convert.ToInt32(Session["ID"]); if (compnayId != 0) { ViewBag.LoginID = compnayId; } else { ViewBag.LoginID = ""; } string jobDescription = HttpUtility.UrlDecode(JobDescription); string comProfile = HttpUtility.UrlDecode(ComProfile); string msg = "添加失败"; try { using (var ct = new DB()) { requirement.CompnayId = compnayId; requirement.JobDescription = jobDescription; requirement.ComProfile = comProfile; requirement.IsDelete = 1; requirement.CreateTime = DateTime.Now; requirement.UpdateTime = DateTime.Now; requirement.CreateUser = Session["CompanyUserName"].ToString(); requirement.UpdateUser = Session["CompanyUserName"].ToString(); ct.Requirement.Add(requirement); if (requirement.RequirementId <= 0) { msg = "添加成功"; } ct.SaveChanges(); } return(Content(msg)); } catch (Exception dbEx) { return(Content(msg)); } }
public void VefifyThatSpecWithRequirementsCanBeLoaded() { var requirementA = new Requirement() { ShortName = "REQA", Owner = this.domain }; var requirementB = new Requirement() { ShortName = "REQB", Owner = this.domain }; this.requirementsSpecification.Requirement.Add(requirementB); this.requirementsSpecification.Requirement.Add(requirementA); var vm = new RequirementsSpecificationEditorViewModel(this.requirementsSpecification, this.session.Object, null, null, null, null); Assert.AreEqual(3, vm.ContainedRows.Count); var requirementARow = (CDP4Requirements.ViewModels.RequirementsSpecificationEditor.RequirementRowViewModel)vm.ContainedRows.Single(row => row.Thing == requirementA); Assert.AreEqual("TST", requirementARow.OwnerShortName); Assert.AreEqual("REQA", requirementARow.ShortName); Assert.AreEqual("S:URD.R:REQA", requirementARow.BreadCrumb); var requirementBRow = (CDP4Requirements.ViewModels.RequirementsSpecificationEditor.RequirementRowViewModel)vm.ContainedRows.Single(row => row.Thing == requirementB); Assert.AreEqual("TST", requirementBRow.OwnerShortName); Assert.AreEqual("REQB", requirementBRow.ShortName); Assert.AreEqual("S:URD.R:REQB", requirementBRow.BreadCrumb); var specRow = vm.ContainedRows[0]; Assert.AreEqual(this.requirementsSpecification, specRow.Thing); var reqARow = vm.ContainedRows[1]; Assert.AreEqual(requirementA, reqARow.Thing); var reqBRow = vm.ContainedRows[2]; Assert.AreEqual(requirementB, reqBRow.Thing); }
public ActionResult Create(Requirement requirement) { int projectID = (int)Session["projectID"]; requirement.ID_Project = projectID; requirement.ID_Requirement = createID(projectID); if (db.Requirements.Where(r => r.ID_Project == projectID && r.ID_Requirement.Equals(requirement.ID_Requirement)).FirstOrDefault() != null) { ViewBag.Error = "Zadané ID požadavku se již v projektu vyskytuje. Zvolte prosím jiné."; } else { try { db.Requirements.Add(requirement); db.SaveChanges(); if (requirement.ID_ReqType == 1) { NotificationSystem.SendNotification(EnumNotification.CREATE_REQUIREMENT, "/Requirements/Functional"); return(RedirectToAction("Functional")); } else { NotificationSystem.SendNotification(EnumNotification.CREATE_REQUIREMENT, "/Requirements/Nonfunctional"); return(RedirectToAction("Nonfunctional")); } } catch (Exception ex) { Console.WriteLine(ex.Message); ViewBag.Error = "Vyskytla se chyba. Opakujte prosím akci."; } } ViewBag.ID_ReqType = new SelectList(db.ReqTypes, "ID", "Type"); ViewBag.ID_Priority = db.PriorityRequirements.ToList(); ViewBag.ID_Category = new SelectList(db.CategoryRequirements.Where(c => c.ID_Project == projectID), "ID", "Name"); ViewBag.ID_Status = db.StatusRequirements.ToList(); return(View(requirement)); }
public RequirementViewModel(Requirement requirement) { Id = requirement.Id; Source = requirement.Source.Title; Category = requirement.Category.Title; if (requirement.Title.Length > TrimLength) { Title = requirement.Title.Substring(0, TrimLength) + "..."; } else { Title = requirement.Title; } BillingType = requirement.BillingType; Budget = requirement.Budget; Status = requirement.RequirementStatus; PostedOn = requirement.PostedOn; RespondedOn = requirement.RespondedOn; CreatedOn = requirement.CreatedOn; }
/// <summary> /// Performs the drop operation for a <see cref="Requirement"/> payload /// </summary> /// <param name="requirement"> /// The <see cref="Requirement"/> that was dropped into this <see cref="RequirementsSpecification"/> /// </param> private async Task OnRequirementDrop(Requirement requirement) { var context = TransactionContextResolver.ResolveContext(this.Thing); var transaction = new ThingTransaction(context); var requirementClone = requirement.Clone(false); requirementClone.Group = null; transaction.CreateOrUpdate(requirementClone); if (requirement.Container != this.Thing) { // Add the requirement to the RequirementSpecification represented by this RowViewModel var requirementSpecificationClone = this.Thing.Clone(false); requirementSpecificationClone.Requirement.Add(requirement); transaction.CreateOrUpdate(requirementSpecificationClone); } await this.DalWrite(transaction); }
/// <summary> /// Print the requirements /// </summary> /// <param name="value"></param> /// <returns></returns> private TreeViewItem PrintRequirement(Requirement value) { TreeViewItem treeViewItem = new TreeViewItem(); treeViewItem.Header = "Requirement"; if (value.applicability != "") { treeViewItem.Items.Add("applicability: " + value.applicability); } if (value.requirement != "") { treeViewItem.Items.Add("requirement: " + value.requirement); } if (value.exchangeRequirement.name != "") { treeViewItem.Items.Add(PrintExchangeRequirement(value.exchangeRequirement)); } return(treeViewItem); }
public IList <Requirement> SearchRequirement(uint rkid) { string sqlstr = "SELECT RAK_ID, COS_ID, REQ_DES FROM db_p2_requirement WHERE RAK_ID="; DataSet ds = MySqlHelper.ExecuteQuery(sqlstr + rkid); DataTable dt = ds.Tables[0]; IList <Requirement> result = new List <Requirement>(); for (int i = 0; i < dt.Rows.Count; i++) { Requirement temp = new Requirement(); temp.Rank = uint.Parse(dt.Rows[i][0].ToString()); temp.Course = ushort.Parse(dt.Rows[i][1].ToString()); temp.Description = dt.Rows[i][2].ToString(); result.Add(temp); } return(result); }
private async Task <AuthRequest> GetAuthRequest(PersonalIdentityNumber?personalIdentityNumber, BankIdLoginOptions loginOptions) { var endUserIp = _bankIdEndUserIpResolver.GetEndUserIp(HttpContext); var personalIdentityNumberString = personalIdentityNumber?.To12DigitString(); var tokenStartRequired = string.IsNullOrEmpty(personalIdentityNumberString) ? true : (bool?)null; List <string>?certificatePolicies = null; if (loginOptions.CertificatePolicies != null && loginOptions.CertificatePolicies.Any()) { certificatePolicies = loginOptions.CertificatePolicies; } var authRequestRequirement = new Requirement(certificatePolicies, tokenStartRequired, loginOptions.AllowBiometric); var authRequestContext = new BankIdAuthRequestContext(endUserIp, personalIdentityNumberString, authRequestRequirement); var userData = await _bankIdAuthUserDataResolver.GetUserDataAsync(authRequestContext, HttpContext); return(new AuthRequest(endUserIp, personalIdentityNumberString, authRequestRequirement, userData.UserVisibleData, userData.UserNonVisibleData, userData.UserVisibleDataFormat)); }
public void VerifyThatBreadCrumbOfGroupRequirementCanBeComputed() { var requirement = new Requirement() { ShortName = "REQA" }; this.requirementsSpecification.Requirement.Add(requirement); var requirementsGroupA = new RequirementsGroup() { ShortName = "GRPA" }; this.requirementsSpecification.Group.Add(requirementsGroupA); requirement.Group = requirementsGroupA; Assert.AreEqual("S:URD.RG:GRPA.R:REQA", requirement.BreadCrumb()); }
public void ShowSomeRoomStats(Reward[] rewards, Requirement[] requirements, List<Character> characters) { int highestVision = 0; foreach (Character c in characters) { if (c.Vision > highestVision) { highestVision = c.Vision; } } roomStats.SetActive(true); SetAllRoomStatsUnknown(); if (rewards != null) { foreach (Reward r in rewards) { if (r.type == Reward.Type.altar && highestVision > r.visionRequired) { altarRew.text = "Yes"; } if (r.type == Reward.Type.human && highestVision > r.visionRequired) { humanRew.text = "Yes"; } } } if (requirements != null) { foreach (Requirement r in requirements) { if (r.type == Requirement.Type.strength && highestVision > r.visionRequired) { strengthReq.text = r.requiredValue.ToString(); } if (r.type == Requirement.Type.agility && highestVision > r.visionRequired) { agilityReq.text = r.requiredValue.ToString(); } } } }
bool CheckRequirement(Requirement requirement) { switch (requirement.function) { case Functions.Less: {if (GetParameterValue(requirement.p1) >= GetParameterValue(requirement.p2)) {return false;} return true;} case Functions.LessEqual: {if (GetParameterValue(requirement.p1) > GetParameterValue(requirement.p2)) {return false;} return true;} case Functions.Equal: {if (GetParameterValue(requirement.p1) != GetParameterValue(requirement.p2)) {return false;} return true;} case Functions.MoreEqual: {if (GetParameterValue(requirement.p1) < GetParameterValue(requirement.p2)) {return false;} return true;} case Functions.More: {if (GetParameterValue(requirement.p1) <= GetParameterValue(requirement.p2)) {return false;} return true;} case Functions.HasScales: {if (!PlayerSaveData.reference.trainData.conditions.HasScales) {return false;} return true;} default: {Debug.Log("unexpected function name in requirements in xml!"); return false;} } }
public ActionResult Edit(Requirement requirement) { if (ModelState.IsValid) { db.Entry(requirement).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PrefixID = new SelectList(db.Prefixes, "PrefixID", "Name", requirement.PrefixID); ViewBag.TargetID = new SelectList(db.Targets, "TargetID", "Name", requirement.TargetID); return View(requirement); }
public bool doMovementsFulfillRequirement(List<Movement> movements, Requirement[] requirements) { int type = 0; int required = 0; int bonus = 0; bool success = false; List<Character> movingChars = new List<Character>(); foreach (Movement movement in movements) { if (requirements == null || requirements.Length == 0) { return true; } Character character = movement.Character; foreach (Requirement r in requirements) { if (r.IsActive) { required = r.getRequiredValue(); if (r.getType() == global::Requirement.Type.agility) { if (character.Agility >= r.getRequiredValue()) { bonus = r.requiredValue / (BonusFactor * 2); character.Agility += bonus; if (bonus <= 0) bonus = 1; switch (movement.Direction) { case 0: movement.Destination.AgiObst.transform.rotation = Quaternion.Euler(0, 0, 180); break; case 1: movement.Destination.AgiObst.transform.rotation = Quaternion.Euler(0, 0, 90); break; case 2: movement.Destination.AgiObst.transform.rotation = Quaternion.Euler(0, 0, 0); break; case 3: movement.Destination.AgiObst.transform.rotation = Quaternion.Euler(0, 0, 270); break; } movement.Destination.AgiObst.SetActive(true); type = 1; success = true; movingChars.Add(character); } else { type = 1; movingChars.Add(character); } } else if (r.getType() == global::Requirement.Type.strength) { if (character.Strength >= r.getRequiredValue()) { bonus = r.requiredValue / (BonusFactor * 2); character.Strength += bonus; if (bonus <= 0) bonus = 1; switch (movement.Direction) { case 0: movement.Destination.StrObst.transform.rotation = Quaternion.Euler(0, 0, 180); break; case 1: movement.Destination.StrObst.transform.rotation = Quaternion.Euler(0, 0, 90); break; case 2: movement.Destination.StrObst.transform.rotation = Quaternion.Euler(0, 0, 0); break; case 3: movement.Destination.StrObst.transform.rotation = Quaternion.Euler(0, 0, 270); break; } movement.Destination.StrObst.SetActive(true); type = 2; success = true; movingChars.Add(character); } else { type = 2; movingChars.Add(character); } } r.IsActive = true; } } } string names = ""; if (movingChars.Count > 0) { foreach (Character c in movingChars) { names += c.CharName + ", "; } names = names.Remove(names.Length - 2); } if (type == 1) { if (success) { //gameController.writeRequirementStory(names + " managed to overcome an exciting obstacle because of their dominating Agility! As a result their Agility has even increased by " + bonus + "."); gameController.audio.playObstAgi(); int caseSwitchAgilityPos = Random.Range(0, 5); // creates a number between 0 and 5; switch (caseSwitchAgilityPos) { case 0: gameController.writeRequirementStory(names + " managed to overcome an exciting obstacle because of his Agility! As a result their Agility even increased by " + bonus + "."); break; case 1: gameController.writeRequirementStory(names + " made it! This Time! As a result their Agility even increased by " + bonus + "."); break; case 2: gameController.writeRequirementStory(names + " On fire! As a result their Agility even increased by " + bonus + "."); break; case 3: gameController.writeRequirementStory(names + " did their homework! As a result their Agility even increased by " + bonus + "."); break; case 4: gameController.writeRequirementStory(names + " still got it! As a result their Agility even increased by " + bonus + "."); break; case 5: gameController.writeRequirementStory(names + " , not as fat as their looks! As a result their Agility even increased by " + bonus + "."); break; } } else { //gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Agility! One of them would have needed " + required + " Agility to master it."); gameController.audio.playObstFail(); int caseSwitchAgilityNegative = Random.Range(0, 5); switch (caseSwitchAgilityNegative) { case 0: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Agility! One of them would have needed " + required + " Agility to master it."); break; case 1: gameController.writeRequirementStory(names + " , to chubby to get through adv.! Their would have needed " + required + " Agility to master it."); break; case 2: gameController.writeRequirementStory(names + " , to slow, maybe next time! " + required + "Agility to master it."); break; case 3: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Agility! One of them would have needed " + required + "Agility to master it."); break; case 4: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Agility! One of them would have needed " + required + "Agility to master it."); break; case 5: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Agility! One of them would have needed " + required + "Agility to master it."); break; } } } if (type == 2) { if (success) { //gameController.writeRequirementStory(names + " managed to overcome an exciting obstacle because of their dominating Strength. As a result their Strength has even increased by " + bonus + "."); gameController.audio.playObstStr(); int caseSwitchStrengthPos = Random.Range(0, 5); // creates a number between 0 and 5; switch (caseSwitchStrengthPos) { case 0: gameController.writeRequirementStory(names + " managed to overcome an exciting obstacle because of his Agility! As a result their Agility even increased by " + bonus + "."); break; case 1: gameController.writeRequirementStory(names + " managed to overcome an exciting obstacle because of their dominating Strength. As a result their Strength has even increased by " + bonus + "."); break; case 2: gameController.writeRequirementStory(names + " managed to overcome an exciting obstacle because of their dominating Strength. As a result their Strength has even increased by " + bonus + "."); break; case 3: gameController.writeRequirementStory(names + " managed to overcome an exciting obstacle because of their dominating Strength. As a result their Strength has even increased by " + bonus + "."); break; case 4: gameController.writeRequirementStory(names + " managed to overcome an exciting obstacle because of their dominating Strength. As a result their Strength has even increased by " + bonus + "."); break; case 5: gameController.writeRequirementStory(names + " , not as fat as their looks! As a result their Agility even increased by " + bonus + "."); break; } } else { //gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Strength! One of them would have needed " + (required) + " more Agility to master it."); gameController.audio.playObstFail(); int caseSwitchStrengthNegative = Random.Range(0, 5); switch (caseSwitchStrengthNegative) { case 0: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Strength!One of them would have needed " + required + " more Strength to master it."); break; case 1: gameController.writeRequirementStory(names + " , to chubby to get thru! Their would have needed " + required + " more Strength to master it."); break; case 2: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Strength!One of them would have needed " + required + " more Strength to master it."); break; case 3: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Strength!One of them would have needed " + required + " more Strength to master it."); break; case 4: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Strength!One of them would have needed " + required + " more Strength to master it."); break; case 5: gameController.writeRequirementStory(names + " failed to overcome an exciting obstacle because of their meagre Strength!One of them would have needed " + required + " more Strength to master it."); break; } } } return success; }
public void Create(Requirement entity) { this.requirements.Add(entity); }
/// <summary> /// Initializes a new instance of the <see cref="SchemaEntityAttribute"/> class. /// </summary> /// <param name="localName">The local name of the Xml attribute.</param> /// <param name="requirement">Indicates whether the attribute is required in the XLIFF document.</param> public SchemaEntityAttribute(string localName, Requirement requirement) : this(null, null, localName, requirement) { }
protected void Put(Field f, Requirement r) { _requirementEnumMap.Add(f, r); }
public void Update(Requirement entity) { this.requirements.Update(entity); }
public void HardDelete(Requirement entity) { this.HardDelete(entity); }
public void Delete(Requirement entity) { this.requirements.Delete(entity); }
public void ShowAllRoomStats(Reward[] rewards, Requirement[] requirements) { roomStats.SetActive(true); SetAllRoomStatsUnrequired(); if (rewards != null) { foreach (Reward r in rewards) { if (r.type == Reward.Type.altar) { altarRew.text = "Yes"; } if (r.type == Reward.Type.human) { humanRew.text = "Yes"; } } } if (requirements != null) { foreach (Requirement r in requirements) { if (r.type == Requirement.Type.strength) { strengthReq.text = r.requiredValue.ToString(); } if (r.type == Requirement.Type.agility) { agilityReq.text = r.requiredValue.ToString(); } } } }
/// <summary> /// Try and use the resourse and return how mnya more resoures are needed /// </summary> /// <param name="req"></param> /// <returns></returns> public int ResourceAvailable(Requirement req) { int needed = req.GetRequired(); if (needed < 1) { // Debug.Log(" 13 "); return 0; } for (int i = 0; i < req.GetRequired(); i++) { if (allResources[req.resourcePos].numOf < 1) { // Debug.Log(" 12 "); return needed; } if (i <= req.requiredDay) { allResources[req.resourcePos].numOf--; //Debug.Log(req.resourcePos + " " + req.requiredDay); needed--; } else { if ((allResources[req.resourcePos].user == ResourceUser.Shelter && allResources[req.resourcePos].numOf > shelters.Count * req.requiredDay) || (allResources[req.resourcePos].user == ResourceUser.Human && allResources[req.resourcePos].numOf > shelters.Count * req.requiredDay)) { allResources[req.resourcePos].numOf--; needed--; } else { // Debug.Log(" 11 "); return needed; } } } // Debug.Log(" 10 "); return needed; }
public void ValidateNewRequirement(Requirement requirement) { ValidateRequirement(requirement, true); }
public void ValidateRequirement(Requirement requirement) { ValidateRequirement(requirement, false); }
public void AddPrefixes(DPrefix[] add, Requirement req) { prefixes.AddRange(add); customRequirements.Add(req); }
public Resource(int pos) { requirementType = new Requirement(pos); }
public ActionResult Delete(int id, Requirement requirement) { var requirementToDelete = _requirementRepository.GetNullableById(id); if (requirementToDelete == null) return this.RedirectToAction<ProjectController>(a => a.Index()); // validate access var redirect = _accessValidator.CheckEditAccess(CurrentUser.Identity.Name, requirementToDelete.Project); if (redirect != null) { Message = "Not authorized to edit project."; return redirect; } var projectId = requirementToDelete.Project.Id; _requirementRepository.Remove(requirementToDelete); Message = "Requirement Removed Successfully"; return RedirectToAction("Index", new {id = projectId}); }
public ActionResult Edit(int id, Requirement requirement) { var requirementToEdit = _requirementRepository.GetNullableById(id); if (requirementToEdit == null) return RedirectToAction("Index", new {id=id}); // validate access var redirect = _accessValidator.CheckEditAccess(CurrentUser.Identity.Name, requirementToEdit.Project); if (redirect != null) { Message = "Not authorized to edit project."; return redirect; } AutoMapper.Mapper.Map(requirement, requirementToEdit); requirementToEdit.LastModified = DateTime.Now; ModelState.Clear(); requirementToEdit.TransferValidationMessagesTo(ModelState); if (ModelState.IsValid) { _requirementRepository.EnsurePersistent(requirementToEdit); Message = "Requirement Edited Successfully"; return RedirectToAction("Index", new {id=requirementToEdit.Project.Id}); } var viewModel = RequirementViewModel.Create(Repository, requirementToEdit.Project); viewModel.Requirement = requirement; return View(viewModel); }