예제 #1
0
        // 検索ボタン押下時、データを読み込み、DATAGRIDVIEWを更新する


        // サブサブプロシージャ:グリットビュー右端にボタンを追加
        private void addButtonsToDataGridView(DataGridView dgv)
        {
            bool  adm_flag = false;
            TfSQL flag     = new TfSQL();
            bool  fl       = flag.sqlExecuteScalarBool("select admin_flag from qc_user where qcuser = '******'");

            if (fl == true)
            {
                adm_flag = true;
            }
            Open      = new DataGridViewButtonColumn();
            Open.Text = "Open";
            Open.UseColumnTextForButtonValue = true;
            Open.Width = 45;
            dgv.Columns.Add(Open);

            if (adm_flag == true)
            {
                btnDelete.Visible = true;
            }
        }
예제 #2
0
        // ロード時の処理
        private void frmManual_Load(object sender, EventArgs e)
        {
            // 当フォームの表示場所を指定
            this.Left = 300;
            this.Top  = 15;

            if (cmbLine.Text == "")
            {
                btnMeasure.Enabled = false;
            }

            //Exit app if user has been log in by another device
            TfSQL  flag    = new TfSQL();
            string ipadd   = flag.sqlExecuteScalarString("select ip_address from qc_user where qcuser = '******'");
            bool   expmiss = flag.sqlExecuteScalarBool("select export_permission from qc_user where qcuser = '******'");

            if (ipadd == "null")
            {
                flag.sqlExecuteScalarString("UPDATE qc_user SET loginstatus=true, ip_address = '" + _ip + "' where qcuser = '******'");
            }
            if (ipadd != "null" && ipadd != _ip)
            {
                DialogResult res = MessageBox.Show("User is logged in " + _ip + "," + System.Environment.NewLine +
                                                   "Do you want to log out and log in again ?", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Question);
                if (res == DialogResult.OK)
                {
                    Application.Exit();
                }
            }
            if (txtUser.Text != "Admin")
            {
                string[] a = txtUser.Text.Split('_');

                //User permission
                if (a[1] != "CHK" && txtUser.Text != "Admin")
                {
                    btnMeasure.Enabled  = false;
                    btnRegister.Enabled = false;
                    btnDelete.Enabled   = false;
                }
                if (expmiss == false && txtUser.Text != "Admin")
                {
                    btnExport.Enabled = false;
                }
            }

            // DATETIMEPICKERを10日前の日付にする
            dtpSet10daysBefore(dtpLotFrom);

            // DATETIMEPICKERの分以下を切り上げる
            dtpRoundUpHour(dtpLotTo);

            // DATETIMEPICKERの分以下を下げる
            dtpRounddownHour(dtpLotInput);



            // 各種処理用のテーブルを生成してデータを読み込む
            dtBuffer = new DataTable();
            defineBufferAndHistoryTable(ref dtBuffer);
            dtHistory = new DataTable();
            defineBufferAndHistoryTable(ref dtHistory);
            readDtHistory(ref dtHistory);
            dtUpLowIns = new DataTable();
            setLimitSetAndCommand(ref dtUpLowIns);


            // グリットビューの更新
            updateDataGripViews(dtBuffer, dtHistory, ref dgvBuffer, ref dgvHistory);



            // グリットビュー右端にボタンを追加(初回のみ)
            addButtonsToDataGridView(dgvHistory);
        }