public tblworeport GettblworeportsDet3(int MachineID, string correctedDate, string ProdFAI) { tblworeport ddldet = new tblworeport(); Repository <tblworeport> lista = new Repository <tblworeport>(); try { string query = "SELECT MinorLoss from [i_facility_TSAL].[dbo].tblworeport WHERE MachineID =" + MachineID + " and CorrectedDate ='" + correctedDate + "' and Type = '" + ProdFAI + "'"; ddldet = lista.GetFirstOrDefault(query, _connectionFactory.GetConnection); } catch (Exception ex) { // MessageBox.Show(ex.ToString()); } return(ddldet); }
public decimal GettblworeportsDet3(int MachineID, string correctedDate, string ProdFAI) { decimal det = 0; tblworeport ddldet = new tblworeport(); Repository <tblworeport> lista = new Repository <tblworeport>(); try { string query = "SELECT Sum(MinorLoss) from [" + ConnectionFactory.DB + "].[" + ConnectionFactory.Schema + "].tblworeport WHERE MachineID =" + MachineID + " and CorrectedDate ='" + correctedDate + "' and Type = '" + ProdFAI + "'"; ddldet = lista.GetFirstOrDefault(query, _connectionFactory.GetConnection); det = (decimal)ddldet.MinorLoss; } catch (Exception ex) { // MessageBox.Show(ex.ToString()); } return(det); }