示例#1
0
        private void AsyncShowDetail(IAsyncResult result)
        {
            MethodCaller aysnDelegate = result.AsyncState as MethodCaller;

            if (aysnDelegate != null)
            {
                bool success = aysnDelegate.EndInvoke(result);
                if (success)
                {
                    ConnDB   conn = new ConnDB();
                    string   strsql;
                    DateTime begin_date, end_date;
                    begin_date = Common.FirstDayOfMonth(dateTimePickerMonth.Value);
                    end_date   = Common.LastDayOfMonth(dateTimePickerMonth.Value);
                    strsql     = "select MATL_NO 料号,MATL_NAME 物料名称,PRICE 单价,BEGIN_DATE 价格开始日期,END_DATE 价格结束日期 from COST_MATL_PRICE where not (begin_date > '" + end_date + "' or end_date <'" + begin_date + "')";
                    DataSet ds = conn.ReturnDataSet(strsql);

                    Action <DataSet> action = (data) =>
                    {
                        gridControl1.DataSource      = data.Tables[0].DefaultView;
                        gridView1.Columns[0].Visible = false;
                        gridView1.Columns[0].OptionsColumn.ReadOnly = true;
                        gridView1.Columns[1].OptionsColumn.ReadOnly = true;
                        gridView1.Columns[2].OptionsColumn.ReadOnly = true;
                        gridView1.Columns[3].OptionsColumn.ReadOnly = true;
                        gridView1.Columns[4].OptionsColumn.ReadOnly = true;
                        simpleButton导入.Enabled = true;
                        simpleButton清空.Enabled = true;
                    };
                    Invoke(action, ds);
                    conn.Close();
                }
            }
        }
示例#2
0
        private void showDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql;
            string begin_date, end_date;

            begin_date = Common.FirstDayOfMonth(dateTimePickerMonth.Value).ToString("d");
            end_date   = Common.LastDayOfMonth(dateTimePickerMonth.Value).ToString("d");
            strsql     = "select MATL_NO 料号,MATL_NAME 物料名称,PRICE 单价,BEGIN_DATE 价格开始日期,END_DATE 价格结束日期 from COST_MATL_PRICE where not (begin_date > '" + end_date + "' or end_date <'" + begin_date + "')";
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            gridView1.Columns[4].OptionsColumn.ReadOnly = true;
            conn.Close();
        }