Ejemplo n.º 1
0
        protected override void Edit()
        {
            HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TFactory InfractionSurveyUsersFactory = new HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TFactory();
            try
            {
                HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T InfractionSurveyUsersEntity = new HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T();
                InfractionSurveyUsersEntity.UserName_nvc = (String)Hepsa.Core.Common.PersentationController.GetEntityValue(UserName_nvcComboBox.SelectedValue, TypeCode.String);
                InfractionSurveyUsersEntity.InfractionSurveyGroupID_int = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionSurveyGroupID_intComboBox.SelectedValue, TypeCode.Int32);

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    InfractionSurveyUsersFactory.BeginProc();
                    InfractionSurveyUsersFactory.Update(InfractionSurveyUsersEntity, (HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TKeys)Key);
                    InfractionSurveyUsersFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T.InfractionSurveyUsers_TField.InfractionSurveyUsersID_int.ToString() + "='" + ((HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TKeys)Key).InfractionSurveyUsersID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0]["UserName_nvcUserName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserName_nvcComboBox);
                            dr[0]["InfractionSurveyGroupID_intInfractionSurveyGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionSurveyGroupID_intComboBox);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                InfractionSurveyUsersFactory.RollBackProc();
                throw ex;
            }
        }
Ejemplo n.º 2
0
        protected override void Insert()
        {
            HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TFactory InfractionSurveyUsersFactory = new HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TFactory();
            try
            {
                HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T InfractionSurveyUsersEntity = new HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T();
                InfractionSurveyUsersEntity.UserName_nvc = (String)Hepsa.Core.Common.PersentationController.GetEntityValue(UserName_nvcComboBox.SelectedValue, TypeCode.String);
                InfractionSurveyUsersEntity.InfractionSurveyGroupID_int = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionSurveyGroupID_intComboBox.SelectedValue, TypeCode.Int32);

                InfractionSurveyUsersFactory.BeginProc();
                InfractionSurveyUsersFactory.Insert(InfractionSurveyUsersEntity);
                InfractionSurveyUsersFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T.InfractionSurveyUsers_TField.InfractionSurveyUsersID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionSurveyUsersEntity.InfractionSurveyUsersID_int, TypeCode.Int32);
                    dr[HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T.InfractionSurveyUsers_TField.UserName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionSurveyUsersEntity.UserName_nvc, TypeCode.String);
                    dr["UserName_nvcUserName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserName_nvcComboBox);
                    dr[HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T.InfractionSurveyUsers_TField.InfractionSurveyGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionSurveyUsersEntity.InfractionSurveyGroupID_int, TypeCode.Int32);
                    dr["InfractionSurveyGroupID_intInfractionSurveyGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionSurveyGroupID_intComboBox);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                InfractionSurveyUsersFactory.RollBackProc();
                throw ex;
            }
        }
Ejemplo n.º 3
0
        public void Insert(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_InfractionSurveyUsers_T_Add]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try{
                this.Command.Parameters.Clear();

                SqlParameter InfractionSurveyUsersID_int = new SqlParameter();
                InfractionSurveyUsersID_int.ParameterName = "@InfractionSurveyUsersID_int";
                InfractionSurveyUsersID_int.SqlDbType     = SqlDbType.Int;
                InfractionSurveyUsersID_int.Direction     = ParameterDirection.Output;
                InfractionSurveyUsersID_int.IsNullable    = false;
                InfractionSurveyUsersID_int.Value         = businessObject.InfractionSurveyUsersID_int;
                this.Command.Parameters.Add(InfractionSurveyUsersID_int);

                SqlParameter UserName_nvc = new SqlParameter();
                UserName_nvc.ParameterName = "@UserName_nvc";
                UserName_nvc.SqlDbType     = SqlDbType.NVarChar;
                UserName_nvc.Direction     = ParameterDirection.Input;
                UserName_nvc.IsNullable    = false;
                UserName_nvc.Value         = businessObject.UserName_nvc;
                this.Command.Parameters.Add(UserName_nvc);

                SqlParameter InfractionSurveyGroupID_int = new SqlParameter();
                InfractionSurveyGroupID_int.ParameterName = "@InfractionSurveyGroupID_int";
                InfractionSurveyGroupID_int.SqlDbType     = SqlDbType.Int;
                InfractionSurveyGroupID_int.Direction     = ParameterDirection.Input;
                InfractionSurveyGroupID_int.IsNullable    = false;
                InfractionSurveyGroupID_int.Value         = businessObject.InfractionSurveyGroupID_int;
                this.Command.Parameters.Add(InfractionSurveyGroupID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                this.Command.ExecuteNonQuery();

                businessObject.InfractionSurveyUsersID_int = (Int32)(this.Command.Parameters["@InfractionSurveyUsersID_int"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Ejemplo n.º 4
0
        public HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T SelectByPrimaryKey(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_InfractionSurveyUsers_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try{
                this.Command.Parameters.Clear();

                SqlParameter InfractionSurveyUsersID_int = new SqlParameter();
                InfractionSurveyUsersID_int.ParameterName = "@InfractionSurveyUsersID_int";
                InfractionSurveyUsersID_int.SqlDbType     = SqlDbType.Int;
                InfractionSurveyUsersID_int.Direction     = ParameterDirection.Input;
                InfractionSurveyUsersID_int.IsNullable    = false;
                InfractionSurveyUsersID_int.Value         = businessObjectKey.InfractionSurveyUsersID_int;
                this.Command.Parameters.Add(InfractionSurveyUsersID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T businessObject = new HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_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;
            }
        }
Ejemplo n.º 5
0
        public List <HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T> list = new List <HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T>();

            while (dataReader.Read())
            {
                HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T businessObject = new HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Ejemplo n.º 6
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TFactory InfractionSurveyUsersFactory = new HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TFactory();
     HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T        InfractionSurveyUsersEntity  = InfractionSurveyUsersFactory.GetBy((HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TKeys)Key);
     if (InfractionSurveyUsersEntity == null)
     {
         throw new HPS.Exceptions.InfractionSurveyUsersNotFound();
     }
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref UserName_nvcComboBox, InfractionSurveyUsersEntity.UserName_nvc, TypeCode.String);
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref InfractionSurveyGroupID_intComboBox, InfractionSurveyUsersEntity.InfractionSurveyGroupID_int, TypeCode.Int32);
 }
Ejemplo n.º 7
0
        public void Insert(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T businessObject)
        {
            try{
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "InfractionSurveyUsersID_int") == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Insert(businessObject);
            }catch (System.Exception ex) {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Ejemplo n.º 8
0
        public void Update(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T businessObject, HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_TKeys businessObjectKey)
        {
            try{
                if (businessObject.InfractionSurveyUsersID_int == businessObjectKey.InfractionSurveyUsersID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueInfractionSurveyUsersID_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);
            }
        }
Ejemplo n.º 9
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T businessObject, IDataReader dataReader)
 {
     businessObject.InfractionSurveyUsersID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T.InfractionSurveyUsers_TField.InfractionSurveyUsersID_int.ToString()));
     businessObject.UserName_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T.InfractionSurveyUsers_TField.UserName_nvc.ToString()));
     businessObject.InfractionSurveyGroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.InfractionSurveyUsersBLL.BLLInfractionSurveyUsers_T.InfractionSurveyUsers_TField.InfractionSurveyGroupID_int.ToString()));
 }