Beispiel #1
0
        protected override void Edit()
        {
            HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();
            try
            {
                HPS.BLL.ComputerBLL.BLLComputer_T ComputerEntity = new HPS.BLL.ComputerBLL.BLLComputer_T();
                ComputerEntity.Computer_nvc    = Hepsa.Core.Common.PersentationController.GetEntityValue(Computer_nvcComboBox.Text, TypeCode.String).ToString();
                ComputerEntity.IPAddress_nvc   = Hepsa.Core.Common.PersentationController.GetEntityValue(IPTextBox.Text, TypeCode.String).ToString();
                ComputerEntity.MacAddress_nvc  = Hepsa.Core.Common.PersentationController.GetEntityValue(MacTextBox.Text, TypeCode.String).ToString();
                ComputerEntity.MessageLED_nvc  = Hepsa.Core.Common.PersentationController.GetEntityValue(MessageLED_nvcTextBox.Text, TypeCode.String).ToString();
                ComputerEntity.Active_bit      = Active_bitCheckBox.Checked;
                ComputerEntity.UserGroupID_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32);

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    ComputerFactory.BeginProc();
                    ComputerFactory.Update(ComputerEntity, (HPS.BLL.ComputerBLL.BLLComputer_TKeys)Key);
                    ComputerFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.ComputerID_int.ToString() + "='" + ((HPS.BLL.ComputerBLL.BLLComputer_TKeys)Key).ComputerID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.Computer_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ComputerEntity.Computer_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.IPAddress_nvc.ToString()]  = Hepsa.Core.Common.ApplicationInfo.IpAddress;
                            dr[0][HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.MacAddress_nvc.ToString()] = Hepsa.Core.Common.ApplicationInfo.MacAddress;
                            dr[0][HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.MessageLED_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ComputerEntity.MessageLED_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.Active_bit.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ComputerEntity.Active_bit, TypeCode.Boolean);
                            dr[0]["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                ComputerFactory.RollBackProc();
                throw ex;
            }
        }
Beispiel #2
0
        protected override void Edit()
        {
            HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();
            List <BLL.ComputerBLL.BLLComputer_T>     ComputerList    = new List <BLL.ComputerBLL.BLLComputer_T>();

            ComputerList = ComputerFactory.GetAllByCondition("MacAddress_nvc=N'" + MacTextBox.Text + "'");
            BLL.ComputerBLL.BLLComputer_TKeys ComputerKey = new BLL.ComputerBLL.BLLComputer_TKeys();
            foreach (BLL.ComputerBLL.BLLComputer_T item in ComputerList)
            {
                item.Deleted_bit           = true;
                ComputerKey.ComputerID_int = item.ComputerID_int;
                ComputerFactory.Update(item, ComputerKey);
            }
            try
            {
                HPS.BLL.ComputerBLL.BLLComputer_T ComputerEntity = new HPS.BLL.ComputerBLL.BLLComputer_T();
                foreach (Janus.Windows.GridEX.GridEXRow item in UserNameGridView.GetCheckedRows())
                {
                    ComputerEntity.ComputerID_int  = null;
                    ComputerEntity.Computer_nvc    = item.Cells["username_nvc"].Value.ToString();
                    ComputerEntity.IPAddress_nvc   = Hepsa.Core.Common.PersentationController.GetEntityValue(IPTextBox.Text, TypeCode.String).ToString();
                    ComputerEntity.MacAddress_nvc  = Hepsa.Core.Common.PersentationController.GetEntityValue(MacTextBox.Text, TypeCode.String).ToString();
                    ComputerEntity.MessageLED_nvc  = Hepsa.Core.Common.PersentationController.GetEntityValue(MessageLED_nvcTextBox.Text, TypeCode.String).ToString();
                    ComputerEntity.Active_bit      = Active_bitCheckBox.Checked;
                    ComputerEntity.UserGroupID_int = (Int32)item.Cells["UserGroupID_int"].Value;
                    ComputerFactory.BeginProc();
                    ComputerFactory.Insert(ComputerEntity);
                    ComputerFactory.CommitProc();
                }
            }
            catch (Exception ex)
            {
                ComputerFactory.RollBackProc();
                throw ex;
            }
        }