Esempio n. 1
0
        private void btn_luu_ItemClick(object sender, ItemClickEventArgs e)
        {
            grvViewDanhMuc.PostEditor();
            if (modifined.Count == 0)
            {
                Form1.Default.ShowMessageDefault("Không có dòng dữ liệu nào thay đổi.");
                return;
            }
            var dgr = HelperMessage.Instance.ShowMessageYesNo("Bạn có muốn lưu lại những thông tin thay đổi này không?", "Xác Nhận", SystemIcons.Question.ToBitmap());

            if (dgr != DialogResult.Yes)
            {
                return;
            }
            int dem = 0;

            foreach (var item in modifined)
            {
                var tentruyen = grvViewDanhMuc.GetRow(item) as TenTruyen;
                if (tentruyen != null)
                {
                    ExecSQL.ExecProcedureNonData("pro_update_tentruyen", new { tentruyen.matruyen, tentruyen.tentruyen, tentruyen.maloaibia, tentruyen.madvt, tentruyen.tap, tentruyen.giabia, tentruyen.ngayxuatban, tentruyen.ghichu, tentruyen.nguoitd2, tentruyen.sotrang, tentruyen.maquatang });
                    dem += 1;
                }
            }
            modifined.Clear();
            //GetDanhMuc();
            Form1.Default.ShowMessageSuccess($"Đã cập nhật thành công {dem} dòng.");
        }
Esempio n. 2
0
 private void OnNext(MessageBroker value)
 {
     if (value.task == "phieunhapdanhsach")
     {
         ExecSQL.ExecProcedureNonData("pro_insert_phieunhapxuat", new { option = 2, maphieu = txt_maphieu.Text, madonvi = cbo_donvi.EditValue.ToString(), loaiphieu = "PN", idloaiphieunhapxuat = Convert.ToInt32(cbo_loaiphieu.EditValue), ngaynhap = Convert.ToDateTime(txt_ngaynhap.EditValue), makho = cbo_kho.EditValue.ToString(), matruyen = ComicPro.StrMaTruyen, diengiai = "Nhập từ danh sách.", nguoitd = ComicPro.StrTenDangNhap.ToUpper() });
         GetCtPhieuNhap();
         Form1.Default.ShowMessageSuccess($"Đã cập nhật thành công phiếu nhập kho ({txt_maphieu.Text}) từ danh sách.");
     }
 }
Esempio n. 3
0
        private void btn_xoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var i   = grvViewLichPhatHanh.FocusedRowHandle;
            var dgr = HelperMessage.Instance.ShowMessageYesNo($"Bạn có muốn xóa lịch phát hành ({grvViewLichPhatHanh.GetRowCellValue(i, "malich")}) này không?", "Xác Nhận", SystemIcons.Question.ToBitmap());

            if (dgr != DialogResult.Yes)
            {
                return;
            }
            ExecSQL.ExecProcedureNonData("pro_delete_lichphathanh", new { malich = grvViewLichPhatHanh.GetRowCellValue(i, "malich") });
            GetLichPhatHanh();
        }
Esempio n. 4
0
 private void LuuQuaTang()
 {
     for (var index = 0; index <= grvViewQuaTang.RowCount - 1; index++)
     {
         var dr = grvViewQuaTang.GetDataRow(Convert.ToInt32(index));
         if (dr is null)
         {
             break;
         }
         if (dr.RowState == DataRowState.Modified)
         {
             ExecSQL.ExecProcedureNonData("prottQuaTang", new { action = "UPDATE", quatang = dr["quatang"].ToString(), maquatang = dr["maquatang"].ToString(), nguoisua = ComicPro.StrTenDangNhap.ToUpper() });
         }
     }
     GetQuaTang();
 }
