Esempio n. 1
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_festival(festival_date,festival_type,festival_note) values('" + dateTimePickerDate.Text.ToString() + "','" + comboBoxType.SelectedValue.ToString() + "','" + textEditNote.Text.ToString().Trim() + "')";
            strsql2 = "select * from cost_festival where festival_date = '" + dateTimePickerDate.Text.ToString() + "'";
            if (textEditNote.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该日期已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        FestivalQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
            conn.Close();
        }
Esempio n. 2
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_festival set festival_date = '" + dateEditDate.Text + "',festival_type = '" + comboBoxType.SelectedValue.ToString() + "',festival_note = '" + textEditNote.Text.ToString().Trim() + "' where festival_date ='" + cdate + "'";
            string sql2 = "select * from cost_festival where festival_date = '" + dateEditDate.Text + "'";

            if (textEditNote.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0 && dateEditDate.Text != cdate)
                {
                    MessageBox.Show("该日期已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        FestivalQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
Esempio n. 3
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     FestivalQuery.RefreshEX();
 }