using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraCharts; using ClientLib.CommonService; using PublicLib; using ClientLib; namespace J_SALE { public partial class NewTradeControl : UserControl { private string m_CUST_CD, m_ITEM_CD, m_ORDER_NM; private int m_MAX, m_MIN; private void button_Close_Click(object sender, EventArgs e) { this.Visible = false; } public NewTradeControl() { InitializeComponent(); } public void selectNEWProc(string strSection, string cust_cd, string item_cd, string order_nm, string minmax) { try { this.Cursor = Cursors.WaitCursor; m_CUST_CD = cust_cd; m_ITEM_CD = item_cd; m_ORDER_NM = order_nm; gridControl_Sub.DataSource = null; System.Data.DataTable dt; dt = new DataTable(); dt.Columns.Add("NEW_DATE", Type.GetType("System.String")); dt.Columns.Add("NEW_CUST", Type.GetType("System.String")); dt.Columns.Add("NEW_QTY", Type.GetType("System.Int32")); dt.Columns.Add("NEW_MONEY", Type.GetType("System.Int32")); dt.Columns.Add("NEW_UNITCOST", Type.GetType("System.Int32")); string[] MinMaxValue = minmax.Split(new string[] { "~" }, StringSplitOptions.RemoveEmptyEntries); int Min_Value = Convert.ToInt32(MinMaxValue[0]); int Max_Value = Convert.ToInt32(MinMaxValue[1]); GetAVGDataRow(ref dt, Min_Value, Max_Value); gridControl_Sub.DataSource = dt; chartControl_AVG.Series.Clear(); Series chartSeries = new Series(strSection, ViewType.Line); chartControl_AVG.Series.AddRange(new Series[] { chartSeries }); chartSeries.DataSource = dt; chartSeries.ArgumentDataMember = "NEW_DATE"; chartSeries.ValueDataMembers.AddRange(new string[] { "NEW_UNITCOST" }); chartControl_AVG.Series.EndUpdate(); this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } private void GetAVGDataRow(ref DataTable dt, int min_unit, int max_unit) { SerializedSqlParam[] aParam; ResultData resultData; DataTable aData; DataRow dr; try { aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, ""),//m_CUST_CD), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_ITEM_CD), ClientClass.CreateSqlParameter("ORDER_NORM", SqlDbType.NVarChar, m_ORDER_NM), ClientClass.CreateSqlParameter("MIN_UNIT", SqlDbType.Int, min_unit), ClientClass.CreateSqlParameter("MAX_UNIT", SqlDbType.Int, max_unit) }; resultData = ClientClass.GetData("U3GetTradeMoneyListNew", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } aData = resultData.TableData; if (resultData.TableData.Rows.Count > 0) { for (int i = 0; i < resultData.TableData.Rows.Count; i++) { dr = dt.NewRow(); dr[0] = UtilClass.toStr(aData.Rows[i]["NEW_DATE"]); dr[1] = UtilClass.toStr(aData.Rows[i]["NEW_CUST"]); dr[2] = UtilClass.toInt(aData.Rows[i]["NEW_QTY"]); dr[3] = UtilClass.toInt(aData.Rows[i]["NEW_MONEY"]); dr[4] = UtilClass.toInt(aData.Rows[i]["NEW_UNITCOST"]); dt.Rows.Add(dr); } } else { gridControl_Sub.DataSource = resultData.TableData; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }