void loadListitem() { WareHouse ser=new WareHouse(); string[] a=ser.ReturnItem(); NuItem=(a.Length+1)/9; listItem=new item[(a.Length+1)/9]; for(int i=0;i<(a.Length+1)/9;i++) { listItem[i] = new item(1,"Cake", 80, 100, 20, 0, 0f, 0f, "image20"); listItem[i].id=int.Parse(a[i*9+0]); listItem[i].name=a[i*9+1]; listItem[i].priceSell=int.Parse(a[i*9+2]); listItem[i].priceBuy=int.Parse(a[i*9+3]); listItem[i].valueMana=int.Parse(a[i*9+4]); listItem[i].valueBlood=int.Parse(a[i*9+5]); listItem[i].percentAttack=int.Parse(a[i*9+6]); listItem[i].percentDefence=int.Parse(a[i*9+7]); listItem[i].avatar=a[i*9+8]; print(listItem[i].name); } /* listItem = new item[3]; //load skills from database listItem[0] = new item("Cake", 80, 100, 20, 0, 0f, 0f, "image20"); listItem[1] = new item("Cake", 80, 100, 20, 0, 0f, 0f, "image20"); listItem[2] = new item("Cake", 80, 100, 20, 0, 0f, 0f, "image20"); */ }
public IActionResult Detail(WareHouse wareHouse) { if (!_permissionService.Authorize("EditWareHouse")) { return(View("_AccessDeniedView")); } var result = _wareHouseService.GetCountByCode(wareHouse.Code); var data = result.ToList().Where(r => r.Id != wareHouse.Id); if (data.Count() > 0) { return(Error("已有相同编码仓库")); } _wareHouseService.UpdateWareHouse(wareHouse); return(Success()); }
// GET: WareHouses/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WareHouse wareHouse = db.WareHouses.Find(id); if (wareHouse == null) { return(HttpNotFound()); } ViewBag.CityId = new SelectList(db.Cities, "CityId", "Name", wareHouse.CityId); ViewBag.CompanyId = new SelectList(db.Companies, "CompanyId", "Name", wareHouse.CompanyId); return(View(wareHouse)); }
// GET: /Category/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest)); } WareHouse oWareHouse = db.GetById(id); if (oWareHouse == null) { return(HttpNotFound()); } var result = AutoMapper.Mapper.Map <WareHouse, WareHouseResponse>(oWareHouse); return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Method to ADD WareHouse details to the list /// </summary> /// <param name="ware">Represents warehouse object</param> public void AddWareHouse(WareHouse ware) { try { //WareHouse Id should not be null if (ware.WareHouseId != null) { //Calls the AddWareHouse method of WareHouse Data Layer WareHouseDataAccessLayer.AddWareHouse(ware); } } catch (WareHouseException ex) { throw new WareHouseException(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public bool DeleteWareHouse(Guid id) { bool isDeleted = false; using (var context = new SCMSEntities()) { WareHouse wareHouse = context.WareHouses.Single(c => c.Id.Equals(id)); context.WareHouses.Remove(wareHouse); if (context.SaveChanges() > 0) { SessionData.CurrentSession.WarehouseList = null; isDeleted = true; } } return(isDeleted); }
/// <summary> ///Method to UPDATE ManagerName /// </summary> /// <param name="wareHouse">Represents the WareHouse object</param> public void UpdateManagerName(WareHouse wareHouse) { try //WareHouse Id should not be null { if (wareHouse.WareHouseId != null) { //Calls the UpdateManagerName method of WareHouse Data Layer WareHouseDataAccessLayer.UpdateManagerName(wareHouse); } } catch (WareHouseException ex) { throw new WareHouseException(ex.Message); } }
private void SetSelectedUsersEnableStatus(bool enabled) { string isUsed = enabled ? "2" : "1"; // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames) List <int> ids = GetSelectedDataKeyIDs(Grid1); // 执行数据库操作 foreach (int ID in ids) { WareHouse entity = Core.Container.Instance.Resolve <IServiceWareHouse>().GetEntity(ID); entity.IsUsed = int.Parse(isUsed); Core.Container.Instance.Resolve <IServiceWareHouse>().Update(entity); } // 重新绑定表格 BindGrid(); }
public void MissionControllerDisplaysSuccessMessage() { var army = new Army(); var warehouse = new WareHouse(); var missionController = new MissionController(army, warehouse); var mission = new Easy(1); string result = ""; for (int counter = 0; counter < 4; counter++) { result = missionController.PerformMission(mission); } Assert.IsTrue(result.Contains("completed")); }
public IActionResult Upsert(int?id) { WareHouse wareHouse = new WareHouse(); if (id == null) { return(View(wareHouse)); } wareHouse = _unitOfWork.WareHouse.Get(id.GetValueOrDefault()); if (wareHouse == null) { return(NotFound()); } return(View(wareHouse)); }
public void MissionCtrollerDisplaysFailMessage() { var army = new Army(); var wareHourse = new WareHouse(); var missionController = new MissionController(army, wareHourse); var mission = new Easy(1); string result = ""; for (int i = 0; i < 4; i++) { result = missionController.PerformMission(mission); } Assert.IsTrue(result.StartsWith("Mission declined")); }
public static void Main() { IWriter writer = new ConsoleWriter(); IReader reader = new ConsoleReader(); IArmy army = new Army(); IAmmunitionFactory amunitionFactory = new AmmunitionFactory(); IMissionFactory missionFactory = new MissionFactory(); ISoldierFactory soldierFactory = new SoldierFactory(); IWareHouse wareHouse = new WareHouse(amunitionFactory); IMissionController missionController = new MissionController(army, wareHouse); IGameController gameController = new GameController(missionController, soldierFactory, missionFactory, writer, wareHouse, army); IEngine engine = new Engine(reader, writer, missionController, gameController , army, wareHouse, soldierFactory, missionFactory, amunitionFactory); engine.Run(); }
public void MissionControllerDisplaysFailMessage() { var army = new Army(); var wareHouse = new WareHouse(); var missionController = new MissionController(army, wareHouse); var mission = new Easy(1); string result = ""; for (int counter = 0; counter < 4; counter++) { result = missionController.PerformMission(mission); } Assert.IsTrue(result.StartsWith("Mission declined - Suppression of civil rebellion")); }
public new static Company Load(BinaryReader reader) { CompType subType = (CompType)reader.ReadInt32(); int capacity = reader.ReadInt32(); Company ret = null; switch (subType) { case CompType.WAREHOUSE: ret = WareHouse.Load(reader); break; } ret.subType = subType; ret.Capacity = capacity; return(ret); }
public ActionResult DeleteConfirmed(int id) { WareHouse wareHouse = db.WareHouse.Find(id); try { db.WareHouse.Remove(wareHouse); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception) { ViewBag.Error = true; return(View("Delete")); } }
void FormWareHouseLoad(object sender, EventArgs e) { //如果是修改,把原来的数据填写进去 if (this.Text == "仓库信息-修改") { textBoxWareHouseID.Text = i_WareHouseID.ToString(); WareHouse tP = BLL.WareHouseBLL.GetWareHouse(i_WareHouseID); textBoxWareHouseName.Text = tP.WareHouseName; this.ActiveControl = textBoxWareHouseName; } else { this.ActiveControl = textBoxWareHouseName; } }
public void UpdateWareHouse(WareHouse wareHouses) { if (wareHouses == null) { throw new ArgumentException("wareHouses"); } var data = _omsAccessor.Get <WareHouse>().Where(r => r.Id == wareHouses.Id).FirstOrDefault(); data.Code = wareHouses.Code.Trim(); data.Name = wareHouses.Name.Trim(); data.IsSyncStock = wareHouses.IsSyncStock; data.WareHouseType = wareHouses.WareHouseType; wareHouses.ModifiedBy = _workContext.CurrentUser.Id; _omsAccessor.Update(data); _omsAccessor.SaveChanges(); }
public bool Add(WareHouse wareHouse) { if (wareHouse == null) { throw new ArgumentException("WareHouse"); } wareHouse.Isvalid = true; wareHouse.CreatedBy = _workContext.CurrentUser.Id; wareHouse.Code = wareHouse.Code.Trim(); wareHouse.Name = wareHouse.Name.Trim(); wareHouse.ModifiedTime = DateTime.Now; wareHouse.CreatedTime = DateTime.Now; _omsAccessor.Insert(wareHouse); _omsAccessor.SaveChanges(); return(true); }
public static void Main() { //List<ISoldier> armyColection = new List<ISoldier>(); //Dictionary<string, int> warehouseColection = new Dictionary<string, int>(); IReader reader = new ConsoleReader(); IWriter writer = new ConsoleWriter(); ISoldierFactory soldierFactory = new SoldierFactory(); IAmmunitionFactory ammunitionFactory = new AmmunitionFactory(); IMissionFactory missionFactory = new MissionFactory(); IArmy army = new Army(); IWareHouse warehouse = new WareHouse(); GameController gameController = new GameController(army, warehouse, soldierFactory, ammunitionFactory, missionFactory, writer); IEngine engine = new Engine(reader, writer, gameController); engine.Run(); }
public ActionResult DeleteConfirmed(int id) { WareHouse wareHouse = db.WareHouses.Find(id); db.WareHouses.Remove(wareHouse); var responseSave = DBHelper.SaveChanges(db); if (responseSave.Succeeded) { return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, responseSave.Message); return(View(wareHouse)); }
public IActionResult Edit(WareHouse wh) { if (_context.Warehouses.FirstOrDefault(w => w.Number == wh.Number && w.Id != wh.Id) != null) { ModelState.AddModelError("", "The number of warehouse already exists"); } if (ModelState.IsValid) { _context.Warehouses.Update(wh); _context.SaveChanges(); var user = _context.Users.Find(User.FindFirst(ClaimTypes.NameIdentifier).Value); _log.LogInformation("Edited warehouse.User: "******"Index")); } return(View()); }
/// <summary> /// 获取仓库列表 /// </summary> /// <param name="keyWords">关键词</param> /// <param name="pageSize">每页条数</param> /// <param name="pageIndex">页码</param> /// <param name="totalCount">总记录数</param> /// <param name="pageCount">总页数</param> /// <param name="clientID">客户端ID</param> /// <returns></returns> public List <WareHouse> GetWareHouses(string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientID) { var dal = new WarehouseDAL(); DataSet ds = dal.GetWareHouses(keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, clientID); List <WareHouse> list = new List <WareHouse>(); foreach (DataRow dr in ds.Tables[0].Rows) { WareHouse model = new WareHouse(); model.FillData(dr); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); list.Add(model); } return(list); }
public void TestSuccessMessage() { var army = new Army(); var af = new AmmunitionFactory(); var wareHouse = new WareHouse(af); var soldierFactory = new SoldierFactory(); var missionFactory = new MissionFactory(); var missionController = new MissionController(army, wareHouse); var writer = new ConsoleWriter(); var gamecontroller = new GameController(army, wareHouse, missionController, soldierFactory, missionFactory, writer); var mission = new Easy(0); var result = missionController.PerformMission(mission).Trim(); Assert.That(result, Is.EqualTo("Mission completed - Suppression of civil rebellion")); }
// GET: WareHouses/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WareHouse wareHouse = db.WareHouses.Find(id); if (wareHouse == null) { return(HttpNotFound()); } ViewBag.CityId = new SelectList(CombosHelper.GetCities(), "CityId", "Name", wareHouse.CityId); ViewBag.DepartmentsId = new SelectList(CombosHelper.GetDepartments(), "DepartmentsId", "Name", wareHouse.DepartmentsId); return(View(wareHouse)); }
static void Main() { var wareHouse = new WareHouse(); var ammunitionFactory = new AmmunitionFactory(); var soldiersFactory = new SoldierFactory(); var missionFactory = new MissionFactory(); var reader = new ConsoleReader(); var writer = new ConsoleWriter(); var army = new Army(wareHouse); var gameController = new GameController(wareHouse, ammunitionFactory, soldiersFactory, army, missionFactory, writer); var engine = new Engine(gameController, reader, writer); engine.Run(); }
public static void LoadData() { SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("box"); reader.Read(); while (reader.Read()) { WareHouse ware = new WareHouse(); ware.m_ID = Convert.ToInt32(reader.GetString(reader.GetOrdinal("boxid"))); string strTemp = reader.GetString(reader.GetOrdinal("position")); if (strTemp != "0") { string[] pos = strTemp.Split(','); if (pos.Length < 3) { Debug.LogError("Mission's LookPosition is Error"); } float x = Convert.ToSingle(pos[0]); float y = Convert.ToSingle(pos[1]); float z = Convert.ToSingle(pos[2]); ware.m_Pos = new Vector3(x, y, z); } strTemp = reader.GetString(reader.GetOrdinal("rotation")); if (strTemp != "0") { string[] pos = strTemp.Split(','); if (pos.Length < 4) { Debug.LogError("Mission's LookPosition is Error"); } float x = Convert.ToSingle(pos[0]); float y = Convert.ToSingle(pos[1]); float z = Convert.ToSingle(pos[2]); float w = Convert.ToSingle(pos[3]); ware.m_Rotation = new Quaternion(x, y, z, w); } ware.m_itemsDesc = reader.GetString(reader.GetOrdinal("itemlist")); m_WareHouseMap.Add(ware.m_ID, ware); } }
public void MissionControllerDisplaysFailMessage() { var army = new Army(); var warehouse = new WareHouse(new AmmunitionFactory()); var missionController = new MissionController(army, warehouse); var mission = new Easy(1); string result = string.Empty; for (int i = 0; i < 4; i++) { result = missionController.PerformMission(mission); } Assert.IsTrue(result.Contains("Mission declined - Suppression of civil rebellion")); }
private void LoadInfo(string ItemID) { using (GoldEntities context = new GoldEntities()) { WareHouse existModel = (from r in context.WareHouse where r.WHCode == ItemID select r).FirstOrDefault(); if (existModel != null) { tbxWHCode.Text = existModel.WHCode; tbxWHName.Text = existModel.WHName; DropDownList_WHType.SelectedIndex = DropDownList_WHType.Items.IndexOf(DropDownList_WHType.Items.FindByValue(existModel.WHType.Value.ToString())); DropDownList_Enabled.SelectedIndex = DropDownList_Enabled.Items.IndexOf(DropDownList_Enabled.Items.FindByValue(existModel.Enabled.Value.ToString())); tbxAddress.Text = existModel.Address; tbxPhone.Text = existModel.Phone; tbxComment.Text = existModel.Comment; } } }
protected override object GetItemFromInput() { WareHouse info; if (UpdatingItem == null) { info = new WareHouse(); } else { info = UpdatingItem as WareHouse; } info.ID = txtID.Text != "自动创建" ? txtID.Text : string.Empty; info.Name = txtName.Text; info.Memo = txtMemo.Text; return(info); }
public void InitializeTests() { this.army = new Army(); this.warehouse = new WareHouse(); this.ammoFactory = new AmmunitionFactory(); var soldier = new Corporal("Ivan", 30, 25.5, 100.0); var missingWeapons = soldier.Weapons.Keys.ToList(); foreach (var weaponKey in missingWeapons) { soldier.Weapons[weaponKey] = this.ammoFactory.CreateAmmunition(weaponKey); } this.army.AddSoldier(soldier); this.mc = new MissionController(this.army, this.warehouse); }
public IActionResult Upsert(WareHouse wareHouse) { if (ModelState.IsValid) { if (wareHouse.Id == 0) { _unitOfWork.WareHouse.Add(wareHouse); } else { _unitOfWork.WareHouse.Update(wareHouse); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } return(View(wareHouse)); }
//När användaren trycker på knappen Lägg till //Läs all indata från GUI i ett lokalt objekt av fastighet //Gör indata kontroll //Spara objektet i fastighetMngr private void btnAdd_Click(object sender, EventArgs e) { Estate estate; //holder for input - create in ReadInput //Send this object to ReadInput //for filling in values (input) //out tells ReadInput that the variable //is data out. All changes to this object //comes back here. //ReadInput creates all data used for the common fields of all estates. //The special for each are filled in later in the switch case. bool ok = ReadInput(out estate); if (ok) //If all common data (in variable estate) is OK { // Now create a correct estate according to the type combo switch ((EstateType)cmbTyp.SelectedIndex) { case EstateType.WareHouse: { // Use a copy constructor to set a warehouse with common data WareHouse wHouse = new WareHouse(estate); // If more data in GUI to fill in for this estate, do it here //Then send it to the manager for adding to the list estateMngr.Add(wHouse); break; } case EstateType.Villa: { // Same procedure all different types of estates Villa vHouse = new Villa(estate); // But here we need to add landSize size bool landSizeOk = false; vHouse.LandSize = ReadLandSize(out landSizeOk); if (!landSizeOk) return; estateMngr.Add(vHouse); break; } case EstateType.Store: { Store store = new Store(estate); estateMngr.Add(store); break; } case EstateType.RowHouse: { RowHouse rHouse = new RowHouse(estate); // Here we need to add landSize size bool gardenok = false; rHouse.LandSize = ReadLandSize(out gardenok); if (!gardenok) return; estateMngr.Add(rHouse); break; } case EstateType.Apartment: { Apartment apart = new Apartment(estate); // We need to add floor bool floorok = false; apart.Floor = ReadFloor(out floorok); if (!floorok) return; estateMngr.Add(apart); break; } } //Then Update the GUI UpdateResults(); } }
void OnGUI() { GUI.skin = skin; GUI.Box(new Rect(55, 0, 370, 30), titleName, "Title"); GUI.Label(new Rect(430, 0, 50, 50), iconScene, "LabelNormal"); if(!GS.showingItemDetail) { if(!GS.pressAvatar) { GS.DrawAvatar(); //draw percent of wareHouse GUI.Label(new Rect(50, 35, 150, 25), "Money: "+ GS.money); GS.drawStretch(1, new Rect(200, 35, 200, 25), GS.currentWareHouse, GS.wareHouse, true); GUIStyle style = new GUIStyle(GUI.skin.customStyles[2]); style.fontSize = 18; style.fontStyle = FontStyle.Bold; if(NuItem>0) { GUI.Label(new Rect(50, 60, 70, 30), " Name ", style); GUI.Label(new Rect(120, 60, 55, 30), "| Price ", style); GUI.Label(new Rect(175, 60, 70, 30), "| vMana ", style); GUI.Label(new Rect(245, 60, 70, 30), "| vBlood ", style); GUI.Label(new Rect(315, 60, 75, 30), "| %Attack ", style); GUI.Label(new Rect(390, 60, 90, 30), "| %Defence", style); GUI.Box(new Rect(-5, 80, 485, 200), "", "BoxGroup1"); scrollViewVector = GUI.BeginScrollView (new Rect(6, 88, 465, 177), scrollViewVector, new Rect (0, 0, 449, (50*NuItem>177)?(50*NuItem):178)); //63 is height of a skill row for(int i = 0; i<NuItem; i++) { drawItemRow(i, 449, 50); } GUI.EndScrollView(); } else{ GUI.Box(new Rect(0, 50, 476, 220), "You have no skill", "BoxGroup1"); } GUI.Label(new Rect(10, 270, 50, 50), iconBack); if(GUI.Button(new Rect(10, 270, 50, 50), "", "ButtonCover")) { Application.LoadLevel("Screen10"); } if(GUI.Button(new Rect(190, 275, 100, 40), "Buy", "ButtonGeneral")) { if(selectingItem!=-1 && GS.money>=listItem[selectingItem].priceBuy) { GS.money -= listItem[selectingItem].priceBuy; WareHouse ser=new WareHouse(); //update money int a=ser.UpdateMoneyUser(GS.idUser,GS.money); //update ware house a=ser.BuyItem(GS.idUser,listItem[selectingItem].id); } else { showMoneyLow =true; } } if(GUI.Button(new Rect(420, 270, 50, 50), "", "buttonMore")) { if(selectingItem!=-1) { GS.loadItemDetail(selectingItem); GS.showingItemDetail = true; } } } else{ GS.PressAvatar(); } } else { GS.showItemDetail(); } }