Пример #1
0
        protected override void Edit()
        {
            BLL.VerifiedCarsBLL.BLLVerifiedCars_TFactory VerifiedCarsFactory = new BLL.VerifiedCarsBLL.BLLVerifiedCars_TFactory();

            try
            {
                BLL.VerifiedCarsBLL.BLLVerifiedCars_T VerifiedCarsEntity = VerifiedCarsFactory.GetBy((BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys)Key);
                //if (VerifiedCarsEntity == null)
                //    throw new TBZRMTO.Exception.VerifiedCarsNotFound();
                VerifiedCarsEntity.NumberPlate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(NumberPlate_nvcTextBox.Text, TypeCode.String).ToString();
                VerifiedCarsEntity.SerialPlate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(SerialPlate_nvcTextBox.Text, TypeCode.String).ToString();
                VerifiedCarsEntity.CompanyID_int   = Convert.ToInt32(CompanyID_intComboBox.SelectedValue);
                VerifiedCarsEntity.FullName_nvc    = Hepsa.Core.Common.PersentationController.GetEntityValue(FullName_nvcTextBox.Text, TypeCode.String).ToString();
                VerifiedCarsEntity.Unit_nvc        = Hepsa.Core.Common.PersentationController.GetEntityValue(Unit_nvcTextBox.Text, TypeCode.String).ToString();

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    VerifiedCarsFactory.BeginProc();
                    VerifiedCarsFactory.Update(VerifiedCarsEntity, (BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys)Key);
                    VerifiedCarsFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(BLL.VerifiedCarsBLL.BLLVerifiedCars_T.VerifiedCars_TField.VerifiedCarID_int.ToString() + "='" + ((BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys)Key).VerifiedCarID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][BLL.VerifiedCarsBLL.BLLVerifiedCars_T.VerifiedCars_TField.VerifiedCarID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(VerifiedCarsEntity.VerifiedCarID_int, TypeCode.Int32);
                            dr[0][BLL.VerifiedCarsBLL.BLLVerifiedCars_T.VerifiedCars_TField.NumberPlate_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(VerifiedCarsEntity.NumberPlate_nvc, TypeCode.String);
                            dr[0][BLL.VerifiedCarsBLL.BLLVerifiedCars_T.VerifiedCars_TField.SerialPlate_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(VerifiedCarsEntity.SerialPlate_nvc, TypeCode.String);
                            dr[0]["Company_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CompanyID_intComboBox);
                            dr[0][BLL.VerifiedCarsBLL.BLLVerifiedCars_T.VerifiedCars_TField.FullName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(VerifiedCarsEntity.FullName_nvc, TypeCode.String);
                            dr[0][BLL.VerifiedCarsBLL.BLLVerifiedCars_T.VerifiedCars_TField.Unit_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(VerifiedCarsEntity.Unit_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (System.Exception ex)
            {
                VerifiedCarsFactory.RollBackProc();
                throw ex;
            }
        }