protected override void Insert() { HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); try { HPS.BLL.ColorBLL.BLLColor_T ColorEntity = new HPS.BLL.ColorBLL.BLLColor_T(); ColorEntity.Color_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Color_nvcTextBox.Text, TypeCode.String).ToString(); ColorEntity.ColorCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(ColorCode_nvcTextBox.Text, TypeCode.String).ToString(); ColorFactory.BeginProc(); ColorFactory.Insert(ColorEntity); ColorFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.ColorBLL.BLLColor_T.Color_TField.ColorID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ColorEntity.ColorID_int, TypeCode.Int32); dr[HPS.BLL.ColorBLL.BLLColor_T.Color_TField.Color_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ColorEntity.Color_nvc, TypeCode.String); dr[HPS.BLL.ColorBLL.BLLColor_T.Color_TField.ColorCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ColorEntity.ColorCode_nvc, TypeCode.String); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { ColorFactory.RollBackProc(); throw ex; } }
protected override void Edit() { HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); try { HPS.BLL.ColorBLL.BLLColor_T ColorEntity = new HPS.BLL.ColorBLL.BLLColor_T(); ColorEntity.Color_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Color_nvcTextBox.Text, TypeCode.String).ToString(); ColorEntity.ColorCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(ColorCode_nvcTextBox.Text, TypeCode.String).ToString(); if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { ColorFactory.BeginProc(); ColorFactory.Update(ColorEntity, (HPS.BLL.ColorBLL.BLLColor_TKeys)Key); ColorFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.ColorBLL.BLLColor_T.Color_TField.ColorID_int.ToString() + "='" + ((HPS.BLL.ColorBLL.BLLColor_TKeys)Key).ColorID_int.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.ColorBLL.BLLColor_T.Color_TField.Color_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ColorEntity.Color_nvc, TypeCode.String); dr[0][HPS.BLL.ColorBLL.BLLColor_T.Color_TField.ColorCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ColorEntity.ColorCode_nvc, TypeCode.String); } DataTable.AcceptChanges(); } } } catch (Exception ex) { ColorFactory.RollBackProc(); throw ex; } }
protected override void Delete() { HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { ColorFactory.BeginProc(); ColorFactory.Delete((HPS.BLL.ColorBLL.BLLColor_TKeys)Key); ColorFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.ColorBLL.BLLColor_T.Color_TField.ColorID_int.ToString() + "='" + ((HPS.BLL.ColorBLL.BLLColor_TKeys)Key).ColorID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { ColorFactory.RollBackProc(); throw ex; } }
private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.ColorBLL.BLLColor_TFactory Color_TFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); HPS.BLL.ColorBLL.BLLColor_TKeys ColorKey = new HPS.BLL.ColorBLL.BLLColor_TKeys(); ColorKey.ColorID_int = (Int32)ColorGridView.CurrentRow.Cells["colColorID_int"].Value; ColorFactory.Delete(ColorKey); DataRow[] dr = ((DataTable)this.ColorGridView.DataSource).Select(HPS.BLL.ColorBLL.BLLColor_T.Color_TField.ColorID_int.ToString() + "='" + ColorKey.ColorID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.ColorGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
protected override void ShowForm() { this.FillCombo(); HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); HPS.BLL.ColorBLL.BLLColor_T ColorEntity = ColorFactory.GetBy((HPS.BLL.ColorBLL.BLLColor_TKeys)Key); if (ColorEntity == null) { throw new HPS.Exceptions.ColorNotFound(); } Color_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(ColorEntity.Color_nvc, TypeCode.String)); ColorCode_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(ColorEntity.ColorCode_nvc, TypeCode.String)); }
private void LoadColor() { try { HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); DataTable ColorDataTable = new DataTable(); ColorFactory.GetAll(ref ColorDataTable); this.ColorGridView.DataSource = ColorDataTable; } catch (System.Exception ex) { throw ex; } }
private void FillCombo() { try { HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCityID_intFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); DataTable PlateCityID_intDataTable = new DataTable(); PlateCityID_intFactory.GetAll(ref PlateCityID_intDataTable); this.PlateCityID_intComboBox.DisplayMember = HPS.BLL.PlateCityBLL.BLLPlateCity_T.PlateCity_TField.PlateCity_nvc.ToString(); this.PlateCityID_intComboBox.ValueMember = HPS.BLL.PlateCityBLL.BLLPlateCity_T.PlateCity_TField.PlateCityID_int.ToString(); this.PlateCityID_intComboBox.DataSource = PlateCityID_intDataTable; this.PlateCityID_intComboBox.SelectedIndex = -1; HPS.BLL.ColorBLL.BLLColor_TFactory PlateColorID_intFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); DataTable PlateColorID_intDataTable = new DataTable(); PlateColorID_intFactory.GetAll(ref PlateColorID_intDataTable); this.PlateColorID_intComboBox.DisplayMember = HPS.BLL.ColorBLL.BLLColor_T.Color_TField.Color_nvc.ToString(); this.PlateColorID_intComboBox.ValueMember = HPS.BLL.ColorBLL.BLLColor_T.Color_TField.ColorID_int.ToString(); this.PlateColorID_intComboBox.DataSource = PlateColorID_intDataTable; this.PlateColorID_intComboBox.SelectedIndex = -1; HPS.BLL.CountryBLL.BLLCountry_TFactory CountryID_intFactory = new HPS.BLL.CountryBLL.BLLCountry_TFactory(); DataTable CountryID_intDataTable = new DataTable(); CountryID_intFactory.GetAll(ref CountryID_intDataTable); this.CountryID_intComboBox.DisplayMember = HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.Country_nvc.ToString(); this.CountryID_intComboBox.ValueMember = HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.CountryID_int.ToString(); this.CountryID_intComboBox.DataSource = CountryID_intDataTable; this.CountryID_intComboBox.SelectedIndex = -1; HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeID_intFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); DataTable LaderTypeID_intDataTable = new DataTable(); LaderTypeID_intFactory.GetAll(ref LaderTypeID_intDataTable); this.LaderTypeID_intComboBox.DisplayMember = HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.LaderType_nvc.ToString(); this.LaderTypeID_intComboBox.ValueMember = HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.LaderTypeID_int.ToString(); this.LaderTypeID_intComboBox.DataSource = LaderTypeID_intDataTable; this.LaderTypeID_intComboBox.SelectedIndex = -1; HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory InfractionGroupID_intFactory = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory(); DataTable InfractionGroupID_intDataTable = new DataTable(); InfractionGroupID_intFactory.GetAll(ref InfractionGroupID_intDataTable); this.InfractionGroupID_intComboBox.DisplayMember = HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroup_nvc.ToString(); this.InfractionGroupID_intComboBox.ValueMember = HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroupID_int.ToString(); this.InfractionGroupID_intComboBox.DataSource = InfractionGroupID_intDataTable; this.InfractionGroupID_intComboBox.SelectedIndex = -1; } catch (Exception ex) { throw ex; } }
private void TrafficFields() { TrafficList = TrafficFactory.GetAllByCondition(TrafficCondition); if (TrafficList != null && TrafficList.Count > 0 && TrafficList[TrafficList.Count - 1].In_bit == true) { CarCardNumber_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].CarCardNumber_nvc; SavedCarCardDate_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].CarCardDate_nvc; SavedPlateType_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].PlateType_nvc; SavedNumberPlate_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].NumberPlate_nvc; SavedSerialPlate_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].SerialPlate_nvc; HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); string PlateCityCondition = "[PlateCity_T].[PlateCityID_int] = '" + TrafficList[TrafficList.Count - 1].PlateCityID_int + "'"; List <HPS.BLL.PlateCityBLL.BLLPlateCity_T> PlateCityList = PlateCityFactory.GetAllByCondition(PlateCityCondition); if (PlateCityList != null) { SavedPlateCityID_inttextBox.Text = PlateCityList[0].PlateCity_nvc; } HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); string ColorCondition = "[Color_T].[ColorID_int] = '" + TrafficList[TrafficList.Count - 1].PlateColorID_int + "'"; List <HPS.BLL.ColorBLL.BLLColor_T> ColorList = ColorFactory.GetAllByCondition(ColorCondition); if (ColorList != null && ColorList.Count > 0) { SavedPlateColorID_inttextBox.Text = ColorList[0].Color_nvc; } SavedCountryID_inttextBox.Text = TrafficList[TrafficList.Count - 1].Country_nvc; SavedYearType_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].YearType_nvc; SavedProductionYear_intNumericTextBox.Text = TrafficList[TrafficList.Count - 1].ProductionYear_int.Value.ToString(); HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); string LaderTypecondition = "[LaderType_T].[LaderTypeID_int] = '" + TrafficList[TrafficList.Count - 1].LaderTypeID_int + "'"; List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeList = LaderTypeFactory.GetAllByCondition(LaderTypecondition); if (LaderTypeList != null) { SavedLaderType_nvctextBox.Text = LaderTypeList[0].LaderType_nvc; } SavedLaderTypeCode_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].LaderTypeCode_nvc; SavedSystemCode_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].SystemCode_nvc; SavedSystem_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].System_nvc; SavedCapacity_intNumericTextBox.Text = TrafficList[TrafficList.Count - 1].Capacity_flt.Value.ToString(); } else { Hepsa.Core.Common.MessageBox.ErrorMessage(string.Format(HPS.Exceptions.ExceptionCs.RecordNotFound, "ترددی با این مشخصات")); } }