Exemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            using (WaitDialogForm fWait1 = new WaitDialogForm("Vui lòng chờ trong giây lát", "Tạo", new Size(this.Width / 4, this.Height / 9), this))
            {
                DataTable dtModule = TextUtils.Select("select * from Modules with(nolock) where status = 2 and Code like '%tpad%' order by Code");
                foreach (DataRow item in dtModule.Rows)
                {
                    string    productCode = item["Code"].ToString();
                    DataTable dt          = TextUtils.Select("select * from ModuleVersion with(nolock) where ModuleCode = '" + productCode + "'");
                    if (dt.Rows.Count == 0)
                    {
                        using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát", "Tạo " + productCode, new Size(this.Width / 4, this.Height / 9), this))
                        {
                            try
                            {
                                string path = TextUtils.DownloadAll(productCode);

                                ModuleVersionModel model = new ModuleVersionModel();
                                //model.ProjectCode = misMatchModel.ProjectCode;
                                model.ModuleCode = productCode;
                                //model.MisMatchCode = misMatchModel.Code;
                                model.Version     = 0;
                                model.Path        = path;
                                model.Description = "Tạo phiên bản đầu tiên của module";
                                model.Reason      = "Tạo phiên bản đầu tiên của module";
                                ModuleVersionBO.Instance.Insert(model);

                                //MessageBox.Show("Tạo phiên bản đầu tiên của module [" + productCode + "] thành công!");
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Lỗi: " + ex.Message);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void gửiMailKhiĐãKhắcPhụcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                MisMatchModel misMatchModel = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));
                if (misMatchModel.StatusTK == 0)
                {
                    MessageBox.Show("Vấn đề này chưa được khắc phục!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                ModulesModel product = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", misMatchModel.ModuleCode)[0];

                frmSendEmailAttach frm = new frmSendEmailAttach();
                frm.To = "*****@*****.**";
                frm.CC = //"*****@*****.**";
                         "[email protected];[email protected];[email protected];[email protected];";
                frm.Subject = string.Format("INVALID REPORT - {0} - {1} - Đã khắc phục", misMatchModel.Code, product.Code);
                DataTable dtConfig = TextUtils.Select("select KeyValue from [ConfigSystem] where [KeyName]='TK_To_KCS_KphEmail'");
                string    content  = dtConfig.Rows[0][0].ToString();
                frm.Content = content.Replace("<ErrorCode>", "<b>" + misMatchModel.Code + "</b>")
                              .Replace("<ProjectCode>", "<b>" + misMatchModel.ProjectCode + "</b>")
                              .Replace("<ProductCode>", "<b>" + product.Code + "</b>")
                              .Replace("<ProductName>", product.Name)
                              .Replace("<ErrorStatus>", "<b>Đã khắc phục</b>")
                              .Replace("<Description>", grvData.GetFocusedRowCellValue(colDes).ToString());
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    misMatchModel.ConfirmSendMailTK = Global.AppFullName + " - " + Environment.MachineName + " đã gửi mail vào ngày: " + DateTime.Now;
                    MisMatchBO.Instance.Update(misMatchModel);
                    loadGrid();

                    if (Global.DepartmentID == 1)//phong thiet ke
                    {
                        DataTable dt = TextUtils.Select("select * from ModuleVersion where MisMatchCode = '" + misMatchModel.Code + "'");
                        if (dt.Rows.Count == 0)
                        {
                            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát", "Đang tạo phiên bản thiết kế"))
                            {
                                try
                                {
                                    string path = TextUtils.DownloadAll(product.Code);

                                    ModuleVersionModel model = new ModuleVersionModel();
                                    model.ProjectCode  = misMatchModel.ProjectCode;
                                    model.ModuleCode   = product.Code;
                                    model.MisMatchCode = misMatchModel.Code;
                                    model.Version      = TextUtils.ToInt(Path.GetFileName(path));
                                    model.Path         = path;
                                    model.Description  = frm.Description;
                                    model.Reason       = "Sửa không phù hợp: " + misMatchModel.Code;
                                    ModuleVersionBO.Instance.Insert(model);
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show("Lỗi: " + ex.Message);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 3
0
        private void btnSendMailComplete_Click(object sender, EventArgs e)
        {
            try
            {
                ModuleErrorModel errorModel = (ModuleErrorModel)ModuleErrorBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));
                if (errorModel.StatusTK == 0)
                {
                    MessageBox.Show("Lỗi chưa được xác nhận là đã khắc phục!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                ModulesModel product = (ModulesModel)ModulesBO.Instance.FindByPK(errorModel.ModuleID);

                frmSendEmailAttach frm = new frmSendEmailAttach();
                frm.To = "*****@*****.**";
                //frm.CC = "*****@*****.**";
                frm.CC      = "[email protected];[email protected];[email protected];[email protected];";
                frm.Subject = string.Format("ERROR REPORT - {0} - {1} - Đã khắc phục", errorModel.Code, product.Code);
                DataTable dtConfig = TextUtils.Select("select KeyValue from [ConfigSystem] where [KeyName]='TKToKCS_Email'");
                string    content  = dtConfig.Rows[0][0].ToString();
                frm.Content = content.Replace("<ErrorCode>", "<b>" + errorModel.Code + "</b>")
                              .Replace("<ProjectCode>", "<b>" + errorModel.ProjectCode + "</b>")
                              .Replace("<ProductCode>", "<b>" + product.Code + "</b>")
                              .Replace("<ProductName>", product.Name)
                              .Replace("<ErrorStatus>", "<b>Đã khắc phục</b>")
                              .Replace("<ErrorUser>", grvData.GetFocusedRowCellValue(colErrorUser).ToString())
                              .Replace("<TamThoi>", errorModel.HuongKhacPhucTamThoi)
                              .Replace("<LauDai>", errorModel.HuongKhacPhuc == "" ? "Chưa có" : errorModel.HuongKhacPhuc)
                              .Replace("<Description>", errorModel.Description);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    errorModel.ReceiveMailContent = Global.AppFullName + " - " + Environment.MachineName + " đã gửi mail vào ngày: " + DateTime.Now;
                    ModuleErrorBO.Instance.Update(errorModel);
                    loadGrid();

                    if (Global.DepartmentID == 1)//phong thiet ke
                    {
                        DataTable dt = TextUtils.Select("select * from ModuleVersion where ModuleErrorCode = '" + errorModel.Code + "'");
                        if (dt.Rows.Count == 0)
                        {
                            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát", "Đang tạo phiên bản thiết kế"))
                            {
                                try
                                {
                                    string path = TextUtils.DownloadAll(product.Code);

                                    ModuleVersionModel model = new ModuleVersionModel();
                                    model.ProjectCode     = errorModel.ProjectCode;
                                    model.ModuleCode      = product.Code;
                                    model.ModuleErrorCode = errorModel.Code;
                                    model.Version         = TextUtils.ToInt(Path.GetFileName(path));
                                    model.Path            = path;
                                    model.Description     = frm.Description;
                                    model.Reason          = "Sửa lỗi: " + errorModel.Code;
                                    ModuleVersionBO.Instance.Insert(model);
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show("Lỗi: " + ex.Message);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 4
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            if (grvProject.Rows.Count == 0)
            {
                MessageBox.Show("Không có thông tin dự án dự án!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            else
            {
                string pCode = TextUtils.ToString(grvProject.Rows[0].Cells[0].Value);
                if (pCode == " ")
                {
                    MessageBox.Show("Không có thông tin dự án dự án!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
            }

            if (grvModule.Rows.Count == 0)
            {
                MessageBox.Show("Không tồn tại module trong tổng hợp thiết kế!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            int count = 0;

            foreach (DataGridViewRow itemRow in grvModule.Rows)
            {
                if (TextUtils.ToBoolean(itemRow.Cells[colCheck.Index].EditedFormattedValue))
                {
                    count++;
                }
            }

            if (count == 0)
            {
                MessageBox.Show("Không có module nào được chọn!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            List <string> listProject = new List <string>();

            foreach (DataGridViewRow itemRow in grvProject.Rows)
            {
                listProject.Add(itemRow.Cells[colPCode.Index].Value.ToString());
            }

            string mailContent = "";

            mailContent = ((ConfigSystemModel)ConfigSystemBO.Instance.FindByAttribute("KeyName", "MailTHTK")[0]).KeyValue;
            mailContent = mailContent.Replace("<Project>", listProject[0]);
            mailContent = mailContent.Replace("<HangMuc>", _muc + " - " + _productName);

            string listModules = "";
            string moduleItem  = ((ConfigSystemModel)ConfigSystemBO.Instance.FindByAttribute("KeyName", "MailTHTK.Item")[0]).KeyValue;
            int    stt         = 0;

            foreach (DataGridViewRow itemRow in grvModule.Rows)
            {
                if (!TextUtils.ToBoolean(itemRow.Cells[colCheck.Index].EditedFormattedValue))
                {
                    continue;
                }
                stt++;
                string moduleCode = TextUtils.ToString(itemRow.Cells[colModuleCode.Index].Value);
                listModules += moduleItem.Replace("<STT>", stt.ToString())
                               .Replace("<ModuleCode>", moduleCode)
                               .Replace("<ModuleName>", itemRow.Cells[colModuleName.Index].Value.ToString());

                DataTable dtItems = LibQLSX.Select("select ID from vDesignSummaryItem where ProjectCode = '" + listProject[0] + "' and Code = '" + moduleCode + "'");
                foreach (DataRow r in dtItems.Rows)
                {
                    int id = TextUtils.ToInt(r["ID"]);
                    TPA.Model.DesignSummaryItemModel m = (TPA.Model.DesignSummaryItemModel)TPA.Business.DesignSummaryItemBO.Instance.FindByPK(id);
                    m.IsTHTK = 1;
                    TPA.Business.DesignSummaryItemBO.Instance.Update(m);
                }
            }

            mailContent = mailContent.Replace("<listModule>", listModules);

            frmSendEmailAttach frm = new frmSendEmailAttach();

            frm.Content = mailContent;
            frm.To      = "*****@*****.**";
            frm.CC      = //"*****@*****.**";
                          "[email protected];[email protected];[email protected];[email protected];[email protected];";
            frm.Subject = "(" + string.Join(", ", listProject.ToArray()) + ") - " + Path.GetFileNameWithoutExtension(txtDMVTPath.Text);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát", "Đang tạo phiên bản thiết kế"))
                {
                    DocUtils.InitFTPQLSX();
                    //Tạo version cho module
                    foreach (DataGridViewRow itemRow in grvModule.Rows)
                    {
                        if (!TextUtils.ToBoolean(itemRow.Cells[colCheck.Index].EditedFormattedValue))
                        {
                            continue;
                        }
                        try
                        {
                            string moduleCode = itemRow.Cells[colModuleCode.Index].Value.ToString();
                            string ftpPathCk  = string.Format("/Thietke.Ck/{0}/{1}.Ck", moduleCode.Substring(0, 6), moduleCode);

                            DataTable dt = TextUtils.Select("select * from ModuleVersion where ModuleCode = '" + moduleCode + "'");
                            if (dt.Rows.Count == 0)
                            {
                                if (DocUtils.CheckExits(ftpPathCk))
                                {
                                    string path = TextUtils.DownloadAll(moduleCode);

                                    ModuleVersionModel model = new ModuleVersionModel();
                                    model.ModuleCode  = moduleCode;
                                    model.ProjectCode = listProject[0];
                                    model.Version     = 0;
                                    model.Path        = path;
                                    model.Description = "Tạo phiên bản đầu tiên của module";
                                    model.Reason      = "Tạo phiên bản đầu tiên của module";
                                    ModuleVersionBO.Instance.Insert(model);
                                }
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
            this.Close();
        }
Exemplo n.º 5
0
 protected ModuleVersionFacade(ModuleVersionModel model) : base(model)
 {
 }