Ejemplo n.º 1
0
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif
            // menu
            ts      = new ToolStripMenuItem("Configurar Consola Tonos...", null, new EventHandler(MenuClick));
            ts.Name = "config";
            ZeusWin.AgregarConfig(ts);
            // boton
            tb      = new ToolStripButton("Consola Tonos", Resources.consola_tonos_32, new EventHandler(ButtonClick));
            tb.Name = "TonosBtn";
            tb.TextImageRelation     = TextImageRelation.ImageAboveText;
            tb.ImageTransparentColor = System.Drawing.Color.Magenta;
            tb.AutoSize = false;
            tb.Width    = 90;
            tb.Height   = 50;
            ZeusWin.AgregarBoton(tb);
        }
Ejemplo n.º 2
0
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif
            // menu
            ts = new ToolStripMenuItem("Configurar HazMat...", null, new EventHandler(MenuClick))
            {
                Name = "config"
            };
            ZeusWin.AgregarConfig(ts);
            // boton
            tb = new ToolStripButton("Guía ERGOS", Resources.ergo_32, ButtonClick)
            {
                Name = "HazMatBtn",
                TextImageRelation     = TextImageRelation.ImageAboveText,
                ImageTransparentColor = Color.Magenta,
                AutoSize = false,
                Width    = 90,
                Height   = 50
            };
            ZeusWin.AgregarBoton(tb);
        }
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif

            // menu
            if (ZeusWin.TipoOperadora == TipoOperadora.Administrador)
            {
                ts = new ToolStripMenuItem("Configurar Resumen Actos...", null, new EventHandler(MenuClick))
                {
                    Name = "resumenConfig"
                };
                ZeusWin.AgregarConfig(ts);
            }

            // boton
            tb = new ToolStripButton("Resumen Actos", Resources.resumen_actos_servicios_32, ButtonClick)
            {
                Name = "ResumenBtn",
                TextImageRelation     = TextImageRelation.ImageAboveText,
                ImageTransparentColor = Color.Magenta,
                AutoSize = false,
                Width    = 90,
                Height   = 50
            };
            ZeusWin.AgregarBoton(tb);
        }
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif

            // menú
            if (ZeusWin.TipoOperadora == TipoOperadora.Administrador)
            {
                config      = new ToolStripMenuItem("Modificar Sectores...", null, new EventHandler(MenuClick));
                config.Name = "configSector";
            }
            // botón
            button      = new ToolStripButton("Especialidades", Resources.asignacion_carro_especialidad_32, new EventHandler(ButtonClick));
            button.Name = "CEspecialidadesBtn";
            button.TextImageRelation     = TextImageRelation.ImageAboveText;
            button.ImageTransparentColor = System.Drawing.Color.Magenta;
            button.AutoSize = false;
            button.Width    = 90;
            button.Height   = 50;
            ZeusWin.AgregarBoton(button);
        }
Ejemplo n.º 5
0
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;
#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif
            // menu
            if (ZeusWin.TipoOperadora == TipoOperadora.Administrador)
            {
                ts = new ToolStripMenuItem("Configurar Despacho por Solicitud de Herramientas y Equipos...", null,
                                           new EventHandler(MenuClick))
                {
                    Name = "dheConfig"
                };
                ZeusWin.AgregarConfig(ts);
            }

            // boton
            tb = new ToolStripButton("Despacho H.E.", Resources.icon, ButtonClick)
            {
                ToolTipText           = "Despacho por Solicitud de Herramientas y Equipos",
                Name                  = "dheButton",
                TextImageRelation     = TextImageRelation.ImageAboveText,
                ImageTransparentColor = Color.Magenta,
                AutoSize              = false,
                Width                 = 90,
                Height                = 50
            };
            ZeusWin.AgregarBoton(tb);
        }
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif

            // boton
            boton = new ToolStripButton("C. Alternativo", Resources.carro_alternativo_32, ButtonClick)
            {
                Name              = "CarroAltBtn",
                ToolTipText       = "Carro Alternativo",
                TextImageRelation = TextImageRelation.ImageAboveText,
                AutoSize          = false,
                Width             = 90,
                Height            = 50
            };
            //boton.ImageTransparentColor = System.Drawing.Color.White;
            ZeusWin.AgregarBoton(boton);

            // menu
            //main = new ToolStripMenuItem("Carros", null, (EventHandler)null);
            //ToolStripMenuItem mc = new ToolStripMenuItem("Carro Alternativo...", null, new EventHandler(MenuClick));
            //mc.Name = "alternativo";
            //main.DropDownItems.Add(mc);
            //ZeusWin.AgregarMenu(main);
        }
