Example #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (fDataCheck() == true)
                {
                    Control.税率 sTax = new Control.税率();

                    switch (fMode.Mode)
                    {
                    case 0:     //新規登録
                        if (MessageBox.Show("新規登録します。よろしいですか?", "登録確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            sTax.Close();
                            return;
                        }

                        if (sTax.DataInsert(cMaster) == true)
                        {
                            MessageBox.Show("新規登録されました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("新規登録に失敗しました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        }

                        break;

                    case 1:     //更新
                        if (MessageBox.Show("更新します。よろしいですか?", "更新確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            sTax.Close();
                            return;
                        }

                        if (sTax.DataUpdate(cMaster) == true)
                        {
                            MessageBox.Show("更新されました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("更新に失敗しました", "所属マスター", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        }

                        break;
                    }

                    sTax.Close();

                    DispClear();

                    //データを 'darwinDataSet.税率' テーブルに読み込みます。
                    this.税率TableAdapter.Fill(this.darwinDataSet.税率);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "更新処理", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Example #2
0
            /// <summary>
            /// データグリッドビューの指定行のデータを取得する
            /// </summary>
            /// <param name="dgv">対象とするデータグリッドビューオブジェクト</param>
            public static Boolean GetData(DataGridView dgv, ref Entity.税率 tempC)
            {
                int    iX = 0;
                string sqlStr;

                Control.税率      sTax = new Control.税率();
                OleDbDataReader dr;

                sqlStr = " where 税率.ID = " + (int)dgv[0, dgv.SelectedRows[iX].Index].Value;
                dr     = sTax.FillBy(sqlStr);

                if (dr.HasRows == true)
                {
                    while (dr.Read() == true)
                    {
                        tempC.ID    = Convert.ToInt32(dr["ID"].ToString());
                        tempC.設定税率  = Convert.ToInt32(dr["税率"].ToString());
                        tempC.開始年月日 = Convert.ToDateTime(dr["開始年月日"].ToString());
                        tempC.備考    = dr["備考"].ToString() + "";
                    }
                }
                else
                {
                    dr.Close();
                    sTax.Close();
                    return(false);
                }

                dr.Close();
                sTax.Close();
                return(true);
            }
Example #3
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            ////他に登録されているときは削除不可とする
            //string SqlStr;
            //SqlStr = " where ";
            //SqlStr += "(受注.受注種別ID = " + txtCode.Text.ToString() + ")  ";

            //OleDbDataReader dr;
            //Control.受注 Order = new Control.受注();
            //dr = Order.FillBy(SqlStr);

            ////該当種別の受注データが登録されているときは削除不可とする
            //if (dr.HasRows == true)
            //{
            //    MessageBox.Show(txtName1.Text.ToString() + "の受注データが登録されています", txtName1.Text.ToString() + "は削除できません", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    dr.Close();
            //    Order.Close();
            //    return;
            //}

            //dr.Close();
            //Order.Close();

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

            //データ削除
            Control.税率 sTax = new Control.税率();
            if (sTax.DataDelete(cMaster.ID) == true)
            {
                MessageBox.Show("削除されました", MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            sTax.Close();

            DispClear();

            //データを 'darwinDataSet.所属' テーブルに読み込みます。
            this.税率TableAdapter.Fill(this.darwinDataSet.税率);
        }