Esempio n. 5
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            var dgr = HelperMessage.Instance.ShowMessageYesNo($"Bạn có muốn chuyển số dư sang tháng {Convert.ToDateTime(txt_ngaychuyen.EditValue).ToString("MM/yyyy")} này không?", "Xác Nhận", SystemIcons.Question.ToBitmap());

            if (dgr != DialogResult.Yes)
            {
                return;
            }
            ExecSQL.ExecProcedureNonData("pro_chuyensodu", new { ky = Convert.ToDateTime(txt_ngaychuyen.EditValue).ToString("yyyyMM01") });
            //Gửi dữ liệu
            var message = new MessageBroker
            {
                data = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                task = "tonkho"
            };

            message.Publish();
        }
Esempio n. 6
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_loaibia.Text))
            {
                Form1.Default.ShowMessageWarning("Bạn phải nhập vào tên loại bìa.");
                txt_loaibia.Focus(); return;
            }
            ExecSQL.ExecProcedureNonData("pro_insert_loaibia", new { loaibia = txt_loaibia.Text, nguoitd = ComicPro.StrTenDangNhap.ToUpper() });
            txt_loaibia.Text = "";
            txt_loaibia.Focus();
            //Gửi dữ liệu
            var message = new MessageBroker
            {
                data = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                task = "loaibia"
            };

            message.Publish();
        }
Esempio n. 7
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtQuaTang.Text))
            {
                Form1.Default.ShowMessageWarning("Bạn phải nhập vào tên quà tặng.");
                txtQuaTang.Focus(); return;
            }
            ExecSQL.ExecProcedureNonData("prottQuaTang", new { action = "SAVE", quatang = txtQuaTang.Text, nguoitao = ComicPro.StrTenDangNhap.ToUpper() });
            Form1.Default.ShowMessageSuccess($"Đã thêm mới quà tặng ({txtQuaTang.Text}) thành công.");
            txtQuaTang.Text = "";
            txtQuaTang.Focus();
            //Gửi dữ liệu
            var message = new MessageBroker
            {
                data = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                task = "quatang"
            };

            message.Publish();
        }
Esempio n. 8
0
        private void btn_xoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dgr = HelperMessage.Instance.ShowMessageYesNo($"Bạn có muốn xóa phiếu nhập ({txt_maphieu.Text}) này không?", "Xác Nhận", SystemIcons.Question.ToBitmap());

            if (dgr != DialogResult.Yes)
            {
                return;
            }
            ExecSQL.ExecProcedureNonData("pro_delete_phieunhapxuat", new { maphieu = txt_maphieu.Text });
            Form1.Default.ShowMessageSuccess($"Đã xóa phiếu nhập ({txt_maphieu.Text}) thành công.");
            GetCtPhieuXuat();
            //Gửi dữ liệu
            var message = new MessageBroker
            {
                data = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                task = "phieuxuat"
            };

            message.Publish();
        }
Esempio n. 9
0
        private void btn_luu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            lbl_malich.Focus();
            var dgr = HelperMessage.Instance.ShowMessageYesNo("Bạn có muốn lưu lại những thông tin thay đổi này không?", "Xác Nhận", SystemIcons.Question.ToBitmap());

            if (dgr != DialogResult.Yes)
            {
                return;
            }
            for (var index = 0; index <= grvViewChiTietLichPhatHanh.RowCount - 1; index++)
            {
                var dr = grvViewChiTietLichPhatHanh.GetDataRow(Convert.ToInt32(index));
                if (dr is null)
                {
                    break;
                }
                if (dr.RowState == DataRowState.Modified)
                {
                    ExecSQL.ExecProcedureNonData("pro_insert_ct_lichphathanh", new { action = "UPDATE", ngayphathanh = Convert.ToDateTime(dr["ngayphathanh1"]).ToString("yyyyMMdd"), tuatruyen = dr["tuatruyen"].ToString(), giabia = Convert.ToDecimal(dr["giabia"]), nguoitd2 = ComicPro.StrTenDangNhap, id = Convert.ToInt32(dr["id"]) });
                }
            }
            GetChiTietLichPhatHanh();
        }
