/// <summary> /// This method will return a list of objects representing all records in the table. /// </summary> /// /// <returns>list of objects of class INVAdjustStock in the form of object of INVAdjustStockCollection </returns> public INVAdjustStockCollection SelectAll() { INVAdjustStockCollection iNVAdjustStockCollection = new INVAdjustStockCollection(); foreach (POS.DataLayer.INVAdjustStock _iNVAdjustStock in POS.DataLayer.INVAdjustStockBase.SelectAll()) { _iNVAdjustStockWCF = new INVAdjustStock(); _iNVAdjustStockWCF.AdjustStockID = _iNVAdjustStock.AdjustStockID; _iNVAdjustStockWCF.ProductID = _iNVAdjustStock.ProductID; _iNVAdjustStockWCF.BatchID = _iNVAdjustStock.BatchID; _iNVAdjustStockWCF.Qty = _iNVAdjustStock.Qty; _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID; _iNVAdjustStockWCF.CreatedBy = _iNVAdjustStock.CreatedBy; _iNVAdjustStockWCF.CredateDate = _iNVAdjustStock.CredateDate; _iNVAdjustStockWCF.UpdatedBy = _iNVAdjustStock.UpdatedBy; _iNVAdjustStockWCF.UpdateDate = _iNVAdjustStock.UpdateDate; _iNVAdjustStockWCF.StockTypeID = _iNVAdjustStock.StockTypeID; _iNVAdjustStockWCF.OldStockTypeID = _iNVAdjustStock.OldStockTypeID; _iNVAdjustStockWCF.InventoryID = _iNVAdjustStock.InventoryID; _iNVAdjustStockWCF.ExpiryDate = _iNVAdjustStock.ExpiryDate; _iNVAdjustStockWCF.BatchNumber = _iNVAdjustStock.BatchNumber; iNVAdjustStockCollection.Add(_iNVAdjustStockWCF); } return(iNVAdjustStockCollection); }
/// <summary> /// This method will return a list of objects representing the specified number of entries from the specified record number in the table. /// </summary> /// /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// /// <returns>list of objects of class INVAdjustStock in the form of an object of class INVAdjustStockCollection </returns> public INVAdjustStockCollection SelectAllPaged(int?pageSize, int?skipPages, string orderByStatement) { INVAdjustStockCollection iNVAdjustStockCollection = new INVAdjustStockCollection(); foreach (POS.DataLayer.INVAdjustStock _iNVAdjustStock in POS.DataLayer.INVAdjustStockBase.SelectAllPaged(pageSize, skipPages, orderByStatement)) { _iNVAdjustStockWCF = new INVAdjustStock(); _iNVAdjustStockWCF.AdjustStockID = _iNVAdjustStock.AdjustStockID; _iNVAdjustStockWCF.ProductID = _iNVAdjustStock.ProductID; _iNVAdjustStockWCF.BatchID = _iNVAdjustStock.BatchID; _iNVAdjustStockWCF.Qty = _iNVAdjustStock.Qty; _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID; _iNVAdjustStockWCF.CreatedBy = _iNVAdjustStock.CreatedBy; _iNVAdjustStockWCF.CredateDate = _iNVAdjustStock.CredateDate; _iNVAdjustStockWCF.UpdatedBy = _iNVAdjustStock.UpdatedBy; _iNVAdjustStockWCF.UpdateDate = _iNVAdjustStock.UpdateDate; _iNVAdjustStockWCF.StockTypeID = _iNVAdjustStock.StockTypeID; _iNVAdjustStockWCF.OldStockTypeID = _iNVAdjustStock.OldStockTypeID; _iNVAdjustStockWCF.InventoryID = _iNVAdjustStock.InventoryID; _iNVAdjustStockWCF.ExpiryDate = _iNVAdjustStock.ExpiryDate; _iNVAdjustStockWCF.BatchNumber = _iNVAdjustStock.BatchNumber; iNVAdjustStockCollection.Add(_iNVAdjustStockWCF); } return(iNVAdjustStockCollection); }
/// <summary> /// This method will return a list of objects representing the specified number of entries from the specified record number in the table /// using the value of the field specified /// </summary> /// /// <param name="field" type="string">Field of the class INVAdjustStock</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// <param name="fieldValue2" type="object">Value for the field specified.</param> /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// /// <returns>List of object of class INVAdjustStock in the form of an object of class INVAdjustStockCollection</returns> public INVAdjustStockCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement) { INVAdjustStockCollection iNVAdjustStockCollection = new INVAdjustStockCollection(); foreach (POS.DataLayer.INVAdjustStock _iNVAdjustStock in POS.DataLayer.INVAdjustStockBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement)) { _iNVAdjustStockWCF = new INVAdjustStock(); _iNVAdjustStockWCF.AdjustStockID = _iNVAdjustStock.AdjustStockID; _iNVAdjustStockWCF.ProductID = _iNVAdjustStock.ProductID; _iNVAdjustStockWCF.BatchID = _iNVAdjustStock.BatchID; _iNVAdjustStockWCF.Qty = _iNVAdjustStock.Qty; _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID; _iNVAdjustStockWCF.CreatedBy = _iNVAdjustStock.CreatedBy; _iNVAdjustStockWCF.CredateDate = _iNVAdjustStock.CredateDate; _iNVAdjustStockWCF.UpdatedBy = _iNVAdjustStock.UpdatedBy; _iNVAdjustStockWCF.UpdateDate = _iNVAdjustStock.UpdateDate; _iNVAdjustStockWCF.StockTypeID = _iNVAdjustStock.StockTypeID; _iNVAdjustStockWCF.OldStockTypeID = _iNVAdjustStock.OldStockTypeID; _iNVAdjustStockWCF.InventoryID = _iNVAdjustStock.InventoryID; _iNVAdjustStockWCF.ExpiryDate = _iNVAdjustStock.ExpiryDate; _iNVAdjustStockWCF.BatchNumber = _iNVAdjustStock.BatchNumber; iNVAdjustStockCollection.Add(_iNVAdjustStockWCF); } return(iNVAdjustStockCollection); }
public FrmAdjustStockAddEdit(FrmAdjustmentSearch frmAdjustmentSearch) { InitializeComponent(); this._invProductStockWrapper = new INVProductStockWrapper(); this._inventoryWrapper = new INVInventoryWrapper(); this._stockTypeWrapper = new INVStockTypeWrapper(); this._adjustStockReasonWrapper = new INVAdjustStockReasonWrapper(); this._adjustStockWrapper = new INVAdjustStockWrapper(); this._adjustStock = new INVAdjustStock(); this._ProductWrapper = new BDProductWrapper(); this._adjustStockCollection = new INVAdjustStockCollection(); this._isEdit = false; this._frmAdjustmentSearch = frmAdjustmentSearch; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// /// <param name="iNVAdjustStock" type="INVAdjustStock">This INVAdjustStock will be inserted in the database.</param> /// /// <returns>True if succeeded</returns> public bool Insert(INVAdjustStock iNVAdjustStock) { _iNVAdjustStock = new POS.DataLayer.INVAdjustStock(); _iNVAdjustStock.AdjustStockID = iNVAdjustStock.AdjustStockID; _iNVAdjustStock.ProductID = iNVAdjustStock.ProductID; _iNVAdjustStock.BatchID = iNVAdjustStock.BatchID; _iNVAdjustStock.Qty = iNVAdjustStock.Qty; _iNVAdjustStock.AdjustReasonID = iNVAdjustStock.AdjustReasonID; _iNVAdjustStock.CreatedBy = iNVAdjustStock.CreatedBy; _iNVAdjustStock.CredateDate = iNVAdjustStock.CredateDate; _iNVAdjustStock.UpdatedBy = iNVAdjustStock.UpdatedBy; _iNVAdjustStock.UpdateDate = iNVAdjustStock.UpdateDate; return(_iNVAdjustStock.Insert()); }
///<summary> /// This method will update one new row into the database using the property Information /// </summary> /// /// <param name="iNVAdjustStock" type="INVAdjustStock">This INVAdjustStock will be updated in the database.</param> /// /// <returns>True if succeeded</returns> public bool Update(INVAdjustStock iNVAdjustStock) { _iNVAdjustStock = POS.DataLayer.INVAdjustStock.SelectOne(new POS.DataLayer.INVAdjustStockPrimaryKey(iNVAdjustStock.AdjustStockID)); _iNVAdjustStock.ProductID = iNVAdjustStock.ProductID; _iNVAdjustStock.BatchID = iNVAdjustStock.BatchID; _iNVAdjustStock.Qty = iNVAdjustStock.Qty; _iNVAdjustStock.AdjustReasonID = iNVAdjustStock.AdjustReasonID; _iNVAdjustStock.CreatedBy = iNVAdjustStock.CreatedBy; _iNVAdjustStock.CredateDate = iNVAdjustStock.CredateDate; _iNVAdjustStock.UpdatedBy = iNVAdjustStock.UpdatedBy; _iNVAdjustStock.UpdateDate = iNVAdjustStock.UpdateDate; return(_iNVAdjustStock.Update()); }
public FrmAdjustStockAddEdit(int id, FrmAdjustmentSearch frmAdjustmentSearch) { InitializeComponent(); this._invProductStockWrapper = new INVProductStockWrapper(); this._inventoryWrapper = new INVInventoryWrapper(); this._stockTypeWrapper = new INVStockTypeWrapper(); this._adjustStockReasonWrapper = new INVAdjustStockReasonWrapper(); this._adjustStockWrapper = new INVAdjustStockWrapper(); this._adjustStock = new INVAdjustStock(); this._ProductWrapper = new BDProductWrapper(); this._isEdit = true; this._adjustStockID = id; GetAdjustStockData(_adjustStockID.Value); this._frmAdjustmentSearch = frmAdjustmentSearch; }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="INVAdjustStockPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class INVAdjustStock</returns> public INVAdjustStock SelectOne(INVAdjustStockPrimaryKey pk) { _iNVAdjustStockWCF = new INVAdjustStock(); _iNVAdjustStock = POS.DataLayer.INVAdjustStockBase.SelectOne(new POS.DataLayer.INVAdjustStockPrimaryKey(pk.AdjustStockID)); _iNVAdjustStockWCF.AdjustStockID = _iNVAdjustStock.AdjustStockID; _iNVAdjustStockWCF.ProductID = _iNVAdjustStock.ProductID; _iNVAdjustStockWCF.BatchID = _iNVAdjustStock.BatchID; _iNVAdjustStockWCF.Qty = _iNVAdjustStock.Qty; _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID; _iNVAdjustStockWCF.CreatedBy = _iNVAdjustStock.CreatedBy; _iNVAdjustStockWCF.CredateDate = _iNVAdjustStock.CredateDate; _iNVAdjustStockWCF.UpdatedBy = _iNVAdjustStock.UpdatedBy; _iNVAdjustStockWCF.UpdateDate = _iNVAdjustStock.UpdateDate; return(_iNVAdjustStockWCF); }
///<summary> /// This method will update one new row into the database using the property Information /// </summary> /// /// <param name="iNVAdjustStock" type="INVAdjustStock">This INVAdjustStock will be updated in the database.</param> /// /// <returns>True if succeeded</returns> public bool Update(INVAdjustStock iNVAdjustStock) { _iNVAdjustStock = POS.DataLayer.INVAdjustStock.SelectOne(new POS.DataLayer.INVAdjustStockPrimaryKey(iNVAdjustStock.AdjustStockID)); _iNVAdjustStock.ProductID = iNVAdjustStock.ProductID; _iNVAdjustStock.BatchID = iNVAdjustStock.BatchID; _iNVAdjustStock.Qty = iNVAdjustStock.Qty; _iNVAdjustStock.AdjustReasonID = iNVAdjustStock.AdjustReasonID; _iNVAdjustStock.CreatedBy = iNVAdjustStock.CreatedBy; _iNVAdjustStock.CredateDate = iNVAdjustStock.CredateDate; _iNVAdjustStock.UpdatedBy = iNVAdjustStock.UpdatedBy; _iNVAdjustStock.UpdateDate = iNVAdjustStock.UpdateDate; _iNVAdjustStock.StockTypeID = iNVAdjustStock.StockTypeID; _iNVAdjustStock.OldStockTypeID = iNVAdjustStock.OldStockTypeID; _iNVAdjustStock.InventoryID = iNVAdjustStock.InventoryID; _iNVAdjustStock.ExpiryDate = iNVAdjustStock.ExpiryDate; _iNVAdjustStock.BatchNumber = iNVAdjustStock.BatchNumber; return(_iNVAdjustStock.Update()); }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// /// <param name="iNVAdjustStock" type="INVAdjustStock">This INVAdjustStock will be inserted in the database.</param> /// /// <returns>True if succeeded</returns> public bool Insert(INVAdjustStock iNVAdjustStock) { _iNVAdjustStock = new POS.DataLayer.INVAdjustStock(); _iNVAdjustStock.AdjustStockID = iNVAdjustStock.AdjustStockID; _iNVAdjustStock.ProductID = iNVAdjustStock.ProductID; _iNVAdjustStock.BatchID = iNVAdjustStock.BatchID; _iNVAdjustStock.Qty = iNVAdjustStock.Qty; _iNVAdjustStock.AdjustReasonID = iNVAdjustStock.AdjustReasonID; _iNVAdjustStock.CreatedBy = iNVAdjustStock.CreatedBy; _iNVAdjustStock.CredateDate = iNVAdjustStock.CredateDate; _iNVAdjustStock.UpdatedBy = iNVAdjustStock.UpdatedBy; _iNVAdjustStock.UpdateDate = iNVAdjustStock.UpdateDate; _iNVAdjustStock.StockTypeID = iNVAdjustStock.StockTypeID; _iNVAdjustStock.OldStockTypeID = iNVAdjustStock.OldStockTypeID; _iNVAdjustStock.InventoryID = iNVAdjustStock.InventoryID; _iNVAdjustStock.ExpiryDate = iNVAdjustStock.ExpiryDate; _iNVAdjustStock.BatchNumber = iNVAdjustStock.BatchNumber; return(_iNVAdjustStock.Insert()); }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="INVBatchPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// /// <returns>object of class INVAdjustStockCollection</returns> public INVAdjustStockCollection SelectAllByForeignKeyBatchIDPaged(INVBatchPrimaryKey pk, int pageSize, int skipPages, string orderByStatement) { INVAdjustStockCollection iNVAdjustStockCollection = new INVAdjustStockCollection(); foreach (POS.DataLayer.INVAdjustStock _iNVAdjustStock in POS.DataLayer.INVAdjustStockBase.SelectAllByForeignKeyBatchIDPaged(new POS.DataLayer.INVBatchPrimaryKey(pk.BatchID), pageSize, skipPages, orderByStatement)) { _iNVAdjustStockWCF = new INVAdjustStock(); _iNVAdjustStockWCF.AdjustStockID = _iNVAdjustStock.AdjustStockID; _iNVAdjustStockWCF.ProductID = _iNVAdjustStock.ProductID; _iNVAdjustStockWCF.BatchID = _iNVAdjustStock.BatchID; _iNVAdjustStockWCF.Qty = _iNVAdjustStock.Qty; _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID; _iNVAdjustStockWCF.CreatedBy = _iNVAdjustStock.CreatedBy; _iNVAdjustStockWCF.CredateDate = _iNVAdjustStock.CredateDate; _iNVAdjustStockWCF.UpdatedBy = _iNVAdjustStock.UpdatedBy; _iNVAdjustStockWCF.UpdateDate = _iNVAdjustStock.UpdateDate; iNVAdjustStockCollection.Add(_iNVAdjustStockWCF); } return(iNVAdjustStockCollection); }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="INVBatchPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class INVAdjustStockCollection</returns> public INVAdjustStockCollection SelectAllByForeignKeyBatchID(INVBatchPrimaryKey pk) { INVAdjustStockCollection iNVAdjustStockCollection = new INVAdjustStockCollection(); foreach (POS.DataLayer.INVAdjustStock _iNVAdjustStock in POS.DataLayer.INVAdjustStockBase.SelectAllByForeignKeyBatchID(new POS.DataLayer.INVBatchPrimaryKey(pk.BatchID))) { _iNVAdjustStockWCF = new INVAdjustStock(); _iNVAdjustStockWCF.AdjustStockID = _iNVAdjustStock.AdjustStockID; _iNVAdjustStockWCF.ProductID = _iNVAdjustStock.ProductID; _iNVAdjustStockWCF.BatchID = _iNVAdjustStock.BatchID; _iNVAdjustStockWCF.Qty = _iNVAdjustStock.Qty; _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID; _iNVAdjustStockWCF.CreatedBy = _iNVAdjustStock.CreatedBy; _iNVAdjustStockWCF.CredateDate = _iNVAdjustStock.CredateDate; _iNVAdjustStockWCF.UpdatedBy = _iNVAdjustStock.UpdatedBy; _iNVAdjustStockWCF.UpdateDate = _iNVAdjustStock.UpdateDate; iNVAdjustStockCollection.Add(_iNVAdjustStockWCF); } return(iNVAdjustStockCollection); }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="INVAdjustStockPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class INVAdjustStock</returns> public INVAdjustStock SelectOne(INVAdjustStockPrimaryKey pk) { _iNVAdjustStockWCF = new INVAdjustStock(); _iNVAdjustStock = POS.DataLayer.INVAdjustStockBase.SelectOne(new POS.DataLayer.INVAdjustStockPrimaryKey(pk.AdjustStockID)); _iNVAdjustStockWCF.AdjustStockID = _iNVAdjustStock.AdjustStockID; _iNVAdjustStockWCF.ProductID = _iNVAdjustStock.ProductID; _iNVAdjustStockWCF.BatchID = _iNVAdjustStock.BatchID; _iNVAdjustStockWCF.Qty = _iNVAdjustStock.Qty; _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID; _iNVAdjustStockWCF.CreatedBy = _iNVAdjustStock.CreatedBy; _iNVAdjustStockWCF.CredateDate = _iNVAdjustStock.CredateDate; _iNVAdjustStockWCF.UpdatedBy = _iNVAdjustStock.UpdatedBy; _iNVAdjustStockWCF.UpdateDate = _iNVAdjustStock.UpdateDate; _iNVAdjustStockWCF.StockTypeID = _iNVAdjustStock.StockTypeID; _iNVAdjustStockWCF.OldStockTypeID = _iNVAdjustStock.OldStockTypeID; _iNVAdjustStockWCF.InventoryID = _iNVAdjustStock.InventoryID; _iNVAdjustStockWCF.ExpiryDate = _iNVAdjustStock.ExpiryDate; _iNVAdjustStockWCF.BatchNumber = _iNVAdjustStock.BatchNumber; return(_iNVAdjustStockWCF); }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// </summary> /// /// <param name="field" type="string">Field of the class INVAdjustStock</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// <param name="fieldValue2" type="object">Value for the field specified.</param> /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param> /// /// <returns>List of object of class INVAdjustStock in the form of an object of class INVAdjustStockCollection</returns> public INVAdjustStockCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation) { INVAdjustStockCollection iNVAdjustStockCollection = new INVAdjustStockCollection(); foreach (POS.DataLayer.INVAdjustStock _iNVAdjustStock in POS.DataLayer.INVAdjustStockBase.SelectByField(field, fieldValue, fieldValue2, typeOperation)) { _iNVAdjustStockWCF = new INVAdjustStock(); _iNVAdjustStockWCF.AdjustStockID = _iNVAdjustStock.AdjustStockID; _iNVAdjustStockWCF.ProductID = _iNVAdjustStock.ProductID; _iNVAdjustStockWCF.BatchID = _iNVAdjustStock.BatchID; _iNVAdjustStockWCF.Qty = _iNVAdjustStock.Qty; _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID; _iNVAdjustStockWCF.CreatedBy = _iNVAdjustStock.CreatedBy; _iNVAdjustStockWCF.CredateDate = _iNVAdjustStock.CredateDate; _iNVAdjustStockWCF.UpdatedBy = _iNVAdjustStock.UpdatedBy; _iNVAdjustStockWCF.UpdateDate = _iNVAdjustStock.UpdateDate; iNVAdjustStockCollection.Add(_iNVAdjustStockWCF); } return(iNVAdjustStockCollection); }
new private bool Validate() { bool isValid = false; bool isValidProduct = false; int ProductID=0; int InvProductID=0; int? oldStockTypeId = dgrid_stock.SelectedRows.Count > 0 ? int.Parse(dgrid_stock.SelectedRows[0].Cells["col_StockTypeID"].Value.ToString()) : 0; string BatchID = dgrid_batches.SelectedRows.Count > 0 ? dgrid_batches.SelectedRows[0].Cells["col_batch"].Value.ToString() : ""; DateTime? ExpiryDate = dgrid_batches.SelectedRows.Count > 0 ? Convert.ToDateTime(dgrid_batches.SelectedRows[0].Cells["col_expiry"].Value.ToString()) : (DateTime?)null; decimal oldQty = dgrid_batches.SelectedRows.Count > 0 ? Convert.ToDecimal(dgrid_batches.SelectedRows[0].Cells["col_batchQty"].Value.ToString()) : dgrid_stock.SelectedRows.Count>0? Convert.ToDecimal(dgrid_stock.SelectedRows[0].Cells["col_qty"].Value.ToString()):0; int AdjustReasonID = 0; int StockTypeID = 0; int InventoryID = 0; decimal Qty = num_Qty.Value; if (dgrid_stock.SelectedRows.Count > 0) int.TryParse(dgrid_stock.SelectedRows[0].Cells["col_invProductStock"].Value.ToString(), out InvProductID); if (cbx_AdjustReason.SelectedValue != null) int.TryParse(cbx_AdjustReason.SelectedValue.ToString(), out AdjustReasonID); if (cbx_StockTypeTO.SelectedValue != null) int.TryParse(cbx_StockTypeTO.SelectedValue.ToString(), out StockTypeID); if (cbx_Store.SelectedValue != null) int.TryParse(cbx_Store.SelectedValue.ToString(), out InventoryID); if (InvProductID > 0) { isValidProduct = true; INVProductStockPrimaryKey ispk = new INVProductStockPrimaryKey(); ispk.ProductStockID = InvProductID; var invPS = _invProductStockWrapper.SelectOne(ispk); ProductID = invPS.ProductID.Value; BDProductPrimaryKey pk = new BDProductPrimaryKey(); pk.ProductID = invPS.ProductID; if (_ProductWrapper.SelectOne(pk).IsAcceptBatch == true) isValidProduct = (!string.IsNullOrEmpty(BatchID) && ExpiryDate.HasValue); } if (!isValidProduct || AdjustReasonID == 0 || StockTypeID == 0 || InventoryID == 0 || Qty == 0 || Qty > oldQty || oldStockTypeId == StockTypeID) isValid= false; else { isValid = true; if (_isEdit) { INVAdjustStock _EditNewAdjustStock = _adjustStock; _EditNewAdjustStock.Qty *= -1; _adjustStockCollection.Add(_EditNewAdjustStock); INVAdjustStock _EditOldAdjustStock = _adjustStock; _adjustStock.StockTypeID = _adjustStock.OldStockTypeID; _adjustStockCollection.Add(_EditOldAdjustStock); } _adjustStock.ProductID = ProductID; _adjustStock.AdjustReasonID = AdjustReasonID; _adjustStock.AdjustStockID = _adjustStockID; _adjustStock.BatchID = null; _adjustStock.InventoryID = InventoryID; _adjustStock.StockTypeID = StockTypeID; _adjustStock.OldStockTypeID = oldStockTypeId; _adjustStock.Qty = Qty; _adjustStock.BatchNumber = BatchID; _adjustStock.ExpiryDate = ExpiryDate; if (_isEdit) { _adjustStock.UpdateDate = DateTime.Now; _adjustStock.UpdatedBy = GlobalVariables.CurrentUser.UserID; } else { _adjustStock.CredateDate = DateTime.Now; _adjustStock.CreatedBy = GlobalVariables.CurrentUser.UserID; } _adjustStockCollection.Add(_adjustStock); INVAdjustStock _oldAdjustStock = new INVAdjustStock(); _oldAdjustStock.ProductID = ProductID; _oldAdjustStock.AdjustReasonID = AdjustReasonID; _oldAdjustStock.AdjustStockID = _adjustStockID; _oldAdjustStock.BatchID = null; _oldAdjustStock.InventoryID = InventoryID; _oldAdjustStock.StockTypeID = oldStockTypeId; _oldAdjustStock.Qty = (-1 * Qty); _oldAdjustStock.BatchNumber = BatchID; _oldAdjustStock.ExpiryDate = ExpiryDate; if (_isEdit) { _oldAdjustStock.UpdateDate = DateTime.Now; _oldAdjustStock.UpdatedBy = GlobalVariables.CurrentUser.UserID; } else { _oldAdjustStock.CredateDate = DateTime.Now; _oldAdjustStock.CreatedBy = GlobalVariables.CurrentUser.UserID; } _adjustStockCollection.Add(_oldAdjustStock); } return isValid; }
private void GetAdjustStockData(int adjustStockID) { INVAdjustStockPrimaryKey pk = new INVAdjustStockPrimaryKey(); pk.AdjustStockID = adjustStockID; _adjustStock = _adjustStockWrapper.SelectOne(pk); }
private void Search() { dgrid_Result.DataSource = null; INVAdjustStock searchModel = new INVAdjustStock(); int AdjustReasonID = 0; int InventoryID = 0; DateTime? dateFrom = null; DateTime? toFrom = null; if (cbx_AdjustReason.SelectedValue != null) { int.TryParse(cbx_AdjustReason.SelectedValue.ToString(), out AdjustReasonID); searchModel.AdjustReasonID = AdjustReasonID; } if (cbx_Store.SelectedValue != null) { int.TryParse(cbx_Store.SelectedValue.ToString(), out InventoryID); searchModel.InventoryID = InventoryID; } if(dtp_fromDate.Value!=null) dateFrom = dtp_fromDate.Value; if (dtp_toDate.Value != null) toFrom = dtp_toDate.Value; if (toFrom == null || dateFrom == null || toFrom < dateFrom) { MessageBox.Show("يجب اختيار فترة زمنية صحيحة"); return; } List<INVAdjustStock> adjustStocks = _invAdjustStockWrapper.SearchByCriteria(searchModel, dateFrom, toFrom); dgrid_Result.DataSource = adjustStocks; }