/// <summary> /// 添加新衣物 /// </summary> /// <param name="clothesPic">新衣物照片</param> /// <param name="wardrobeID">衣物所属衣橱ID</param> /// <param name="name">新衣物名称</param> /// <param name="type">新衣物类型</param> /// <param name="thickness">新衣物厚度指数</param> /// <returns></returns> public static bool add(IFormFile clothesPic, int wardrobeID, string name, ClothesType type, int thickness) { //确保衣橱存在 if (!WardrobeManager.exist(wardrobeID)) { return(false); } Clothes clothes = new Clothes(wardrobeID, name, type, thickness); clothes.id = clothesDb.InsertReturnIdentity(clothes); savePic(clothesPic, clothes); TaobaoItem taobaoItem = TaobaoApi.getTaobaoItem(clothes.picPath); //处理购衣推荐 if (taobaoItem != null) { Thread setCommendThread = new Thread(new ParameterizedThreadStart(UserManager.setRecommend_thread)); setCommendThread.Start(new SetRecommendInfo(UserManager.similarUsers(WardrobeManager.user(wardrobeID)), taobaoItem)); //已改为多线程执行 //UserManager.setRecommend(userID,taobaoItem); } return(true); }
public Clothes(int id, string name, double strength, ClothesType clothesType) { this.id = id; this.name = name; this.strength = strength; this.clothesType = clothesType; }
public async Task AddAsync( string userId, string name, ClothesType type, int quantity, ClothesSize size, double singlePrice, string pictureUrl, string description) { var clothes = new Clothes { Name = name, Type = type, Quantity = quantity, Size = size, SinglePrice = singlePrice, PictureUrl = pictureUrl, Description = description, OwnerId = userId }; this.db.Add(clothes); await this.db.SaveChangesAsync(); }
public void UpdateSellingPrice(ClothesType type, decimal newPrice) { DbContext.GetClothes().ForEach(x => { x.UpdateSellingPrice(type, newPrice); }); }
public async Task <IActionResult> Edit(int id, [Bind("Name,Destinantion,ImageName,Id")] ClothesType clothesType) { if (id != clothesType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(clothesType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClothesTypeExists(clothesType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(clothesType)); }
public override void UpdateSellingPrice(ClothesType type, decimal newPrice) { if (type == ClothesType.TShirt) { SellPrice = newPrice; } }
public void EquipClothes(ClothesType clothesType) { foreach (var item in clothes) { item.SetActive(false); } clothes[(int)clothesType].SetActive(true); }
public ActionResult DeleteConfirmed(int id) { ClothesType clothesType = db.ClothesTypes.Find(id); db.ClothesTypes.Remove(clothesType); db.SaveChanges(); return(RedirectToAction("Index")); }
void OnGUI() { selectedClothesType = (ClothesType)EditorGUILayout.EnumPopup("type to create:", selectedClothesType); if (GUILayout.Button("Create")) { CreatePrefab(); } }
public Сlothes(string Name, float Durability, float Protection, float Prestige, ClothesType ClothesType, Mesh ItemMesh) { name = Name; protection = Protection; prestige = Prestige; durability = Durability; clothesType = ClothesType; itemMesh = ItemMesh; }
public ClothesInfoResponse(Clothes clothes) { id = clothes.id; name = clothes.name; type = clothes.type; thickness = clothes.thickness; lastWearingTime = (int)(DateTime.Now - clothes.lastWearingTime).TotalDays; wearingFrequency = clothes.wearingFrequency; }
/// <summary> /// Public Constructor for Clothes Items /// </summary> /// <param name="id">id for clothes item</param> /// <param name="name">name of clothes item</param> /// <param name="value">value of clothes item</param> /// <param name="type">type of clothes item</param> /// <param name="healthChange">health change for clothes item</param> /// <param name="manaChange">mana change for clothes item</param> /// <param name="mageSkillChange">mage skill change for clothes item</param> /// <param name="healerSkillChange">healer skill change for clothes item</param> /// <param name="experienceGain">experience gain for clothes item</param> /// <param name="description">description of clothes item</param> /// <param name="onUseMessage">Message for on use of clothes</param> public Clothes(int id, string name, int value, ClothesType type, int healthChange, int manaChange, int mageSkillChange, int healerSkillChange, int experienceGain, string description, string onUseMessage) : base(id, name, value, description, onUseMessage) { Type = type; HealthChange = healthChange; ManaChange = manaChange; MageSkillChange = mageSkillChange; HealerSkillChange = healerSkillChange; ExperienceGain = experienceGain; }
/// <summary> /// 初始化成员变量 /// </summary> /// <param name="_wardrobeID"></param> /// <param name="_name"></param> /// <param name="_type"></param> /// <param name="_thickness"></param> public Clothes(int _wardrobeID, string _name, ClothesType _type, int _thickness) { wardrobeID = _wardrobeID; name = _name; type = _type; color = 0; thickness = _thickness; lastWearingTime = DateTime.MinValue; wearingFrequency = 0; }
public ActionResult Edit([Bind(Include = "TypeID,TypeName")] ClothesType clothesType) { if (ModelState.IsValid) { db.Entry(clothesType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(clothesType)); }
public ActionResult Create([Bind(Include = "TypeID,TypeName")] ClothesType clothesType) { if (ModelState.IsValid) { db.ClothesTypes.Add(clothesType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(clothesType)); }
public async Task <ClothesTypeModel> DeleteClothesTypeAsync(int clothesTypeId) { ClothesType clothesType = await this._context.ClothesTypes.FindAsync(clothesTypeId); if (clothesType != null) { this._context.ClothesTypes.Remove(clothesType); await this._context.SaveChangesAsync(); } return(Mapper.Map <ClothesType, ClothesTypeModel>(clothesType)); }
/// <summary> /// Create clothes item. /// </summary> /// <param name="clothes">Clothes type.</param> /// <returns>CLothes item.</returns> public IClothes GetClothes(ClothesType clothes) { switch (clothes) { case ClothesType.TShirt: return(new TShirt()); case ClothesType.DShirt: return(new DShirt()); default: return(null); } }
public async Task SaveClothesTypeAsync(ClothesTypeModel clothesType) { if (clothesType.ClothesTypeId == 0) { this._context.ClothesTypes.Add(Mapper.Map <ClothesTypeModel, ClothesType>(clothesType)); } else { ClothesType newClothesType = await this._context.ClothesTypes.FindAsync(clothesType.ClothesTypeId); newClothesType.Name = clothesType.Name; } await this._context.SaveChangesAsync(); }
// GET: ClothesTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ClothesType clothesType = db.ClothesTypes.Find(id); if (clothesType == null) { return(HttpNotFound()); } return(View(clothesType)); }
/// <summary> /// Вывод списка одежды по полу /// </summary> public void GenderComboBoxLoad() { if (DBLists.ClothesTypeList != null) { DBLists.ClothesTypeList.Clear(); comboBoxPurpose.Items.Clear(); } string GenderBuf; GenderBuf = comboBoxGender.Text; SqlConnection connection = new SqlConnection(Connection.connectionString); try { connection.Open(); SqlCommand command = new SqlCommand(); command.CommandText = "SELECT * FROM ClothesType WHERE Gender=@Gender"; command.Connection = connection; SqlParameter GenderParam = new SqlParameter("@Gender", GenderBuf); command.Parameters.Add(GenderParam); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { DBLists.ClothesTypeList = new List <ClothesType>(); while (reader.Read()) { long id = reader.GetInt64(0); string Purpose = reader.GetString(1); string Gender = reader.GetString(2); ClothesType Element = new ClothesType(id, Purpose, Gender); comboBoxPurpose.Items.Add(Purpose); DBLists.ClothesTypeList.Add(Element); } } } catch (SqlException ex) { MessageBox.Show(ex.Message); } }
static void AddClothes(ref List <Clothes> clothes) { Random rnd = new Random(); int clothesEnumLength = Enum.GetValues(typeof(ClothesType)).Length; for (int i = 0; i < 10; i++) { ClothesType cl = (ClothesType)rnd.Next(0, clothesEnumLength); clothes.Add(new Clothes(i, cl.ToString(), rnd.Next(10, 90), cl)); } //int gainEnumLength = Enum.GetValues(typeof(GainType)).Length; //for (int i = 10; i < 16; i++) //{ // ClothesType cl = (ClothesType)rnd.Next(0, clothesEnumLength); // GainType gain = (GainType)rnd.Next(0, gainEnumLength); // clothes.Add(new MagicalClothes(rnd.Next(1, 5), gain, i, cl.ToString(), rnd.Next(10, 90), cl)); //} }
public async Task EditAsync( int id, string name, ClothesType type, int quantity, ClothesSize size, double singlePrice, string pictureUrl, string description) { var product = await this.db.Clothes.FindAsync(id); product.Name = name; product.Type = type; product.Quantity = quantity; product.Size = size; product.SinglePrice = singlePrice; product.PictureUrl = pictureUrl; product.Description = description; await this.db.SaveChangesAsync(); }
private Clothes AddClothes(ClothesType type, decimal buyPrice, Sizes size, Colors color, int amount) { Clothes clothes = null; switch (type) { case ClothesType.DressShirt: clothes = new DressShirt() { SellPrice = 8, }; break; case ClothesType.TShirt: clothes = new TShirt() { SellPrice = 12 }; break; } if (clothes == null) { throw new Exception("Cannot determine the clothes type"); } clothes.Amount = amount; clothes.Id = Guid.NewGuid().ToString(); clothes.BuyPrice = buyPrice; clothes.Color = color; clothes.Size = size; DbContext.AddClothes(clothes); return(clothes); }
public Clothes(ClothesType type, double price, int time) { this.Price = price; this.Type = type; this.CompleteTime = time; }
/// <inheritdoc /> public Trouser(int warm, string name, ClothesType type) : base(warm, name, type) { this.warm = 100; this.name = "裤子"; this._type = ClothesType.Trouser; }
/// <inheritdoc /> public Jacket(int warm, string name, ClothesType type) : base(warm, name, type) { this.name = "夹克"; this._type = ClothesType.Jacket; this.warm = 100;//基础 耐寒度为100 }
/// <inheritdoc /> protected Clothes(int warm, string name, ClothesType type) { this.warm = warm; this.name = name; _type = type; }
/// <inheritdoc /> public Briefs(int warm, string name, ClothesType type) : base(warm, name, type) { this.warm = 30; this.name = "内裤"; this._type = ClothesType.Briefs; }
/// <inheritdoc /> public Hat(int warm, string name, ClothesType type) : base(warm, name, type) { this.warm = 20; this.name = "帽子"; this._type = ClothesType.Hat; }
/// <summary> /// 按照指定衣物获取对应返回信息 /// </summary> /// <param name="clothes">指定的衣物</param> public ClothesResponse(Clothes clothes) { id = clothes.id; name = clothes.name; type = clothes.type; }