Esempio n. 10
0
        private void GrvViewChiTietLichPhatHanh_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            var i = grvViewChiTietLichPhatHanh.FocusedRowHandle;

            if (i < 0)
            {
                return;
            }
            if (e.Column == colXacNhan)
            {
                ExecSQL.ExecProcedureNonData("pro_insert_ct_lichphathanh", new { action = "DAMUA", id = Convert.ToInt32(grvViewChiTietLichPhatHanh.GetRowCellValue(i, "id")) });
                GetChiTietLichPhatHanh();
            }
            else if (e.Column == colXoa)
            {
                var dgr = HelperMessage.Instance.ShowMessageYesNo($"Bạn có muốn xóa chi tiết lịch phát hành ({grvViewChiTietLichPhatHanh.GetRowCellValue(i, "tuatruyen")}) này không?", "Xác Nhận", SystemIcons.Question.ToBitmap());
                if (dgr != DialogResult.Yes)
                {
                    return;
                }
                ExecSQL.ExecProcedureNonData("pro_delete_ct_lichphathanh", new { id = Convert.ToInt32(grvViewChiTietLichPhatHanh.GetRowCellValue(i, "id")) });
                GetChiTietLichPhatHanh();
            }
        }
Esempio n. 11
0
        private void btn_luu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            txt_maphieu.Focus();
            var dgr = HelperMessage.Instance.ShowMessageYesNo("Bạn có muốn cập nhật lại những thay đổi không?", "Xác Nhận", SystemIcons.Question.ToBitmap());

            if (dgr != DialogResult.Yes)
            {
                return;
            }
            if (string.IsNullOrEmpty(txt_maphieu.Text))
            {
                Form1.Default.ShowMessageWarning("Bạn phải nhập vào mã phiếu.");
                txt_maphieu.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_ngaynhap.Text))
            {
                Form1.Default.ShowMessageWarning("Bạn phải nhập vào ngày xuất.");
                txt_ngaynhap.Focus();
                return;
            }
            if (string.IsNullOrEmpty(cbo_donvi.Text))
            {
                Form1.Default.ShowMessageWarning("Bạn phải nhập đơn vị để lập phiếu nhập.");
                cbo_donvi.Focus();
                return;
            }

            if (string.IsNullOrEmpty(cbo_kho.Text))
            {
                Form1.Default.ShowMessageWarning("Bạn phải nhập tên kho.");
                cbo_kho.Focus();
                return;
            }

            if (Convert.ToInt32(ExecSQL.ExecQuerySacalar($"SELECT COUNT(*) FROM dbo.tbl_phieunhapxuat WHERE maphieu='{txt_maphieu.Text}'")) == 0)
            {
                ExecSQL.ExecProcedureNonData("pro_insert_phieunhapxuat", new { option = 1, maphieu = txt_maphieu.Text, madonvi = cbo_donvi.EditValue.ToString(), loaiphieu = "PX", idloaiphieunhapxuat = Convert.ToInt32(cbo_loaiphieu.EditValue), ngaynhap = Convert.ToDateTime(txt_ngaynhap.EditValue), makho = cbo_kho.EditValue.ToString(), diengiai = txt_diengiai.Text, nguoitd = ComicPro.StrTenDangNhap.ToUpper() });
            }
            else
            {
                ExecSQL.ExecProcedureNonData("pro_insert_phieunhapxuat", new { option = 3, maphieu = txt_maphieu.Text, madonvi = cbo_donvi.EditValue.ToString(), ngaynhap = Convert.ToDateTime(txt_ngaynhap.EditValue), diengiai = txt_diengiai.Text, nguoitd2 = ComicPro.StrTenDangNhap.ToUpper() });
            }

            for (var i = 0; i <= gridView1.RowCount; i++)
            {
                var dr = gridView1.GetDataRow(Convert.ToInt32(i));
                if (ReferenceEquals(dr, null))
                {
                    break;
                }
                switch (dr.RowState)
                {
                case DataRowState.Added:
                    ExecSQL.ExecProcedureNonData("pro_insert_ct_phieunhapxuat", new { maphieu = txt_maphieu.Text, matruyen = dr["matruyen"].ToString(), slxuat = Convert.ToInt32(dr["slxuat"]), dongia = Convert.ToDecimal(dr["dongia"]), ghichu = dr["ghichu"].ToString(), nguoitd = ComicPro.StrTenDangNhap.ToUpper() });
                    break;

                case DataRowState.Modified:
                    ExecSQL.ExecProcedureNonData("pro_update_phieunhapxuat", new { option = 1, slxuat = Convert.ToInt32(dr["slxuat"]), dongia = Convert.ToDecimal(dr["dongia"]), ghichu = dr["ghichu"].ToString(), nguoitd2 = ComicPro.StrTenDangNhap.ToUpper(), id = Convert.ToInt32(dr["id"]) });
                    break;
                }
            }
            GetCtPhieuXuat();
            //Gửi dữ liệu
            var message = new MessageBroker
            {
                data = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                task = "phieuxuat"
            };

            message.Publish();
        }
