Beispiel #1
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            //他に登録されているときは削除不可とする
            string SqlStr;

            SqlStr  = " where ";
            SqlStr += "(配布エリア.町名ID = " + txtCode.Text.ToString() + ")  ";

            OleDbDataReader dr;

            Control.配布エリア Area = new Control.配布エリア();
            dr = Area.FillBy(SqlStr);

            //該当町名が登録されているときは削除不可とする
            if (dr.HasRows == true)
            {
                MessageBox.Show(txtName1.Text.ToString() + "が配布エリアデータに登録されています", txtName1.Text.ToString() + "は削除できません", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dr.Close();
                Area.Close();
                return;
            }

            dr.Close();
            Area.Close();

            //削除確認
            if (MessageBox.Show("削除します。よろしいですか?", "削除確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            //データ削除
            Control.町名 Town = new Control.町名();
            if (Town.DataDelete(Convert.ToInt32(txtCode.Text.ToString())) == true)
            {
                MessageBox.Show("削除されました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            Town.Close();

            DispClear();

            //データを 'darwinDataSet.町名' テーブルに読み込みます。
            this.町名TableAdapter.Fill(this.darwinDataSet.町名);
            dataGridView1.DataSource = this.darwinDataSet.町名;
        }
Beispiel #2
0
            public static void AreaShowData(DataGridView tempDGV, long tempID)
            {
                int iX;

                try
                {
                    tempDGV.RowCount = 0;

                    //配布エリアデータを取得する
                    OleDbDataReader dr;
                    Control.配布エリア   dArea = new Control.配布エリア();
                    dr = dArea.FillBy("where 受注ID = " + tempID.ToString() + " order by 町名ID");

                    iX = 0;

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

                        tempDGV[0, iX].Value = long.Parse(dr["ID"].ToString());
                        tempDGV[1, iX].Value = dr["町名ID"].ToString();
                        tempDGV[3, iX].Value = Int32.Parse(dr["予定枚数"].ToString());
                        tempDGV[4, iX].Value = Int32.Parse(dr["配布指示ID"].ToString());
                        iX++;
                    }

                    tempDGV.CurrentCell = null;

                    //if (tempDGV.RowCount <= 18)
                    //{
                    //    tempDGV.Columns[2].Width = 218;
                    //}
                    //else
                    //{
                    //    tempDGV.Columns[2].Width = 201;
                    //}

                    dr.Close();
                    dArea.Close();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "エラー", MessageBoxButtons.OK);
                }
            }
Beispiel #3
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            //配布エリアデータに登録されているときは削除不可とする
            string SqlStr;

            SqlStr  = " where ";
            SqlStr += "(配布エリア.理由 = " + txtCode.Text.ToString() + ")  ";

            OleDbDataReader dr;

            Control.配布エリア Shain = new Control.配布エリア();
            dr = Shain.FillBy(SqlStr);

            //配布エリアデータに登録されているときは削除不可とする
            if (dr.HasRows == true)
            {
                MessageBox.Show("未配布理由が「" + txtName1.Text.ToString() + "」の配布エリアデータが登録されています", txtName1.Text.ToString() + "は削除できません", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dr.Close();
                Shain.Close();
                return;
            }

            dr.Close();
            Shain.Close();

            //削除確認
            if (MessageBox.Show("削除します。よろしいですか?", "削除確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            //データ削除
            Control.未配布理由 Shozoku = new Control.未配布理由();
            if (Shozoku.DataDelete(Convert.ToInt32(txtCode.Text.ToString())) == true)
            {
                MessageBox.Show("削除されました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            Shozoku.Close();

            DispClear();

            //データを 'darwinDataSet.所属' テーブルに読み込みます。
            this.未配布理由TableAdapter.Fill(this.darwinDataSet.未配布理由);
        }
Beispiel #4
0
            public static Boolean GetPostingData(int tempID, ref Entity.配布エリア tempC)
            {
                string sqlStr;

                Control.配布エリア   dArea = new Control.配布エリア();
                OleDbDataReader dr;

                sqlStr = " where 配布エリア.ID = " + tempID.ToString();
                dr     = dArea.FillBy(sqlStr);

                if (dr.HasRows == true)
                {
                    while (dr.Read() == true)
                    {
                        tempC.ID     = Convert.ToInt32(dr["ID"].ToString());
                        tempC.町名ID   = Int32.Parse(dr["町名ID"].ToString());
                        tempC.予定枚数   = Int32.Parse(dr["予定枚数"].ToString());
                        tempC.受注ID   = long.Parse(dr["受注ID"].ToString());
                        tempC.配布指示ID = Int32.Parse(dr["配布指示ID"].ToString());
                        tempC.配布単価   = double.Parse(dr["配布単価"].ToString(), System.Globalization.NumberStyles.AllowDecimalPoint);
                        tempC.配布日    = dr["配布日"].ToString();
                        tempC.実配布枚数  = Int32.Parse(dr["実配布枚数"].ToString());
                        tempC.実残数    = Int32.Parse(dr["実残数"].ToString());
                        tempC.報告枚数   = Int32.Parse(dr["報告枚数"].ToString());
                        tempC.報告残数   = Int32.Parse(dr["報告残数"].ToString());
                        tempC.併配区分   = Int32.Parse(dr["併配区分"].ToString());
                        tempC.枝番記入   = dr["枝番記入"].ToString();
                        tempC.完了区分   = Int32.Parse(dr["完了区分"].ToString());
                        tempC.ステータス  = Int32.Parse(dr["ステータス"].ToString());
                    }
                }
                else
                {
                    dr.Close();
                    dArea.Close();
                    return(false);
                }

                dr.Close();
                dArea.Close();
                return(true);
            }