コード例 #1
0
        public string jrn_service(cService s)
        {
            string sql = "insert into service_jrn (" +
                         " RID," +
                         " SERVICE_ID," +
                         " SERVICE_YEAR_ID," +
                         " SONG_ID," +
                         " SERVICE_DATE," +
                         " SERVICE_TYPE," +
                         " SERVICE_NOTE," +
                         " SONG_LAST_SANG," +
                         " SERVICE_SYSTEM_DATE," +
                         " SYSTEM_DATE," +
                         " SYSTEM_TYPE," +
                         " SYSTEM_CNT)" +
                         " values (" +
                         s.service_rid + "," +
                         s.service_id + "," +
                         s.service_year_id + "," +
                         s.song_id + "," +
                         "#" + s.service_date + "#," +
                         s.service_type + "," +
                         "'" + s.service_note + "'," +
                         "#" + s.song_last_sang + "#," +
                         "#" + s.service_sys_date + "#," +
                         "#" + s.jrn_system_date + "#," +
                         "'" + s.service_sys_type + "'," +
                         s.service_sys_cnt + ")";

            return(sql);
        }
コード例 #2
0
        public string save_new_service(cService serv, string song_id, int order)
        {
            string sql = "";

            sql = "INSERT into service (" +
                  " SERVICE_ID," +
                  " SERVICE_YEAR_ID," +
                  " SONG_ID," +
                  " SERVICE_DATE," +
                  " SERVICE_TYPE," +
                  " SERVICE_NOTE," +
                  " SONG_LAST_SANG," +
                  " SONG_ORDER," +
                  " SYSTEM_DATE," +
                  " SYSTEM_TYPE," +
                  " SYSTEM_CNT)" +
                  " values (" +
                  serv.service_id + "," +
                  serv.service_year_id + "," +
                  "'" + song_id + "'," +
                  "#" + serv.service_date + "#," +
                  serv.service_type + "," +
                  "'" + serv.service_note + "'," +
                  "#" + serv.song_last_sang + "#, " +
                  order + "," +
                  "#" + serv.service_sys_date + "#," +
                  "'I'," +
                  "0)";
            return(sql);
        }
コード例 #3
0
        public bool save_spevka(cService serv)
        {
            bool   stat = false;
            string sql  = "";

            string[] key     = null;
            string   song_id = "";
            int      i       = 0;
            TreeNode n       = (TreeNode)serv.obj;

            try
            {
                foreach (TreeNode nd in n.Nodes)
                {
                    i++;
                    key     = nd.Tag.ToString().Split(';');
                    song_id = key[4];
                    // saving spevka into service
                    sql  = sql_lib.save_new_service(serv, song_id, i);
                    stat = mdb.Execute(sql);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                stat = false;
            }
            return(stat);
        }
コード例 #4
0
        private void btnSaveService_Click(object sender, EventArgs e)
        {
            if (validate_spevka() == false)
            {
                return;
            }

            bool stat = true;

            Cursor.Current = Cursors.WaitCursor;
            cService serv = new cService();

            serv.service_type = utl.get_cbo_itm_key(cboSongCat);
            serv.service_year = DateTime.Now.Year.ToString();
            //serv.service_date = DateTime.Now.ToShortDateString();
            serv.service_date    = dtPick.Value.ToShortDateString(); // Changed logic so I can set the date if needed
            serv.service_year_id = serv.service_year.Substring(2, 2);
            serv.song_last_sang  = serv.service_date;
            serv.service_note    = txtServiceNote.Text.Trim();
            serv.obj             = tvBuildSpevka.Nodes[0];

            if (tvBuildSpevka.Tag == null) // Save new spevka
            {
                serv.service_id = utl.get_next_service_id();
                stat            = utl.save_spevka(serv);
                utl.get_latest_spevka(ref tvBuildSpevka, txtServiceNote, dtPick);

                if (stat == false)
                {
                    MessageBox.Show("Служение не сохранено.", "Сохранить Служение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    MessageBox.Show("Служение успешно сохранено.", "Сохранить Служение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else // update spevka
            {
                serv.service_id = tvBuildSpevka.Tag.ToString();
                stat            = utl.update_spevka(serv);

                if (stat == false)
                {
                    MessageBox.Show("Служение не пересохранино.", "Пересохранить Служение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    MessageBox.Show("Служение успешно пересохранино.", "Пересохранить Служение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    spevka_changed   = false;
                    spevka_orig_note = txtServiceNote.Text; // reset note
                }
            }
            Cursor.Current = Cursors.Default;
        }
コード例 #5
0
        public string update_service(cService serv, string song_id, string song_rid, int order)
        {
            string sql = "";

            sql = "UPDATE service " +
                  " set SERVICE_YEAR_ID = '" + serv.service_year_id + "'," +
                  " SONG_ID = '" + song_id + "'," +
                  " SERVICE_DATE = #" + serv.service_date + "#," +
                  " SERVICE_TYPE = " + serv.service_type + "," +
                  " SERVICE_NOTE = '" + serv.service_note + "'," +
                  " SONG_LAST_SANG = #" + serv.song_last_sang + "#," +
                  " SONG_ORDER = " + order + "," +
                  " SYSTEM_DATE = #" + serv.service_sys_date + "#," +
                  " SYSTEM_TYPE = 'U'," +
                  " SYSTEM_CNT = SYSTEM_CNT+1" +
                  " where SERVICE_ID = " + serv.service_id +
                  " and rid = " + song_rid;

            return(sql);
        }
コード例 #6
0
        private bool jrn_service(string serv_id, string song_id)
        {
            bool     stat = false;
            string   sql  = sql_lib.get_service_song_data(serv_id, song_id);
            DateTime d    = new DateTime();

            ADODB.Recordset rs = null;

            if (mdb.RsOpen(out rs, sql) == false)
            {
                return(stat);
            }

            while (rs.EOF == false)
            {
                cService s = new cService();

                s.service_rid     = rs.Fields["rid"].Value.ToString();
                s.service_id      = rs.Fields["service_id"].Value.ToString();
                s.service_year_id = rs.Fields["service_year_id"].Value.ToString();
                s.song_id         = rs.Fields["song_id"].Value.ToString();
                d = Convert.ToDateTime(rs.Fields["service_date"].Value.ToString());
                s.service_date = d.ToShortDateString();
                s.service_type = rs.Fields["service_type"].Value.ToString();
                s.service_note = rs.Fields["service_note"].Value.ToString();
                d = Convert.ToDateTime(rs.Fields["song_last_sang"].Value.ToString());
                s.song_last_sang   = d.ToShortDateString();
                s.service_sys_date = rs.Fields["system_date"].Value.ToString();
                s.service_sys_type = rs.Fields["system_type"].Value.ToString();
                s.service_sys_cnt  = rs.Fields["system_cnt"].Value.ToString();

                sql  = sql_lib.jrn_service(s);
                stat = mdb.Execute(sql);

                rs.MoveNext();
            }

            rs = null;
            return(stat);
        }