Esempio n. 1
0
        public void Move(BindingSource BSTemp)
        {
            int ComputerID = GetidCurrentComputer(BSTemp);

            DS_NiheComputers.CompRow cr = DS.Comp.FindByID(ComputerID);
            Computer   comp             = new Computer(DS, cr);
            DialogMove D = new DialogMove(comp);

            if (MoveEvent != null)
            {
                MoveEvent(this, D);
                if (D.Changed)
                {
                    if (comp.Room != D.Room)
                    {
                        DisconectMonitor(comp, D.Date, D.ExtendedInfo);
                    }
                    comp.DepartmentID = D.DepartmentID;
                    comp.Username     = D.Username;
                    comp.Room         = D.Room;
                    WriteEvent("Перемещение клмпьютера", D.Date, comp, D.ExtendedInfo);
                }
            }
            D    = null;
            comp = null;
        }
Esempio n. 2
0
        public void Add()
        {
            DS_NiheComputers.CompRow cr = null;
            DialogComputerAdd        D  = new DialogComputerAdd();
            string infoString           = null;

            if (ComputerAddEvent != null)
            {
                ComputerAddEvent(this, D);
                if (D.Changed)
                {
                    cr              = DS.Comp.NewCompRow();
                    cr.Name         = D.ComputerName;
                    cr.DepartmentID = D.DepartmentID;
                    cr.HDDID        = D.HDD;
                    cr.Num          = D.Number;
                    cr.OSID         = D.OSID;
                    cr.ProcessorID  = D.ProcessorID;
                    cr.PurchaseDate = D.PurchaseDate;
                    cr.WarantyDate  = D.PurchaseDate.AddYears((int)D.WarantyDate);
                    cr.Room         = D.Room;
                    cr.User         = D.Username;
                    cr.RAMID        = D.RAMID;
                    cr.GUID         = D.GUID;
                    DS.Comp.AddCompRow(cr);
                    Computer comp = new Computer(DS, cr);
                    infoString = comp.FullName;
                    EventWriterComp ewc = new EventWriterComp(DS, D);
                    ewc.EventName = "Поступление компьютера";
                    ewc.Info      = comp.FullName;
                    if (comp.Number != null & comp.Number != "")
                    {
                        ewc.Info = string.Format("{0}\r\nИнв. №: {1}", ewc.Info, comp.Number);
                    }
                    if (comp.Vendor != null & comp.Vendor != " ")
                    {
                        ewc.Info = string.Format("{0}\r\nПроизвод.: {1}", ewc.Info, comp.Vendor);
                    }
                    if (comp.Department != null & comp.Department != "")
                    {
                        ewc.Info = string.Format("{0}\r\nСтрукт подразд.: {1}", ewc.Info, comp.Department);
                    }
                    if (comp.ComputerName != null & comp.ComputerName != "")
                    {
                        ewc.Info = string.Format("{0}\r\nИмя комп.: {1}", ewc.Info, comp.ComputerName);
                    }
                    if (comp.Room != null & comp.Room != "")
                    {
                        ewc.Info = string.Format("{0}\r\nКабинет: {1}", ewc.Info, comp.Room);
                    }
                    if (comp.Username != null & comp.Username != "")
                    {
                        ewc.Info = string.Format("{0}\r\nИмя польз.: {1}", ewc.Info, comp.Username);
                    }
                    ewc.Write();
                    comp = null;
                }
            }
            D = null;
        }
Esempio n. 3
0
 public Computer(DS_NiheComputers DS)
 {
     this.DS = DS;
     DS_NiheComputers.CompRow newRow = DS.Comp.NewCompRow();
     newRow.GUID = Guid.NewGuid().ToString();
     DS.Comp.AddCompRow(newRow);
     this.ComputerRow = newRow;
 }
Esempio n. 4
0
 public void ShowInfo(BindingSource BSTemp, bool ShowDelButton)
 {
     if (ComputerShowInfo != null)
     {
         int ComputerID = GetidCurrentComputer(BSTemp);
         DS_NiheComputers.CompRow cr = DS.Comp.FindByID(ComputerID);
         Computer       Comp         = new Computer(DS, cr);
         DialogComputer D            = new DialogComputer(Comp);
         D.ShowDelButton = ShowDelButton;
         ComputerShowInfo(this, D);
     }
 }
Esempio n. 5
0
        public static Computer FindByGUID(DS_NiheComputers DS, string GUID)
        {
            DS_NiheComputers.CompRow row = null;
            Computer comp         = null;
            var      selectedrows = DS.Comp.Select(string.Format(@"GUID = '{0}'", GUID));

            if (selectedrows.Length > 0)
            {
                DataRow r     = selectedrows[0];
                int     index = (int)r["ID"];
                row  = DS.Comp.FindByID(index);
                comp = new Computer(DS, row);
            }

            return(comp);
        }
