Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fdlg = new OpenFileDialog();
            if (DialogResult.OK == fdlg.ShowDialog())
            {
                var excel = new ExcelQueryFactory(fdlg.FileName);
                var indianaCompanies = from c in excel.Worksheet("Sheet1")
                                       select c;
                int ix = 0;
                int il = 0;
                foreach (var item in indianaCompanies)
                {
                    TblInfor newInfo = new TblInfor();

                    string content = "<b>" + item[1].ToString().Trim() + "</b> <br />"
                                    + "" + item[10].ToString().Trim()
                                    + "<br>Khu vực: " + item[9].ToString().Trim()
                                   + "<br>ĐC: " + item[4].ToString().Trim()
                                   + "<br> Số Phòng: " + item[6].ToString().Trim()
                                   + "<br> ĐT: " + item[2].ToString().Trim() + " - FAX: " + item[3].ToString().Trim()
                                   + "<br> Email: " + item[5].ToString().Trim()
                                    + "<br> Chủ đầu tư: " + item[7].ToString().Trim()
                                   + "<br>Giám đốc: " + item[8].ToString().Trim();

                    string tag = "Khách sạn, khach san, ks, " + item[11].ToString().Trim() + ", " + item[2].ToString().Trim();

                    newInfo.CreateDate = DateTime.Now;
                    newInfo.CreateUserID = Guid.Parse("b0b6997c-282b-4aff-b286-b0820cdb0100");
                    newInfo.ID = Guid.NewGuid();
                    newInfo.Category = Categories.KhachSan;
                    newInfo.Location = item[9].ToString().Trim();
                    newInfo.InfoContent = HtmlRemoval.StripTagsRegexCompiled(content);
                    newInfo.InfoContentHtml = content;
                    newInfo.InfoTag = tag;
                    newInfo.InfoTitle = item[1].ToString().Trim() + " " + item[9].ToString().Trim();
                    newInfo.InfoType = InformationType.NoLimit;
                    newInfo.Status = InformationStatus.Approved;

                    newInfo.UpdateDate = DateTime.Now;
                    newInfo.UpdateUserID = Guid.Parse("b0b6997c-282b-4aff-b286-b0820cdb0100");

                    try
                    {
                        BBLInfo b = new BBLInfo();
                        b.InsertOrUpdate(newInfo);

                        ix++;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("E - > " + ex.Message);
                        // DevExpress.XtraEditors.XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, this.FindForm(), ex.Message, "Có sự cố", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        il++;
                    }
                }

                Console.WriteLine(ix + " | " + il);
            }
        }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 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);

            }
        }
Ejemplo n.º 4
0
        public void LoadData(BBLInfo _info)
        {
            string clientCode = ConfigurationManager.AppSettings["CLIENTCODE"];

            currentClient = new BBLClient().GetAll().FirstOrDefault(x=>x.ClientCode==clientCode);

            if (currentClient == null) {
                MessageBox.Show("Xác minh lại thiết lập Máy Trạm");
                new FrmConfig().ShowDialog();
            }

            this.info = _info;
            lstInfo = info.GetAll().Where(x=>x.IsDeleted==0);
            List<TblInfor> lst = new List<TblInfor>();

            lst.AddRange(lstInfo);

            lstInfo = lst;
            RunFilter();
        }
Ejemplo n.º 5
0
        public void LoadData(BBLInfo _info)
        {
            if (currentUser.Permission == Permission.Normal) chkStatus.Enabled = false;

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

            currentClient = new BBLClient().GetAll().FirstOrDefault(x => x.ClientCode == clientCode);

            if (currentClient == null)
            {
                MessageBox.Show("Xác minh lại thiết lập Máy Trạm");
                new FrmConfig().ShowDialog();
            }

            this.info = _info;
            lstInfo = info.GetAll().Where(x => x.IsDeleted == 0).ToList();
            //List<TblInfor> lst = new List<TblInfor>();

            //lst.AddRange(lstInfo);

            //lstInfo = lst;
            SettingAutoSuggest();
            RunFilter();
        }
