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;
            }
        }
Exemplo n.º 2
0
 public override string ToString()
 {
     if (AccessoryType != null)
     {
         return(AccessoryType.ToString());
     }
     return(base.ToString());
 }
Exemplo n.º 3
0
 public AccessoryTabViewModel(IUnitOfWork context)
 {
     _context          = context;
     DisplayName       = "Accessory";
     Accessories       = new BindableCollection <AccessoryType>(_context.AccessoryTypes.GetAll());
     EditAccessory     = new Accessory();
     SelectedAccessory = new AccessoryType();
 }
Exemplo n.º 4
0
 /// <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"));
        }
Exemplo n.º 6
0
        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;
            }
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 10
0
        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));
        }
Exemplo n.º 11
0
        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));
        }
Exemplo n.º 13
0
        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));
        }
Exemplo n.º 14
0
        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());
        }
Exemplo n.º 16
0
        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]);
            }
        }
Exemplo n.º 17
0
        // 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));
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
        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;
        }
Exemplo n.º 22
0
        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"));
        }
Exemplo n.º 25
0
 public void Remove(AccessoryType AccessoryTypeIn) =>
 _accessoryType.DeleteOne(AccessoryType => AccessoryType.Id == AccessoryTypeIn.Id);
Exemplo n.º 26
0
    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();
     }
 }
Exemplo n.º 28
0
 public static void SetAccessory(BindableObject bindableObject, AccessoryType accessoryType) =>
     bindableObject.SetValue(AccessoryProperty, accessoryType);
Exemplo n.º 29
0
 public void Update(string id, AccessoryType AccessoryTypeIn) =>
 _accessoryType.ReplaceOne(AccessoryType => AccessoryType.Id == id, AccessoryTypeIn);
 public void SetFilter(AccessoryType lt)
 {
     filterType = lt;
     SetItemsSource();
 }
Exemplo n.º 31
0
 public Client(PetType wantedPet, AccessoryType wantedAccessory, string dialogText)
 {
     this.wantedPet       = wantedPet;
     this.wantedAccessory = wantedAccessory;
     this.dialogText      = dialogText;
 }
Exemplo n.º 32
0
 public AccessoryData()
 {
     Type       = AccessoryType.None;
     Attributes = new List <ItemAttribute>();
 }
Exemplo n.º 33
0
 /// <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();
 }