Exemple #1
0
        private void btnDownloadVersion_Click(object sender, EventArgs e)
        {
            string year        = grvData.GetFocusedRowCellValue(colYear).ToString();
            string projectCode = grvData.GetFocusedRowCellValue(colCode).ToString();
            string moduleCode  = grvProduct.GetFocusedRowCellValue(colProductCode).ToString();
            string version     = grvVersion.GetFocusedRowCellValue(colVersion).ToString();
            string sourcePath  = grvVersion.GetFocusedRowCellValue(colPath).ToString();

            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát",
                                                                 "Đang download phiên bản thiết kế"))
                {
                    TextUtils.CopyFolderVB(sourcePath,
                                           fbd.SelectedPath + "/" + year + "/" + projectCode + "/" + moduleCode + "/" + version);
                }
            }
            else
            {
                return;
            }
            Process.Start(fbd.SelectedPath + "/" + year + "/" + projectCode + "/" + moduleCode);
        }
Exemple #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            _newModuleCode = txtNewModule.Text.ToUpper();
            _oldModuleCode = txtOldModule.Text.ToUpper();

            //Kiểm tra lỗi trong module con
            string    moduleCode = _oldModuleCode;
            DataTable dtError    = TextUtils.Select(
                string.Format("select * from [vModuleError] where [ModuleCode]='{0}' and Status = 0 and ConfirmTemp = 0", moduleCode));
            DataTable dtKPH = TextUtils.Select(
                string.Format("select * from [vMisMatch] where [ModuleCode]='{0}' StatusKCS = 0 and ConfirmTemp = 0", moduleCode));

            if (dtError.Rows.Count > 0 || dtKPH.Rows.Count > 0)
            {
                string errorString = "Có " + dtError.Rows.Count + " lỗi và " + dtKPH.Rows.Count + " sự không phù hợp";
                MessageBox.Show(errorString, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang đổi mã thiết kế"))
            {
                string desPath = @"D:\DOIMA\Thietke.Ck\" + _newModuleCode.Substring(0, 6) + "/" + _newModuleCode.ToUpper() + ".Ck";
                if (Directory.Exists(desPath))
                {
                    MessageBox.Show("Thiết kế mới đã tồn tại trong ổ D", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                Directory.CreateDirectory(desPath);

                TextUtils.CopyFolderVB(_modulePath, desPath);
                TextUtils.DeleteFolderVB(desPath + "/3D." + _oldModuleCode);

                rename(desPath);
            }
            MessageBox.Show("Đã chuyển mã thành công!");
        }