Example #1
0
        private void AutoUpdateToServer()
        {
            textBox1.Text = "Starting...\n";

            string baseHost = ConfigurationManager.AppSettings["SERVERURL"];

            string clientCode = ConfigurationManager.AppSettings["CLIENTCODE"];

            try
            {

                //WebRequest request = WebRequest.Create("http://google.com/");
                //request.Timeout =   Timeout.Infinite;
                ////request.KeepAlive = true;
                //HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                //if (response == null || response.StatusCode != HttpStatusCode.OK)
                //{
                //    Console.WriteLine("Hiện không thể kết nối máy chủ. \n Chương trình sẽ chạy với dữ liệu offline cho đến khi có kết nối với máy chủ.\n Hãy kiểm tra kết nối internet và [Thiết lập máy trạm]");
                //}
                //else
                //{
                // Đồng bộ user
                textBox1.Text += "Sync User ...\n";
                BBLUser userData = new BBLUser();
                userData.ServiceUpdate(baseHost);
                textBox1.Text += "Sync user is success n";
                textBox1.Text += "Sync Info ...\n";
                // Đồng bộ Info
                BBLInfo infoData = new BBLInfo();
                infoData.ServiceUpdate(baseHost);
                textBox1.Text += "Sync info is success n";
                textBox1.Text += "Sync client ...\n";
                // Đồng bộ BBLClient
                BBLClient clientData = new BBLClient();
                clientData.ServiceUpdate(baseHost);
                textBox1.Text += "Sync client is success n";
                textBox1.Text += "Sync Consultant ...\n";
                // Đồng bộ BBLConsultant
                BBLConsultant consultantData = new BBLConsultant();
                consultantData.ServiceUpdate(baseHost);
                //}
                textBox1.Text += "finish \n";

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Source);
                textBox1.Text += "Error " + ex.Message;
            }
        }
Example #2
0
        public void LoadData(BBLConsultant cons)
        {
            //currentUser = new BBLUser().GetUser().FirstOrDefault();
            currentClient = new BBLClient().GetAll().FirstOrDefault();
            this.cons = cons;
            lstInfo = cons.GetAll();
            List<TblConsultantLog> lst = new List<TblConsultantLog>();

            lst.AddRange(lstInfo);

            lstInfo = lst;
            RunFilter();
        }
Example #3
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            panelDongBo.Invoke((Action)(() =>
            {
                panelDongBo.Visible = true;
                progressBar1.Value = progressBar1.Minimum;
            }));

            string baseHost = ConfigurationManager.AppSettings["SERVERURL"];

            string clientCode = ConfigurationManager.AppSettings["CLIENTCODE"];

            try
            {
                progressBar1.Invoke((Action)(() => progressBar1.Value = 1));
                worker.ReportProgress(1);
                // Đồng bộ user
                BBLUser userData = new BBLUser();
                userData.ServiceUpdate(baseHost);
                progressBar1.Invoke((Action)(() => progressBar1.Value = 2));
                worker.ReportProgress(2);
                // Đồng bộ Info
                BBLInfo infoData = new BBLInfo();
                infoData.ServiceUpdate(baseHost);
                progressBar1.Invoke((Action)(() => progressBar1.Value = 6));
                worker.ReportProgress(3);
                // Đồng bộ BBLClient
                BBLClient clientData = new BBLClient();
                clientData.ServiceUpdate(baseHost);
                progressBar1.Invoke((Action)(() => progressBar1.Value = 8));
                worker.ReportProgress(4);
                // Đồng bộ BBLConsultant
                BBLConsultant consultantData = new BBLConsultant();
                consultantData.ServiceUpdate(baseHost);
                progressBar1.Invoke((Action)(() => progressBar1.Value = 10));
                worker.ReportProgress(5);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);

            }
        }
Example #4
0
        public void LoadData()
        {
            if (cons != null)
            {
                lstInfo = cons.GetAll();
                List<TblConsultantLog> lst = new List<TblConsultantLog>();

                lst.AddRange(lstInfo);

                lstInfo = lst;
            }
            else {
                cons = new BBLConsultant();
                lstInfo = cons.GetAll();
                List<TblConsultantLog> lst = new List<TblConsultantLog>();

                lst.AddRange(lstInfo);

                lstInfo = lst;

            }
            RunFilter();
        }
Example #5
0
 private void FrmSaveHotline_Load(object sender, EventArgs e)
 {
     cons = new BBLConsultant();
 }
Example #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //ctrlBanLamViec1.UpdateNewsData();
            BBLInfo info = new BBLInfo();
            ctrlQuanLyNoiDung1.currentUser = loggedUser;
            ctrlQuanLyNoiDung1.LoadData(info);

            ctrlBanLamViec1.currentUser = loggedUser;
            ctrlBanLamViec1.LoadData(info);

            BBLConsultant cons = new BBLConsultant();
            ctrlThongKe1.currentUser = loggedUser;
            ctrlThongKe1.LoadData(cons);

            panelDongBo.Visible = false;

            //timer = new Timer();
            //timer.Tick += new EventHandler(TimeTick); // Every time timer ticks, timer_Tick will be called
            //timer.Interval = (300) * (1000);             // Timer will tick every 300 seconds
            //timer.Enabled = true;                       // Enable the timer
            //timer.Start();

            if (loggedUser.Permission != Permission.Admin)
            {
                quảnLýNgươiDùngToolStripMenuItem.Visible = false;
                resetUpdateToolStripMenuItem.Visible = false;
            }
        }
Example #7
0
 private void FrmSaveFull_Load(object sender, EventArgs e)
 {
     cons = new BBLConsultant();
     txtTgName.Focus();
 }