Exemplo n.º 1
0
        /// <summary>
        /// Close connection
        /// </summary>
        public void Close()
        {
            try
            {
                switch (OpenInterface)
                {
                case interfaces.COM:
                    SP.ReadExisting();
                    SP.Close();
                    break;

                case interfaces.TCPClient:
                case interfaces.TCPServer:
                case interfaces.Udp:
                    SocketClient.Close();
                    break;

                default:
                    break;
                }
            }
            catch (Exception)
            {
            }
            OpenInterface = interfaces.None;
        }
Exemplo n.º 2
0
        private void bt_ajouter_Click(object sender, EventArgs e)
        {
            if (i <= nombre_d_interface)
            {
                interfaces interfaceAajouter = new interfaces();

                interfaceAajouter.type = tb_type_interface.Text;
                interfaceAajouter.nom = tb_nom_interface.Text;
                commande.listeDesInterfaces.Add(interfaceAajouter);
                lab_interface_ajoute.Text = " Interface " +i+ " : " + tb_nom_interface.Text + " (" + tb_type_interface.Text + ") " + " a été ajouté";
                i++;
                if (i == nombre_d_interface+1)
                {
                    lab_msg.Visible = true;
                    bt_ajouter.Text = "TERMIER";
                    panel2.Enabled = false;
                    lab_interface_ajoute.Text = "Les interfaces ajoutés :\n";

                    StreamWriter w = File.AppendText(@"C:\interfaces.txt");

                    foreach (interfaces j in commande.listeDesInterfaces)
                    {
                        lab_interface_ajoute.Text =lab_interface_ajoute.Text +" - "+  j.nom + " (" + j.type + ")\n";
                          try
                            {
                                w.WriteLine("interface: " + j.nom + " type " + j.type);
                                w.Flush();
                            }catch (Exception v) { Console.WriteLine(v.Message); }
                    }

                    w.Close();
                    bt_console.Visible = true;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Open Serial Port
        /// </summary>
        /// <param name="COM">Name of serial port</param>
        /// <param name="baud">Baud rate</param>
        /// <param name="parity">Parity</param>
        /// <param name="databits">Data bits</param>
        /// <param name="stopbits">Stop bits</param>
        /// <exception cref="System.ArgumentException">Thrown when...</exception>
        /// <exception cref="System.ArgumentNullException">Thrown when...</exception>
        /// <exception cref="System.InvalidOperationException">Thrown when...</exception>
        /// <exception cref="System.UnauthorizedAccessException">Thrown when...</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown when...</exception>
        /// <exception cref="System.IO.IOException">Thrown when...</exception>
        public void Open(string COM)
        {
            SP.PortName = COM;

            SP.Open();
            OpenInterface = interfaces.COM;
            comBuffer     = new byte[0];
            PrevData      = new byte[0];
        }
Exemplo n.º 4
0
        /// <summary>
        /// Class initialization
        /// </summary>
        private void init()
        {
            OpenInterface              = interfaces.None;
            SP                         = new SerialPort();
            SP.DataReceived           += new SerialDataReceivedEventHandler(SP_Received);
            SocketClient.ReceivedData += new NetReceivedEventHandler(TCP_Received);

            //SocketClient.AsyncReceive += new AsyncReceivedEventHandlerTCP(TCP_Received);
            //TimeOut = new System.Timers.Timer(20);
            //TimeOut.Elapsed += new ElapsedEventHandler(TimeOut_Elapsed);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Connect to Udp
        /// </summary>
        /// <param name="hostName">Udp server host name</param>
        /// <param name="portNumber">Port number</param>
        /// <exception cref="System.IO.IOException">Thrown when...</exception>
        public void ConnectUdp(string hostName, int hostPort, int lisenPort = -1)
        {
            bool res = SocketClient.ConnectUdp(hostName, hostPort, lisenPort);

            if (res == true)
            {
                OpenInterface = interfaces.Udp;
                comBuffer     = new byte[0];
                PrevData      = new byte[0];
            }
            else
            {
                throw new System.IO.IOException("Connect Error");
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Connect to TCP/IP server
        /// </summary>
        /// <param name="hostName">TCP/IP server host name</param>
        /// <param name="portNumber">Port number</param>
        /// <exception cref="System.IO.IOException">Thrown when...</exception>
        public void ConnectTcp(string hostName, int portNumber)
        {
            bool res = SocketClient.ConnectTcp(hostName, portNumber);

            if (res == true)
            {
                OpenInterface = interfaces.TCPClient;
                comBuffer     = new byte[0];
                PrevData      = new byte[0];
            }
            else
            {
                throw new System.IO.IOException("Connect Error");
            }
        }
Exemplo n.º 7
0
        public void CreateTCPServer(int portNumber)
        {
            bool res = SocketClient.CreateTcp(portNumber);

            if (res == true)
            {
                OpenInterface = interfaces.TCPServer;
                comBuffer     = new byte[0];
                PrevData      = new byte[0];
            }
            else
            {
                throw new System.IO.IOException("Connect Error");
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Open Serial Port
        /// </summary>
        /// <param name="COM">Name of serial port</param>
        /// <param name="baud">Baud rate</param>
        /// <param name="parity">Parity</param>
        /// <param name="databits">Data bits</param>
        /// <param name="stopbits">Stop bits</param>
        /// <exception cref="System.ArgumentException">Thrown when...</exception>
        /// <exception cref="System.ArgumentNullException">Thrown when...</exception>
        /// <exception cref="System.InvalidOperationException">Thrown when...</exception>
        /// <exception cref="System.UnauthorizedAccessException">Thrown when...</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown when...</exception>
        /// <exception cref="System.IO.IOException">Thrown when...</exception>
        public void ConnectSP(string COM)
        {
            SP.PortName = COM;

            SP.Open();
            OpenedInterface = interfaces.COM;
            comBuffer       = new byte[0];
            RecData         = new byte[0];
            if (ReceivedData == null)
            {
                asynch = false;
            }
            else
            {
                asynch = true;
            }
        }
        /// <summary>
        /// Executes on the current document object when the specified actions occur
        /// </summary>
        /// <param name="documentObject">The document object.</param>
        /// <param name="action">The action.</param>
        /// <returns>Returns true if successfull, otherwise false</returns>
        public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, interfaces.IAction action)
        {
            if (UmbracoSettings.EnsureUniqueNaming)
            {
                string currentName = documentObject.Text;
                int uniqueNumber = 1;

                // Check for all items underneath the parent to see if they match
                // as any new created documents are stored in the bottom, we can just
                // keep checking for other documents with a uniquenumber from 

                //store children array here because iterating over an Array property object is very inneficient.
                var c = Document.GetChildrenBySearch(documentObject.ParentId, currentName + "%");

                // must sort the list or else duplicate name will exist if pages are out out sequence
                //e.g. Page (1), Page (3), Page (2)
                var results = c.OrderBy(x => x.Text, new SimilarNodeNameComparer());
                foreach (Document d in results)
                {
                    if (d.Id != documentObject.Id && d.Text.ToLower() == currentName.ToLower())
                    {
                        currentName = documentObject.Text + " (" + uniqueNumber.ToString() + ")";
                        uniqueNumber++;
                    }
                }

                // if name has been changed, update the documentobject
                if (currentName != documentObject.Text)
                {
                    // add name change to the log
					LogHelper.Debug<umbEnsureUniqueName>("Title changed from '" + documentObject.Text + "' to '" + currentName + "' for document  id" + documentObject.Id);
                    
                    documentObject.Text = currentName;

                    return true;
                }
            }

            return false;
        }
 public void Process(interfaces.INotaPengeluaran notaPengeluaran)
 {
     var period = this.Repository.FindPeriodForDate(notaPengeluaran.Date);
     if (period == null)
     {
         throw new PeriodeNotFoundException();
     }
     var cashFlow = this.Repository.FindCashFlowByPeriod(period.PeriodId);
     if (cashFlow == null)
     {
         throw new CashflowNotFoundException();
     }
     else
     {
         var listAkun = notaPengeluaran.ListAkun();
         var listSummary = this.Repository.ListSummaryAkunIn(period,listAkun);
         foreach (var sumakun in listSummary)
         {
             cashFlow.ChangePengeluaran(sumakun.Akun, sumakun.Nominal,sumakun.Jumlah);
         }
         this.Repository.Save(cashFlow);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// Connect to TCP/IP server
        /// </summary>
        /// <param name="hostName">TCP/IP server host name</param>
        /// <param name="portNumber">Port number</param>
        /// <exception cref="System.IO.IOException">Thrown when...</exception>
        public void ConnectTcp(string hostName, int portNumber)
        {
            if (ReceivedData == null)
            {
                asynch = false;
            }
            else
            {
                asynch = true;
            }
            bool res = SocketClient.ConnectTcp(hostName, portNumber, asynch);

            if (res == true)
            {
                OpenedInterface = interfaces.TCPClient;
                comBuffer       = new byte[0];
                RecData         = new byte[0];
            }
            else
            {
                throw new System.IO.IOException("Connect Error");
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Connect to Udp
        /// </summary>
        /// <param name="hostName">Udp server host name</param>
        /// <param name="portNumber">Port number</param>
        /// <exception cref="System.IO.IOException">Thrown when...</exception>
        public void ConnectUdp(string hostName, int hostPort, int lisenPort = -1)
        {
            if (ReceivedData == null)
            {
                asynch = false;
            }
            else
            {
                asynch = true;
            }
            bool res = SocketClient.ConnectUdp(hostName, hostPort, lisenPort, asynch);

            if (res == true)
            {
                OpenedInterface = interfaces.Udp;
                comBuffer       = new byte[0];
                RecData         = new byte[0];
            }
            else
            {
                throw new System.IO.IOException("Connect Error");
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Create TCP/IP server
        /// </summary>
        /// <param name="portNumber">Lisen port number</param>
        public void CreateTCPServer(int portNumber)
        {
            if (ReceivedData == null)
            {
                asynch = false;
            }
            else
            {
                asynch = true;
            }
            bool res = SocketClient.CreateTcp(portNumber, asynch);

            if (res == true)
            {
                OpenedInterface = interfaces.TCPServer;
                comBuffer       = new byte[0];
                RecData         = new byte[0];
            }
            else
            {
                throw new System.IO.IOException("Connect Error");
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Executes on the current document object when the specified actions occur
        /// </summary>
        /// <param name="documentObject">The document object.</param>
        /// <param name="action">The action.</param>
        /// <returns>Returns true if successfull, otherwise false</returns>
        public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, interfaces.IAction action)
        {
            if (UmbracoSettings.EnsureUniqueNaming)
            {
                string currentName = documentObject.Text;
                int uniqueNumber = 1;

                // Check for all items underneath the parent to see if they match
                // as any new created documents are stored in the bottom, we can just
                // keep checking for other documents with a uniquenumber from

                //store children array here because iterating over an Array property object is very inneficient.
                var c = Document.GetChildrenBySearch(documentObject.ParentId, currentName + "%");
                foreach (Document d in c)
                {
                    if (d.Id != documentObject.Id && d.Text.ToLower() == currentName.ToLower())
                    {
                        currentName = documentObject.Text + " (" + uniqueNumber.ToString() + ")";
                        uniqueNumber++;
                    }

                }

                // if name has been changed, update the documentobject
                if (currentName != documentObject.Text)
                {
                    // add name change to the log
                    umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, umbraco.BusinessLogic.User.GetUser(0), documentObject.Id, "Title changed from '" + documentObject.Text + "' to '" + currentName + "'");

                    documentObject.Text = currentName;

                    return true;
                }
            }

            return false;
        }
Exemplo n.º 15
0
		public numberField(interfaces.IData Data) 
        {
			_data = Data;
		}
Exemplo n.º 16
0
 public dropdownMultiple(interfaces.IData Data, List<KeyValuePair<int, String>> Prevalues)
 {
     _data = Data;
     this.Prevalues = Prevalues;
 }
Exemplo n.º 17
0
		public dropdownMultiple(interfaces.IData Data,SortedList Prevalues)
		{
			_data = Data;
			_prevalues = Prevalues;
		}
Exemplo n.º 18
0
		public memberPicker(interfaces.IData Data)
		{
			_data = Data;
		}
Exemplo n.º 19
0
 public checkboxlistEditor(interfaces.IData Data, List<KeyValuePair<int, String>> Prevalues)
 {
     _data = Data;
     this.Prevalues = Prevalues;
 }
Exemplo n.º 20
0
 public radiobox(interfaces.IData Data, List<KeyValuePair<int, String>> Prevalues)
 {
     _data = Data;
     this.Prevalues = Prevalues;
 }
Exemplo n.º 21
0
		public checkboxlistEditor(interfaces.IData Data,SortedList Prevalues)
		{
			_data = Data;
			_prevalues = Prevalues;
		}
Exemplo n.º 22
0
 public colorPicker(interfaces.IData Data, List<KeyValuePair<int, String>> Prevalues)
 {
     _data = Data;
     this.Prevalues = Prevalues;
 }
Exemplo n.º 23
0
		public dateField(interfaces.IData Data) {
			_data = Data;
		}
Exemplo n.º 24
0
		public pagePicker(interfaces.IData Data)
		{
			_data = Data;
		}
Exemplo n.º 25
0
 public pagePicker(interfaces.IData data) : base(data) { }
Exemplo n.º 26
0
		public radiobox(interfaces.IData Data, SortedList Prevalues) 
		{
			_data = Data;
			_prevalues = Prevalues;
		}
Exemplo n.º 27
0
		public noEdit(interfaces.IData Data) {
			_data = Data;
		}
Exemplo n.º 28
0
 public void AddTask(interfaces.ITask task)
 {
     this.taskList.Add(task);
 }
Exemplo n.º 29
0
		public SimpleEditor(interfaces.IData Data) 
		{
			_data = Data;

		}
Exemplo n.º 30
0
 public colorPicker(interfaces.IData Data, SortedList Prevalues)
 {
     _data = Data;
     _prevalues = Prevalues;
 }
Exemplo n.º 31
0
		public dictionaryPicker(interfaces.IData Data, SortedList Prevalues) 
		{
			_data = Data;
			_prevalues = Prevalues;
		}
Exemplo n.º 32
0
		public mediaChooser(interfaces.IData Data)
		{
			_data = Data;
		}
Exemplo n.º 33
0
		public yesNo(interfaces.IData Data) {
			_data = Data;
		}
Exemplo n.º 34
0
 public TextFieldEditor(interfaces.IData Data)
 {
     _data = Data;
 }
Exemplo n.º 35
0
        public uploadField(interfaces.IData Data, string ThumbnailSizes)
        {
            _data = (Cms.BusinessLogic.datatype.DefaultData)Data;
            _thumbnails = ThumbnailSizes;
		}