Ejemplo n.º 7
0
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif
            // menu
            //ts = new ToolStripMenuItem("Prueba de Equipos...", null, new EventHandler(MenuClick));
            //ts.Name = "prueba";
            //ZeusWin.AgregarConfig(ts);
            //if (ZeusWin.TipoOperadora == TipoOperadora.Administrador)
            //{
            //    ts2 = new ToolStripMenuItem("Configurar Prueba de Equipos...", null, new EventHandler(MenuClick));
            //    ts2.Name = "config_prueba";
            //    ZeusWin.AgregarConfig(ts2);
            //}

            // boton
            tb = new ToolStripButton("Estadísticas", Resources.statistics_32x32, ButtonClick)
            {
                Name = "EstadisticasBtn",
                TextImageRelation     = TextImageRelation.ImageAboveText,
                ImageTransparentColor = Color.Magenta,
                AutoSize = false,
                Width    = 90,
                Height   = 50
            };
            ZeusWin.AgregarBoton(tb);
        }
Ejemplo n.º 8
0
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif

            // menu
            if (ZeusWin.TipoOperadora == TipoOperadora.Administrador)
            {
                ts = new ToolStripMenuItem("Configurar Boletín...", null, new EventHandler(MenuClick))
                {
                    Name = "boletinConfig"
                };
                ZeusWin.AgregarConfig(ts);
            }

            // boton
            tb = new ToolStripButton("Boletín", null, ButtonClick)
            {
                Name = "BoletinBtn",
                TextImageRelation = TextImageRelation.ImageAboveText,
                ImageAlign        = ContentAlignment.TopCenter,
                Image             = Resources.boletin_informativo_32,
                AutoSize          = false,
                Width             = 90,
                Height            = 50
            };
            //tb.ImageTransparentColor = System.Drawing.Color.Magenta;
            ZeusWin.AgregarBoton(tb);

            // precargar assemblies
            //DateTime date = new DateTime(); DateTime ts1 = new DateTime(); DateTime ts2 = new DateTime();
#if CBMS
            BoletinCBMS bc = new BoletinCBMS();
            bc.Load();
#elif CBQN
            //date = DateTime.Now;
            //BoletinCBQN bc = new BoletinCBQN();
            //ts1 = DateTime.Now;
            //bc.Load();
            //ts2 = DateTime.Now;
            //MessageBox.Show("Tiempo new:"+(ts1-date).ToString()+" tiempo load:"+(ts2-ts1).ToString());
#endif
        }
Ejemplo n.º 9
0
    protected void dvUSBKey_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        USBKey usbkey = new USBKey();

        usbkey.Serialnumber = e.Values["Serialnumber"].ToString();

        string errors = Utilities.CheckIfExists(usbkey);

        if (errors.Length > 0)
        {
            e.Cancel = true;
            SetError(errors);
        }

        e.Values["CreatedBy"] = Membership.GetUser().ProviderUserKey;
    }