Ejemplo n.º 6
0
        private void btnSaveInfo_Click(object sender, EventArgs e)
        {
            TblInfor newInfo = new TblInfor();

            // Check Data Input
            bool checkInputFlag = true;
            string message = "Thông báo : ";

            if (txtInfoTitle.Text.Trim().Length == 0)
            {
                checkInputFlag = false;
                message += "\n Phải nhập tiêu đề.";
            }

            if (txtContent.Text.Trim().Length == 0)
            {
                checkInputFlag = false;
                message += "\n Phải nhập nội dung.";
            }

            if (chkInfoType.Checked)
                if (dateFrom.Value == null || dateTo.Value == null || dateTo.Value < dateFrom.Value)
                {
                    checkInputFlag = false;
                    message += "\n Giới hạn ngày bắt đầu không được lớn hơn ngày kết thúc";
                }

            if (!checkInputFlag)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, this.FindForm(), message, "Không thể tạo mới", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {

                if (chkInfoType.Checked)
                {
                    newInfo.BeginDate = dateFrom.Value.Date;
                    newInfo.ExprieDate = dateTo.Value.Date.AddHours(23);
                }

                if (createNewFlag)
                {
                    newInfo.CreateDate = DateTime.Now;
                    newInfo.CreateUserID = currentUser.UserID;
                    newInfo.ID = Guid.NewGuid();
                }
                else
                {
                    newInfo.CreateDate = currentInfo.CreateDate;
                    newInfo.CreateUserID = currentInfo.CreateUserID;
                    newInfo.ID = currentInfo.ID;
                }
                newInfo.InfoContent = txtContent.Text.Trim();
                newInfo.InfoContentHtml = txtContent.HtmlText.Trim();
                newInfo.InfoTag = txtTag.Text.Trim();
                newInfo.InfoTitle = txtInfoTitle.Text.Trim();
                newInfo.InfoType = (chkInfoType.Checked) ? InformationType.Limited : InformationType.NoLimit;
                newInfo.Status = (chkStatus.Checked) ? InformationStatus.Approved : InformationStatus.Pending;

                newInfo.Location = cbbLocation.SelectedValue.ToString();
                newInfo.Category = cbbCategory.SelectedValue.ToString();

                newInfo.UpdateDate = DateTime.Now;
                newInfo.UpdateUserID = currentUser.UserID;
                newInfo.IsDeleted = 0;
                try
                {
                    BBLInfo b = new BBLInfo();
                    b.InsertOrUpdate(newInfo);

                    btnDeleteInfo.Visible = false;
                    btnEdit.Visible = false;
                    btnCancelEditInfo.Visible = false;
                    btnSaveInfo.Visible = false;

                    btnCreateInfo.Visible = true;

                    gridControl1.Enabled = true;
                    if (createNewFlag)
                    {
                        createNewFlag = false;
                        currentSelectedIndex = 0;
                    }
                    lstInfo = info.GetAll().Where(x=>x.IsDeleted==0);
                    LoadData();
                    grvMainInfo.FocusedRowHandle = currentSelectedIndex;

                }
                catch (Exception ex)
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, this.FindForm(), ex.Message, "Có sự cố", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

            }
        }
Ejemplo n.º 7
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;
            }
        }