Esempio n. 12
0
        private void gridView1_RowCellClick(object sender, RowCellClickEventArgs e)
        {
            var i = grvViewDanhMuc.FocusedRowHandle;

            if (e.Column == col_themhinh)
            {
                xtraOpenFileDialog1.Filter   = @"Image files (*.jpg)|*.jpg|Image files(*.png)|*.png|All files (*.*)|*.*";
                xtraOpenFileDialog1.FileName = "Chọn file cần import";
                if (xtraOpenFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    string strNewDirPathOrigin = Application.StartupPath + "\\img\\origin\\" + grvViewDanhMuc.GetRowCellValue(i, "matua");
                    //Tạo đường dẫn mới
                    if (!Directory.Exists(strNewDirPathOrigin))
                    {
                        Directory.CreateDirectory(strNewDirPathOrigin);
                    }

                    File.Copy(xtraOpenFileDialog1.FileName, strNewDirPathOrigin + "\\" + grvViewDanhMuc.GetRowCellValue(i, "matruyen") + ".jpg", true);

                    string strNewDirPathThumb = Application.StartupPath + "\\img\\thumb\\" + grvViewDanhMuc.GetRowCellValue(i, "matua");
                    if (!Directory.Exists(strNewDirPathThumb))
                    {
                        Directory.CreateDirectory(strNewDirPathThumb);
                    }
                    var            img        = CreateThumbnailImageByOriginImage(xtraOpenFileDialog1.FileName);
                    Encoder        myEncoder  = Encoder.Quality;
                    ImageCodecInfo jpgEncoder = GetEncoder(ImageFormat.Jpeg);

                    EncoderParameter  myEncoderParameter  = new EncoderParameter(myEncoder, 80L);
                    EncoderParameters myEncoderParameters = new EncoderParameters(1);
                    myEncoderParameters.Param[0] = myEncoderParameter;
                    img.Save(strNewDirPathThumb + "\\" + grvViewDanhMuc.GetRowCellValue(i, "matruyen") + ".jpg", jpgEncoder, myEncoderParameters);
                    //Tao folder
                    var folder = "httpdocs/img/thumb/" + lbl_matua.Text;
                    fTPHelper.createDirectory(folder);
                    //UploadFileToFTP(lbl_matua.Text, lbl_matruyen.Text, Application.StartupPath + "\\img\\thumb\\" + gridView1.GetRowCellValue(i, "matua") + "\\" + lbl_matruyen.Text + ".jpg");
                    var remotefile = "httpdocs/img/thumb/" + lbl_matua.Text + "/" + lbl_matruyen.Text + ".jpg";
                    var localfile  = strNewDirPathThumb + "\\" + grvViewDanhMuc.GetRowCellValue(i, "matruyen") + ".jpg";
                    fTPHelper.upload(remotefile, localfile);
                    pictureEdit1.Image = ReadImageToStream(strNewDirPathOrigin + "\\" + grvViewDanhMuc.GetRowCellValue(i, "matruyen") + ".jpg");

                    ExecSQL.ExecQueryNonData($"UPDATE dbo.tbl_tentruyen SET filehinh='{xtraOpenFileDialog1.FileName}' WHERE matruyen='{grvViewDanhMuc.GetRowCellValue(i, "matua")}'");
                }
            }

            //else if (e.Column == col_pdf)
            //{
            //    ComicPro.StrDuongDanPdf = Application.StartupPath + "\\pdf\\" + gridView1.GetRowCellValue(i, "matua") + "\\" + gridView1.GetRowCellValue(i, "matruyen") + ".pdf";
            //    if (File.Exists(ComicPro.StrDuongDanPdf))
            //    {
            //        ComicPro.StrCaption = gridView1.GetRowCellValue(i, "tentruyen").ToString();
            //        var f = new FrmReadComic();
            //        f.Show();
            //    }
            //    else
            //    {
            //        //Thêm file mới
            //        xtraOpenFileDialog1.Filter = @"PDF files |*.pdf";
            //        xtraOpenFileDialog1.FileName = "Chọn file cần import";
            //        if (xtraOpenFileDialog1.ShowDialog() == DialogResult.OK)
            //        {
            //            string strNewDirPath = Application.StartupPath + "\\pdf\\" + gridView1.GetRowCellValue(i, "matua");
            //            //Tạo đường dẫn mới
            //            if (!Directory.Exists(strNewDirPath))
            //            {
            //                Directory.CreateDirectory(strNewDirPath);
            //            }
            //            try
            //            {
            //                File.Copy(xtraOpenFileDialog1.FileName, strNewDirPath + "\\" + gridView1.GetRowCellValue(i, "matruyen") + ".pdf", true);
            //                ExecSQL.ExecQueryNonData($"UPDATE dbo.tbl_tentruyen SET filetruyen=1 WHERE matruyen='{gridView1.GetRowCellValue(i, "matruyen").ToString()}'");
            //                ComicPro.StrDuongDanPdf = Application.StartupPath + "\\pdf\\" + gridView1.GetRowCellValue(i, "matua") + "\\" + gridView1.GetRowCellValue(i, "matruyen") + ".pdf";
            //                GetDanhMuc();
            //                var f = new FrmReadComic();
            //                f.Show();
            //            }
            //            catch (Exception exception)
            //            {
            //                XtraMessageBox.Show(exception.Message, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);

            //            }
            //        }
            //    }
            //}

            //else if (e.Column == col_upload)
            //{
            //    if (gridView1.GetRowCellValue(i, "uploadfile").ToString() == "Not upload")
            //    {
            //        Form1.Default.ShowMessageWarning($"File {gridView1.GetRowCellValue(i, "tentruyen")} không tồn tại.");
            //        return;
            //    }

            //    if (gridView1.GetRowCellValue(i, "uploadfile").ToString() == "Đã upload")
            //    {
            //        Form1.Default.ShowMessageWarning($"File {gridView1.GetRowCellValue(i, "tentruyen")} đã được upload lên google drive.");
            //        return;
            //    }
            //    ComicPro.StrDuongDanPdf = Application.StartupPath + "\\pdf\\" + gridView1.GetRowCellValue(i, "matua") + "\\" + gridView1.GetRowCellValue(i, "matruyen") + ".pdf";
            //    progressBarControl3.Visible = true;
            //    lbl_upload.Visible = true;
            //    lbl_upload.Text = @"Đang upload file lên google drive...";
            //    UploadFilePdf(gridView1.GetRowCellValue(i, "tuatruyen").ToString(), e.RowHandle);
            //}

            else if (e.Column == col_copy)
            {
                ExecSQL.ExecProcedureNonData("pro_copy_tentruyen", new { matruyencu = grvViewDanhMuc.GetRowCellValue(i, "matruyen"), nguoitd = ComicPro.StrTenDangNhap.ToUpper() });
                GetDanhMuc();
            }
        }