コード例 #1
0
        private void PrintECNOrPCN()
        {
            try
            {
                string smessage = "";
                drwBll.IsDefaultSubmitRequired = false;
                if (PartNo.ToValueAsString().Trim() == "")
                {
                    ShowInformationMessage(PDMsg.NotEmpty("Part No."));
                    return;
                }
                //  CheckBox chkdraw = (CheckBox)_mdiChild.FindName("chkprddrawing");
                //      if (_screenType=="PCN")
                //       {
                //chkdraw.Visibility = System.Windows.Visibility.Hidden;
                //       }
                smessage = (_screenType == "ECN" ? "ECN" : "PCN");
                if (PCNSheetNo.ToValueAsString().Trim() == "")
                {
                    ShowInformationMessage(PDMsg.NotEmpty(smessage + " Number"));
                    return;
                }
                //if (DDPCNECNModel.SFL_DRAW_ISSUENO.ToValueAsString().Trim() == "")
                if (SFLDrawIssueNo.ToValueAsString().Trim() == "")
                {
                    ShowInformationMessage(PDMsg.NotEmpty("Pro.Seq.Drg.Issue No."));
                    return;
                }

                if (SFLDrawIssueNo1.ToValueAsString().Trim() == "")
                {
                    ShowInformationMessage(PDMsg.NotEmpty("Pro.Drg.Issue No."));
                    return;
                }
                if (ShowWarningMessage(PDMsg.BeforeCloseForm, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    isPrintClicked = true;
                    SaveECNOrPCN();
                }
                else
                {
                    if (AddEnable)
                    {
                        DDPCNECNModel.SNO = (SelectedRow != null) ? SelectedRow["SNO"].ToString().ToIntValue() : 0;
                        //System.Resources.ResourceManager myManager;
                        //myManager = new System.Resources.ResourceManager(typeof(ProcessDesigner.Properties.Resources));
                        //string conStr = myManager.GetString("ConnectionString");

                        //DataAccessLayer dal = new DataAccessLayer(conStr);
                        //DDPCNECNModel.SNO = dal.Get_Ecn_Pcn_Sel_Sno(DDPCNECNModel.PART_NO, _screenType);
                        GetECNMPSDetails();
                    }
                }
                DDPCNECNModel.SFL_DRAW_ISSUENO  = Convert.ToDecimal(SFLDrawIssueNo);
                DDPCNECNModel.SFL_DRAW_ISSUENO1 = Convert.ToDecimal(SFLDrawIssueNo1);
                DDPCNECNModel.PRODUCT_CHANGE_NO = PCNSheetNo;


                DataTable     dtData     = new DataTable();
                List <DD_PCN> lstDDPCN   = new List <DD_PCN>();
                EXHIBIT_DOC   entity     = new EXHIBIT_DOC();
                string        docName    = "ECN";
                string        formatNo   = "";
                string        revisionNo = "";
                lstDDPCN.Add(DDPCNECNModel);
                dtData = Essential.ToDataTable(lstDDPCN);

                if (dtData.Rows.Count > 0)
                {
                    foreach (DataColumn dc in dtData.Columns)
                    {
                        if (dtData.Rows[0][dc].ToValueAsString().Trim() == "")
                        {
                            dtData.Rows[0][dc] = "";
                        }
                    }
                    dtData.Rows[0]["SFL_DRAW_ISSUE_DATE"]    = ReplaceString(dtData.Rows[0]["SFL_DRAW_ISSUE_DATE"].ToValueAsString());
                    dtData.Rows[0]["SFL_DRAW_ISSUEDATE1"]    = ReplaceString(dtData.Rows[0]["SFL_DRAW_ISSUEDATE1"].ToValueAsString());
                    dtData.Rows[0]["DATE_OF_IMPLEMENTATION"] = ReplaceString(dtData.Rows[0]["DATE_OF_IMPLEMENTATION"].ToValueAsString());
                    dtData.Rows[0]["DATE_OF_PCN"]            = ReplaceString(dtData.Rows[0]["DATE_OF_PCN"].ToValueAsString());
                    dtData.Rows[0]["INVOICE_DATE"]           = ReplaceString(dtData.Rows[0]["INVOICE_DATE"].ToValueAsString());
                    dtData.Rows[0]["SIGNATURE_DATE"]         = ReplaceString(dtData.Rows[0]["SIGNATURE_DATE"].ToValueAsString());
                    if (!AddEnable)
                    {
                        dtData.Rows[0]["RE_PPAP"] = RE_PPAP;
                    }
                }

                docName = (_screenType == "ECN" ? "ECN" : "PCN");
                try
                {
                    entity = (from row in drwBll.DB.EXHIBIT_DOC
                              where row.DOC_NAME == docName && (row.DELETE_FLAG == false || row.DELETE_FLAG == null)
                              select row).FirstOrDefault();
                    if (entity != null)
                    {
                        formatNo   = entity.EX_NO.ToValueAsString().Trim();
                        revisionNo = entity.REVISION_NO.ToValueAsString().Trim();
                        //revisionNo = entity.
                    }
                }
                catch (Exception ex1)
                {
                }
                frmReportViewer report = new frmReportViewer(dtData, "ECNPCN", _screenType, formatNo, revisionNo);
                report.ShowDialog();
                if (isPrintClicked)
                {
                    //AddECNOrPCN();
                    isPrintClicked = false;
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }