Exemple #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);
            }
        }
        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);
                }

            }
        }
Exemple #3
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);
            }
        }
Exemple #4
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);
            }
        }