public List <ProductOrderReportWarningModel> GetProductOrderReportWaring(string orderDetailId) { string sql = query.PRODUCT_ORDER_REPORT_WARNING_LIST_BY_DETAIL_ID; if (orderDetailId != null) { sql += !orderDetailId.Equals("") ? string.Format(" AND PORW.Order_Detail_ID = {0} ", orderDetailId) : ""; } log.Debug("SQL[PRODUCT ORDERREPORT WARNING LIST] : " + sql); List <ProductOrderReportWarningModel> orderReportWarningList = new List <ProductOrderReportWarningModel>(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); log.Debug("Connect to Sqlserver success."); using (SqlCommand sqlcmd = new SqlCommand(sql, conn)) { using (SqlDataReader dataReader = sqlcmd.ExecuteReader()) { while (dataReader.Read()) { ProductOrderReportWarningModel model = new ProductOrderReportWarningModel(); model.Warning_No = Convert.ToInt32(dataReader["Warning_No"]); model.Warning_Date = dataReader["Warning_Date"].ToString().Trim(); model.Warning_Noted_Date = dataReader["Warning_Noted_Date"].ToString().Trim(); model.Reason = dataReader["Reason"].ToString().Trim(); orderReportWarningList.Add(model); } } } } log.Debug("Disconnect to Sqlserver."); } catch (Exception ex) { log.Error("Error", ex); throw ex; } return(orderReportWarningList); }
public List <ProductOrderReportWarningModel> GetProductOrderReportWaring() { string sql = query.PRODUCT_ORDER_REPORT_WARNING_ALERT; log.Debug("SQL[PRODUCT ORDERREPORT WARNING LIST] : " + sql); List <ProductOrderReportWarningModel> orderReportWarningList = new List <ProductOrderReportWarningModel>(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); log.Debug("Connect to Sqlserver success."); using (SqlCommand sqlcmd = new SqlCommand(sql, conn)) { using (SqlDataReader dataReader = sqlcmd.ExecuteReader()) { while (dataReader.Read()) { ProductOrderReportWarningModel model = new ProductOrderReportWarningModel(); model.RowNo = Convert.ToInt32(dataReader["RowNo"]); model.Order_Detail_ID = Convert.ToInt32(dataReader["Order_Detail_ID"]); model.Warning_No = Convert.ToInt32(dataReader["Warning_No"]); model.Warning_Date = dataReader["Warning_Date"].ToString().Trim(); model.Order_ID = dataReader["Order_ID"].ToString().Trim(); model.Order_Day_Count = Convert.ToInt32(dataReader["Order_Day_Count"]); model.Order_to = dataReader["Order_to"].ToString().Trim(); model.Product_Code = dataReader["Product_Code"].ToString().Trim(); model.Operation_Detail = dataReader["Operation_Detail"].ToString().Trim(); orderReportWarningList.Add(model); } } } } log.Debug("Disconnect to Sqlserver."); } catch (Exception ex) { log.Error("Error", ex); throw ex; } return(orderReportWarningList); }