public List <PRD_MAST> GetProductMasterDetailsByPartNumber(PRD_MAST paramEntity = null) { List <PRD_MAST> lstEntity = null; try { if (!DB.IsNotNullOrEmpty()) { return(lstEntity); } if (paramEntity.IsNotNullOrEmpty() && paramEntity.IDPK.IsNotNullOrEmpty()) { lstEntity = (from row in DB.PRD_MAST where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null) && row.IDPK == paramEntity.IDPK select row).ToList <PRD_MAST>(); } else { lstEntity = (from row in DB.PRD_MAST where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null) select row).ToList <PRD_MAST>(); } } catch (Exception ex) { ex.LogException(); } return(lstEntity); }
private void ExportToExcelData() { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.DefaultExt = ".xlsx"; dlg.Filter = "Excel File (*.xls, *.xlsx)|*.xls;*.xlsx"; dlg.ShowDialog(); if (!dlg.FileName.IsNotNullOrEmpty()) { return; } PRD_MAST productMaster = new PRD_MAST() { PART_NO = MandatoryFields.PART_NO }; DDCI_INFO customerInfo = null; DataSet dsReport = bll.GetAllMFM(Convert.ToDateTime(StartDate).ToString("MM/dd/yyyy"), Convert.ToDateTime(EndDate).ToString("MM/dd/yyyy"), productMaster, customerInfo, DDCUST_MAST); DataView dv = dsReport.Tables[0].DefaultView; DataTable dt = dv.ToTable(); if (dlg.FileName != "") { dt.ExportMFMToExcel(dlg.FileName); ShowInformationMessage("Successfully Exported to Excel"); } }
private void RefreshSubmitCommand() { try { Progress.ProcessingText = PDMsg.Search; Progress.Start(); Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; PCCS feature = new PCCS() { FEATURE = MandatoryFields.FEATURE }; PCCS feature1 = new PCCS() { FEATURE = MandatoryFields.FEATURE1 }; PCCS feature2 = new PCCS() { FEATURE = MandatoryFields.FEATURE2 }; PCCS specification = new PCCS() { SPEC_MIN = MandatoryFields.SPEC_MIN, SPEC_MAX = MandatoryFields.SPEC_MAX }; PRD_MAST productMaster = new PRD_MAST() { PART_DESC = MandatoryFields.PART_DESC }; DsReport = bll.GetAllFeatures(feature, feature1, feature2, specification, productMaster); DataSet dsReport = DsReport; MandatoryFields.GRID_TITLE = REPORT_TITLE; if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count < 0) { Mouse.OverrideCursor = null; ShowInformationMessage(PDMsg.NoRecordsPrint); return; } dsReport.DataSetName = REPORT_NAME; MandatoryFields.GridData = dsReport.Tables[0].DefaultView; MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; DataRow row = dsReport.Tables[1].Rows.Add(); row["ReportTitle"] = REPORT_TITLE; row.AcceptChanges(); dsReport.Tables[1].AcceptChanges(); Progress.End(); } catch (Exception ex) { Mouse.OverrideCursor = null; ex.LogException(); } finally { Mouse.OverrideCursor = null; } //dsReport.WriteXmlSchema("D:\\" + dsReport.DataSetName + ".xml"); }
public List <PRD_MAST> GetPartNumber(PRD_MAST paramEntity = null) { List <PRD_MAST> lstEntity = null; try { if (!DB.IsNotNullOrEmpty()) { return(lstEntity); } if (paramEntity.IsNotNullOrEmpty() && paramEntity.IDPK.IsNotNullOrEmpty()) { lstEntity = (from row in DB.PRD_MAST where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null) && row.IDPK == paramEntity.IDPK select row).ToList <PRD_MAST>(); } else { lstEntity = (from row in DB.PRD_MAST where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null) select row).ToList <PRD_MAST>(); } if (lstEntity.IsNotNullOrEmpty()) { lstEntity = lstEntity.GroupBy(row => row.PART_NO).Select(row => row.First()).Distinct <PRD_MAST>().OrderBy(row => row.PART_NO).ToList <PRD_MAST>(); } } catch (Exception ex) { throw ex.LogException(); } return(lstEntity); }
public List <PROCESS_MAIN> GetProcessSheetMainDetailsByPartNumber(PRD_MAST paramEntity = null) { List <PROCESS_MAIN> lstEntity = null; try { if (!DB.IsNotNullOrEmpty()) { return(lstEntity); } if (paramEntity.IsNotNullOrEmpty() && paramEntity.PART_NO.IsNotNullOrEmpty()) { lstEntity = (from row in DB.PROCESS_MAIN where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null) && row.PART_NO == paramEntity.PART_NO select row).ToList <PROCESS_MAIN>(); } else { lstEntity = (from row in DB.PROCESS_MAIN where (Convert.ToBoolean(Convert.ToInt16(row.DELETE_FLAG)) == false || row.DELETE_FLAG == null) select row).ToList <PROCESS_MAIN>(); } } catch (Exception ex) { ex.LogException(); } return(lstEntity); }
private void RefreshSubmitCommand() { if (StartDate.ToValueAsString().Trim() == "") { ShowInformationMessage(PDMsg.NotEmpty("Start Date")); return; } if (EndDate.ToValueAsString().Trim() == "") { ShowInformationMessage(PDMsg.NotEmpty("End Date")); return; } if (StartDate > EndDate) { ShowInformationMessage("Start Date is Greater than End Date,Please Check it.!"); return; } PRD_MAST productMaster = new PRD_MAST() { PART_NO = MandatoryFields.PART_NO }; DDCI_INFO customerInfo = null; DataSet dsReport = bll.GetAllMFM(Convert.ToDateTime(StartDate).ToString("MM/dd/yyyy"), Convert.ToDateTime(EndDate).ToString("MM/dd/yyyy"), productMaster, customerInfo, DDCUST_MAST); MandatoryFields.GRID_TITLE = REPORT_TITLE; //for (int i = 0; i < dsReport.Tables[0].Rows.Count; i++) //{ // string date = Convert.ToDateTime(dsReport.Tables[0].Rows[i]["DOC_REL_DT_PLAN"].ToString()).ToShortDateString(); //} foreach (DataRow dr in dsReport.Tables[0].Rows) { dr["DOC_REL_DT_PLAN"] = string.IsNullOrEmpty(dr["DOC_REL_DT_PLAN"].ToString()) ? null : DateTime.Parse((dr["DOC_REL_DT_PLAN"].ToString())).ToString("dd/MM/yyyy"); dr["DOC_REL_DT_ACTUAL"] = string.IsNullOrEmpty(dr["DOC_REL_DT_ACTUAL"].ToString()) ? null : DateTime.Parse((dr["DOC_REL_DT_ACTUAL"].ToString())).ToString("dd/MM/yyyy"); dr["TOOLS_READY_DT_PLAN"] = string.IsNullOrEmpty(dr["TOOLS_READY_DT_PLAN"].ToString()) ? null : DateTime.Parse((dr["TOOLS_READY_DT_PLAN"].ToString())).ToString("dd/MM/yyyy"); dr["TOOLS_READY_ACTUAL_DT"] = string.IsNullOrEmpty(dr["TOOLS_READY_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["TOOLS_READY_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy"); dr["FORGING_PLAN_DT"] = string.IsNullOrEmpty(dr["FORGING_PLAN_DT"].ToString()) ? null : DateTime.Parse((dr["FORGING_PLAN_DT"].ToString())).ToString("dd/MM/yyyy"); dr["FORGING_ACTUAL_DT"] = string.IsNullOrEmpty(dr["FORGING_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["FORGING_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy"); dr["SECONDARY_PLAN_DT"] = string.IsNullOrEmpty(dr["SECONDARY_PLAN_DT"].ToString()) ? null : DateTime.Parse((dr["SECONDARY_PLAN_DT"].ToString())).ToString("dd/MM/yyyy"); dr["SECONDARY_ACTUAL_DT"] = string.IsNullOrEmpty(dr["SECONDARY_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["SECONDARY_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy"); dr["HEAT_TREATMENT_PLAN_DT"] = string.IsNullOrEmpty(dr["HEAT_TREATMENT_PLAN_DT"].ToString()) ? null : DateTime.Parse((dr["HEAT_TREATMENT_PLAN_DT"].ToString())).ToString("dd/MM/yyyy"); dr["HEAT_TREATMENT_ACTUAL"] = string.IsNullOrEmpty(dr["HEAT_TREATMENT_ACTUAL"].ToString()) ? null : DateTime.Parse((dr["HEAT_TREATMENT_ACTUAL"].ToString())).ToString("dd/MM/yyyy"); dr["ISSR_PLAN_DT"] = string.IsNullOrEmpty(dr["ISSR_PLAN_DT"].ToString()) ? null : DateTime.Parse((dr["ISSR_PLAN_DT"].ToString())).ToString("dd/MM/yyyy"); dr["ISSR_ACTUAL_DT"] = string.IsNullOrEmpty(dr["ISSR_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["ISSR_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy"); dr["PPAP_PLAN"] = string.IsNullOrEmpty(dr["PPAP_PLAN"].ToString()) ? null : DateTime.Parse((dr["PPAP_PLAN"].ToString())).ToString("dd/MM/yyyy"); dr["PPAP_ACTUAL_DT"] = string.IsNullOrEmpty(dr["PPAP_ACTUAL_DT"].ToString()) ? null : DateTime.Parse((dr["PPAP_ACTUAL_DT"].ToString())).ToString("dd/MM/yyyy"); dr["PSW_DATE"] = string.IsNullOrEmpty(dr["PSW_DATE"].ToString()) ? null : DateTime.Parse((dr["PSW_DATE"].ToString())).ToString("dd/MM/yyyy"); } if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count <= 0) { return; } MandatoryFields.GridData = dsReport.Tables[0].DefaultView; MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; }
public frmrptMFM(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DDCUST_MAST customerMaster = null, bool refreshOnLoad = false, string title = "MFM") { InitializeComponent(); this.mdiChild = mdiChild; vm = new ReportMISMFMViewModel(userInformation, mdiChild, productMaster, customerInfo, customerMaster, refreshOnLoad, title); this.DataContext = vm; mdiChild.Closing += vm.CloseMethod; //if (vm.CloseAction == null && mdiChild.IsNotNullOrEmpty()) // vm.CloseAction = new Action(() => mdiChild.Close()); }
private void RefreshSubmitCommand() { string pgCategory = ""; ProductPGCategoryDataSource.RowFilter = "PG_CATEGORY='" + MandatoryFields.PG_CATEGORY + "'"; if (ProductPGCategoryDataSource.Count > 0) { pgCategory = ProductPGCategoryDataSource[0]["PG_CAT"].ToValueAsString(); } ProductPGCategoryDataSource.RowFilter = null; PRD_MAST productMaster = new PRD_MAST() { PART_NO = MandatoryFields.PART_NO, PART_DESC = MandatoryFields.PART_DESC, QUALITY = MandatoryFields.QUALITY, PG_CATEGORY = pgCategory, PSW_ST = pwsStatus }; DDCUST_MAST customerMaster = new DDCUST_MAST() { CUST_CODE = (selectedCustomer.IsNotNullOrEmpty() ? selectedCustomer.CUST_CODE : -999999) }; List <DDLOC_MAST> lstLocation = null; if (SelectedItems.IsNotNullOrEmpty()) { lstLocation = new List <DDLOC_MAST>(); foreach (object loc in SelectedItems.Values) { lstLocation.Add(new DDLOC_MAST() { LOC_CODE = loc.ToValueAsString() }); } } DataSet dsReport = bll.GetAllPartNos(productMaster, customerMaster, lstLocation); MandatoryFields.GRID_TITLE = REPORT_TITLE; if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count <= 0) { return; } MandatoryFields.GridData = dsReport.Tables[0].DefaultView; MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; }
private void ShowProductInformation() { try { if (SelectedRow != null) { if (_perfOption == performanceOption.PartNumberAllotted || _perfOption != performanceOption.DocumentReleased || _perfOption != performanceOption.SampleSubmitted) { string part_no = string.Empty; if (SelectedRow.DataView.Table.Columns.Contains("COLUMN0")) { part_no = SelectedRow["COLUMN0"].ToValueAsString(); } if (!part_no.IsNotNullOrEmpty()) { return; } ProductInformation bll = new ProductInformation(_userInformation); PRD_MAST parentEntity = bll.GetEntityByPartNumber(new PRD_MAST() { PART_NO = part_no }); MdiChild frmProductInformationChild = new MdiChild { Title = ApplicationTitle + " - Product Master - " + part_no, MaximizeBox = false, MinimizeBox = false }; ProcessDesigner.frmProductInformation productInformation = new ProcessDesigner.frmProductInformation(_userInformation, frmProductInformationChild, parentEntity.IDPK, OperationMode.Edit); frmProductInformationChild.Content = productInformation; frmProductInformationChild.Height = productInformation.Height + 50; frmProductInformationChild.Width = productInformation.Width + 20; MainMDI.Container.Children.Add(frmProductInformationChild); } } } catch (Exception ex) { throw ex.LogException(); } }
private void PrintSubmitCommand() { PRD_MAST productMaster = new PRD_MAST() { PART_NO = MandatoryFields.PART_NO }; DDCI_INFO customerInfo = new DDCI_INFO() { CUST_DWG_NO = MandatoryFields.CUST_DWG_NO }; DataSet dsReport = bll.GetAllCustomerPartNos(productMaster, customerInfo, CustomerSelectedRow); MandatoryFields.GRID_TITLE = REPORT_TITLE; if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count < 0) { ShowInformationMessage(PDMsg.NoRecordsPrint); return; } dsReport.DataSetName = REPORT_NAME; MandatoryFields.GridData = dsReport.Tables[0].DefaultView; MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; DataRow row = dsReport.Tables[1].Rows.Add(); row["ReportTitle"] = REPORT_TITLE; row.AcceptChanges(); dsReport.Tables[1].AcceptChanges(); //dsReport.WriteXmlSchema("D:\\" + dsReport.DataSetName + ".xml"); frmReportViewer reportViewer = new frmReportViewer(dsReport, REPORT_NAME); if (!reportViewer.ReadyToShowReport) { return; } reportViewer.ShowDialog(); }
private void RefreshSubmitCommand() { PRD_MAST productMaster = new PRD_MAST() { PART_NO = MandatoryFields.PART_NO }; DDCI_INFO customerInfo = new DDCI_INFO() { CUST_DWG_NO = MandatoryFields.CUST_DWG_NO }; DataSet dsReport = bll.GetAllCustomerPartNos(productMaster, customerInfo, CustomerSelectedRow); MandatoryFields.GRID_TITLE = REPORT_TITLE; if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count <= 0) { MandatoryFields.GridData = null; return; } MandatoryFields.GridData = dsReport.Tables[0].DefaultView; MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; }
private void ExportToExcelSubmitCommand() { try { PCCS feature = new PCCS() { FEATURE = MandatoryFields.FEATURE }; PCCS feature1 = new PCCS() { FEATURE = MandatoryFields.FEATURE1 }; PCCS feature2 = new PCCS() { FEATURE = MandatoryFields.FEATURE2 }; PCCS specification = new PCCS() { SPEC_MIN = MandatoryFields.SPEC_MIN, SPEC_MAX = MandatoryFields.SPEC_MAX }; PRD_MAST productMaster = new PRD_MAST() { PART_DESC = MandatoryFields.PART_DESC }; DataSet dsReport = DsReport; if (!DsReport.IsNotNullOrEmpty() || !DsReport.Tables.IsNotNullOrEmpty() || DsReport.Tables.Count == 0) { dsReport = bll.GetAllFeatures(feature, feature1, feature2, specification, productMaster); } //MandatoryFields.GRID_TITLE = REPORT_TITLE; if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count < 0) { ShowInformationMessage(PDMsg.NoRecordsPrint); return; } //dsReport.DataSetName = REPORT_NAME; //MandatoryFields.GridData = dsReport.Tables[0].DefaultView; //MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; //DataRow row = dsReport.Tables[1].Rows.Add(); //row["ReportTitle"] = REPORT_TITLE; //row.AcceptChanges(); //dsReport.Tables[1].AcceptChanges(); //dsReport.WriteXmlSchema("D:\\" + dsReport.DataSetName + ".xml"); //frmReportViewer reportViewer = new frmReportViewer(dsReport, REPORT_NAME, CrystalDecisions.Shared.ExportFormatType.ExcelWorkbook); //if (!reportViewer.ReadyToShowReport) return; string reportName = GetReportPath() + "FeatureWiseExport.rpt"; if (BindReport(dsReport, reportName, CrystalDecisions.Shared.ExportFormatType.ExcelWorkbook) == true) // If condition added by Jeyan { ShowInformationMessage("Exported to Excel File Successfully."); } //reportViewer.ShowDialog(); } catch (Exception ex) { ShowWarningMessage(ex.Message, MessageBoxButton.OK); } }
public frmRptFeatureWise(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PCCS feature = null, PCCS feature1 = null, PCCS feature2 = null, PCCS specification = null, PRD_MAST productMaster = null, bool refreshOnLoad = false, string title = "Feature Wise Report") { InitializeComponent(); this.mdiChild = mdiChild; vm = new ReportMISFeatureWiseViewModel(userInformation, mdiChild, feature, feature1, feature2, specification, productMaster, refreshOnLoad, title); this.DataContext = vm; mdiChild.Closing += vm.CloseMethod; if (vm.CloseAction == null) { vm.CloseAction = new Action(() => mdiChild.Close()); } }
private void PrintSubmitCommand() { Progress.ProcessingText = PDMsg.Load; Progress.Start(); PCCS feature = new PCCS() { FEATURE = MandatoryFields.FEATURE }; PCCS feature1 = new PCCS() { FEATURE = MandatoryFields.FEATURE1 }; PCCS feature2 = new PCCS() { FEATURE = MandatoryFields.FEATURE2 }; PCCS specification = new PCCS() { SPEC_MIN = MandatoryFields.SPEC_MIN, SPEC_MAX = MandatoryFields.SPEC_MAX }; PRD_MAST productMaster = new PRD_MAST() { PART_DESC = MandatoryFields.PART_DESC }; DataSet dsReport = DsReport; if (!DsReport.IsNotNullOrEmpty() || !DsReport.Tables.IsNotNullOrEmpty() || DsReport.Tables.Count == 0) { RefreshSubmitCommand(); } //if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count < 0) //{ // ShowInformationMessage(PDMsg.NoRecordsPrint); // return; //} if (MandatoryFields.GridData.IsNotNullOrEmpty()) { if (MandatoryFields.GridData.Count <= 0) { ShowInformationMessage(PDMsg.NoRecordsPrint); return; } } //dsReport.DataSetName = REPORT_NAME; //MandatoryFields.GridData = dsReport.Tables[0].DefaultView; //MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; //DataRow row = dsReport.Tables[1].Rows.Add(); //row["ReportTitle"] = REPORT_TITLE; //row.AcceptChanges(); //dsReport.Tables[1].AcceptChanges(); //dsReport.WriteXmlSchema("D:\\" + dsReport.DataSetName + ".xml"); frmMISInputBox inp = new frmMISInputBox("Report Title", "Enter the Title of the Report"); inp.ShowDialog(); //inp.Txt_InputBox.Text; frmReportViewer reportViewer = new frmReportViewer(dsReport, REPORT_NAME, inp.Txt_InputBox.Text); Progress.End(); if (!reportViewer.ReadyToShowReport) { return; } reportViewer.ShowDialog(); }
public ReportMISCustomerPartNoWiseViewModel(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DDCUST_MAST customerMaster = null, bool refreshOnLoad = false, string title = REPORT_TITLE) { _userInformation = userInformation; this.mdiChild = mdiChild; bll = new ReportMISCustomerPartNoWise(userInformation); MandatoryFields = new ReportMISCustomerPartNoWiseModel(); MandatoryFields.GRID_TITLE = REPORT_TITLE; CustomersDataSource = bll.GetCustomerDetails().ToDataTable <DDCUST_MAST>().DefaultView; this.customerSelectedItemChangedCommand = new DelegateCommand(this.CustomerChanged); CustomerDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "CUST_CODE", ColumnDesc = "Customer Code", ColumnWidth = "25*" }, new DropdownColumns() { ColumnName = "CUST_NAME", ColumnDesc = "Customer", ColumnWidth = "75*", IsDefaultSearchColumn = true } }; SFLPartNumbersDataSource = bll.GetPartNumber().ToDataTable <PRD_MAST>().DefaultView; this.sflPartNumberSelectedItemChangedCommand = new DelegateCommand(this.SFLPartNumberChanged); SFLPartNumberDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "PART_NO", ColumnDesc = "SFL Part Number", ColumnWidth = "1*" }, }; this.printCommand = new DelegateCommand(this.PrintSubmitCommand); this.refreshCommand = new DelegateCommand(this.RefreshSubmitCommand); CustomerPartNumbersDataSource = bll.GetCustomerPartNumber().ToDataTable <DDCI_INFO>().DefaultView; this.customerPartNumberSelectedItemChangedCommand = new DelegateCommand(this.CustomerPartNumberChanged); CustomerPartNumberDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "CUST_DWG_NO", ColumnDesc = "Customer Part Number", ColumnWidth = "1*" }, }; }
public ReportMISMFMViewModel(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DDCUST_MAST customerMaster = null, bool refreshOnLoad = false, string title = REPORT_TITLE) { CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name); ci.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy"; ci.DateTimeFormat.DateSeparator = "/"; Thread.CurrentThread.CurrentCulture = ci; _userInformation = userInformation; this.mdiChild = mdiChild; bll = new ReportMISMFM(userInformation); MandatoryFields = new ReportMISMFMModel(); MandatoryFields.GRID_TITLE = REPORT_TITLE; CustomersDataSource = bll.GetCustomerDetails().ToDataTable <DDCUST_MAST>().DefaultView; this.customerSelectedItemChangedCommand = new DelegateCommand(this.CustomerChanged); CustomerDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "CUST_CODE", ColumnDesc = "Customer Code", ColumnWidth = "25*" }, new DropdownColumns() { ColumnName = "CUST_NAME", ColumnDesc = "Customer", ColumnWidth = "75*", IsDefaultSearchColumn = true } }; SFLPartNumbersDataSource = bll.GetPartNumber().ToDataTable <PRD_MAST>().DefaultView; this.sflPartNumberSelectedItemChangedCommand = new DelegateCommand(this.SFLPartNumberChanged); SFLPartNumberDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "PART_NO", ColumnDesc = "SFL Part Number", ColumnWidth = "1*" }, }; this.printCommand = new DelegateCommand(this.PrintSubmitCommand); this.refreshCommand = new DelegateCommand(this.RefreshSubmitCommand); this.ExportCommand = new DelegateCommand(this.ExportToExcelData); }
public System.Data.DataSet GetAllCustomerPartNos(PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DataRowView customerMaster = null) { System.Data.DataSet dsReport = null; try { StringBuilder sb = new StringBuilder(); sb.Append("SELECT "); sb.Append(" ROW_NUMBER() OVER(ORDER BY A.PART_NO) AS SNO, "); sb.Append(" a.PART_NO, "); sb.Append(" a.PART_DESC, "); //sb.Append(" a.SIM_TO_STD_CD, "); //sb.Append(" a.PRD_CLASS_CD, "); //sb.Append(" a.MFG_STD, "); //sb.Append(" a.ED_CD, "); //sb.Append(" a.THREAD_CD, "); //sb.Append(" a.DIA_CD, "); //sb.Append(" a.QUALITY, "); //sb.Append(" a.BIF_PROJ, "); //sb.Append(" a.BIF_FORECAST, "); //sb.Append(" a.FINISH_WT, "); //sb.Append(" a.FINISH_WT_EST, "); //sb.Append(" a.HEAT_TREATMENT_CD, "); //sb.Append(" a.HEAT_TREATMENT_DESC, "); //sb.Append(" a.PRD_GRP_CD, "); //sb.Append(" a.MACHINE_CD, "); //sb.Append(" a.ALLOT_DATE, "); //sb.Append(" a.DOC_REL_DATE, "); //sb.Append(" a.DOC_REL_REMARKS, "); //sb.Append(" a.FAMILY, "); //sb.Append(" a.HEAD_STYLE, "); //sb.Append(" a.TYPE, "); //sb.Append(" a.APPLICATION, "); //sb.Append(" a.USER_CD, "); //sb.Append(" a.THREAD_CLASS, "); //sb.Append(" a.THREAD_STD, "); //sb.Append(" a.PG_CATEGORY, "); //sb.Append(" a.NOS_PER_PACK, "); //sb.Append(" a.SAMP_SUBMIT_DATE, "); //sb.Append(" a.ALLOTTED_BY, "); //sb.Append(" a.PSW_ST, "); //sb.Append(" a.DOC_REL_TYPE, "); //sb.Append(" a.HOLD_ME, "); //sb.Append(" a.ADDL_FEATURE, "); //sb.Append(" a.KEYWORDS, "); //sb.Append(" a.CANCEL_STATUS, "); //sb.Append(" a.IDPK AS PRD_MAST_IDPK, "); //sb.Append(" a.PART_CONFIG_ID, "); //sb.Append(" a.LOC_CODE, "); //sb.Append(" C.CI_REFERENCE, "); //sb.Append(" C.ENQU_RECD_ON, "); //sb.Append(" C.FR_CS_DATE, "); //sb.Append(" C.PROD_DESC, "); //sb.Append(" C.CUST_CODE, "); sb.Append(" C.CUST_DWG_NO "); //sb.Append(" C.CUST_DWG_NO_ISSUE, "); //sb.Append(" C.EXPORT, "); //sb.Append(" C.NUMBER_OFF, "); //sb.Append(" C.POTENTIAL, "); //sb.Append(" C.SFL_SHARE, "); //sb.Append(" C.REMARKS, "); //sb.Append(" C.RESPONSIBILITY, "); //sb.Append(" C.PENDING, "); //sb.Append(" C.FEASIBILITY, "); //sb.Append(" C.REJECT_REASON, "); //sb.Append(" C.LOC_CODE, "); //sb.Append(" C.CHEESE_WT, "); //sb.Append(" C.FINISH_WT, "); //sb.Append(" C.FINISH_CODE, "); //sb.Append(" C.SUGGESTED_RM, "); //sb.Append(" C.RM_COST, "); //sb.Append(" C.FINAL_COST, "); //sb.Append(" C.COST_NOTES, "); //sb.Append(" C.PROCESSED_BY, "); //sb.Append(" C.ORDER_DT, "); //sb.Append(" C.ALLOT_PART_NO, "); //sb.Append(" C.PART_NO_REQ_DATE, "); //sb.Append(" C.CUST_STD_NO, "); //sb.Append(" C.CUST_STD_DATE, "); //sb.Append(" C.AUTOPART, "); //sb.Append(" C.SAFTYPART, "); //sb.Append(" C.APPLICATION, "); //sb.Append(" C.STATUS, "); //sb.Append(" C.CUSTOMER_NEED_DT, "); //sb.Append(" C.MKTG_COMMITED_DT, "); //sb.Append(" C.PPAP_LEVEL, "); //sb.Append(" C.DEVL_METHOD, "); //sb.Append(" C.PPAP_FORGING, "); //sb.Append(" C.PPAP_SAMPLE, "); //sb.Append(" C.PACKING, "); //sb.Append(" C.NATURE_PACKING, "); //sb.Append(" C.SPL_CHAR, "); //sb.Append(" C.OTHER_CUST_REQ, "); //sb.Append(" C.ATP_DATE, "); //sb.Append(" C.SIMILAR_PART_NO, "); //sb.Append(" C.GENERAL_REMARKS, "); //sb.Append(" C.MONTHLY, "); //sb.Append(" C.MKTG_COMMITED_DATE, "); //sb.Append(" C.IDPK AS CI_IDPK, "); //sb.Append(" C.COATING_CODE, "); //sb.Append(" C.REALISATION, "); //sb.Append(" C.NO_OF_PCS, "); //sb.Append(" C.ZONE_CODE, "); //sb.Append(" C.RM_FACTOR, "); //sb.Append(" C.IS_COMBINED "); //sb.Append("FROM prd_mast a "); //sb.Append("LEFT OUTER JOIN prd_ciref b "); //sb.Append("ON a.part_no = b.part_no "); //sb.Append("LEFT OUTER JOIN ddci_info c "); //sb.Append("ON b.ci_ref = c.ci_reference"); //sb.Append(" where b.CURRENT_CIREF = 1 "); sb.Append("FROM prd_mast a ,prd_ciref b ,ddci_info c where a.part_no = b.part_no and b.ci_ref=c.ci_reference and b.CURRENT_CIREF = 1"); if (customerInfo.IsNotNullOrEmpty() && customerInfo.CUST_DWG_NO.ToValueAsString().Trim().Length > 0) { sb.Append(" and RTRIM(LTRIM(cust_dwg_no)) like '" + customerInfo.CUST_DWG_NO.ToValueAsString() + "%'"); } if (productMaster.IsNotNullOrEmpty() && productMaster.PART_NO.ToValueAsString().Trim().Length > 0) { sb.Append(" and RTRIM(LTRIM(a.part_no)) like '" + productMaster.PART_NO.ToValueAsString() + "%'"); } if (customerMaster.IsNotNullOrEmpty() && customerMaster["CUST_CODE"].ToValueAsString().Trim().Length > 0) { sb.Append(" and RTRIM(LTRIM(cust_code)) = '" + customerMaster["CUST_CODE"].ToValueAsString() + "'"); } sb.Append(" order by a.PART_NO"); List <StringBuilder> sqlList = new List <StringBuilder>() { sb }; dsReport = Dal.GetDataSet(sqlList); if (dsReport.IsNotNullOrEmpty() && dsReport.Tables.IsNotNullOrEmpty() && dsReport.Tables.Count > 0) { dsReport.Tables[0].TableName = "PRD_MAST_CI"; } DataTable dtCompany = new DataTable(); dtCompany.TableName = "CompanyName"; dtCompany.Columns.Add("Name"); dtCompany.Columns.Add("ShortName"); dtCompany.Columns.Add("Phone"); dtCompany.Columns.Add("Fax"); dtCompany.Columns.Add("Mobile"); dtCompany.Columns.Add("EMail"); dtCompany.Columns.Add("Title"); dtCompany.Columns.Add("ReportTitle"); if (dsReport.IsNotNullOrEmpty()) { dsReport.Tables.Add(dtCompany); } } catch (Exception ex) { throw ex.LogException(); } return(dsReport); }
private void ShowProductInformation() { try { // public frmProductInformation(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, int entityPrimaryKey, //OperationMode operationMode, string title = "Feasibility Report and Cost Sheet") //return; if (SelectedPartRow != null) { string part_no = string.Empty; if (SelectedPartRow.DataView.Table.Columns.Contains("PART_NO")) { part_no = SelectedPartRow["PART_NO"].ToValueAsString(); } if (!part_no.IsNotNullOrEmpty()) { return; } ProductInformation bll = new ProductInformation(_userInformation); PRD_MAST parentEntity = bll.GetEntityByPartNumber(new PRD_MAST() { PART_NO = part_no }); //Window win = new Window(); //win.Title = ApplicationTitle + " - Prodcut Master"; //System.Windows.Media.Imaging.IconBitmapDecoder ibd = new System.Windows.Media.Imaging.IconBitmapDecoder(new Uri(@"pack://application:,,/Images/logo.ico", UriKind.RelativeOrAbsolute), System.Windows.Media.Imaging.BitmapCreateOptions.None, System.Windows.Media.Imaging.BitmapCacheOption.Default); //win.Icon = ibd.Frames[0]; //win.ResizeMode = ResizeMode.NoResize; //ProcessDesigner.frmProductInformation userControl = new ProcessDesigner.frmProductInformation(_userInformation, win, parentEntity.IDPK, OperationMode.Edit, win.Title); //win.Content = userControl; //win.Height = userControl.Height + 50; //win.Width = userControl.Width + 10; //win.ShowInTaskbar = false; //win.WindowStartupLocation = WindowStartupLocation.CenterScreen; //win.ShowDialog(); MdiChild frmProductInformationChild = new MdiChild { Title = ApplicationTitle + " - Product Master", MaximizeBox = false, MinimizeBox = false }; ProcessDesigner.frmProductInformation productInformation = new ProcessDesigner.frmProductInformation(_userInformation, frmProductInformationChild, parentEntity.IDPK, OperationMode.Edit); frmProductInformationChild.Content = productInformation; frmProductInformationChild.Height = productInformation.Height + 50; frmProductInformationChild.Width = productInformation.Width + 20; MainMDI.Container.Children.Add(frmProductInformationChild); } } catch (Exception ex) { throw ex.LogException(); } }
public System.Data.DataSet GetAllFeatures(PCCS feature = null, PCCS feature1 = null, PCCS feature2 = null, PCCS specification = null, PRD_MAST productMaster = null) { System.Data.DataSet dsReport = null; try { StringBuilder sb = new StringBuilder(); sb.Append("SELECT DISTINCT 123456789012 AS SNO, A.PART_NO, A.PART_DESC, A.IDPK, B.FEATURE, "); sb.Append("B.SPEC_MIN, B.SPEC_MAX, A.QUALITY, E.CUST_NAME, "); sb.Append("(select TOP 1 p.CTRL_SPEC_MIN from pccs p where p.PART_NO=b.part_no "); sb.Append("and (UPPER(p.FEATURE) LIKE 'HEAD HEI%' "); sb.Append("or UPPER(p.FEATURE) LIKE 'HEAD TH%') "); sb.Append(") CTRL_SPEC_MIN, "); sb.Append("(select TOP 1 p.CTRL_SPEC_MAX from pccs p where p.PART_NO=b.part_no "); sb.Append("and (UPPER(p.FEATURE) LIKE 'HEAD HEI%' "); sb.Append("or UPPER(p.FEATURE) LIKE 'HEAD TH%') "); sb.Append(") as CTRL_SPEC_MAX, "); sb.Append("(select TOP 1 p.CTRL_SPEC_MIN from pccs p where p.PART_NO=b.part_no "); sb.Append("and (UPPER(p.FEATURE) LIKE 'COLLAR DIA%' "); sb.Append("or UPPER(p.FEATURE) LIKE 'FLANGE DIA%') "); sb.Append(") AS COLLAR_FLANGE_DIA_MIN, "); sb.Append("(select TOP 1 p.CTRL_SPEC_MAX from pccs p where p.PART_NO=b.part_no "); sb.Append("and (UPPER(p.FEATURE) LIKE 'COLLAR DIA%' "); sb.Append("or UPPER(p.FEATURE) LIKE 'FLANGE DIA%')) "); sb.Append("AS COLLAR_FLANGE_DIA_MAX, "); sb.Append("(select TOP 1 p.CTRL_SPEC_MIN from pccs p where p.PART_NO=b.part_no "); sb.Append("and (UPPER(p.FEATURE) LIKE 'COLLAR TH%' "); sb.Append("or UPPER(p.FEATURE) LIKE 'FLANGE TH%')) AS COLLAR_FLANGE_TK_MIN, "); sb.Append("(select TOP 1 p.CTRL_SPEC_MAX from pccs p where p.PART_NO=b.part_no "); sb.Append("and (UPPER(p.FEATURE) LIKE 'COLLAR TH%' "); sb.Append("or UPPER(p.FEATURE) LIKE 'FLANGE TH%')) AS COLLAR_FLANGE_TK_MAX, "); sb.Append("(SELECT TOP 1 VFORG.CC_CODE FROM V_FORGING_COST_CENTER VFORG WHERE VFORG.PART_NO=B.PART_NO) AS FORGING_COST_CENTER, "); sb.Append("(SELECT TOP 1 VFORG.WIRE_SIZE_MIN FROM V_FORGING_COST_CENTER VFORG WHERE VFORG.PART_NO=B.PART_NO) AS WIRE_DIA_MIN, "); sb.Append("(SELECT TOP 1 VFORG.WIRE_SIZE_MAX FROM V_FORGING_COST_CENTER VFORG WHERE VFORG.PART_NO=B.PART_NO) AS WIRE_DIA_MAX "); sb.Append("FROM PRD_MAST A, PCCS B, "); sb.Append("PRD_CIREF C, DDCI_INFO D, "); sb.Append("DDCUST_MAST E "); sb.Append("WHERE A.PART_NO =B.PART_NO AND "); sb.Append("A.PART_NO =C.PART_NO AND "); sb.Append("C.CI_REF =D.CI_REFERENCE AND C.CURRENT_CIREF = 1 AND D.CUST_CODE =E.CUST_CODE "); //sb.Append("C.CI_REF =D.CI_REFERENCE AND D.CUST_CODE =E.CUST_CODE "); string featureSql = ""; if (feature.IsNotNullOrEmpty() && feature.FEATURE.IsNotNullOrEmpty()) { featureSql = featureSql + "UPPER(B.FEATURE) LIKE '%" + sqlEncode(feature.FEATURE.ToUpper()) + "%' "; } string feature1Sql = ""; if (feature1.IsNotNullOrEmpty() && feature1.FEATURE.IsNotNullOrEmpty()) { feature1Sql = feature1Sql + "UPPER(B.FEATURE) LIKE '%" + sqlEncode(feature1.FEATURE.ToUpper()) + "%' "; } if (featureSql.IsNotNullOrEmpty() && feature1Sql.IsNotNullOrEmpty()) { featureSql = featureSql + " OR " + feature1Sql; } else if (!featureSql.IsNotNullOrEmpty() && feature1Sql.IsNotNullOrEmpty()) { featureSql = feature1Sql; } string feature2Sql = ""; if (feature2.IsNotNullOrEmpty() && feature2.FEATURE.IsNotNullOrEmpty()) { feature2Sql = feature2Sql + "UPPER(B.FEATURE) LIKE '%" + sqlEncode(feature2.FEATURE.ToUpper()) + "%' "; } if (featureSql.IsNotNullOrEmpty() && feature2Sql.IsNotNullOrEmpty()) { featureSql = featureSql + " OR " + feature2Sql; } else if (!featureSql.IsNotNullOrEmpty() && feature2Sql.IsNotNullOrEmpty()) { featureSql = feature2Sql; } if (featureSql.IsNotNullOrEmpty() && featureSql.Trim().Length > 0) { sb.Append(" AND ( " + featureSql + ") "); } if (productMaster.IsNotNullOrEmpty() && productMaster.PART_DESC.IsNotNullOrEmpty()) { sb.Append(" AND UPPER(A.PART_DESC) LIKE '%" + sqlEncode(productMaster.PART_DESC.ToUpper()) + "%' "); } if (specification.IsNotNullOrEmpty()) { if (specification.SPEC_MIN.IsNotNullOrEmpty() && specification.SPEC_MIN.IsNumeric()) { sb.Append(" AND B.SPEC_MIN BETWEEN '" + sqlEncode(specification.SPEC_MIN) + "' AND '" + Convert.ToDouble(specification.SPEC_MIN) + 1 + "' "); } else if (specification.SPEC_MIN.IsNotNullOrEmpty()) { sb.Append(" AND UPPER(B.SPEC_MIN) LIKE '" + sqlEncode(specification.SPEC_MIN.ToUpper()) + "%' "); } if (specification.SPEC_MAX.IsNotNullOrEmpty() && specification.SPEC_MAX.IsNumeric() && 1 == 2) { sb.Append(" AND B.SPEC_MAX BETWEEN '" + sqlEncode(specification.SPEC_MAX) + "' AND '" + Convert.ToDouble(specification.SPEC_MAX) + 1 + "' "); } else if (specification.SPEC_MAX.IsNotNullOrEmpty()) { sb.Append(" AND UPPER(B.SPEC_MAX) = '" + sqlEncode(specification.SPEC_MAX.ToUpper()) + "' "); } } sb.Append(" ORDER BY A.PART_NO "); List <StringBuilder> sqlList = new List <StringBuilder>() { sb }; dsReport = Dal.GetDataSet(sqlList); if (dsReport.IsNotNullOrEmpty() && dsReport.Tables.IsNotNullOrEmpty() && dsReport.Tables.Count > 0) { dsReport.Tables[0].TableName = "FEATURE_WISE_REPORT"; long sno = 0; foreach (DataRow dataRow in dsReport.Tables[0].Rows) { string part_no = dataRow["PART_NO"].ToValueAsString(); sno++; dataRow["SNO"] = sno.ToValueAsString(); } dsReport.Tables[0].AcceptChanges(); } DataTable dtCompany = new DataTable(); dtCompany.TableName = "CompanyName"; dtCompany.Columns.Add("Name"); dtCompany.Columns.Add("ShortName"); dtCompany.Columns.Add("Phone"); dtCompany.Columns.Add("Fax"); dtCompany.Columns.Add("Mobile"); dtCompany.Columns.Add("EMail"); dtCompany.Columns.Add("Title"); dtCompany.Columns.Add("ReportTitle"); if (dsReport.IsNotNullOrEmpty()) { dsReport.Tables.Add(dtCompany); } } catch (Exception ex) { throw ex.LogException(); } return(dsReport); }
//private readonly ICommand mousecombocommand; //public ICommand MouseComboCommand { get { return this.mousecombocommand; } } public ReportMISFeatureWiseViewModel(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PCCS feature = null, PCCS feature1 = null, PCCS feature2 = null, PCCS specification = null, PRD_MAST productMaster = null, bool refreshOnLoad = false, string title = REPORT_TITLE) { _userInformation = userInformation; this.mdiChild = mdiChild; bll = new ReportMISFeatureWise(userInformation); MandatoryFields = new ReportMISFeatureWiseModel(); MandatoryFields.GRID_TITLE = REPORT_TITLE; this.printCommand = new DelegateCommand(this.PrintSubmitCommand); //this.mousecombocommand = new DelegateCommand(this.MouseDblClick); this.refreshCommand = new DelegateCommand(this.RefreshSubmitCommand); this.exportToExcelCommand = new DelegateCommand(this.ExportToExcelSubmitCommand); //FeatureDataSource = bll.GetFeature().ToDataTable<PCCS>().DefaultView; FeatureDataSource = bll.GetFeatureDataTable().DefaultView; this._featureSelectedItemChangedCommand = new DelegateCommand(this.FeatureChanged); FeatureDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "FEATURE", ColumnDesc = "Feature", ColumnWidth = "1*" }, }; Feature1DataSource = FeatureDataSource.Table.Copy().DefaultView; this._feature1SelectedItemChangedCommand = new DelegateCommand(this.Feature1Changed); Feature1DropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "FEATURE", ColumnDesc = "Feature", ColumnWidth = "1*" }, }; Feature2DataSource = FeatureDataSource.Table.Copy().DefaultView; this._feature2SelectedItemChangedCommand = new DelegateCommand(this.Feature2Changed); Feature2DropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "FEATURE", ColumnDesc = "Feature", ColumnWidth = "1*" }, }; }
public System.Data.DataSet GetAllPartNos(PRD_MAST productMaster = null, DDCUST_MAST customerMaster = null, List <DDLOC_MAST> lstLocation = null) { System.Data.DataSet dsReport = null; try { StringBuilder sb = new StringBuilder(); sb.Append("SELECT ROW_NUMBER() OVER(ORDER BY M.PART_NO) AS SNO, "); sb.Append(" M.PART_NO, "); sb.Append(" P.PART_DESC, "); sb.Append(" T.CUST_NAME, "); sb.Append(" P.BIF_PROJ, "); sb.Append(" P.BIF_FORECAST, "); sb.Append(" P.FINISH_WT, "); sb.Append(" M.CHEESE_WT, "); sb.Append(" M.RM_WT, "); sb.Append(" P.PG_CATEGORY, "); sb.Append(" P.QUALITY, "); sb.Append(" P.SAMP_SUBMIT_DATE, "); sb.Append(" P.PSW_ST, "); sb.Append(" C.CUST_DWG_NO, "); sb.Append(" P.DOC_REL_DATE "); sb.Append("FROM dbo.PRD_MAST AS P "); sb.Append("LEFT OUTER JOIN dbo.PRD_CIREF AS F "); sb.Append("ON F.PART_NO = P.PART_NO "); sb.Append("LEFT OUTER JOIN dbo.DDCI_INFO AS C "); sb.Append("ON C.CI_REFERENCE = F.CI_REF, "); sb.Append(" dbo.PROCESS_MAIN AS M, "); sb.Append(" dbo.DDCUST_MAST AS T "); sb.Append("WHERE P.PART_NO = M.PART_NO "); sb.Append("AND M.CURRENT_PROC = 1 "); sb.Append("AND T.CUST_CODE = C.CUST_CODE "); if (customerMaster.IsNotNullOrEmpty() && customerMaster.CUST_CODE.IsNotNullOrEmpty() && customerMaster.CUST_CODE != -999999) { sb.Append(" AND C.CUST_CODE = '" + customerMaster.CUST_CODE + "' "); } if (productMaster.IsNotNullOrEmpty()) { if (productMaster.PART_NO.IsNotNullOrEmpty()) { sb.Append(" AND P.PART_NO LIKE '" + productMaster.PART_NO + "%' "); } if (productMaster.PART_DESC.IsNotNullOrEmpty()) { sb.Append(" AND upper(P.PART_DESC) LIKE '%" + productMaster.PART_DESC.ToUpper() + "%' "); } if (productMaster.QUALITY.IsNotNullOrEmpty()) { sb.Append(" AND P.QUALITY LIKE '" + productMaster.QUALITY + "%' "); } if (productMaster.PG_CATEGORY.IsNotNullOrEmpty()) { sb.Append(" AND P.PG_CATEGORY = '" + productMaster.PG_CATEGORY + "' "); } if (productMaster.PSW_ST.IsNotNullOrEmpty() && (productMaster.PSW_ST.ToUpper() == "YES" || productMaster.PSW_ST.ToUpper() == "NO")) { sb.Append(" AND P.PSW_ST = '" + productMaster.PSW_ST + "' "); } if (productMaster.PSW_ST.IsNotNullOrEmpty() && (productMaster.PSW_ST.ToUpper() == "NONE")) { sb.Append(" AND P.PSW_ST IS NULL "); } } if (lstLocation.IsNotNullOrEmpty() && lstLocation.Count > 0 && lstLocation.Count < 4) { string locsql = ""; foreach (DDLOC_MAST loc in lstLocation) { locsql = locsql + "(P.BIF_PROJ LIKE '" + loc.LOC_CODE + "%' OR P.BIF_FORECAST LIKE '" + loc.LOC_CODE + "%')"; if (lstLocation[lstLocation.Count - 1].GetHashCode() != loc.GetHashCode()) { locsql = locsql + " OR "; } } sb.Append(" AND (" + locsql + ") "); } sb.Append(" order by M.PART_NO"); List <StringBuilder> sqlList = new List <StringBuilder>() { sb }; dsReport = Dal.GetDataSet(sqlList); if (dsReport.IsNotNullOrEmpty() && dsReport.Tables.IsNotNullOrEmpty() && dsReport.Tables.Count > 0) { dsReport.Tables[0].TableName = "PRD_MAST_CI"; } DataTable dtCompany = new DataTable(); dtCompany.TableName = "CompanyName"; dtCompany.Columns.Add("Name"); dtCompany.Columns.Add("ShortName"); dtCompany.Columns.Add("Phone"); dtCompany.Columns.Add("Fax"); dtCompany.Columns.Add("Mobile"); dtCompany.Columns.Add("EMail"); dtCompany.Columns.Add("Title"); dtCompany.Columns.Add("ReportTitle"); if (dsReport.IsNotNullOrEmpty()) { dsReport.Tables.Add(dtCompany); } } catch (Exception ex) { throw ex.LogException(); } return(dsReport); }
public ReportMISProductInformationViewModel(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PRD_MAST productMaster = null, ReportMISProductInformationModel productInformationModel = null, DDCUST_MAST customerMaster = null, List <DDLOC_MAST> lstLocation = null, bool refreshOnLoad = false, string title = REPORT_TITLE) { _userInformation = userInformation; this.mdiChild = mdiChild; bll = new ReportMISProductInformationWise(userInformation); MandatoryFields = new ReportMISProductInformationModel(); MandatoryFields.GRID_TITLE = REPORT_TITLE; CustomersDataSource = bll.GetCustomerDetails().ToDataTable <DDCUST_MAST>().DefaultView; this.customerSelectedItemChangedCommand = new DelegateCommand(this.CustomerChanged); CustomerDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "CUST_CODE", ColumnDesc = "Customer Code", ColumnWidth = "25*" }, new DropdownColumns() { ColumnName = "CUST_NAME", ColumnDesc = "Customer", ColumnWidth = "75*", IsDefaultSearchColumn = true } }; SFLPartNumbersDataSource = bll.GetPartNumber().ToDataTable <PRD_MAST>().DefaultView; this.sflPartNumberSelectedItemChangedCommand = new DelegateCommand(this.SFLPartNumberChanged); SFLPartNumberDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "PART_NO", ColumnDesc = "SFL Part Number", ColumnWidth = "1*" }, }; this.printCommand = new DelegateCommand(this.PrintSubmitCommand); this.refreshCommand = new DelegateCommand(this.RefreshSubmitCommand); Items = new Dictionary <string, object>(); SelectedItems = new Dictionary <string, object>(); SelectedItems.Add("All", "All"); foreach (DDLOC_MAST locationMaster in bll.GetLocationDetails()) { Items.Add(locationMaster.LOCATION + "(" + locationMaster.LOC_CODE + ")", locationMaster.LOC_CODE); SelectedItems.Add(locationMaster.LOCATION + "(" + locationMaster.LOC_CODE + ")", locationMaster.LOC_CODE); } DataTable dtPGCategory = bll.GetProductPGCategoryByPrimaryKey().ToDataTable <PG_CATEGORY>(); if (dtPGCategory.Columns.Contains("PG_CAT_DESC")) { dtPGCategory.Columns["PG_CAT_DESC"].ColumnName = "PG_CATEGORY"; } ProductPGCategoryDataSource = dtPGCategory.DefaultView; ProductPGCategoryDropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "PG_CAT", ColumnDesc = "Code", ColumnWidth = "25*" }, new DropdownColumns() { ColumnName = "PG_CATEGORY", ColumnDesc = " Product Group Category", ColumnWidth = "75*" } }; this.productPGCategorySelectedItemChangedCommand = new DelegateCommand(this.productPGCategoryChanged); this.productPGCategoryEndEditCommand = new DelegateCommand(this.productPGCategoryEndEdit); //Items.Add("Padi", "M"); //Items.Add("KPM", "K"); //Items.Add("Pondy", "Y"); //SelectedItems.Add("All", "All"); //SelectedItems.Add("Padi", "M"); //SelectedItems.Add("KPM", "K"); //SelectedItems.Add("Pondy", "Y"); }
public System.Data.DataSet GetAllMFM(string startDate, string endDate, PRD_MAST productMaster = null, DDCI_INFO customerInfo = null, DDCUST_MAST customerMaster = null) { System.Data.DataSet dsReport = null; try { StringBuilder sb = new StringBuilder(); sb.Append("SELECT ROW_NUMBER() OVER(ORDER BY MFM_MAST.PART_NO) AS SNO, "); sb.Append(" MFM_MAST.PART_NO, "); sb.Append(" CAST(DOC_REL_DT_PLAN as varchar(10)) as DOC_REL_DT_PLAN, "); sb.Append(" CAST(DOC_REL_DT_ACTUAL as varchar(10)) as DOC_REL_DT_ACTUAL, "); sb.Append(" CAST(TOOLS_READY_DT_PLAN as varchar(10)) as TOOLS_READY_DT_PLAN, "); sb.Append(" CAST(TOOLS_READY_ACTUAL_DT as varchar(10)) as TOOLS_READY_ACTUAL_DT, "); sb.Append(" CAST(FORGING_PLAN_DT as varchar(10)) as FORGING_PLAN_DT, "); sb.Append(" CAST(FORGING_ACTUAL_DT as varchar(10)) as FORGING_ACTUAL_DT, "); sb.Append(" CAST(SECONDARY_PLAN_DT as varchar(10)) as SECONDARY_PLAN_DT, "); sb.Append(" CAST(SECONDARY_ACTUAL_DT as varchar(10)) as SECONDARY_ACTUAL_DT, "); sb.Append(" CAST(HEAT_TREATMENT_PLAN_DT as varchar(10)) as HEAT_TREATMENT_PLAN_DT, "); sb.Append(" CAST(HEAT_TREATMENT_ACTUAL as varchar(10)) as HEAT_TREATMENT_ACTUAL, "); sb.Append(" CAST(ISSR_PLAN_DT as varchar(10)) as ISSR_PLAN_DT, "); sb.Append(" CAST(ISSR_ACTUAL_DT as varchar(10)) as ISSR_ACTUAL_DT, "); sb.Append(" CAST(PPAP_PLAN as varchar(10)) as PPAP_PLAN, "); sb.Append(" CAST(PPAP_ACTUAL_DT as varchar(10)) as PPAP_ACTUAL_DT, "); sb.Append(" CAST(PSW_DATE as varchar(10)) as PSW_DATE, "); sb.Append(" SAMPLE_QTY, "); sb.Append(" RESP "); sb.Append("FROM MFM_MAST "); if (customerMaster.IsNotNullOrEmpty() && customerMaster.CUST_CODE.ToValueAsString().Trim().Length > 0) { sb.Append(" , "); sb.Append(" prd_mast, "); sb.Append(" prd_ciref, "); sb.Append(" ddci_info "); } sb.Append(" WHERE 1 = 1 "); sb.Append(" AND DOC_REL_DT_PLAN BETWEEN " + "'" + startDate + "'" + " AND " + "'" + endDate + "'"); if (customerMaster.IsNotNullOrEmpty() && customerMaster.CUST_CODE.ToValueAsString().Trim().Length > 0) { sb.Append(" AND prd_ciref.part_no = prd_mast.part_no "); sb.Append(" AND mfm_mast.part_no = prd_mast.part_no "); sb.Append(" AND ddci_info.ci_reference = prd_ciref.ci_ref AND prd_ciref.CURRENT_CIREF = 1 "); //sb.Append(" AND ddci_info.ci_reference = prd_ciref.ci_ref"); sb.Append(" AND cust_code = '" + customerMaster.CUST_CODE.ToValueAsString() + "'"); } if (productMaster.IsNotNullOrEmpty() && productMaster.PART_NO.ToValueAsString().Trim().Length > 0) { sb.Append(" and MFM_MAST.part_no like '" + productMaster.PART_NO.ToValueAsString() + "%'"); } sb.Append(" order by MFM_MAST.PART_NO"); List <StringBuilder> sqlList = new List <StringBuilder>() { sb }; dsReport = Dal.GetDataSet(sqlList); if (dsReport.IsNotNullOrEmpty() && dsReport.Tables.IsNotNullOrEmpty() && dsReport.Tables.Count > 0) { dsReport.Tables[0].TableName = "PRD_MAST_CI"; } DataTable dtCompany = new DataTable(); dtCompany.TableName = "CompanyName"; dtCompany.Columns.Add("Name"); dtCompany.Columns.Add("ShortName"); dtCompany.Columns.Add("Phone"); dtCompany.Columns.Add("Fax"); dtCompany.Columns.Add("Mobile"); dtCompany.Columns.Add("EMail"); dtCompany.Columns.Add("Title"); dtCompany.Columns.Add("ReportTitle"); if (dsReport.IsNotNullOrEmpty()) { dsReport.Tables.Add(dtCompany); } } catch (Exception ex) { throw ex.LogException(); } return(dsReport); }
public frmrptPartNos(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, PRD_MAST productMaster = null, ReportMISProductInformationModel productInformationModel = null, DDCUST_MAST customerMaster = null, List <DDLOC_MAST> lstLocation = null, bool refreshOnLoad = false, string title = "Customer Partno Wise Report") { InitializeComponent(); this.mdiChild = mdiChild; vm = new ReportMISProductInformationViewModel(userInformation, mdiChild, productMaster, productInformationModel, customerMaster, lstLocation, refreshOnLoad, title); this.DataContext = vm; mdiChild.Closing += vm.CloseMethod; //if (vm.CloseAction == null && mdiChild.IsNotNullOrEmpty()) // vm.CloseAction = new Action(() => mdiChild.Close()); }
public System.Data.DataSet GetAllFeaturesBackUp(PCCS feature = null, PCCS feature1 = null, PCCS feature2 = null, PCCS specification = null, PRD_MAST productMaster = null) { System.Data.DataSet dsReport = null; try { StringBuilder sb = new StringBuilder(); sb.Append("SELECT DISTINCT 123456789012 AS SNO, A.PART_NO, "); sb.Append(" A.PART_DESC, "); sb.Append(" B.FEATURE, "); sb.Append(" B.SPEC_MIN, "); sb.Append(" B.SPEC_MAX, "); sb.Append(" A.QUALITY, "); sb.Append(" E.CUST_NAME, "); sb.Append(" B.CTRL_SPEC_MIN, "); sb.Append(" B.CTRL_SPEC_MAX, "); sb.Append(" ' ' AS COLLAR_FLANGE_DIA_MIN, "); sb.Append(" ' ' AS COLLAR_FLANGE_DIA_MAX, "); sb.Append(" ' ' AS COLLAR_FLANGE_TK_MIN, "); sb.Append(" ' ' AS COLLAR_FLANGE_TK_MAX, "); sb.Append(" ' ' AS FORGING_COST_CENTER, "); sb.Append(" ' ' AS WIRE_DIA_MIN, "); sb.Append(" ' ' AS WIRE_DIA_MAX "); sb.Append("FROM PRD_MAST A, "); sb.Append(" PCCS B, "); sb.Append(" PRD_CIREF C, "); sb.Append(" DDCI_INFO D, "); sb.Append(" DDCUST_MAST E "); sb.Append("WHERE A.PART_NO =B.PART_NO "); sb.Append("AND A.PART_NO =C.PART_NO "); sb.Append("AND C.CI_REF =D.CI_REFERENCE AND C.CURRENT_CIREF = 1 "); //sb.Append("AND C.CI_REF =D.CI_REFERENCE "); sb.Append("AND D.CUST_CODE =E.CUST_CODE "); //sb.Append("AND A.PART_NO ='M03920' "); string featureSql = ""; if (feature.IsNotNullOrEmpty() && feature.FEATURE.IsNotNullOrEmpty()) { featureSql = featureSql + "UPPER(B.FEATURE) LIKE '%" + feature.FEATURE.ToUpper() + "%' "; } string feature1Sql = ""; if (feature1.IsNotNullOrEmpty() && feature1.FEATURE.IsNotNullOrEmpty()) { feature1Sql = feature1Sql + "UPPER(B.FEATURE) LIKE '%" + feature1.FEATURE.ToUpper() + "%' "; } if (featureSql.IsNotNullOrEmpty() && feature1Sql.IsNotNullOrEmpty()) { featureSql = featureSql + " OR " + feature1Sql; } else if (!featureSql.IsNotNullOrEmpty() && feature1Sql.IsNotNullOrEmpty()) { featureSql = feature1Sql; } string feature2Sql = ""; if (feature2.IsNotNullOrEmpty() && feature2.FEATURE.IsNotNullOrEmpty()) { feature2Sql = feature2Sql + "UPPER(B.FEATURE) LIKE '%" + feature2.FEATURE.ToUpper() + "%' "; } if (featureSql.IsNotNullOrEmpty() && feature2Sql.IsNotNullOrEmpty()) { featureSql = featureSql + " OR " + feature2Sql; } else if (!featureSql.IsNotNullOrEmpty() && feature2Sql.IsNotNullOrEmpty()) { featureSql = feature2Sql; } if (featureSql.IsNotNullOrEmpty() && featureSql.Trim().Length > 0) { sb.Append(" AND ( " + featureSql + ") "); } if (productMaster.IsNotNullOrEmpty() && productMaster.PART_DESC.IsNotNullOrEmpty()) { sb.Append(" AND UPPER(A.PART_DESC) LIKE '%" + productMaster.PART_DESC.ToUpper() + "%' "); } if (specification.IsNotNullOrEmpty()) { if (specification.SPEC_MIN.IsNotNullOrEmpty() && specification.SPEC_MIN.IsNumeric()) { sb.Append(" AND B.SPEC_MIN BETWEEN '" + specification.SPEC_MIN + "' AND '" + Convert.ToDouble(specification.SPEC_MIN) + 1 + "' "); } else if (specification.SPEC_MIN.IsNotNullOrEmpty()) { sb.Append(" AND UPPER(B.SPEC_MIN) LIKE '" + specification.SPEC_MIN.ToUpper() + "%' "); } if (specification.SPEC_MAX.IsNotNullOrEmpty() && specification.SPEC_MAX.IsNumeric() && 1 == 2) { sb.Append(" AND B.SPEC_MAX BETWEEN '" + specification.SPEC_MAX + "' AND '" + Convert.ToDouble(specification.SPEC_MAX) + 1 + "' "); } else if (specification.SPEC_MAX.IsNotNullOrEmpty()) { sb.Append(" AND UPPER(B.SPEC_MAX) = '" + specification.SPEC_MAX.ToUpper() + "' "); } } sb.Append(" ORDER BY A.PART_NO "); List <StringBuilder> sqlList = new List <StringBuilder>() { sb }; dsReport = Dal.GetDataSet(sqlList); if (dsReport.IsNotNullOrEmpty() && dsReport.Tables.IsNotNullOrEmpty() && dsReport.Tables.Count > 0) { dsReport.Tables[0].TableName = "FEATURE_WISE_REPORT"; List <PCCS> lstAllPCCS = (from row in DB.PCCS where ( row.FEATURE.ToUpper().StartsWith("HEAD HEI") || row.FEATURE.ToUpper().StartsWith("HEAD TH") || row.FEATURE.ToUpper().StartsWith("COLLAR DIA") || row.FEATURE.ToUpper().StartsWith("FLANGE DIA") || row.FEATURE.ToUpper().StartsWith("COLLAR TH") || row.FEATURE.ToUpper().StartsWith("FLANGE TH")) select row).ToList <PCCS>(); List <PCCS> lstPCCS = null; List <V_FORGING_COST_CENTER> lstAllFORGING_COST_CENTER = (from row in DB.V_FORGING_COST_CENTER select row).ToList <V_FORGING_COST_CENTER>(); List <V_FORGING_COST_CENTER> lstFORGING_COST_CENTER = null; //SELECT PC.CC_CODE, // PC.PART_NO, // PC.WIRE_SIZE_MIN, // PC.WIRE_SIZE_MAX //FROM PROCESS_CC PC //WHERE PC.PART_NO = 'M92910' //AND PC.SEQ_NO IN // (SELECT a.SEQ_NO // FROM PROCESS_SHEET a // WHERE a.OPN_DESC LIKE 'FORG%' // AND A.PART_NO = PC.PART_NO // AND A.PART_NO = 'M92910' // AND a.ROUTE_NO IN // (SELECT DISTINCT(B.ROUTE_NO) // FROM PROCESS_MAIN B // WHERE B.CURRENT_PROC=1 // AND B.PART_NO =a.PART_NO // AND B.PART_NO = PC.PART_NO // AND B.PART_NO = 'M92910' // ) // ) //AND PC.ROUTE_NO IN // (SELECT DISTINCT(C.ROUTE_NO) // FROM PROCESS_MAIN C // WHERE C.CURRENT_PROC=1 // AND C.PART_NO = PC.PART_NO // AND C.PART_NO = 'M92910' // ) long sno = 0; foreach (DataRow dataRow in dsReport.Tables[0].Rows) { string part_no = dataRow["PART_NO"].ToValueAsString(); sno++; dataRow["SNO"] = sno.ToValueAsString(); lstPCCS = (from row in lstAllPCCS.AsEnumerable() where row.PART_NO == part_no && (row.FEATURE.ToUpper().StartsWith("HEAD HEI") || row.FEATURE.ToUpper().StartsWith("HEAD TH")) select row).ToList <PCCS>(); if (lstPCCS.IsNotNullOrEmpty() && lstPCCS.Count > 0) { dataRow["CTRL_SPEC_MIN"] = lstPCCS[0].CTRL_SPEC_MIN; dataRow["CTRL_SPEC_MAX"] = lstPCCS[0].CTRL_SPEC_MAX; } lstPCCS = (from row in lstAllPCCS.AsEnumerable() where row.PART_NO == part_no && (row.FEATURE.ToUpper().StartsWith("COLLAR DIA") || row.FEATURE.ToUpper().StartsWith("FLANGE DIA")) select row).ToList <PCCS>(); if (lstPCCS.IsNotNullOrEmpty() && lstPCCS.Count > 0) { dataRow["COLLAR_FLANGE_DIA_MIN"] = lstPCCS[0].CTRL_SPEC_MIN; dataRow["COLLAR_FLANGE_DIA_MAX"] = lstPCCS[0].CTRL_SPEC_MAX; } lstPCCS = (from row in lstAllPCCS.AsEnumerable() where row.PART_NO == part_no && (row.FEATURE.ToUpper().StartsWith("COLLAR TH") || row.FEATURE.ToUpper().StartsWith("FLANGE TH")) select row).ToList <PCCS>(); if (lstPCCS.IsNotNullOrEmpty() && lstPCCS.Count > 0) { dataRow["COLLAR_FLANGE_TK_MIN"] = lstPCCS[0].CTRL_SPEC_MIN; dataRow["COLLAR_FLANGE_TK_MAX"] = lstPCCS[0].CTRL_SPEC_MAX; } lstFORGING_COST_CENTER = (from row in lstAllFORGING_COST_CENTER.AsEnumerable() where row.PART_NO == part_no select row).ToList <V_FORGING_COST_CENTER>(); if (lstFORGING_COST_CENTER.IsNotNullOrEmpty() && lstFORGING_COST_CENTER.Count > 0) { dataRow["FORGING_COST_CENTER"] = lstFORGING_COST_CENTER[0].CC_CODE.ToValueAsString(); dataRow["WIRE_DIA_MIN"] = lstFORGING_COST_CENTER[0].WIRE_SIZE_MIN.ToValueAsString(); dataRow["WIRE_DIA_MAX"] = lstFORGING_COST_CENTER[0].WIRE_SIZE_MAX.ToValueAsString(); } //sb = new StringBuilder(); //sb.Append("SELECT CC_CODE, "); //sb.Append(" WIRE_SIZE_MIN, "); //sb.Append(" WIRE_SIZE_MAX "); //sb.Append("FROM PROCESS_CC "); //sb.Append("WHERE PART_NO='" + part_no + "' "); //sb.Append("AND SEQ_NO = "); //sb.Append(" (SELECT a.SEQ_NO "); //sb.Append(" FROM PROCESS_SHEET a "); //sb.Append(" WHERE a.OPN_DESC LIKE 'FORG%' "); //sb.Append(" AND a.ROUTE_NO= "); //sb.Append(" (SELECT DISTINCT(ROUTE_NO) "); //sb.Append(" FROM PROCESS_MAIN B "); //sb.Append(" WHERE B.CURRENT_PROC=1 "); //sb.Append(" AND B.PART_NO =a.PART_NO "); //sb.Append(" AND B.PART_NO ='" + part_no + "' "); //sb.Append(" ) "); //sb.Append(" ) "); //sb.Append("AND ROUTE_NO= "); //sb.Append(" (SELECT DISTINCT(ROUTE_NO) "); //sb.Append(" FROM PROCESS_MAIN B "); //sb.Append(" WHERE B.CURRENT_PROC=1 "); //sb.Append(" AND B.PART_NO =PART_NO "); //sb.Append(" AND B.PART_NO ='" + part_no + "' "); //sb.Append(" )"); //sqlList = new List<StringBuilder>() { sb }; //DataSet dsResult = Dal.GetDataSet(sqlList); //if (dsResult.IsNotNullOrEmpty() && dsResult.Tables.IsNotNullOrEmpty() && dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0) //{ // DataRow resultRow = dsResult.Tables[0].Rows[0]; // dataRow["FORGING_COST_CENTER"] = resultRow["CC_CODE"].ToValueAsString(); // dataRow["WIRE_DIA_MIN"] = resultRow["WIRE_SIZE_MIN"].ToValueAsString(); // dataRow["WIRE_DIA_MAX"] = resultRow["WIRE_SIZE_MAX"].ToValueAsString(); // dataRow.AcceptChanges(); //} dataRow.AcceptChanges(); } dsReport.Tables[0].AcceptChanges(); } DataTable dtCompany = new DataTable(); dtCompany.TableName = "CompanyName"; dtCompany.Columns.Add("Name"); dtCompany.Columns.Add("ShortName"); dtCompany.Columns.Add("Phone"); dtCompany.Columns.Add("Fax"); dtCompany.Columns.Add("Mobile"); dtCompany.Columns.Add("EMail"); dtCompany.Columns.Add("Title"); dtCompany.Columns.Add("ReportTitle"); if (dsReport.IsNotNullOrEmpty()) { dsReport.Tables.Add(dtCompany); } } catch (Exception ex) { throw ex.LogException(); } return(dsReport); }