Esempio n. 1
0
        private void refreshData()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                DateTime date1   = Helper.Conv.ToDateTime(dateTextBox1.Text.Trim());
                DateTime date2   = Helper.Conv.ToDateTime(dateTextBox2.Text.Trim());
                string   txt_sup = txt_sup_id.Text.Split('/')[0].Trim();
                Thread   th      = new Thread(() =>
                {
                    Helper.GlobalData.windows.ShowLoad(this);
                    try
                    {
                        IBLL.IInOutBLL bll = new BLL.InOutBLL();
                        if (date1 == DateTime.MinValue)
                        {
                            throw new Exception("期间不正确");
                        }
                        if (date2 == DateTime.MinValue)
                        {
                            throw new Exception("期间不正确");
                        }
                        var tb = bll.GetCGOrderList(date1, date2, txt_sup, "");

                        this.dataGrid1.Invoke((MethodInvoker) delegate
                        {
                            this.dataGrid1.DataSource = tb;
                            if (tb.Rows.Count > 0)
                            {
                                sheet_no = tb.Rows[0]["sheet_no"].ToString();
                                trans_no = tb.Rows[0]["trans_no"].ToString();

                                System.Data.DataTable tb1;
                                System.Data.DataTable tb2;
                                bll.GetCGOrder(sheet_no, out tb1, out tb2);


                                this.dataGrid2.DataSource = tb2;

                                update_time = Helper.Conv.ToDateTime(tb1.Rows[0]["update_time"]);
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        LogHelper.writeLog("refreshData", ex.ToString());
                        MsgForm.ShowFrom(ex);
                    }
                    Helper.GlobalData.windows.CloseLoad(this);
                });
                th.Start();
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
                Helper.LogHelper.writeLog("frmCGInSheetList->refreshData()", ex.ToString());
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }