public static void SetDisclosure(Cell item, UITableViewCell cell) { AccessoryType disclosureType = (item as IAccessoryCell).AccessoryType; switch (disclosureType) { case AccessoryType.Detail: cell.Accessory = UIKit.UITableViewCellAccessory.DetailButton; break; case AccessoryType.Disclosure: cell.Accessory = UIKit.UITableViewCellAccessory.DisclosureIndicator; break; case AccessoryType.Checkmark: cell.Accessory = UIKit.UITableViewCellAccessory.Checkmark; break; case AccessoryType.DetailDisclosure: cell.Accessory = UIKit.UITableViewCellAccessory.DetailDisclosureButton; break; case AccessoryType.None: cell.Accessory = UIKit.UITableViewCellAccessory.None; break; } }
public override string ToString() { if (AccessoryType != null) { return(AccessoryType.ToString()); } return(base.ToString()); }
public AccessoryTabViewModel(IUnitOfWork context) { _context = context; DisplayName = "Accessory"; Accessories = new BindableCollection <AccessoryType>(_context.AccessoryTypes.GetAll()); EditAccessory = new Accessory(); SelectedAccessory = new AccessoryType(); }
/// <summary> /// Returns the current status of an accessory. /// </summary> /// <param name="address">Accessory address.</param> /// <param name="status">Current accessory status.</param> public AccessoryInformation(int address, int status, bool finished, AccessoryType type, OperationResult result) { this.Address = address; this.Status = status; this.Finished = finished; this.Type = type; this.Result = result; }
public ActionResult DeleteConfirmed(int id) { AccessoryType accessoryType = db.AccessoryTypes.Find(id); db.AccessoryTypes.Remove(accessoryType); db.SaveChanges(); return(RedirectToAction("Index")); }
public void CreateAccessory(string item, string art, string description, string comment, string color, int customerPK, int supplierPK, int accessoryTypePK, string userID) { try { string accessoryID = ""; AccessoryType accessoryType = db.AccessoryTypes.Find(accessoryTypePK); Customer customer = db.Customers.Find(customerPK); Supplier supplier = db.Suppliers.Find(supplierPK); List <Accessory> accessories = (from acc in db.Accessories.OrderByDescending(unit => unit.AccessoryPK) where acc.AccessoryTypePK == accessoryTypePK && acc.CustomerPK == customerPK && acc.SupplierPK == supplier.SupplierPK select acc).ToList(); if (accessories.Count == 0) { accessoryID = accessoryType.Abbreviation + "-" + customer.CustomerCode + "-" + supplier.SupplierCode + "-" + "00001"; } else { HashSet <int> hsSupllierPK = new HashSet <int>(); string tempStr; Int32 tempInt; tempStr = accessories[0].AccessoryID.Substring(accessories[0].AccessoryID.Length - 5); tempInt = Int32.Parse(tempStr) + 1; tempStr = tempInt + ""; if (tempStr.Length == 1) { tempStr = "0000" + tempStr; } if (tempStr.Length == 2) { tempStr = "000" + tempStr; } if (tempStr.Length == 3) { tempStr = "00" + tempStr; } if (tempStr.Length == 4) { tempStr = "0" + tempStr; } accessoryID = accessoryType.Abbreviation + "-" + customer.CustomerCode + "-" + supplier.SupplierCode + "-" + tempStr; } // create accessory Accessory accessory = new Accessory(accessoryID, description, item, art, color, comment, accessoryTypePK, supplierPK, customerPK); db.Accessories.Add(accessory); // lưu activity create Activity activity = new Activity("create", accessory.AccessoryID, "Accessory", userID); db.Activities.Add(activity); db.SaveChanges(); } catch (Exception e) { throw e; } }
public async Task <ActionResult> DeleteConfirmed(int id) { AccessoryType accessoryType = await db.AccessoryTypes.FindAsync(id); db.AccessoryTypes.Remove(accessoryType); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "AccessoryTypeID,AccessoryType1")] AccessoryType accessoryType) { if (ModelState.IsValid) { db.Entry(accessoryType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(accessoryType)); }
public ActionResult Create([Bind(Include = "AccessoryTypeID,AccessoryType1")] AccessoryType accessoryType) { if (ModelState.IsValid) { db.AccessoryTypes.Add(accessoryType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(accessoryType)); }
public async Task <ActionResult> Edit([Bind(Include = "AccessoryTypeID,TypeName")] AccessoryType accessoryType) { if (ModelState.IsValid) { db.Entry(accessoryType).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(accessoryType)); }
public AccessoryData(AccessoryType type, int actions, string useAnimation, string useParticle, string useSound) { Type = type; this.useAnimation = useAnimation; this.useParticle = useParticle; this.useSound = useSound; Attributes = new List <ItemAttribute>(); Attributes.Add(new ItemAttribute((int)AccessoryAttributes.Actions, actions)); Attributes.Add(new ItemAttribute((int)AccessoryAttributes.Cooldown, actions)); }
public ActionResult <AccessoryType> Create([FromForm] AccessoryType accessoryType) { var curAccessoryType = _accessoryTypeService.GetAccessoryTypeByName(accessoryType.Name); if (curAccessoryType != null) { return(BadRequest(new { message = "Accessory Type has been used" })); } _accessoryTypeService.Create(accessoryType); return(CreatedAtRoute("GetAccessoryType", new { id = accessoryType.Id.ToString() }, accessoryType)); }
public async Task <ActionResult> Create([Bind(Include = "AccessoryTypeID,TypeName")] AccessoryType accessoryType) { if (ModelState.IsValid) { db.AccessoryTypes.Add(accessoryType); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(accessoryType)); }
public Accessory getAccessory(AccessoryType accessoryType, [Optional, DefaultParameterValue(null)] string material) { Accessory component = ResourceUtil.Instantiate <GameObject>("Prefabs/Accessories/" + accessoryType).GetComponent <Accessory>(); component.Type = accessoryType; if (!string.IsNullOrEmpty(material)) { component.Renderer.sharedMaterial = ResourceUtil.Instantiate <Material>("Materials/" + material); } component.initializeFlashMaterials(); return(component); }
public IActionResult Update([FromBody] AccessoryType accessoryTypeIn) { var accessoryType = _accessoryTypeService.Get(accessoryTypeIn.Id); if (accessoryType == null) { return(NotFound()); } _accessoryTypeService.Update(accessoryTypeIn.Id, accessoryTypeIn); return(NoContent()); }
public AccessoryData(AccessoryData data) { Type = data.Type; this.useAnimation = data.useAnimation; this.useParticle = data.useParticle; this.useSound = data.useSound; Attributes = new List <ItemAttribute>(); for (int i = 0; i < data.Attributes.Count; i++) { Attributes.Add(data.Attributes[i]); } }
// GET: AccessoryTypes/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AccessoryType accessoryType = await db.AccessoryTypes.FindAsync(id); if (accessoryType == null) { return(HttpNotFound()); } return(View(accessoryType)); }
// GET: AccessoryTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AccessoryType accessoryType = db.AccessoryTypes.Find(id); if (accessoryType == null) { return(HttpNotFound()); } return(View(accessoryType)); }
internal static string ToSerializedValue(this AccessoryType value) { switch (value) { case AccessoryType.HeadWear: return("headWear"); case AccessoryType.Glasses: return("glasses"); case AccessoryType.Mask: return("mask"); } return(null); }
public static AccessoryType ToModel(this AccessoryTypeViewModel accessoryTypeViewModel) { if (accessoryTypeViewModel == null) { throw new ArgumentNullException("accessoryTypeViewModel"); } AccessoryType accessoryType = new AccessoryType(); accessoryType.Id = accessoryTypeViewModel.Id; accessoryType.Name = accessoryTypeViewModel.Name; accessoryType.Category = accessoryTypeViewModel.Category; accessoryType.Description = accessoryTypeViewModel.Description; accessoryType.Price = accessoryTypeViewModel.Price; return(accessoryType); }
public override void Restore() { AccessoryType original = Original as AccessoryType; if (original == null) { throw new InvalidOperationException( "View model does not have an original value."); } Id = original.Id; Name = original.Name; Category = original.Category; Description = original.Description; Price = original.Price; }
public static Accessory createAccessory(AccessoryType type, TileEntity t) { Accessory a = null; switch (type) { case AccessoryType.Counting: a = new CountAccessory(t); break; case AccessoryType.Blaster: a = new Blaster(t); break; } return(a); }
public IHttpActionResult GetAllAccessory() { List <Client_Accessory_Information> result = new List <Client_Accessory_Information>(); try { List <Accessory> accessories = db.Accessories.ToList(); foreach (var accessory in accessories) { AccessoryType accessoryType = db.AccessoryTypes.Find(accessory.AccessoryTypePK); result.Add(new Client_Accessory_Information(accessory, accessoryType.Name)); } } catch (Exception e) { return(Content(HttpStatusCode.Conflict, new Content_InnerException(e).InnerMessage())); } return(Content(HttpStatusCode.OK, result)); }
public async Task <IActionResult> AddAccessoryType(string name) { if (!String.IsNullOrEmpty(name)) { try { var accessoryType = new AccessoryType { Name = name, }; await _dbContext.AccessoryTypes.AddAsync(accessoryType); await _dbContext.SaveChangesAsync(); return(Json(accessoryType)); } catch (Exception) { return(Json("fail")); } } return(Json("fail")); }
public void Remove(AccessoryType AccessoryTypeIn) => _accessoryType.DeleteOne(AccessoryType => AccessoryType.Id == AccessoryTypeIn.Id);
public void SetCard(PetType _petType, AccessoryType _accessoryType, bool isNeedThis) { if (isNeedThis) { petType = _petType; accessoryType = _accessoryType; } else { if (_petType != PetType.None) { do { Array pets = Enum.GetValues(typeof(PetType)); petType = (PetType)pets.GetValue(Random.Range(0, pets.Length)); } while (ISSameType(petType, _petType)); } if (_accessoryType != AccessoryType.None) { do { Array accessory = Enum.GetValues(typeof(AccessoryType)); accessoryType = (AccessoryType)accessory.GetValue(Random.Range(0, accessory.Length)); } while (accessoryType == _accessoryType); } } if (petType == PetType.None) { int randomNum = Random.Range(0, pets.Length); petData = pets[randomNum]; petType = (PetType)(randomNum); } else { petData = pets[(int)(petType) - 1]; } petSprites = petData.sprites.Random(); if (accessoryType == AccessoryType.None) { int randomNum = Random.Range(0, petData.accessories.Length + 1); if (randomNum != petData.accessories.Length) { accessorySprite = petData.accessories[randomNum]; accessoryType = (AccessoryType)(randomNum); } else { accessorySprite = null; } } else { accessorySprite = petData.accessories[(int)(accessoryType) - 1];; } petImageAnimator.SetSpritesDublicateInner(petSprites.sprites); accessoryImage.sprite = accessorySprite; accessoryImage.color = accessoryImage.color.SetA(accessorySprite == null ? 0 : 1); bool ISSameType(PetType t1, PetType t2) { return((IsDog(t1) && IsDog(t2)) || (IsCat(t1) && IsCat(t2))); } bool IsDog(PetType type) { return(type == PetType.Dog1 || type == PetType.Dog2 || type == PetType.Dog3); } bool IsCat(PetType type) { return(type == PetType.Cat1 || type == PetType.Cat2 || type == PetType.Cat3 || type == PetType.Cat4); } }
private static string AccessoryTypeGroupToText(AccessoryType t) { switch (t) { case AccessoryType.Turnout: return Labels.Turnouts.ToCapital(); case AccessoryType.Signal: return Labels.Signals.ToCapital(); case AccessoryType.Semaphore: return Labels.Semaphores.ToCapital(); case AccessoryType.Light: return Labels.Lights.ToCapital(); case AccessoryType.Route: return Labels.Routes.ToCapital(); case AccessoryType.Misc: default: return Labels.Misc.ToCapital(); } }
public static void SetAccessory(BindableObject bindableObject, AccessoryType accessoryType) => bindableObject.SetValue(AccessoryProperty, accessoryType);
public void Update(string id, AccessoryType AccessoryTypeIn) => _accessoryType.ReplaceOne(AccessoryType => AccessoryType.Id == id, AccessoryTypeIn);
public void SetFilter(AccessoryType lt) { filterType = lt; SetItemsSource(); }
public Client(PetType wantedPet, AccessoryType wantedAccessory, string dialogText) { this.wantedPet = wantedPet; this.wantedAccessory = wantedAccessory; this.dialogText = dialogText; }
public AccessoryData() { Type = AccessoryType.None; Attributes = new List <ItemAttribute>(); }
/// <summary> /// Initializes a new instance of the Accessory class. /// </summary> /// <param name="type">Type of an accessory. Possible values include: /// 'headWear', 'glasses', 'mask'</param> /// <param name="confidence">Confidence level of an accessory</param> public Accessory(AccessoryType type = default(AccessoryType), double confidence = default(double)) { Type = type; Confidence = confidence; CustomInit(); }