コード例 #1
0
ファイル: frmMain.cs プロジェクト: lodedood/TestStock
        public void LoadAssetData(bool lvShow)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                btnIn.Enabled       = false;
                btnOut.Enabled      = false;
                btnBorrow.Enabled   = false;
                btnNoteBook.Enabled = false;

                string lvSQL = "Select * from Asset Where Asset_ID2 >= '" + txtSearchS.Text + "' And Asset_ID2 <= '" + txtSearchE.Text + "' ";

                DataTable DT = new DataTable();
                DT = GsysSQL.fncGetQueryData(lvSQL, DT);

                int lvNumRow = DT.Rows.Count;
                sp3.ActiveSheet.RowCount = lvNumRow;

                progressBar1.Maximum = lvNumRow;
                progressBar1.Value   = 0;
                pnStatus.Visible     = true;

                for (int i = 0; i < lvNumRow; i++)
                {
                    sp3.ActiveSheet.Cells[i, 0].Text = DT.Rows[i]["Asset_ID2"].ToString();
                    sp3.ActiveSheet.Cells[i, 1].Text = DT.Rows[i]["Asset_Faction"].ToString();
                    sp3.ActiveSheet.Cells[i, 2].Text = Gstr.fncChangeSDate(DT.Rows[i]["Asset_ResiveDate"].ToString());
                    sp3.ActiveSheet.Cells[i, 3].Text = DT.Rows[i]["Asset_Name"].ToString();

                    progressBar1.Value += 1;
                    Application.DoEvents();
                }

                pnStatus.Visible = false;
                DT.Dispose();

                btnIn.Enabled       = true;
                btnOut.Enabled      = true;
                btnBorrow.Enabled   = true;
                btnNoteBook.Enabled = true;

                if (lvShow)
                {
                    tabControl1.SelectedIndex = 3;
                }

                this.Cursor = Cursors.Default;
            }
            catch
            {
                Application.Restart();
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: lodedood/TestStock
        public void lvLoadItem(bool lvShow)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                btnreg.Enabled      = false;
                btnIn.Enabled       = false;
                btnOut.Enabled      = false;
                btnBorrow.Enabled   = false;
                btnNoteBook.Enabled = false;

                string lvSQL = "Select Top 50 * from Inv_Moving Where M_Type in ('R','P') Order by M_Pk Desc ";

                DataTable DT = new DataTable();
                DT = GsysSQL.fncGetQueryData(lvSQL, DT);

                int lvNumRow = DT.Rows.Count;
                sp1.ActiveSheet.RowCount = lvNumRow;

                progressBar1.Maximum = lvNumRow;
                progressBar1.Value   = 0;
                pnStatus.Visible     = true;

                for (int i = 0; i < lvNumRow; i++)
                {
                    sp1.ActiveSheet.Cells[i, 0].Text = Gstr.fncChangeSDate(DT.Rows[i]["M_Date"].ToString());
                    sp1.ActiveSheet.Cells[i, 1].Text = DT.Rows[i]["M_ItemID"].ToString();
                    sp1.ActiveSheet.Cells[i, 2].Text = GsysSQL.fncFindItemName(DT.Rows[i]["M_ItemID"].ToString());
                    sp1.ActiveSheet.Cells[i, 3].Text = DT.Rows[i]["M_AmountR"].ToString();
                    sp1.ActiveSheet.Cells[i, 4].Text = DT.Rows[i]["M_AmountP"].ToString();
                    sp1.ActiveSheet.Cells[i, 5].Text = DT.Rows[i]["M_AmountBal"].ToString();
                    sp1.ActiveSheet.Cells[i, 6].Text = GsysSQL.fncFindEmpName(DT.Rows[i]["M_UserResive"].ToString());
                    sp1.ActiveSheet.Cells[i, 7].Text = GsysSQL.fncFindEmpName(DT.Rows[i]["M_UserPay"].ToString());
                    sp1.ActiveSheet.Cells[i, 8].Text = GsysSQL.fncFindEmpName(DT.Rows[i]["M_Remark"].ToString());

                    progressBar1.Value += 1;
                    Application.DoEvents();
                }

                pnStatus.Visible = false;
                DT.Dispose();

                btnreg.Enabled      = true;
                btnIn.Enabled       = true;
                btnOut.Enabled      = true;
                btnBorrow.Enabled   = true;
                btnNoteBook.Enabled = true;

                if (lvShow)
                {
                    tabControl1.SelectedIndex = 0;
                }

                this.Cursor = Cursors.Default;
            }
            catch
            {
                Application.Restart();
            }
        }