Beispiel #1
0
        private void hủyXácNhậnTạmThờiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int count = 0;

            _rownIndex = grvData.FocusedRowHandle;

            foreach (int i in grvData.GetSelectedRows())
            {
                if (i < 0)
                {
                    continue;
                }
                int           iD    = TextUtils.ToInt(grvData.GetRowCellValue(i, colID));
                MisMatchModel model = (MisMatchModel)MisMatchBO.Instance.FindByPK(iD);
                if (model.ConfirmTemp == 1)
                {
                    model.ConfirmTemp = 0;
                    MisMatchBO.Instance.Update(model);
                    count++;
                }
            }
            if (count > 0)
            {
                loadGrid();
            }
        }
Beispiel #2
0
        private void btnConfirmTemp_Click(object sender, EventArgs e)
        {
            int count = 0;

            if (MessageBox.Show("Bạn có chắc muốn xác nhận tạm thời bỏ qua những sự không phù hợp này?", TextUtils.Caption, MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                _rownIndex = grvData.FocusedRowHandle;

                foreach (int i in grvData.GetSelectedRows())
                {
                    if (i < 0)
                    {
                        continue;
                    }
                    int           iD    = TextUtils.ToInt(grvData.GetRowCellValue(i, colID));
                    MisMatchModel model = (MisMatchModel)MisMatchBO.Instance.FindByPK(iD);
                    if (model.ConfirmTemp == 0)
                    {
                        model.ConfirmTemp = 1;
                        MisMatchBO.Instance.Update(model);
                        count++;
                    }
                }
            }
            if (count > 0)
            {
                loadGrid();
            }
        }
Beispiel #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (grvData.FocusedRowHandle < 0)
            {
                return;
            }
            MisMatchModel model = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));

            if (model.CreatedBy != Global.LoginName)
            {
                MessageBox.Show("Bạn không có quyền xóa sự không phù hợp này!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            int confirm = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colConfirm));

            if (confirm == 1)
            {
                MessageBox.Show("Bạn không thể xóa [" + grvData.GetFocusedRowCellValue(colCode).ToString() + "], vì nó đã được xác nhận!",
                                TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            DialogResult result = MessageBox.Show("Bạn có chắc muốn xóa [" + grvData.GetFocusedRowCellValue(colCode).ToString() + "] ?",
                                                  TextUtils.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                MisMatchBO.Instance.Delete(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));
                _rownIndex = grvData.FocusedRowHandle - 1;
                loadGrid();
            }
        }
Beispiel #4
0
        private void kCSBỏXácNhậnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int count = 0;

            if (MessageBox.Show("Bạn có chắc muốn bỏ xác nhận những sự không phù hợp này?", TextUtils.Caption, MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                _rownIndex = grvData.FocusedRowHandle;

                foreach (int i in grvData.GetSelectedRows())
                {
                    if (i < 0)
                    {
                        continue;
                    }
                    int           iD    = TextUtils.ToInt(grvData.GetRowCellValue(i, colID));
                    MisMatchModel model = (MisMatchModel)MisMatchBO.Instance.FindByPK(iD);
                    if (model.StatusKCS == 1)
                    {
                        model.StatusKCS    = 0;
                        model.CompleteTime = null;
                        MisMatchBO.Instance.Update(model);
                        count++;
                    }
                }
            }
            if (count > 0)
            {
                loadGrid();
            }
        }
Beispiel #5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (grvData.FocusedRowHandle < 0)
            {
                return;
            }
            MisMatchModel model = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));

            if (model.CreatedBy != Global.LoginName)
            {
                MessageBox.Show("Bạn không có quyền sửa sự không phù hợp này!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            if (model.ConfirmTK == 1)
            {
                MessageBox.Show("Bạn không thể sửa sự không phù hợp này.\nDo sự không phù hợp này đã được thiết kế xác nhận.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            frmMisMatch frm = new frmMisMatch();

            frm.MisMatch = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));

            if (frm.ShowDialog() == DialogResult.OK)
            {
                _rownIndex = grvData.FocusedRowHandle;
                loadGrid();
            }
        }
Beispiel #6
0
        private void gửiMailBáoKhôngPhùHợpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string subject;
            string to;
            string content;

            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load dữ liệu..."))
            {
                int           id          = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID));
                ModulesModel  product     = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", grvData.GetFocusedRowCellValue(colModuleCode).ToString())[0];
                string        productCode = product.Code;
                string        projectCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colProjectCode));
                List <string> listEmail   = getListMail(productCode);

                subject = string.Format("INVALID REPORT - {0} - {1}", grvData.GetFocusedRowCellValue(colCode).ToString(), productCode);

                DataTable dtProjectUser = LibQLSX.Select("SELECT p.ProjectCode, u.UserName FROM Project p INNER JOIN Users u ON p.UserId = u.UserId where p.ProjectCode='" + projectCode + "'");
                string    projectUser   = dtProjectUser.Rows.Count > 0 ? TextUtils.ToString(dtProjectUser.Rows[0][1]) : "";

                DataTable dtConfig = TextUtils.Select("select KeyValue from [ConfigSystem] where [KeyName]='KPH_To_TK_Email'");
                content = dtConfig.Rows[0][0].ToString();
                content = content.Replace("<ErrorCode>", "<b>" + grvData.GetFocusedRowCellValue(colCode).ToString() + "</b>")
                          .Replace("<ProjectCode>", "<b>" + projectCode + "</b>")
                          .Replace("<ProjectUser>", "<b>" + projectUser == "" ? "Không tìm thấy" : projectUser + "</b>")
                          .Replace("<ProductCode>", "<b>" + productCode + "</b>")
                          .Replace("<ProductName>", product.Name)
                          .Replace("<UserFind>", grvData.GetFocusedRowCellValue(colUserFindText).ToString())
                          .Replace("<Description>", grvData.GetFocusedRowCellValue(colDes).ToString())
                          .Replace("<Ck>", NVCoKhi == "" ? "Không tìm thấy" : NVCoKhi)
                          .Replace("<Dn>", NVDien == "" ? "Không tìm thấy" : NVDien)
                          .Replace("<Dt>", NVDT == "" ? "Không tìm thấy" : NVDT);
                to = "";
                foreach (string item in listEmail)
                {
                    to += item.ToLower() + ";";
                }
            }
            frmSendEmailAttach frm = new frmSendEmailAttach();

            frm.Subject = subject;
            frm.CC      = //"*****@*****.**";
                          "[email protected];[email protected];[email protected];[email protected];";
            frm.To      = to;
            frm.Content = content;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                MisMatchModel errorModel = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));
                errorModel.ConfirmSendMailKCS = Global.AppFullName + " - " + Environment.MachineName + " đã gửi mail vào ngày: " + DateTime.Now;
                MisMatchBO.Instance.Update(errorModel);
                loadGrid();
            }
        }