Ejemplo n.º 10
0
        public MainForm()
        {
            InitializeComponent();

            // inicializar sistema de logs

            Log.Init(Path.Combine(System.Windows.Forms.Application.UserAppDataPath,
                                  "Log " + DateTime.Now.ToString("dd-MM-yy") + ".txt"));

            plugins = new PluginsManager(this);
            usbKey  = new USBKey();

            // agregar referencias
            mainTabs1.ZeusWin           = this;
            mainLlamadosCarros1.ZeusWin = this;
            mainTree1.ZeusWin           = this;
        }
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif
            // menu
            //ts = new ToolStripMenuItem("Libro de Novedades...", null, new EventHandler(MenuClick));
            //ts.Name = "novedades";
            //ZeusWin.AgregarConfig(ts);

            var tmi = new ToolStripMenuItem("Agregar nuevo evento...")
            {
                Name = "cms_novedades"
            };
            tmi.Click += MenuClick;
            tmi        = new ToolStripMenuItem("Ver bitácoras...")
            {
                Name = "cms_ver"
            };
            tmi.Click += MenuClick;


            // boton
            tb = new ToolStripSplitButton("L. Novedades", Resources.libro_novedades_32, new EventHandler(ButtonClick))
            {
                Name                  = "NovedadesBtn",
                ToolTipText           = "Libro Novedades",
                TextImageRelation     = TextImageRelation.ImageAboveText,
                ImageTransparentColor = Color.Magenta,
                AutoSize              = false,
                Width                 = 90,
                Height                = 50
            };
            tb.DropDown.Items.Add("Agregar Nuevo Evento...", null, MenuClick).Name   = "cms_novedades";
            tb.DropDown.Items.Add("Ver Libro de Novedades...", null, MenuClick).Name = "cms_ver";

            ZeusWin.AgregarBoton(tb);
        }
Ejemplo n.º 12
0
    protected void dvUSBKey_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        Page.Validate();

        if (Page.IsValid)
        {
            USBKey usbkey = new USBKey();
            string error  = "";

            usbkey.Serialnumber = e.NewValues["Serialnumber"].ToString().ToUpper();

            error = Utilities.CheckIfExists(usbkey, e.Keys["ID"].ToString());

            if (error.Length > 0)
            {
                lblError.Text    = Utilities.GetErrorMsg(error);
                lblError.Visible = true;
                e.Cancel         = true;
            }

            e.NewValues["Serialnumber"] = e.NewValues["Serialnumber"].ToString().ToUpper();
            e.NewValues["UserID"]       = Membership.GetUser().ProviderUserKey;

            string changedNote = "";

            if (!Utilities.CompareValues(e.OldValues["Serialnumber"], e.NewValues["Serialnumber"]))
            {
                changedNote += "Serienummer, ";
            }
            if (!Utilities.CompareValues(e.OldValues["Discarded"], e.NewValues["Discarded"]))
            {
                changedNote += "Kasseret, ";
            }
            if (!Utilities.CompareValues(e.OldValues["Comment"], e.NewValues["Comment"]))
            {
                changedNote += "Bemærkninger, ";
            }

            changedNote = Utilities.RemoveEndString(changedNote, ", ");

            e.NewValues["Note"] = changedNote;
        }
    }
Ejemplo n.º 13
0
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;
#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif

            timer = new Timer {
                Interval = 1000
            };
            timer.Tick += timer_Tick;
            // menú
            config = new ToolStripMenuItem("Configurar Alerta de Ferias...", null, new EventHandler(MenuClick))
            {
                Name = "config"
            };
            ZeusWin.AgregarConfig(config);

            Despacho.OnDespacho += DespachoHandler;

            // botón
            tb = new ToolStripButton("Alerta Ferias", /*Resources.feria1.ToBitmap()*/ Resources.ferias_32_1, ButtonClick)
            {
                Name              = "FeriaBtn",
                Enabled           = false,
                TextImageRelation = TextImageRelation.ImageAboveText,
                AutoSize          = false,
                Width             = 90,
                Height            = 50
            };
            //tb.ImageTransparentColor = System.Drawing.Color.Magenta;
            ZeusWin.AgregarBoton(tb);
        }
        public void Initialize(IZeusWin Isg)
        {
            ZeusWin = Isg;

#if USBKEY
            // verificar llave
            USBKey usb = new USBKey();
            if (!usb.IniciarConexion("00"))
            {
                return;
            }
#endif

            // menú
            if (ZeusWin.TipoOperadora == TipoOperadora.Administrador)
            {
                config = new ToolStripMenuItem("Configurar Agenda Inspectores...", null, new EventHandler(MenuClick))
                {
                    Name = "configAgendaDepto"
                };
                ZeusWin.AgregarConfig(config);
            }
            // botón
            button = new ToolStripButton("A. Inspectores", Resources.agenda_inspectores_32, ButtonClick)
            {
                Name                  = "AgendaDepartamentosBtn",
                ToolTipText           = "Agenda Inspectores",
                TextImageRelation     = TextImageRelation.ImageAboveText,
                ImageTransparentColor = Color.Magenta,
                AutoSize              = false,
                Width                 = 90,
                Height                = 50
            };
            //button.Visible = false;
            ZeusWin.AgregarBoton(button);
        }
