protected override void Edit() { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); try { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T TurnCancelCommentEntity = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T(); TurnCancelCommentEntity.TurnCancelComment_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(TurnCancelComment_nvcTextBox.Text, TypeCode.String).ToString(); TurnCancelCommentEntity.UserGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32); if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { TurnCancelCommentFactory.BeginProc(); TurnCancelCommentFactory.Update(TurnCancelCommentEntity, (HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys)Key); TurnCancelCommentFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelCommentID_int.ToString() + "='" + ((HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys)Key).TurnCancelCommentID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelComment_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnCancelCommentEntity.TurnCancelComment_nvc, TypeCode.String); dr[0]["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox); } DataTable.AcceptChanges(); } } } catch (Exception ex) { TurnCancelCommentFactory.RollBackProc(); throw ex; } }
protected override void Delete() { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { TurnCancelCommentFactory.BeginProc(); TurnCancelCommentFactory.Delete((HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys)Key); TurnCancelCommentFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelCommentID_int.ToString() + "='" + ((HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys)Key).TurnCancelCommentID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { TurnCancelCommentFactory.RollBackProc(); throw ex; } }
protected override void Insert() { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); try { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T TurnCancelCommentEntity = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T(); TurnCancelCommentEntity.TurnCancelComment_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(TurnCancelComment_nvcTextBox.Text, TypeCode.String).ToString(); TurnCancelCommentEntity.UserGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32); TurnCancelCommentFactory.BeginProc(); TurnCancelCommentFactory.Insert(TurnCancelCommentEntity); TurnCancelCommentFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelCommentID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnCancelCommentEntity.TurnCancelCommentID_int, TypeCode.Int32); dr[HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelComment_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnCancelCommentEntity.TurnCancelComment_nvc, TypeCode.String); dr[HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.UserGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnCancelCommentEntity.UserGroupID_int, TypeCode.Int32); dr["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { TurnCancelCommentFactory.RollBackProc(); throw ex; } }
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 FillCombo() { try { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommantID_intFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); DataTable TurnCancelCommantID_intDataTable = new DataTable(); TurnCancelCommantID_intFactory.GetAll(ref TurnCancelCommantID_intDataTable); this.TurnCancelCommantID_intComboBox.DisplayMember = HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelComment_nvc.ToString(); DataRow[] rows; if (HPS.Common.CurrentUser.user.UserGroupID_int != 16) { rows = TurnCancelCommantID_intDataTable.Select(" TurnCancelCommentID_int=57"); foreach (DataRow row in rows) { TurnCancelCommantID_intDataTable.Rows.Remove(row); } } this.TurnCancelCommantID_intComboBox.ValueMember = HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelCommentID_int.ToString(); this.TurnCancelCommantID_intComboBox.DataSource = TurnCancelCommantID_intDataTable; this.TurnCancelCommantID_intComboBox.SelectedIndex = -1; } catch (Exception ex) { throw ex; } }
protected override void ShowForm() { this.FillCombo(); HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T TurnCancelCommentEntity = TurnCancelCommentFactory.GetBy((HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys)Key); if (TurnCancelCommentEntity == null) { throw new HPS.Exceptions.TurnCancelCommentNotFound(); } TurnCancelComment_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(TurnCancelCommentEntity.TurnCancelComment_nvc, TypeCode.String).ToString(); Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref UserGroupID_intComboBox, TurnCancelCommentEntity.UserGroupID_int, TypeCode.Int32); }
private void LoadTurnCancelComment() { try { HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory(); DataTable TurnCancelCommentDataTable = new DataTable(); TurnCancelCommentFactory.GetAll(ref TurnCancelCommentDataTable); this.TurnCancelCommentGridView.DataSource = TurnCancelCommentDataTable; } catch (System.Exception ex) { throw ex; } }
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); }