private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelComment_TFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys TurnCancelCommentKey = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys(); TurnCancelCommentKey.TurnCancelCommentID_int = (Int32?)TurnCancelCommentGridView.CurrentRow.Cells["colTurnCancelCommentID_int"].Value; TurnCancelCommentFactory.Delete(TurnCancelCommentKey); DataRow[] dr = ((DataTable)this.TurnCancelCommentGridView.DataSource).Select(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelCommentID_int.ToString() + "='" + TurnCancelCommentKey.TurnCancelCommentID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.TurnCancelCommentGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void EditButton_Click(object sender, EventArgs e) { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys TurnCancelCommentKey = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys(); TurnCancelCommentKey.TurnCancelCommentID_int = (Int32?)this.TurnCancelCommentGridView.CurrentRow.Cells["colTurnCancelCommentID_int"].Value; TurnCancelCommentEntityForm TurnCancelComment = new TurnCancelCommentEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.TurnCancelCommentGridView.DataSource, TurnCancelCommentKey); TurnCancelComment.ShowDialog(); }
public void GetBy(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys keys, ref System.Data.DataTable dataTable) { try{ _dataObject.SelectByPrimaryKey(keys, ref dataTable); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T GetBy(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys keys) { try{ return(_dataObject.SelectByPrimaryKey(keys)); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void Delete(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys keys) { try{ _dataObject.Delete(keys); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }
public void SelectByPrimaryKey(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys businessObjectKey, ref System.Data.DataTable dataTable) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); SqlDataAdapter sqlDataAdapter = new System.Data.SqlClient.SqlDataAdapter(this.Command); this.Command.CommandText = "[sp_TurnCancelComment_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter TurnCancelCommentID_int = new SqlParameter(); TurnCancelCommentID_int.ParameterName = "@TurnCancelCommentID_int"; TurnCancelCommentID_int.SqlDbType = SqlDbType.Int; TurnCancelCommentID_int.Direction = ParameterDirection.Input; TurnCancelCommentID_int.IsNullable = false; TurnCancelCommentID_int.Value = businessObjectKey.TurnCancelCommentID_int; this.Command.Parameters.Add(TurnCancelCommentID_int); if (ControlConnection) { this.BeginTransaction(); } sqlDataAdapter.Fill(dataTable); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public void Update(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject, HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_TurnCancelComment_T_Update]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter TurnCancelComment_nvc = new SqlParameter(); TurnCancelComment_nvc.ParameterName = "@TurnCancelComment_nvc"; TurnCancelComment_nvc.SqlDbType = SqlDbType.NVarChar; TurnCancelComment_nvc.Direction = ParameterDirection.Input; TurnCancelComment_nvc.IsNullable = false; TurnCancelComment_nvc.Value = businessObject.TurnCancelComment_nvc; this.Command.Parameters.Add(TurnCancelComment_nvc); SqlParameter UserGroupID_int = new SqlParameter(); UserGroupID_int.ParameterName = "@UserGroupID_int"; UserGroupID_int.SqlDbType = SqlDbType.Int; UserGroupID_int.Direction = ParameterDirection.Input; UserGroupID_int.IsNullable = false; if (businessObject.UserGroupID_int.HasValue == false) { UserGroupID_int.Value = DBNull.Value; } else { UserGroupID_int.Value = businessObject.UserGroupID_int; } this.Command.Parameters.Add(UserGroupID_int); SqlParameter pk_TurnCancelCommentID_int = new SqlParameter(); pk_TurnCancelCommentID_int.ParameterName = "@pk_TurnCancelCommentID_int"; pk_TurnCancelCommentID_int.SqlDbType = SqlDbType.Int; pk_TurnCancelCommentID_int.Direction = ParameterDirection.Input; pk_TurnCancelCommentID_int.IsNullable = false; pk_TurnCancelCommentID_int.Value = businessObjectKey.TurnCancelCommentID_int; this.Command.Parameters.Add(pk_TurnCancelCommentID_int); if (ControlConnection) { this.BeginTransaction(); } this.Command.ExecuteNonQuery(); if (ControlConnection) { this.Commit(); } } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T SelectByPrimaryKey(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys businessObjectKey) { bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open); this.Command.CommandText = "[sp_TurnCancelComment_T_SelectByPrimaryKey]"; this.Command.CommandType = CommandType.StoredProcedure; try{ this.Command.Parameters.Clear(); SqlParameter TurnCancelCommentID_int = new SqlParameter(); TurnCancelCommentID_int.ParameterName = "@TurnCancelCommentID_int"; TurnCancelCommentID_int.SqlDbType = SqlDbType.Int; TurnCancelCommentID_int.Direction = ParameterDirection.Input; TurnCancelCommentID_int.IsNullable = false; TurnCancelCommentID_int.Value = businessObjectKey.TurnCancelCommentID_int; this.Command.Parameters.Add(TurnCancelCommentID_int); if (ControlConnection) { this.BeginTransaction(); } IDataReader dataReader = this.Command.ExecuteReader(); HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T(); if (dataReader.Read()) { PopulateBusinessObjectFromReader(businessObject, dataReader); } else { businessObject = null; } if (dataReader.IsClosed == false) { dataReader.Close(); } if (ControlConnection) { this.Commit(); } return(businessObject); } catch (System.Exception ex) { if (ControlConnection) { this.RollBack(); } throw ex; } }
public TurnCancelCommentEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys Key) : base(State, DataTable, Key) { InitializeComponent(); }
private Int32 DoCancelOperation(string Date_nvc, string LaderTypeID_nvc) { string CancelDate = string.Empty; if (string.IsNullOrEmpty(Date_nvc)) { HPS.BLL.SettingsBLL.BLLSetting_TFactory SettingFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory(); HPS.BLL.SettingsBLL.BLLSetting_T SettingEntity = new HPS.BLL.SettingsBLL.BLLSetting_T(); HPS.BLL.SettingsBLL.BLLSetting_TKeys SettingKey = new HPS.BLL.SettingsBLL.BLLSetting_TKeys(); SettingKey.SettingID_int = 1003; SettingEntity = SettingFactory.GetBy(SettingKey); Hepsa.Core.Common.MyDateTime CurrentDate = new Hepsa.Core.Common.MyDateTime(SettingFactory.ServerJalaliDate); string CancelTime = SettingFactory.ServerTime; string CurrentDateTime = CurrentDate.MyDate.ToString("yyyy/MM/dd") + " " + CancelTime; DateTime SubtractedDate = DateTime.Parse(CurrentDateTime); SubtractedDate = SubtractedDate.AddHours(-Int32.Parse(SettingEntity.Value_nvc)); CancelDate = new Hepsa.Core.Common.MyDateTime(SubtractedDate).ConvertToPersianShortDate(); } else { CancelDate = Date_nvc; } HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T TurnCancelCommentEntity = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T(); HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys TurnCancelCommentKey = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys(); TurnCancelCommentKey.TurnCancelCommentID_int = 40; TurnCancelCommentEntity = TurnCancelCommentFactory.GetBy(TurnCancelCommentKey); HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory(); HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); DataTable AcceptedTurnsWithoutLadBillDataTable = new DataTable(); if (string.IsNullOrEmpty(LaderTypeID_nvc)) { TrafficFactory.SelectInTurnAcceptedForDelete(CancelDate, string.Empty, AcceptedTurnsWithoutLadBillDataTable); } else { TrafficFactory.SelectInTurnAcceptedForDelete(CancelDate, LaderTypeID_nvc, AcceptedTurnsWithoutLadBillDataTable); } int rowcount = -1; if (AcceptedTurnsWithoutLadBillDataTable != null && AcceptedTurnsWithoutLadBillDataTable.Rows.Count > 0) { rowcount = AcceptedTurnsWithoutLadBillDataTable.Rows.Count; foreach (DataRow row in AcceptedTurnsWithoutLadBillDataTable.Rows) { HPS.BLL.TurnManagementBLL.BLLTurnManagement_T TurnManagementEntity = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_T(); TurnManagementEntity.TurnCancelCommantID_int = TurnCancelCommentEntity.TurnCancelCommentID_int; TurnManagementEntity.TurnCancelCommment_nvc = TurnCancelCommentEntity.TurnCancelComment_nvc; TurnManagementEntity.Return_bit = false; TurnManagementEntity.Date_nvc = TurnManagementFactory.ServerJalaliDate; TurnManagementEntity.Time_nvc = TurnManagementFactory.ServerTime; TurnManagementEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc; TurnManagementEntity.TrafficID_bint = Convert.ToInt64(row["TrafficID_bint"]); TurnManagementFactory.BeginProc(); TurnManagementFactory.Insert(TurnManagementEntity); TurnManagementFactory.CommitProc(); } } return(rowcount); }
public void Update(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject, HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys businessObjectKey) { try{ if (businessObject.TurnCancelCommentID_int == businessObjectKey.TurnCancelCommentID_int) { if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueTurnCancelCommentID_int") == false) { throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString()); } } else { if (businessObject.IsValid() == false) { throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString()); } } _dataObject.Update(businessObject, businessObjectKey); }catch (System.Exception ex) { throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this); } }