Beispiel #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);
            }
        }
Beispiel #2
0
        protected override void Delete()
        {
            HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    ComputerFactory.BeginProc();
                    ComputerFactory.Delete((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].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ComputerFactory.RollBackProc();
                throw ex;
            }
        }
Beispiel #3
0
        protected override void ShowForm()
        {
            this.FillCombo();
            HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();
            HPS.BLL.ComputerBLL.BLLComputer_T        ComputerEntity  = ComputerFactory.GetBy((HPS.BLL.ComputerBLL.BLLComputer_TKeys)Key);
            if (ComputerEntity == null)
            {
                throw new HPS.Exceptions.ComputerNotFound();
            }
            MessageLED_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.MessageLED_nvc, TypeCode.String).ToString();
            IPTextBox.Text             = Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.IPAddress_nvc, TypeCode.String).ToString();
            MacTextBox.Text            = Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.MacAddress_nvc, TypeCode.String).ToString();
            Active_bitCheckBox.Checked = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.Active_bit, TypeCode.Boolean);

            List <HPS.BLL.ComputerBLL.BLLComputer_T> ComputerList = new List <HPS.BLL.ComputerBLL.BLLComputer_T>();

            ComputerList = ComputerFactory.GetAllByCondition(string.Format(" Computer_T.MacAddress_nvc='{0}' AND Deleted_bit=0", _MacAddress_nvc));

            if (ComputerList.Count > 0)
            {
                foreach (var item in ComputerList)
                {
                    foreach (var gridRow in UserNameGridView.GetRows())
                    {
                        if (item.Computer_nvc == gridRow.Cells["username_nvc"].Value.ToString())
                        {
                            gridRow.IsChecked = true;
                        }
                    }
                }
            }
        }
Beispiel #4
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;
        }
Beispiel #5
0
 private void LoadComputer()
 {
     try
     {
         HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();
         DataTable ComputerDataTable = new DataTable();
         ComputerFactory.GetAll(ref ComputerDataTable);
         ComputerDataTable = ComputerDataTable.Select("deleted_bit=false").CopyToDataTable();
         this.ComputerGridView.DataSource = ComputerDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Beispiel #6
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();
     HPS.BLL.ComputerBLL.BLLComputer_T        ComputerEntity  = ComputerFactory.GetBy((HPS.BLL.ComputerBLL.BLLComputer_TKeys)Key);
     if (ComputerEntity == null)
     {
         throw new HPS.Exceptions.ComputerNotFound();
     }
     Computer_nvcComboBox.Text  = Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.Computer_nvc, TypeCode.String).ToString();
     MessageLED_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.MessageLED_nvc, TypeCode.String).ToString();
     IPTextBox.Text             = Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.IPAddress_nvc, TypeCode.String).ToString();
     MacTextBox.Text            = Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.MacAddress_nvc, TypeCode.String).ToString();
     Active_bitCheckBox.Checked = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(ComputerEntity.Active_bit, TypeCode.Boolean);
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref UserGroupID_intComboBox, ComputerEntity.UserGroupID_int, TypeCode.Int32);
 }
Beispiel #7
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();
                if (ComputerList.Find(a => a.Computer_nvc.Trim() == Hepsa.Core.Common.PersentationController.GetEntityValue(Computer_nvcComboBox.Text.Trim(), TypeCode.String).ToString() && a.Deleted_bit == false && a.MacAddress_nvc == MacTextBox.Text) == null)
                {
                    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);
                    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;
            }
        }
Beispiel #8
0
        private bool CheckComputerRegistration(HPS.BLL.UserBLL.BLLUser_T user)
        {
            if (!((new HPS.BLL.SettingsBLL.BLLSetting_TFactory()).GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
            {
                SettingID_int = 1028
            }).Value_nvc == "1"))
            {
                return(true);
            }
            HPS.BLL.ComputerBLL.BLLComputer_TFactory ComputerFactory = new HPS.BLL.ComputerBLL.BLLComputer_TFactory();
            //TODO: فیلد پاک شده بررسی نمیشد
            string ComputerCondition = "[Computer_T].[MacAddress_nvc]='" + Hepsa.Core.Common.ApplicationInfo.MacAddress + "' and [Computer_T].[Computer_nvc]='" + user.UserName_nvc + "' and [Computer_T].[active_bit]=1 and Deleted_bit=0";
            List <HPS.BLL.ComputerBLL.BLLComputer_T> ComputerList = ComputerFactory.GetAllByCondition(ComputerCondition);

            if (ComputerList != null && ComputerList.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #9
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 #10
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;
            }
        }