public ActionResult ChangeMonitor(cMonitor monitor, int?quantity, string image)
        {
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            PartsStock part = new PartsStock();

            if (quantity != null)
            {
                part.Quantity = (int)quantity;
            }
            else
            {
                part.Quantity = sr.getPart(monitor.id).Quantity;
            }
            if (image != null && image != "")
            {
                part.Image = image;
            }
            else
            {
                part.Image = sr.getPart(monitor.id).image;
            }
            bool done = sr.EditMonitor(monitor, part, monitor.id);

            if (done)
            {
                return(this.Redirect(Url.Action("Complete", "EditProduct")));
            }
            else
            {
                return(this.Redirect(Url.Action("Monitor", "EditProduct")));
            }
        }
        public ActionResult Monitor(int id)
        {
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            cMonitor part = sr.getMonitor(id);

            return(View(part));
        }
Esempio n. 3
0
        public ActionResult Monitor()
        {
            if (Convert.ToInt32(Session["UserType"]) != 1 && Convert.ToInt32(Session["UserType"]) != 3)
            {
                return(this.Redirect(@Url.Action("Index", "Home")));
            }
            cMonitor part = new cMonitor
            {
                active = 0
            };

            return(View(part));
        }
Esempio n. 4
0
 public override PluginArgs ChannelPart(PluginArgs args)
 {
     if (args.Nick == args.Connection.ServerSetting.NickName)
     {
         //remove the channel from the list
         cMonitor newChan = new cMonitor(args.Connection, StripColorCodes(args.Channel));
         if (monitoredChannels.IndexOf(newChan) > -1)
         {
             monitoredChannels.Remove(newChan);
             AddMonitorMessage(args.Channel, "Stopped Monitoring channel:" + monitoredChannels.Count, false, args.Connection.ServerSetting.ID);
         }
     }
     return(args);
 }
Esempio n. 5
0
        private void OnEnableMonitor_Click(object sender, EventArgs e)
        {
            //get the current selected item for the popup menu
            cMonitor newChan  = new cMonitor(ServerTreeCurrentConnection, StripColorCodes(ServerTreeCurrentTab));
            bool     mEnabled = false;

            if (((ToolStripMenuItem)sender).CheckState == CheckState.Checked)
            {
                //remove the channel from being monitored
                if (monitoredChannels.IndexOf(newChan) > -1)
                {
                    monitoredChannels.Remove(newChan);
                    AddMonitorMessage(newChan.channel, "Stopped Monitoring channel:" + monitoredChannels.Count, false, ServerTreeCurrentConnection.ServerSetting.ID);
                }
                ((ToolStripMenuItem)sender).CheckState = CheckState.Unchecked;
            }
            else
            {
                //add the channel for monitoring
                if (monitoredChannels.IndexOf(newChan) == -1)
                {
                    monitoredChannels.Add(newChan);
                    AddMonitorMessage(newChan.channel, "Started Monitoring channel:" + monitoredChannels.Count, false, ServerTreeCurrentConnection.ServerSetting.ID);
                }
                ((ToolStripMenuItem)sender).CheckState = CheckState.Checked;
                mEnabled = true;
            }

            //save this setting in an XML file
            if (monitorChannels.ChannelExist(newChan.channel) != null)
            {
                monitorChannels.UpdateChannel(newChan.channel, mEnabled);
            }
            else
            {
                MonitorItem c = new MonitorItem
                {
                    Channel = newChan.channel,
                    Enabled = mEnabled
                };

                monitorChannels.AddChannel(c);
            }

            SaveSettings();
        }
Esempio n. 6
0
        public override PluginArgs ChannelAction(PluginArgs args)
        {
            cMonitor newChan = new cMonitor(args.Connection, StripColorCodes(args.Channel));

            if (monitoredChannels.IndexOf(newChan) > -1)
            {
                string message = StripColorCodes(args.Message);
                if (message.IndexOf(args.Connection.ServerSetting.CurrentNickName) > -1)
                {
                    AddMonitorMessage(args.Channel, message, true, args.Connection.ServerSetting.ID);
                }
                else
                {
                    AddMonitorMessage(args.Channel, message, false, args.Connection.ServerSetting.ID);
                }
            }
            return(args);
        }
Esempio n. 7
0
        public override ToolStripMenuItem MenuItemShow(ToolStripMenuItem menu)
        {
            if (menu == m_EnableMonitor)
            {
                // check if this needs to be checked or not
                cMonitor newChan = new cMonitor(ServerTreeCurrentConnection, StripColorCodes(ServerTreeCurrentTab));
                if (monitoredChannels.IndexOf(newChan) > -1)
                {
                    menu.Checked = true;
                }
                else
                {
                    menu.Checked = false;
                }
            }

            return(menu);
        }
Esempio n. 8
0
        public ActionResult addMonitor(cMonitor part, string image)
        {
            if (Convert.ToInt32(Session["UserType"]) != 1 && Convert.ToInt32(Session["UserType"]) != 3)
            {
                return(this.Redirect(@Url.Action("Index", "Home")));
            }
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            bool added = sr.addMonitor(part, 1, image);

            if (added)
            {
                return(this.Redirect(Url.Action("Complete", "AddNewProduct")));
            }
            else
            {
                return(this.Redirect(Url.Action("Monitor", "AddNewProduct")));
            }
        }
