Example #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;
        }
Example #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;
                }
            }
        }
Example #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];
        }
Example #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);
        }
Example #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");
            }
        }
Example #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");
            }
        }
Example #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");
            }
        }
Example #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);
     }
 }
Example #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");
            }
        }
Example #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");
            }
        }
Example #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");
            }
        }
        /// <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;
        }
Example #15
0
		public numberField(interfaces.IData Data) 
        {
			_data = Data;
		}
 public dropdownMultiple(interfaces.IData Data, List<KeyValuePair<int, String>> Prevalues)
 {
     _data = Data;
     this.Prevalues = Prevalues;
 }
		public dropdownMultiple(interfaces.IData Data,SortedList Prevalues)
		{
			_data = Data;
			_prevalues = Prevalues;
		}
Example #18
0
		public memberPicker(interfaces.IData Data)
		{
			_data = Data;
		}
Example #19
0
 public checkboxlistEditor(interfaces.IData Data, List<KeyValuePair<int, String>> Prevalues)
 {
     _data = Data;
     this.Prevalues = Prevalues;
 }
Example #20
0
 public radiobox(interfaces.IData Data, List<KeyValuePair<int, String>> Prevalues)
 {
     _data = Data;
     this.Prevalues = Prevalues;
 }
Example #21
0
		public checkboxlistEditor(interfaces.IData Data,SortedList Prevalues)
		{
			_data = Data;
			_prevalues = Prevalues;
		}
Example #22
0
 public colorPicker(interfaces.IData Data, List<KeyValuePair<int, String>> Prevalues)
 {
     _data = Data;
     this.Prevalues = Prevalues;
 }
Example #23
0
		public dateField(interfaces.IData Data) {
			_data = Data;
		}
Example #24
0
		public pagePicker(interfaces.IData Data)
		{
			_data = Data;
		}
Example #25
0
 public pagePicker(interfaces.IData data) : base(data) { }
Example #26
0
		public radiobox(interfaces.IData Data, SortedList Prevalues) 
		{
			_data = Data;
			_prevalues = Prevalues;
		}
Example #27
0
		public noEdit(interfaces.IData Data) {
			_data = Data;
		}
Example #28
0
 public void AddTask(interfaces.ITask task)
 {
     this.taskList.Add(task);
 }
Example #29
0
		public SimpleEditor(interfaces.IData Data) 
		{
			_data = Data;

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