Ejemplo n.º 15
0
        //获取USB使用信息
        private void button1_Click(object sender, EventArgs e)
        {
            //清空内容
            richTextBox1.Clear();
            //定义注册表顶级节点 其命名空间是using Microsoft.Win32;
            RegistryKey USBKey;

            //检索子项
            USBKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Enum\USBSTOR", false);
            //记录获取数量赋初值
            Num = 0;

            //检索所有子项USBSTOR下的字符串数组
            foreach (string sub1 in USBKey.GetSubKeyNames())
            {
                RegistryKey sub1key = USBKey.OpenSubKey(sub1, false);
                foreach (string sub2 in sub1key.GetSubKeyNames())
                {
                    try
                    {
                        /* OpenSubKey 检索子项 函数原型
                         * public RegistryKey OpenSubKey(
                         *  string name,     //要打开的子项名称或路径
                         *  bool writable    //如果需要项的写访问权限=true
                         * )
                         */

                        //打开sub1key的子项
                        RegistryKey sub2key = sub1key.OpenSubKey(sub2, false);
                        //检索Service=disk(磁盘)值的子项 cdrom(光盘)
                        if (sub2key.GetValue("Service", "").Equals("disk"))
                        {
                            String Path = "USBSTOR" + "\\" + sub1 + "\\" + sub2;
                            String Name = (string)sub2key.GetValue("FriendlyName", "");

                            string fileName = "usbDeleteLog.txt";     //文件名称
                            bool   isDelete = false;                  //是否删除
                            string content  = "";                     //文件内容
                            //判断是否文件存在
                            if (!File.Exists(fileName))
                            {
                                //创建写入文件
                                FileStream   fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
                                StreamWriter sw = new StreamWriter(fs);
                                sw.WriteLine();
                                sw.Close();
                                fs.Close();
                            }
                            else
                            {
                                StreamReader sReader = new StreamReader(fileName);
                                content  = sReader.ReadToEnd();
                                isDelete = content.Contains(Path);
                                sReader.Close();
                            }

                            //不存在
                            if (isDelete == false)
                            {
                                //记录第一条信息删除
                                if (Num == 0)
                                {
                                    deleteFirstUSB = Path;
                                }

                                //添加信息
                                Num++;
                                string num  = "信息标号 No." + Num + "\r\n";
                                string name = "USB名称  " + Name + "\r\n";
                                string uid  = "UID标记  " + sub2 + "\r\n";
                                string path = "路径信息 " + Path + "\r\n";
                                //获取当前时间
                                string time = "log时间 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "\r\n";

                                //利用文件知识存储后台USB管理信息
                                string usbFileLog = "usbFileLog.txt";
                                if (!File.Exists(usbFileLog))
                                {
                                    //创建写入文件
                                    FileStream   fs = new FileStream(usbFileLog, FileMode.Create, FileAccess.Write);
                                    StreamWriter sw = new StreamWriter(fs);
                                    sw.WriteLine(num + name + uid + path + time);
                                    sw.Close();
                                    fs.Close();
                                }
                                else
                                {
                                    //写入文件
                                    using (StreamWriter sw = new StreamWriter(usbFileLog, true))
                                    {
                                        sw.WriteLine(num + name + uid + path + time);
                                        sw.Close();
                                    }
                                }
                                //添加信息
                                richTextBox1.AppendText(num);
                                richTextBox1.AppendText(name);
                                richTextBox1.AppendText(uid);
                                richTextBox1.AppendText(path + "\r\n");
                            }
                        }
                    }
                    catch (Exception msg) //异常处理
                    {
                        MessageBox.Show(msg.Message);
                    }
                }
            }

            //提示
            if (Num == 0)
            {
                MessageBox.Show(this, "USB使用记录已经删空,无信息!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                label2.Text = "☺☺☺☺☺☺☺\n秀璋提醒您:\nUSB信息已空\n☺☺☺☺☺☺☺";
            }
            else
            {
                label2.Text = "☺☺☺☺☺☺☺\n秀璋提醒您:\nUSB信息获取成功\n☺☺☺☺☺☺☺";
            }
        }
Ejemplo n.º 16
0
        //删除USB信息
        private void button2_Click(object sender, EventArgs e)
        {
            //定义注册表顶级节点 其命名空间是using Microsoft.Win32;
            RegistryKey USBKey;

            //检索子项
            USBKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Enum\USBSTOR", false);

            //检索所有子项USBSTOR下的字符串数组
            foreach (string sub1 in USBKey.GetSubKeyNames())
            {
                RegistryKey sub1key = USBKey.OpenSubKey(sub1, false);
                foreach (string sub2 in sub1key.GetSubKeyNames())
                {
                    try
                    {
                        //打开sub1key的子项
                        RegistryKey sub2key = sub1key.OpenSubKey(sub2, false);

                        //检索Service=disk(磁盘)值的子项 cdrom(光盘)
                        if (sub2key.GetValue("Service", "").Equals("disk"))
                        {
                            String Path = "USBSTOR" + "\\" + sub1 + "\\" + sub2;

                            try
                            {
                                //其中sub2存储的是USBSTOR/Disk&Ven_agio&Prod_&Rev_/00A1234567AF&0中
                                if (deleteFirstUSB == Path)
                                {
                                    //获取删除路径信息
                                    string usb = @"SYSTEM\CurrentControlSet\Enum\" + deleteFirstUSB;

                                    //usb = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR\Disk&Ven_aigo&Prod_&Rev_\00A1234567AF&0";
                                    //USBSTOR\Disk&Ven_aigo&Prod_&Rev_\00A1234567AF&0

                                    //确认删除
                                    if (MessageBox.Show("确认要删除第一条USB信息?路径:" + usb, "验证提示",
                                                        System.Windows.Forms.MessageBoxButtons.YesNo,
                                                        System.Windows.Forms.MessageBoxIcon.Question) ==
                                        System.Windows.Forms.DialogResult.Yes)
                                    {
                                        //删除文件
                                        //Registry.LocalMachine.DeleteSubKeyTree(usb,true);
                                        //设置键值为空(该子项不存在,因此无法删除)
                                        //Registry.SetValue(usb, "Service", "null");

                                        //文件存储后台USB删除log信息
                                        string usbDeleteLog = "usbDeleteLog.txt";
                                        if (!File.Exists(usbDeleteLog))
                                        {
                                            //创建写入文件
                                            FileStream   fs = new FileStream(usbDeleteLog, FileMode.Create, FileAccess.Write);
                                            StreamWriter sw = new StreamWriter(fs);
                                            sw.WriteLine(Path);
                                            sw.Close();
                                            fs.Close();
                                        }
                                        else
                                        {
                                            //写入文件
                                            using (StreamWriter sw = new StreamWriter(usbDeleteLog, true))
                                            {
                                                sw.WriteLine(Path);
                                                sw.Close();
                                            }
                                        }
                                        MessageBox.Show("删除USB痕迹成功!路径:" + usb, "信息提示",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        label2.Text = "☺☺☺☺☺☺☺\n秀璋提醒您:\nUSB信息删除成功\n☺☺☺☺☺☺☺";
                                        //清空内容
                                        richTextBox1.Clear();
                                    }
                                }
                            }
                            catch (Exception m) //异常处理
                            {
                                MessageBox.Show(m.Message);
                            }
                        }
                    }
                    catch (Exception msg) //异常处理
                    {
                        MessageBox.Show(msg.Message);
                    }
                }
            }
        }