Ejemplo n.º 1
0
        private void btn_demarrer_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                Application.DoEvents();
                canal = new TcpChannel(4001);

                ChannelServices.RegisterChannel(canal, false);

                RemotingConfiguration.RegisterWellKnownServiceType(typeof(CHM_GESTION_COM), "CHM_GESTION_COM", WellKnownObjectMode.SingleCall);

                CONNECTION_PARAM.charger_param();
                if (CONNECTION_PARAM.cnx.State == ConnectionState.Closed)
                {
                    CONNECTION_PARAM.cnx.Open();
                }

                btn_demarrer.Enabled = false;
                btn_demarrer.Visible = false;
                button3.Visible      = true;
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }

            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                Application.DoEvents();
                canal = new TcpServerChannel(4001);

                ChannelServices.RegisterChannel(canal, false);

                RemotingConfiguration.RegisterWellKnownServiceType(typeof(CHM_GESTION_COM), "CHM_GESTION_COM", WellKnownObjectMode.SingleCall);

                CONNECTION_PARAM.charger_param();
                if (CONNECTION_PARAM.cnx.State == ConnectionState.Closed)
                {
                    CONNECTION_PARAM.cnx.Open();
                }
                NOM_MACHINE_SERVER.Text = CONNECTION_PARAM.cnx.WorkstationId.ToString();
                btn_demarrer.Enabled    = false;
                btn_demarrer.Visible    = false;
                button3.Visible         = true;
                pictureBox1.Visible     = false;
                pictureBox2.Visible     = true;
                label1.Text             = "Connecté";
                string[] IpAdress = GetIPaddresses(CONNECTION_PARAM.cnx.WorkstationId.ToString());
                int      i        = 0;
                while (IpAdress[i] != null)
                {
                    SERVER_IP_ADDRESS.Text = IpAdress[i];
                    i++;
                    break;
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }

            finally
            {
                this.Cursor = Cursors.Default;
            }
            //gest = (CHM_GESTION_COMERCIALE.CHM_GESTION)Activator.GetObject(typeof(CHM_GESTION_COMERCIALE.CHM_GESTION), "tcp://LOCALHOST:4001/CHM_GESTION_COM");
            timer1.Enabled = false;
            License.License license = new License.License();



            if (license.license_type != "O")
            {
                dt = new CHM_GESTION_COM().P_FACTURE.SELECT_ALL_FACTURES(); //gest.P_FACTURE.SELECT_ALL_FACTURES();
                int n = license.nb - dt.Rows.Count;
                if (n <= 50 && n > 0)
                {
                    timer1.Enabled = false;
                    MessageBox.Show(" áÞÏ ÞÇÑÈÊ ÑÎÕÉ ÇÓÊÚãÇá ÇáãäÙæãÉ Úáì ÇáÅäÊåÇÁ.\n ÊÈÞì áßã ÅãßÇäíÉ ÅÏÎÇá " + n.ToString() + "ÝÇÊæÑÉ", "CHM Commercial Management Program");
                    timer1.Enabled = false;
                }

                if (dt.Rows.Count >= license.nb)
                {
                    this.Cursor = Cursors.WaitCursor;
                    Application.DoEvents();
                    canal.StopListening(4001);
                    ChannelServices.UnregisterChannel(canal);

                    if (CONNECTION_PARAM.cnx.State == ConnectionState.Open)
                    {
                        CONNECTION_PARAM.cnx.Close();
                    }
                    btn_demarrer.Enabled   = true;
                    btn_demarrer.Visible   = true;
                    button3.Visible        = false;
                    pictureBox1.Visible    = true;
                    pictureBox2.Visible    = false;
                    label1.Text            = "Déconnecté";
                    SERVER_IP_ADDRESS.Text = "";
                    MessageBox.Show(" áÞÏ ÇäÊåÊ ÑÎÕÉ ÇÓÊÚãÇá ÇáãäÙæãÉ.", "CHM Commercial Management Program");
                }
            }
        }
Ejemplo n.º 3
0
 private void server_Load(object sender, EventArgs e)
 {
     CONNECTION_PARAM.charger_param();
     btn_demarrer_Click(null, null);
     this.Hide();
 }
Ejemplo n.º 4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     CONNECTION_PARAM.charger_param();
 }