public bool SaveRecord(int?id, bool IsnewInventory = true) { if (saveSimpleButton.Tag == null) { if (m_AllowAdd == true) { saveSimpleButton.Tag = InventoryAdjustmentBLL.GetNewInventoryAdjustmentID(); } else { return(false); } } if (m_Adjustment.UpdateInventoryAdjustment(Convert.ToInt32(saveSimpleButton.Tag), adjustmentDateEdit.DateTime, Convert.ToInt32(customerLookUpEdit.EditValue), Convert.ToInt32(itemLookUpEdit.EditValue), Convert.ToSingle(originalQtyTextEdit.EditValue), Convert.ToSingle(newQtyTextEdit.EditValue), Convert.ToString(reasonMemoExEdit.EditValue), Convert.ToInt32(locationLookUpEdit.EditValue), Convert.ToString(originalLotLookUpEdit.EditValue), newLotTextEdit.Text, Utilities.ChangeType <int?>(lpnLookUpEdit.EditValue), Utilities.ChangeType <DateTime?>(originalLotLookUpEdit.GetColumnValue("Expr")), IsnewInventory) != true) { MessageBox.Show("The adjustment record was not updated succesfully.", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else if (m_newLpn && !string.IsNullOrEmpty(originalLotLookUpEdit.Text)) { LocationInventoryByLot Lpntodelete = Session.DefaultSession.FindObject <LocationInventoryByLot>(new GroupOperator(GroupOperatorType.And, new BinaryOperator(LocationInventoryByLot.Fields.LPNNumber.PropertyName, (object)Utilities.ChangeType <int?>(lpnLookUpEdit.EditValue), BinaryOperatorType.Equal), new BinaryOperator(LocationInventoryByLot.Fields.QuantityOnHand.PropertyName, 0, BinaryOperatorType.Equal), new BinaryOperator("LocationInventoryLot", "", BinaryOperatorType.Equal))); if (Lpntodelete != null) { Lpntodelete.Delete(); Session.DefaultSession.PurgeDeletedObjects(); } } printLpn(); inventoryXPView.Reload(); return(true); }
private void InventoryAdjustmentXtraForm_Load(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; CheckPermissions(); //Dim fullLPN As String //fullLPN = CustomersBLL.GetLPNPrefix(7) & Strings.Right("0000000000" & "", Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString)) //lpnLookUpEdit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric //lpnLookUpEdit.Properties.DisplayFormat.FormatString = CustomersBLL.GetLPNPrefix(7) & "{0:D" & Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString) & "}" //lpnXpView.Properties.Add(New ViewProperty("LPN", SortDirection.None, "'" & CustomersBLL.GetLPNPrefix(7) & "' + RIGHT(CONCAT('0000000000',LPNNumber)," & Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString) & ")", True, True)) m_Items = new ItemsBLL(); m_Customers = new CustomersBLL(); m_Adjustment = new InventoryAdjustmentBLL(); PrepareNewRecord(); SetDefaultViewFilter(); FillAdjustmentView(); FilterLpns(); Cursor = Cursors.Default; }
private void deleteRepositoryItemButtonEdit_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete this record?", "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (InventoryAdjustmentBLL.DeleteInventoryAdjustment(Convert.ToInt32(adjustmentGridView.GetFocusedRowCellValue(idGridColumn))) != true) { MessageBox.Show("The adjustment record was not deleted succesfully.", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } inventoryXPView.Reload(); }
public bool ValidateRecord() { if (itemLookUpEdit.EditValue == null || (itemLookUpEdit.EditValue == null ? null : Convert.ToString(itemLookUpEdit.EditValue)) == itemLookUpEdit.Properties.NullText) { MessageBox.Show("You must select a Item Code."); itemLookUpEdit.Focus(); return(false); } if (string.IsNullOrEmpty(newQtyTextEdit.Text) && string.IsNullOrEmpty(newLotTextEdit.Text)) { MessageBox.Show("You must enter a new quantity or lot."); newQtyTextEdit.Focus(); return(false); } else if (!string.IsNullOrEmpty(newQtyTextEdit.Text) && !string.IsNullOrEmpty(newLotTextEdit.Text)) { if (saveSimpleButton.Tag != null && newQtyTextEdit.Text == "0") { newQtyTextEdit.Text = null; } else { MessageBox.Show("You cant update quantity and lot at once."); newQtyTextEdit.Focus(); return(false); } } if (originalLotLookUpEdit.EditValue == null && lpnLookUpEdit.EditValue != null) { MessageBox.Show("You must select a Lot."); originalLotLookUpEdit.Focus(); return(false); } if (!string.IsNullOrEmpty(newLotTextEdit.Text) && LotCodeValidator.ValidateByItemID(Convert.ToInt32(itemLookUpEdit.GetColumnValue("ItemID")), newLotTextEdit.Text, true) == false) { MessageBox.Show("Lot code invalid."); newLotTextEdit.Focus(); return(false); } if (string.IsNullOrEmpty(Convert.ToString(reasonMemoExEdit.EditValue)) == true) { if (MessageBox.Show(string.Format("The reason field is empty. {0} Do you want to save the record.", Environment.NewLine), "Save Adjustment", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) { return(false); } else { } } if (locationLookUpEdit.EditValue == null || (locationLookUpEdit.EditValue == null ? null : Convert.ToString(locationLookUpEdit.EditValue)) == locationLookUpEdit.Properties.NullText) { MessageBox.Show("You must select a Location."); locationLookUpEdit.Focus(); return(false); } if (saveSimpleButton.Tag == null) { if (m_AllowAdd == true) { saveSimpleButton.Tag = InventoryAdjustmentBLL.GetNewInventoryAdjustmentID(); } else { return(false); } } return(true); }