Beispiel #7
0
        private void btnShowImage_Click(object sender, EventArgs e)
        {
            if (grvData.FocusedRowHandle < 0)
            {
                return;
            }
            MisMatchModel model = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));
            frmMisMatch   frm   = new frmMisMatch();

            frm.MisMatch      = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));
            frm.OnlyShowImage = true;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                _rownIndex = grvData.FocusedRowHandle;
                loadGrid();
            }
        }
Beispiel #8
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (grvData.FocusedRowHandle < 0)
            {
                return;
            }
            MisMatchModel model = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));

            if (model.ConfirmTK == 0)
            {
                MessageBox.Show("Thiết kế chưa xác nhận sự không phù hợp này là đúng!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            frmConfirmUser frm = new frmConfirmUser();

            frm.MisMatch = model;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                _rownIndex = grvData.FocusedRowHandle;
                loadGrid();
            }
        }
Beispiel #9
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)
            {
            }
        }
Beispiel #10
0
        void save(bool close)
        {
            ProcessTransaction pt = new ProcessTransaction();

            pt.OpenConnection();
            pt.BeginTransaction();

            try
            {
                if (!ValidateForm())
                {
                    return;
                }

                if (MisMatch.ID > 0)
                {
                    MisMatch = (MisMatchModel)MisMatchBO.Instance.FindByPK(MisMatch.ID);
                }

                MisMatch.Code        = txtCode.Text.Trim().ToUpper();
                MisMatch.Description = txtDescription.Text.Trim();
                MisMatch.StatusTK    = 0;
                MisMatch.ProjectCode = TextUtils.ToString(cboProject.EditValue);
                MisMatch.ModuleCode  = cboModule.EditValue != null?cboModule.EditValue.ToString() : "";

                MisMatch.Cost     = txtCost.Value;
                MisMatch.UserFind = TextUtils.ToInt(cboUser.EditValue);

                //MisMatch.CompleteTime = _completeTime;

                if (MisMatch.ID == 0)
                {
                    MisMatch.ID = (int)pt.Insert(MisMatch);
                }
                else
                {
                    pt.Update(MisMatch);
                }

                pt.CommitTransaction();
                _isSaved = true;

                if (close)
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("Lưu trữ thành công!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    groupBoxPicture.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                pt.CloseConnection();
            }
        }
Beispiel #11
0
 protected MisMatchFacade(MisMatchModel model) : base(model)
 {
 }