Esempio n. 9
0
        public override PluginArgs ChannelJoin(PluginArgs args)
        {
            if (args.Nick == args.Connection.ServerSetting.NickName)
            {
                //add the channel to the list
                //check if this channel is on Monitor settings
                bool disabled = false;
                if (monitorChannels.ChannelExist(args.Channel) != null)
                {
                    if (monitorChannels.ChannelExist(args.Channel).Enabled == false)
                    {
                        disabled = true;
                    }
                }

                if (disabled == false)
                {
                    cMonitor newChan = new cMonitor(args.Connection, StripColorCodes(args.Channel));
                    monitoredChannels.Add(newChan);

                    AddMonitorMessage(args.Channel, "Started Monitoring channel:" + monitoredChannels.Count, false, args.Connection.ServerSetting.ID);
                }

                if (monitorChannels.ChannelExist(args.Channel) != null)
                {
                    monitorChannels.UpdateChannel(args.Channel, !disabled);
                }
                else
                {
                    MonitorItem c = new MonitorItem
                    {
                        Channel = args.Channel,
                        Enabled = !disabled
                    };

                    monitorChannels.AddChannel(c);
                }

                SaveSettings();
            }
            return(args);
        }
Esempio n. 10
0
        //declare all the necessary events

        public override PluginArgs ChannelMessage(PluginArgs args)
        {
            //check if monitoring is enabled for this channel
            cMonitor newChan = new cMonitor(args.Connection, StripColorCodes(args.Channel));

            if (monitoredChannels.IndexOf(newChan) > -1)
            {
                //check if nick is said
                string message = StripColorCodes(args.Message);
                if (message.IndexOf(args.Connection.ServerSetting.CurrentNickName) > -1)
                {
                    AddMonitorMessage(args.Channel, message, true, args.Connection.ServerSetting.ID);
                }
                else
                {
                    AddMonitorMessage(args.Channel, message, false, args.Connection.ServerSetting.ID);
                }
            }
            return(args);
        }
Esempio n. 11
0
 public override void MainProgramLoaded(SortedList ServerConnections)
 {
     //automatically add in the opened channels
     foreach (IceChat.IRCConnection c in ServerConnections.Values)
     {
         if (c.IsConnected)
         {
             //get all the open channels
             foreach (string chan in c.OpenChannels)
             {
                 cMonitor newChan = new cMonitor(c, StripColorCodes(chan));
                 if (monitoredChannels.IndexOf(newChan) == -1)
                 {
                     monitoredChannels.Add(newChan);
                     AddMonitorMessage(newChan.channel, "Started Monitoring channel:" + monitoredChannels.Count, false, c.ServerSetting.ID);
                 }
             }
         }
     }
 }
Esempio n. 12
0
 private void OnEnableMonitor_Click(object sender, EventArgs e)
 {
     //get the current selected item for the popup menu
     cMonitor newChan = new cMonitor(ServerTreeCurrentConnection, ServerTreeCurrentTab);
     if (((ToolStripMenuItem)sender).CheckState == CheckState.Checked)
     {
         //remove the channel from being monitored
         if (monitoredChannels.IndexOf(newChan) > -1)
         {
             monitoredChannels.Remove(newChan);
             AddMonitorMessage(newChan.channel, "Stopped Monitoring channel:" + monitoredChannels.Count);
         }
         ((ToolStripMenuItem)sender).CheckState = CheckState.Unchecked;
     }
     else
     {
         //add the channel for monitoring
         if (monitoredChannels.IndexOf(newChan) == -1)
         {
             monitoredChannels.Add(newChan);
             AddMonitorMessage(newChan.channel, "Started Monitoring channel:" + monitoredChannels.Count);
         }
         ((ToolStripMenuItem)sender).CheckState = CheckState.Checked;
     }
 }
Esempio n. 13
0
        public override PluginArgs ChannelPart(PluginArgs args)
        {
            if (args.Nick == args.Connection.ServerSetting.NickName)
            {
                //remove the channel from the list
                cMonitor newChan = new cMonitor(args.Connection, args.Channel);
                if (monitoredChannels.IndexOf(newChan) > -1)
                {
                    monitoredChannels.Remove(newChan);
                    AddMonitorMessage(args.Channel, "Stopped Monitoring channel:" + monitoredChannels.Count);
                }

            }
            return args;
        }
Esempio n. 14
0
 //declare all the necessary events
 public override PluginArgs ChannelMessage(PluginArgs args)
 {
     //check if monitoring is enabled for this channel
     cMonitor newChan = new cMonitor(args.Connection, args.Channel);
     if (monitoredChannels.IndexOf(newChan) > -1)
         AddMonitorMessage(args.Channel, StripColorCodes(args.Message));
     return args;
 }
Esempio n. 15
0
        public override PluginArgs ChannelJoin(PluginArgs args)
        {
            if (args.Nick == args.Connection.ServerSetting.NickName)
            {
                //add the channel to the list
                cMonitor newChan = new cMonitor(args.Connection, args.Channel);
                monitoredChannels.Add(newChan);

                AddMonitorMessage(args.Channel, "Started Monitoring channel:" + monitoredChannels.Count);
            }
            return args;
        }
Esempio n. 16
0
 public override PluginArgs ChannelAction(PluginArgs args)
 {
     cMonitor newChan = new cMonitor(args.Connection, args.Channel);
     if (monitoredChannels.IndexOf(newChan) > -1)
         AddMonitorMessage(args.Channel, StripColorCodes(args.Message));
     return args;
 }