/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="INVAdjustStockReasonPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class INVAdjustStockReason</returns> public INVAdjustStockReason SelectOne(INVAdjustStockReasonPrimaryKey pk) { _iNVAdjustStockReasonWCF = new INVAdjustStockReason(); _iNVAdjustStockReason = POS.DataLayer.INVAdjustStockReasonBase.SelectOne(new POS.DataLayer.INVAdjustStockReasonPrimaryKey(pk.AdjustStockReasonID)); _iNVAdjustStockReasonWCF.AdjustStockReasonID = _iNVAdjustStockReason.AdjustStockReasonID; _iNVAdjustStockReasonWCF.AdjustStockreasonName = _iNVAdjustStockReason.AdjustStockreasonName; return _iNVAdjustStockReasonWCF; }
public override void btn_Edit_Click(object sender, EventArgs e) { INVAdjustStockReasonPrimaryKey pk = new INVAdjustStockReasonPrimaryKey(); pk.AdjustStockReasonID = (int)dgrid_Result.Rows [dgrid_Result.SelectedCells[0].RowIndex].Cells["AdjustStockReasonID"].Value; INVAdjustStockReason reason = adjustStock.SelectOne(pk); FrmAdjustReasonAddEdit frm = new FrmAdjustReasonAddEdit(reason); frm.ShowDialog(); dgrid_Result.DataSource = adjustStock.SelectAll(); }
public override void btn_Delete_Click(object sender, EventArgs e) { if (dgrid_Result.SelectedRows.Count > 0) { if (MessageBox.Show("هل نت متأكد من الحذف ؟", "تحذير", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { INVAdjustStockReasonPrimaryKey pk = new INVAdjustStockReasonPrimaryKey(); pk.AdjustStockReasonID = (int)dgrid_Result.SelectedRows[0].Cells["AdjustStockReasonID"].Value; adjustStock.Delete(pk); dgrid_Result.DataSource = adjustStock.SelectAll(); } } }
public override void btn_Save_Click(object sender, EventArgs e) { if (txb_AdjustStockReason.Text != "") { if (_currentReason == null) { _currentReason = new INVAdjustStockReason(); _currentReason.AdjustStockreasonName = txb_AdjustStockReason.Text; service.Insert(_currentReason); } else { INVAdjustStockReasonPrimaryKey pk = new INVAdjustStockReasonPrimaryKey(); pk.AdjustStockReasonID = _currentReason.AdjustStockReasonID; _currentReason = service.SelectOne(pk); _currentReason.AdjustStockreasonName = txb_AdjustStockReason.Text; service.Update(_currentReason); } MessageBox.Show("تم الحفظ بنجاح"); } }
public override void btn_Delete_Click(object sender, EventArgs e) { if (dgrid_Result.SelectedCells.Count > 0) { if (MessageBox.Show("هل نت متأكد من الحذف ؟", "تحذير", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { INVAdjustStockReasonPrimaryKey pk = new INVAdjustStockReasonPrimaryKey(); pk.AdjustStockReasonID = (int)dgrid_Result.Rows[dgrid_Result.SelectedCells[0].RowIndex].Cells["AdjustStockReasonID"].Value; try { adjustStock.Delete(pk); MessageBox.Show("لقد تمت عمليه الحذف بنجاح"); } catch (Exception ex) { MessageBox.Show("لم تتم عمليه الحذف .. حيث ان السبب مستخدم "); } dgrid_Result.DataSource = adjustStock.SelectAll(); } } }
///<summary> ///This method will Delete the object from the database ///</summary> ///<param name="pk" type="INVAdjustStockReasonPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// <returns>True if succeeded</returns> public bool Delete(INVAdjustStockReasonPrimaryKey pk) { return POS.DataLayer.INVAdjustStockReasonBase.Delete(new POS.DataLayer.INVAdjustStockReasonPrimaryKey(pk.AdjustStockReasonID)); }