示例#1
0
        protected override void Insert()
        {
            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();
                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 (Janus.Windows.GridEX.GridEXRow item in UserNameGridView.GetCheckedRows())
                {
                    if (ComputerList.Find(a => a.Computer_nvc == item.Cells["username_nvc"].Value.ToString() && a.Deleted_bit == false && a.MacAddress_nvc == MacTextBox.Text) == null)
                    {
                        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();
                    }
                }
                //if (DataTable != null)
                //{
                //    DataRow dr = this.DataTable.NewRow();
                //    dr[HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.ComputerID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ComputerEntity.ComputerID_int, TypeCode.Int32);
                //    dr[HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.Computer_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ComputerEntity.Computer_nvc, TypeCode.String);
                //    dr[HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.IPAddress_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValue(IPTextBox.Text, TypeCode.String).ToString();
                //    dr[HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.MacAddress_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValue(MacTextBox.Text, TypeCode.String).ToString();
                //    dr[HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.MessageLED_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ComputerEntity.MessageLED_nvc, TypeCode.String);
                //    dr[HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ComputerEntity.Active_bit, TypeCode.Boolean);
                //    dr[HPS.BLL.ComputerBLL.BLLComputer_T.Computer_TField.UserGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ComputerEntity.UserGroupID_int, TypeCode.Int32);
                //    dr["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox);

                //    DataTable.Rows.Add(dr);
                //    DataTable.AcceptChanges();
                //}
                //this.ClearForm(this);
            }

            catch (Exception ex)
            {
                ComputerFactory.RollBackProc();
                throw ex;
            }
            this.DialogResult = DialogResult.OK;
        }
示例#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;
            }
        }