Esempio n. 6
0
        public void SimpleEdit(BindingSource BSTemp)
        {
            int ComputerID = GetidCurrentComputer(BSTemp);

            DS_NiheComputers.CompRow cr = DS.Comp.FindByID(ComputerID);
            Computer computer           = new Computer(DS, cr);
            DialogStringValueEdit D     = new DialogStringValueEdit();

            if (SimpleEditEvent != null)
            {
                SimpleEditEvent(this, D);
            }
            if (D.Changed)
            {
                SimpleEdit(computer, D.Date, D.ExtendedInfo);
            }
        }
Esempio n. 7
0
        public void DisconectMonitor(BindingSource BSTemp)
        {
            int ComputerID = GetidCurrentComputer(BSTemp);

            DS_NiheComputers.CompRow cr = DS.Comp.FindByID(ComputerID);
            Computer computer           = new Computer(DS, cr);
            DialogStringValueEdit D     = new DialogStringValueEdit();

            if (SimpleEditEvent != null)
            {
                SimpleEditEvent(this, D);
            }
            if (D.Changed)
            {
                DisconectMonitor(computer, D.Date, D.ExtendedInfo);
                WriteEvent("Отключение монитора", D.Date, computer, D.ExtendedInfo);
                computer.ResetMessage();
            }
        }
Esempio n. 8
0
        public void EditDescription(BindingSource BSTemp)
        {
            int ComputerID = GetidCurrentComputer(BSTemp);

            DS_NiheComputers.CompRow cr = DS.Comp.FindByID(ComputerID);
            Computer comp           = new Computer(DS, cr);
            DialogStringValueEdit D = new DialogStringValueEdit();

            D.StartText = comp.Description;
            if (ChangeStringValueEvent != null)
            {
                ChangeStringValueEvent(this, D);
                if (D.Changed)
                {
                    EditDescription(comp, D.EndText, D.Date, D.ExtendedInfo);
                }
            }
            D    = null;
            comp = null;
        }
Esempio n. 9
0
        public void ChangeDepartment(BindingSource BSTemp)
        {
            int ComputerID = GetidCurrentComputer(BSTemp);

            DS_NiheComputers.CompRow cr = DS.Comp.FindByID(ComputerID);
            Computer            comp    = new Computer(DS, cr);
            DialogListValueEdit D       = new DialogListValueEdit(Operation.ChangeDepartment);

            D.ValuesList = DS.Department.Select("name <> 'списан'", "Sort");
            D.StartValue = comp.DepartmentID;
            if (ChangeListValueEvent != null)
            {
                ChangeListValueEvent(this, D);
                if (D.Changed)
                {
                    ChangeDepartment(comp.GUID, D.EndValue, D.Date, D.ExtendedInfo);
                }
            }
            D    = null;
            comp = null;
        }
Esempio n. 10
0
        public void ChangeOS(BindingSource BSTemp)
        {
            int ComputerID = GetidCurrentComputer(BSTemp);

            DS_NiheComputers.CompRow cr = DS.Comp.FindByID(ComputerID);
            Computer            comp    = new Computer(DS, cr);
            DialogListValueEdit D       = new DialogListValueEdit(Operation.ChangeOS);

            D.ValuesList = DS.OS.Select();
            D.StartValue = comp.OSID;
            if (ChangeListValueEvent != null)
            {
                ChangeListValueEvent(this, D);
                if (D.Changed)
                {
                    comp.OSID = D.EndValue;
                    WriteEvent("Изменение операционной системы компьютера", D.Date, comp, D.ExtendedInfo);
                }
            }
            D    = null;
            comp = null;
        }
Esempio n. 11
0
        public void ChangeMonitor(BindingSource BSTemp)
        {
            int ComputerID = GetidCurrentComputer(BSTemp);

            DS_NiheComputers.CompRow cr = DS.Comp.FindByID(ComputerID);
            Computer            comp    = new Computer(DS, cr);
            DialogListValueEdit D       = new DialogListValueEdit(Operation.ChangeMonitor);

            //D.ValuesList = DS.Monitor.Select(string.Format("room = '{0}'", comp.Room));
            D.ValuesList = DS.Monitor.Select(string.Format("room = '{0}' and computerguid like '' ", comp.Room));

            D.StartValue = comp.MonitorID;
            if (ChangeListValueEvent != null)
            {
                ChangeListValueEvent(this, D);
                if (D.Changed)
                {
                    ChangeMonitor(comp.GUID, D.EndValue, D.Date, D.ExtendedInfo);
                }
            }
            D    = null;
            comp = null;
        }
Esempio n. 12
0
 public void ChangeComputer(string MonitorGuid, int NewCompID, DateTime Date, string ExtendedInfo)
 {
     DS_NiheComputers.CompRow cr = DS.Comp.FindByID(NewCompID);
     ChangeComputer(MonitorGuid, cr.GUID, Date, ExtendedInfo);
 }
Esempio n. 13
0
 public Computer(DS_NiheComputers DS, DS_NiheComputers.CompRow ComputerRow)
 {
     this.DS          = DS;
     this.ComputerRow = ComputerRow;
     RatingCalculation();
 }