private void AcceptButton_Click(object sender, EventArgs e) { try { HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T(); LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKeys); if (LadeAssignmentEntity == null) { throw new HPS.Exceptions.LadeAssignmentNotFound(); } LadeAssignmentEntity.Accepted_bit = true; LadeAssignmentFactory.BeginProc(); LadeAssignmentFactory.Update(LadeAssignmentEntity, LadeAssignmentKeys); LadeAssignmentFactory.CommitProc(); if (this._DataTable != null) { DataRow[] dr = this._DataTable.Select("LadeAssignmentID_bint=" + this.LadeAsssignmentID.ToString()); if (dr != null && dr.Length > 0) { dr[0].Delete(); this._DataTable.AcceptChanges(); } } this.Close(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ChooseLadeAssignmentAcceptedButton_Click(object sender, EventArgs e) { try { HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LadeAssignmentKeys = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys(); DataTable gridTable = new DataTable(); gridTable = LadeAssignmentDataTable.Copy(); DataRow[] dr = null; LadeAssignmentFactory.BeginProc(); foreach (Janus.Windows.GridEX.GridEXRow itm in LadeAssignmentGridView.GetCheckedRows()) { LadeAssignmentKeys.LadeAssignmentID_bint = (Int64)itm.Cells["LadeAssignmentID_bint"].Value; LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKeys); LadeAssignmentEntity.Accepted_bit = true; LadeAssignmentEntity.AcceptUserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc; LadeAssignmentEntity.AcceptDate_vc = LadeAssignmentFactory.ServerJalaliDate; LadeAssignmentEntity.AcceptTime_vc = LadeAssignmentFactory.ServerTime; LadeAssignmentFactory.Update(LadeAssignmentEntity, LadeAssignmentKeys); dr = gridTable.Select(HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T.LadeAssignment_TField.LadeAssignmentID_bint.ToString() + "='" + (Int64)itm.Cells["LadeAssignmentID_bint"].Value + "'"); if (dr.Length > 0) { dr[0].Delete(); } gridTable.AcceptChanges(); } LadeAssignmentFactory.CommitProc(); LadeAssignmentGridView.DataSource = null; LadeAssignmentGridView.SetDataBinding(gridTable, "gridTable"); LadeAssignmentDataTable = gridTable.Copy(); gridTable.Dispose(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }