protected void SaveItem_Click(object sender, EventArgs e) { try { FacadeManager facade = new FacadeManager(); IShoppingCart cartItem = new ShoppingCartManager(); cartItem.ItemID = hdnItemID.Value; cartItem.ItemCode = txtStdMatCode.Text; cartItem.Description = txtStdDescription.Text; cartItem.Quantity = txtStdQuantiry.Text.Replace(",", "."); cartItem.Remark = txtStdRemark.Text; cartItem.ProductNotes = txtStdProdNote.Text; facade.UpdateShoppingCartItem(cartItem); EditingGrid currentGrid = (EditingGrid)Enum.Parse(typeof(EditingGrid), hdnCurrentGrid.Value); if (EditingGrid.SPECIAL == currentGrid) { FillShoppingCartSpecialData(); } else { FillShoppingCartStandardData(); } PopulateOrderDetail(); udpShoppingCart.Update(); mpeStandardItem.Hide(); } catch (Exception ex) { } }
private void MainEditorPanel_DragDrop(object sender, DragEventArgs e) { var agentDropped = e.Data.GetData(e.Data.GetFormats()[0]) as Agent; //Getting dropped data var newCoords = MainEditorPanel.PointToClient(new Point(e.X, e.Y)); //Getting client coords from screen var cellToEdit = EditingGrid.GetCellByXYCoord(newCoords.X - totalShiftVector.X, newCoords.Y - totalShiftVector.Y); //Getting cell from coords to add agent in it if (cellToEdit != null) { cellToEdit.InnerAgent = agentDropped; EditingGrid.AddOrReplaceCell(cellToEdit); } MainEditorPanel.Refresh(); }
/// <summary> /// Used for dragging and for updating mouse coords in the tool bar /// </summary> private void MainEditorPanel_MouseMove(object sender, MouseEventArgs e) { var currentCell = EditingGrid.GetCellByXYCoord(e.X - totalShiftVector.X, e.Y - totalShiftVector.Y); //Current cell that is covered with mouse if (currentTileBrush != null && currentCell != null) { brushCovering = EditingGrid.GetCellNeighboursOfRadius(currentCell, currentTileBrush.Size); #region Left mouse button for tile drawing if (leftMouseButtonInMapIsPressed) { foreach (var cell in brushCovering) { cell.PresentedTile = currentTileBrush.CurrentTile; EditingGrid.AddOrReplaceCell(cell); } } #endregion MainEditorPanel.Refresh(); } if (MouseCoordsChanged != null) { var newMouseEventArgs = new MouseEventArgs(e.Button, e.Clicks, e.X - totalShiftVector.X, e.Y - totalShiftVector.Y, e.Delta); MouseCoordsChanged(this, newMouseEventArgs); } #region Middle mouse button for dragging if (middleMouseButtonInMapIsPressed) { dragVector.X = e.X - mouseDownPoint.X; dragVector.Y = e.Y - mouseDownPoint.Y; MainEditorPanel.Refresh(); } #endregion }
/// <summary> /// Used for ending dragging and for cells selecting /// </summary> private void MainEditorPanel_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Middle) { shiftVector.X += dragVector.X; shiftVector.Y += dragVector.Y; dragVector = new Point(0, 0); middleMouseButtonInMapIsPressed = false; } if (e.Button == MouseButtons.Left) { leftMouseButtonInMapIsPressed = false; } if (e.Button == MouseButtons.Right) { var cellUnderMouse = EditingGrid.GetCellByXYCoord(e.X - totalShiftVector.X, e.Y - totalShiftVector.Y); contextMenuCellSelect.Checked = selectedCells.Contains(cellUnderMouse) ? true : false; contextMenuCell.Tag = cellUnderMouse; contextMenuCell.Show(Cursor.Position); } }