Ejemplo n.º 8
0
        // Ngân hàng ATM
        private void button8_Click(object sender, EventArgs e)
        {
            OpenFileDialog fdlg = new OpenFileDialog();
            if (DialogResult.OK == fdlg.ShowDialog())
            {
                var excel = new ExcelQueryFactory(fdlg.FileName);
                var indianaCompanies = from c in excel.Worksheet("Sheet1")
                                       select c;
                int ix = 0;
                int il = 0;
                foreach (var item in indianaCompanies)
                {
                    TblInfor newInfo = new TblInfor();

                    string content = "<b>" + item[5].ToString().Trim() +" "+ item[1].ToString().Trim() + "</b> "
                                    + "<br><i>" + item[4].ToString().Trim() + "</i>"

                                   + "<br><u>Địa chỉ</u>:<br> " + item[2].ToString().Trim()
                                   + "<br><u>Điện thoại</u>: " + item[3].ToString().Trim();

                    string tag = "ATM, Ngân Hàng, Bank";

                    newInfo.CreateDate = DateTime.Now;
                    newInfo.CreateUserID = Guid.Parse("b0b6997c-282b-4aff-b286-b0820cdb0100");
                    newInfo.ID = Guid.NewGuid();
                    newInfo.IsDeleted = 0;
                    newInfo.InfoContent = HtmlRemoval.StripTagsRegexCompiled(content);
                    newInfo.InfoContentHtml = content;
                    newInfo.InfoTag = tag;
                    newInfo.InfoTitle =item[5].ToString().Trim() +" "+ item[1].ToString().Trim();
                    newInfo.InfoType = InformationType.NoLimit;
                    newInfo.Status = InformationStatus.Approved;
                    newInfo.Category = Categories.NganHang;
                    newInfo.Location = item[6].ToString().Trim();
                    newInfo.UpdateDate = DateTime.Now;
                    newInfo.UpdateUserID = Guid.Parse("b0b6997c-282b-4aff-b286-b0820cdb0100");

                    try
                    {
                        BBLInfo b = new BBLInfo();
                        b.InsertOrUpdate(newInfo);

                        ix++;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("E - > " + ex.Message);
                        // DevExpress.XtraEditors.XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, this.FindForm(), ex.Message, "Có sự cố", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        il++;
                    }
                }

                Console.WriteLine(ix + " | " + il);
            }
        }
Ejemplo n.º 9
0
        private void button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog fdlg = new OpenFileDialog();
            if (DialogResult.OK == fdlg.ShowDialog())
            {
                var excel = new ExcelQueryFactory(fdlg.FileName);
                var indianaCompanies = from c in excel.Worksheet("Sheet1")
                                       select c;
                int ix = 0;
                int il = 0;
                foreach (var item in indianaCompanies)
                {
                    TblInfor newInfo = new TblInfor();

                    string content = "<b>" + item[0].ToString().Trim() + "</b>  Số hiệu :" + item[2].ToString().Trim()
                                    + "<br>Tần suất: " + item[4].ToString().Trim() + " Giá vé : " + item[7].ToString().Trim()
                                   + "<br>Tuyến đường: " + item[3].ToString().Trim()
                                   + "<br>Thời gian hoạt động: " + item[6].ToString().Trim() + " Số chuyến/ngày: " + item[5].ToString().Trim()
                                   + "<br>Đơn vị: " + item[1].ToString().Trim()
                                   + "<br>ĐT: " + item[8].ToString().Trim();

                    string tag = "xe, vận tải, dịch vụ ";

                    newInfo.CreateDate = DateTime.Now;
                    newInfo.CreateUserID = Guid.Parse("b0b6997c-282b-4aff-b286-b0820cdb0100");
                    newInfo.ID = Guid.NewGuid();
                    newInfo.IsDeleted = 0;
                    newInfo.InfoContent = HtmlRemoval.StripTagsRegexCompiled(content);
                    newInfo.InfoContentHtml = content;
                    newInfo.InfoTag = tag;
                    newInfo.InfoTitle = item[0].ToString().Trim();
                    newInfo.InfoType = InformationType.NoLimit;
                    newInfo.Status = InformationStatus.Approved;

                    newInfo.UpdateDate = DateTime.Now;
                    newInfo.UpdateUserID = Guid.Parse("b0b6997c-282b-4aff-b286-b0820cdb0100");

                    try
                    {
                        BBLInfo b = new BBLInfo();
                        b.InsertOrUpdate(newInfo);

                        ix++;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("E - > " + ex.Message);
                        // DevExpress.XtraEditors.XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, this.FindForm(), ex.Message, "Có sự cố", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        il++;
                    }
                }

                Console.WriteLine(ix + " | " + il);
            }
        }