Пример #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();
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        private void SaveECNOrPCN()
        {
            string smessage = "";

            try
            {
                PartNumberIsFocused            = true;
                drwBll.IsDefaultSubmitRequired = true;
                //if (DDPCNECNModel.PART_NO.ToValueAsString().Trim() == "")
                if (PartNo.ToValueAsString().Trim() == "")
                {
                    ShowInformationMessage(PDMsg.NotEmpty("Part No."));
                    return;
                }

                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 (ActionMode == OperationMode.AddNew)
                {
                    LostFocusPartNo();
                }
                //LostFocusPartNo();
                DDPCNECNModel.PART_NO           = PartNo;
                DDPCNECNModel.SFL_DRAW_ISSUENO  = Convert.ToDecimal(SFLDrawIssueNo);
                DDPCNECNModel.SFL_DRAW_ISSUENO1 = Convert.ToDecimal(SFLDrawIssueNo1);
                DDPCNECNModel.PRODUCT_CHANGE_NO = PCNSheetNo;
                if (DDPCNECNModel.PART_NO.ToValueAsString() != "")
                {
                    if (RE_PPAP == true)
                    {
                        DDPCNECNModel.RE_PPAP = true;
                    }
                    else
                    {
                        DDPCNECNModel.RE_PPAP = false;
                    }
                    if (DDPCNECNModel.PART_NO.ToValueAsString().Trim() != "" &&
                        DDPCNECNModel.PRODUCT_CHANGE_NO.ToValueAsString().Trim() != "" &&
                        DDPCNECNModel.SFL_DRAW_ISSUENO.ToValueAsString().Trim() != "")
                    {
                        Progress.ProcessingText = PDMsg.ProgressUpdateText;
                        Progress.Start();
                        drwBll.SaveECNMPSDetails(DDPCNECNModel, DDPCNECNModel.PART_NO, _screenType, ActionMode);

                        Progress.End();
                    }
                    if (ActionMode == OperationMode.AddNew)
                    {
                        ShowInformationMessage(PDMsg.SavedSuccessfully);
                        _logviewBll.SaveLog(DDPCNECNModel.PART_NO, "ECN/PCN");
                    }
                    else
                    {
                        ShowInformationMessage(PDMsg.UpdatedSuccessfully);
                        _logviewBll.SaveLog(DDPCNECNModel.PART_NO, "ECN/PCN");
                    }
                    if (isPrintClicked != true)
                    {
                        // AddECNOrPCN();
                    }
                }

                try
                {
                    if (ActionMode == OperationMode.AddNew)
                    {
                        string oldPartNo     = PartNo;
                        string oldPCNSheetNo = PCNSheetNo;
                        int    i             = 0;
                        PartNumberIsFocused = true;
                        EditECNOrPCN();
                        foreach (DataRowView drView in DvDD_PCN)
                        {
                            if (drView["PRODUCT_CHANGE_NO"].ToString() == oldPCNSheetNo && drView["PART_NO"].ToString() == oldPartNo)
                            {
                                PartNo = oldPartNo;
                                NotifyPropertyChanged("PartNo");
                                SelectedRow = DvDD_PCN[i];
                                SelectChangeComboPart();
                                //NotifyPropertyChanged("SelectedRow");
                                //GetECNMPSDetails();
                                break;
                            }
                            i = i + 1;
                        }
                    }
                }
                catch (Exception ex1)
                {
                }

                //NotifyPropertyChanged("SelectedRow");
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }