示例#1
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                MessageBox.Show("未配布情報データが選択されていません", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (MessageBox.Show("選択された " + dataGridView1.SelectedRows.Count.ToString() + "件の未配布情報を削除します。よろしいですか?", "削除確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                dataGridView1.CurrentCell = null;
                return;
            }

            foreach (DataGridViewRow r in dataGridView1.SelectedRows)
            {
                int aID;
                aID = int.Parse(dataGridView1[0, r.Index].Value.ToString(), System.Globalization.NumberStyles.Any);

                //レコード削除
                Control.未配布情報 dArea = new Control.未配布情報();

                if (dArea.DataDelete(aID) == false)
                {
                    MessageBox.Show("削除に失敗しました。ID:" + aID.ToString(), MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                dArea.Close();
            }

            //未配布情報再表示
            GridviewSet.ShowData(dataGridView1, int.Parse(_ID.ToString()));
        }
示例#2
0
            /// <summary>
            /// データグリッドビューの指定行のデータを取得する
            /// </summary>
            /// <param name="dgv">対象とするデータグリッドビューオブジェクト</param>
            public static Boolean GetData(DataGridView dgv, ref Entity.未配布情報 tempC)
            {
                int    iX = 0;
                string sqlStr;

                Control.未配布情報   mihaifu = new Control.未配布情報();
                OleDbDataReader dr;

                sqlStr = " where 未配布情報.ID = " + (int)dgv[0, dgv.SelectedRows[iX].Index].Value;
                dr     = mihaifu.FillBy(sqlStr);

                if (dr.HasRows == true)
                {
                    while (dr.Read() == true)
                    {
                        tempC.ID      = Convert.ToInt32(dr["ID"].ToString());
                        tempC.配布エリアID = int.Parse(dr["配布エリアID"].ToString());
                        tempC.番地号     = dr["番地号"].ToString();
                        tempC.マンション名  = dr["マンション名"].ToString();
                        tempC.理由      = Int32.Parse(dr["理由"].ToString());
                        tempC.その他内容   = dr["その他内容"].ToString();
                    }
                }
                else
                {
                    dr.Close();
                    mihaifu.Close();
                    return(false);
                }

                dr.Close();
                mihaifu.Close();
                return(true);
            }
示例#3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("未配布情報を登録します。よろしいですか", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            if (fDataCheck() == false)
            {
                return;
            }

            Control.未配布情報 cMihaifu = new Control.未配布情報();

            switch (sMode)
            {
            case 0:
                cMihaifu.DataInsert(cMaster);
                break;

            case 1:
                cMihaifu.DataUpdate(cMaster);
                break;
            }

            this.Close();
        }
示例#4
0
        private void ShowData()
        {
            lblID.Text  = _ID.ToString();
            lblAdd.Text = _Add;

            //データ取得
            OleDbDataReader dR;
            string          sqlSTR;

            sqlSTR = "where ID = " + _ID.ToString();

            Control.未配布情報 cMihaifu = new Control.未配布情報();
            dR = cMihaifu.FillBy(sqlSTR);

            while (dR.Read())
            {
                cMaster.ID      = int.Parse(dR["ID"].ToString());
                cMaster.配布エリアID = int.Parse(dR["配布エリアID"].ToString());
                cMaster.番地号     = dR["番地号"].ToString();
                cMaster.マンション名  = dR["マンション名"].ToString();
                cMaster.理由      = int.Parse(dR["理由"].ToString());
                cMaster.その他内容   = dR["その他内容"].ToString();
            }

            dR.Close();
            cMihaifu.Close();

            //データ画面表示
            txtBanchi.Text  = cMaster.番地号;
            txtManshon.Text = cMaster.マンション名;
            txtRiyu.Text    = cMaster.理由.ToString();
            txtSonota.Text  = cMaster.その他内容;

            //理由摘要表示
            //OleDbDataReader dR;
            Control.未配布理由 cRiyu = new Control.未配布理由();

            dR = cRiyu.FillBy("where ID = " + txtRiyu.Text);

            //摘要名を表示
            while (dR.Read())
            {
                txtRiyuName.Text = dR["摘要"].ToString().Trim();
            }

            dR.Close();
            cRiyu.Close();
        }
示例#5
0
            public static void ShowData(DataGridView tempDGV, int tempID)
            {
                string sqlSTRING = "";
                int    iX;

                try
                {
                    tempDGV.RowCount = 0;

                    //未配布情報データのデータリーダーを取得する
                    OleDbDataReader dR;
                    Control.未配布情報   cMi = new Control.未配布情報();
                    sqlSTRING = "where 配布エリアID = " + tempID.ToString();
                    dR        = cMi.FillBy(sqlSTRING);

                    //グリッドビューに表示する
                    iX = 0;

                    while (dR.Read())
                    {
                        tempDGV.Rows.Add();

                        tempDGV[0, iX].Value = dR["ID"].ToString();
                        tempDGV[1, iX].Value = dR["配布エリアID"].ToString();
                        tempDGV[2, iX].Value = dR["番地号"].ToString();
                        tempDGV[3, iX].Value = dR["マンション名"].ToString();
                        tempDGV[4, iX].Value = Int32.Parse(dR["理由"].ToString());
                        tempDGV[5, iX].Value = dR["その他内容"].ToString();
                        iX++;
                    }

                    dR.Close();
                    cMi.Close();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "エラー", MessageBoxButtons.OK);
                }

                tempDGV.CurrentCell = null;
            }