public DataTable selectInvoiceReport(int poid) { //object result = null; DataTable _dt = new DataTable(); CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection); try { CSQLParameterList plist = new CSQLParameterList(); plist.Add("@POID", DbType.String, poid, ParameterDirection.Input); CSQLDataAdepterList adlist = new CSQLDataAdepterList(); CSQLStatementValue csv = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Select); adlist.Add(csv); cstate.Open(); _dt = (DataTable)cstate.Execute(adlist); //DataTable dt = (DataTable)result; InvoiceAll = _dt; invoice = new _Invoice(); var item = _dt.Rows[0]; invoice._Invoice_Date = item["Invoice_Date"].ToString() == null || item["Invoice_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["Invoice_Date"].ToString()); invoice._GetInvoice_Date = item["GetInvoice_Date"].ToString() == null || item["GetInvoice_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetInvoice_Date"].ToString()); invoice._NoteSet_Date = item["NoteSet_Date"].ToString() == null || item["NoteSet_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["NoteSet_Date"].ToString()); invoice._GetNotSet_Date = item["GetNoteSet_Date"].ToString() == null || item["GetNoteSet_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetNoteSet_Date"].ToString()); invoice._Transport_Date = item["Transport_Date"].ToString() == null || item["Transport_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["Transport_Date"].ToString()); invoice._GetGuide = item["GetGuide_Date"].ToString() == null || item["GetGuide_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetGuide_Date"].ToString()); invoice._GetBadge_Date = item["GetBadge_Date"].ToString() == null || item["GetBadge_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetBadge_Date"].ToString()); invoice._RemarkInvoice = item["RemarkInvoice"].ToString() == string.Empty || item["RemarkInvoice"].ToString() == "" ? "-" : item["RemarkInvoice"].ToString(); //_InvoiceList invoice = new _InvoiceList(_invoicedate, _getinvoicedate, _trandate, _getguide, _getbadge, _noteset, _getnoteset); //this._invoicelist = dt.ToDictionary<int, _Invoice>("PurchaseID"); cstate.Commit(); } catch (Exception ex) { string error = ex.Message; cstate.Rollback(); } finally { cstate.Close(); } return(_dt); }
public object selectInvoice(int poid) { object result = null; CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection); try { CSQLParameterList plist = new CSQLParameterList(); plist.Add("@POID", DbType.String, poid, ParameterDirection.Input); CSQLDataAdepterList adlist = new CSQLDataAdepterList(); CSQLStatementValue csv = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Select); adlist.Add(csv); cstate.Open(); result = cstate.Execute(adlist); DataTable dt = (DataTable)result; InvoiceAll = dt; invoice = new _Invoice(); var item = dt.Rows[0]; invoice._Invoice_Date = item["Invoice_Date"].ToString() == null || item["Invoice_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["Invoice_Date"].ToString()); invoice._GetInvoice_Date = item["GetInvoice_Date"].ToString() == null || item["GetInvoice_Date"].ToString() == ""? DateTime.MinValue : DateTime.Parse(item["GetInvoice_Date"].ToString()); invoice._NoteSet_Date = item["NoteSet_Date"].ToString() == null || item["NoteSet_Date"].ToString() == ""? DateTime.MinValue : DateTime.Parse(item["NoteSet_Date"].ToString()); invoice._GetNotSet_Date = item["GetNoteSet_Date"].ToString() == null || item["GetNoteSet_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetNoteSet_Date"].ToString()); invoice._Transport_Date = item["Transport_Date"].ToString() == null || item["Transport_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["Transport_Date"].ToString()); invoice._GetGuide = item["GetGuide_Date"].ToString() == null || item["GetGuide_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetGuide_Date"].ToString()); invoice._GetBadge_Date = item["GetBadge_Date"].ToString() == null || item["GetBadge_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetBadge_Date"].ToString()); invoice._RemarkInvoice = item["RemarkInvoice"].ToString() == string.Empty || item["RemarkInvoice"].ToString() == "" ? "-" : item["RemarkInvoice"].ToString(); cstate.Commit(); } catch (Exception ex) { string error = ex.Message; cstate.Rollback(); } finally { cstate.Close(); } return(result); }