protected void Page_Load(object sender, EventArgs e) { _WarehouseId = AlwaysConvert.ToInt(Request.QueryString["WarehouseId"]); _Warehouse = WarehouseDataSource.Load(_WarehouseId); if (_Warehouse == null) { Response.Redirect("Default.aspx"); } Caption.Text = string.Format(Caption.Text, _Warehouse.Name); if (!Page.IsPostBack) { List <Warehouse> targets = new List <Warehouse>(); IList <Warehouse> allWarehouses = WarehouseDataSource.LoadAll(); foreach (Warehouse w in allWarehouses) { if (w.Id != AlwaysConvert.ToInt(_WarehouseId)) { targets.Add(w); } } if (targets.Count > 0) { NewWarehouse.DataSource = targets; NewWarehouse.DataBind(); } } FindAssignProducts1.AssignmentValue = _WarehouseId; FindAssignProducts1.OnAssignProduct += new AssignProductEventHandler(FindAssignProducts1_AssignProduct); FindAssignProducts1.OnLinkCheck += new AssignProductEventHandler(FindAssignProducts1_LinkCheck); FindAssignProducts1.OnCancel += new EventHandler(FindAssignProducts1_CancelButton); }
public async Task <IActionResult> AddNewWarehouse(NewWarehouse newwarehouse) { if (HttpContext.Session.GetString("Id") == null) { HttpContext.Session.Clear(); return(RedirectToAction("Index", "Account")); } await newwarehouse.AddWarehouse(_context); TempData["Message"] = "warehouse"; return(RedirectToAction("Index")); }