示例#1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                {
                    return;
                }


                HPS.BLL.ComputerBLL.BLLComputer_TFactory Computer_TFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();
                HPS.BLL.ComputerBLL.BLLComputer_TKeys    ComputerKey       = new HPS.BLL.ComputerBLL.BLLComputer_TKeys();

                ComputerKey.ComputerID_int = (Int32?)ComputerGridView.CurrentRow.Cells["colComputerID_int"].Value;
                ComputerFactory.Delete(ComputerKey);

                DataRow[] dr = ((DataTable)this.ComputerGridView.DataSource).Select(HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.ComputerID_int.ToString() + "='" + ComputerKey.ComputerID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.ComputerGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
示例#2
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.ComputerBLL.BLLComputer_TKeys ComputerKey = new HPS.BLL.ComputerBLL.BLLComputer_TKeys();
            ComputerKey.ComputerID_int = (Int32?)this.ComputerGridView.CurrentRow.Cells["colComputerID_int"].Value;
            ComputerEntityForm Computer = new ComputerEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.ComputerGridView.DataSource, ComputerKey);

            Computer.ShowDialog();
        }
示例#3
0
        public HPS.BLL.ComputerBLL.BLLComputer_T SelectByPrimaryKey(HPS.BLL.ComputerBLL.BLLComputer_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.ComputerBLL.BLLComputer_T businessObject = new HPS.BLL.ComputerBLL.BLLComputer_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;
            }
        }
示例#4
0
 public void GetBy(HPS.BLL.ComputerBLL.BLLComputer_TKeys keys, ref System.Data.DataSet dataSet)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataSet);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
示例#5
0
 public HPS.BLL.ComputerBLL.BLLComputer_T GetBy(HPS.BLL.ComputerBLL.BLLComputer_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
示例#6
0
 public void Delete(HPS.BLL.ComputerBLL.BLLComputer_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
示例#7
0
        private void EditAllButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.ComputerBLL.BLLComputer_TKeys ComputerKey = new HPS.BLL.ComputerBLL.BLLComputer_TKeys();
            ComputerKey.ComputerID_int = (int?)this.ComputerGridView.CurrentRow.Cells[colComputerID_int.Name].Value;
            ComputerManyEntityForm computer = new ComputerManyEntityForm(BaseEntityParentForm.enmState.Edit, (DataTable)this.ComputerGridView.DataSource, ComputerKey);

            computer._MacAddress_nvc = ComputerGridView.CurrentRow.Cells[colMacAddress_nvc.Name].Value.ToString();
            if (computer.ShowDialog() == DialogResult.OK)
            {
                this.RefreshButton.PerformClick();
            }
        }
示例#8
0
        public void SelectByPrimaryKey(HPS.BLL.ComputerBLL.BLLComputer_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_Computer_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
示例#9
0
        public void Update(HPS.BLL.ComputerBLL.BLLComputer_T businessObject, HPS.BLL.ComputerBLL.BLLComputer_TKeys businessObjectKey)
        {
            try
            {
                HPS.BLL.ComputerBLL.BLLComputer_T tmpComputer = this.GetBy(businessObjectKey);
                List <string> Except = new List <string>();
                if (businessObject.ComputerID_int == businessObjectKey.ComputerID_int)
                {
                    Except.Add("UniqueComputerID_int");
                }
                if (businessObject.MacAddress_nvc == tmpComputer.MacAddress_nvc)
                {
                    Except.Add("UniqueMacAddress_nvc");
                }

                if (Except.Count > 0)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, Except.ToArray()) == 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);
            }
        }
示例#10
0
 public ComputerManyEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.ComputerBLL.BLLComputer_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }
示例#11
0
        public void Update(HPS.BLL.ComputerBLL.BLLComputer_T businessObject, HPS.BLL.ComputerBLL.BLLComputer_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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

                SqlParameter MessageLED_nvc = new SqlParameter();
                MessageLED_nvc.ParameterName = "@MessageLED_nvc";
                MessageLED_nvc.SqlDbType     = SqlDbType.NVarChar;
                MessageLED_nvc.Direction     = ParameterDirection.Input;
                MessageLED_nvc.IsNullable    = false;
                if (String.IsNullOrEmpty(businessObject.MessageLED_nvc))
                {
                    MessageLED_nvc.Value = DBNull.Value;
                }
                else
                {
                    MessageLED_nvc.Value = businessObject.MessageLED_nvc;
                }
                this.Command.Parameters.Add(MessageLED_nvc);

                SqlParameter Active_bit = new SqlParameter();
                Active_bit.ParameterName = "@Active_bit";
                Active_bit.SqlDbType     = SqlDbType.Bit;
                Active_bit.Direction     = ParameterDirection.Input;
                Active_bit.IsNullable    = true;
                Active_bit.Value         = businessObject.Active_bit;
                this.Command.Parameters.Add(Active_bit);

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

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

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



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }