Exemplo n.º 1
0
        public void showData(String regType, String regName)
        {
            DBProvider dbprovider = new DBProvider();

            MySqlCommand command = new MySqlCommand();


            String sqlCmd = "select * from daftar_register where reg_type=?reg_type and reg_name=?reg_name";

            command.CommandText = sqlCmd;
            command.Parameters.Add(new MySqlParameter("reg_type", regType));
            command.Parameters.Add(new MySqlParameter("reg_name", regName));

            DataTable dtCommand = dbprovider.getData(command);

            if (dtCommand.Rows.Count > 0)
            {
                DataRow row = dtCommand.Rows[0];

                this.Txt_CmdType.Text = row["reg_type"].ToString();
                this.Txt_CmdName.Text = row["reg_name"].ToString();
                this.Txt_ClassName.Text = row["nama_class"].ToString();
                this.Txt_AssemblyName.Text = row["nama_assembly"].ToString();

            }

        }
Exemplo n.º 2
0
        public void showData(int jadwalID) {
            DBProvider dbprovider = new DBProvider();

            MySqlCommand command = new MySqlCommand();


            String sqlCmd = "select * from jadwal_broadcast where id_jadwal=?id_jadwal";

            command.CommandText = sqlCmd;
            command.Parameters.Add(new MySqlParameter("id_jadwal", jadwalID));

            DataTable dtCommand = dbprovider.getData(command);

            if (dtCommand.Rows.Count > 0)
            {
                DataRow row = dtCommand.Rows[0];

                Cmb_Name.SelectedValue = row["reg_type"].ToString() + "-" + row["reg_name"].ToString();
                this.Txt_MaxLoop.Text = row["pengulangan_max"].ToString();
                this.Txt_CurrLoop.Text = row["pengulangan_hitung"].ToString();

                this.Txt_Interval.Text = row["Pengulangan_Jeda_Hari"].ToString();
                this.dtNextExecute.Value = DateTime.Parse(row["Waktu_Eksekusi_Berikut"].ToString());
                this.dtLastExecute.Value = DateTime.Parse(row["waktu_eksekusi_terakhir"].ToString());
                this.Cmb_Status.Text = row["status"].ToString();

                brcdID = jadwalID;
            }
            else 
            {
                brcdID = 0;
                MessageBox.Show(this,"ID "+ jadwalID.ToString() +" Tidak ditemukan","Error");
            }
        }
Exemplo n.º 3
0
        private void Btn_Save_Click(object sender, EventArgs e)
        {
            MySqlCommand command = new MySqlCommand();
            DBProvider dbProvider = new DBProvider();

            String sqlCmd = "select * from daftar_register where reg_type=?reg_type and reg_name=?reg_name";

            command.Parameters.Clear();
            command.Parameters.Add(new MySqlParameter("reg_type", Txt_CmdType.Text));
            command.Parameters.Add(new MySqlParameter("reg_name", Txt_CmdName.Text));
            command.Parameters.Add(new MySqlParameter("nama_class", Txt_ClassName.Text));
            command.Parameters.Add(new MySqlParameter("nama_assembly", Txt_AssemblyName.Text));

            command.CommandText = sqlCmd;
            DataTable dtCommand = dbProvider.getData(command);

            if (dtCommand.Rows.Count > 0)
            {
                command.CommandText = " update `daftar_register`  set ";
                command.CommandText += " `reg_type`=?reg_type, ";
                command.CommandText += " `reg_name`=?reg_name , ";
                command.CommandText += " `nama_class`=?nama_class , ";
                command.CommandText += " `nama_assembly`=?nama_assembly ";
                command.CommandText += " where `reg_type`=?reg_type and `reg_name`=?reg_name";
            }
            else
            {
                command.CommandText = "INSERT INTO `daftar_register` ";
                command.CommandText += "( `reg_type` , `reg_name` , `nama_class` , `nama_assembly` ) ";
                command.CommandText += "VALUES ( ?reg_type , ?reg_name , ?nama_class , ?nama_assembly )";
            }

            if (dbProvider.Exec(command))
            {
                MessageBox.Show("Data Saved", "Save");
            }
            else
            {
                MessageBox.Show("Cannot Saving Data", "Save");
            }
            dbProvider.dbClose();
            this.Close();


        }
Exemplo n.º 4
0
        private void getCommandName() 
        {
            DBProvider dbprovider = new DBProvider();

            MySqlCommand command = new MySqlCommand();


            String sqlCmd = "select concat(reg_type, '-', reg_name) as hasil  from daftar_register order by reg_name";

            command.CommandText = sqlCmd;
            
            DataTable dtCommand = dbprovider.getData(command);

            if (dtCommand.Rows.Count > 0) {
              
                this.Cmb_Name.DataSource = dtCommand.DefaultView;
                this.Cmb_Name.DisplayMember = "hasil";
                this.Cmb_Name.ValueMember = "hasil";

                this.Cmb_Name.SelectedIndex = 0;
            }
        }
Exemplo n.º 5
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            MySqlCommand command = new MySqlCommand();
            DBProvider dbProvider = new DBProvider();

            String sqlCmd = "select * from `jadwal_broadcast` where id_jadwal=?id_jadwal";

            command.Parameters.Clear();
            command.Parameters.Add(new MySqlParameter("id_jadwal", brcdID));


            command.CommandText = sqlCmd;
            DataTable dtCommand = dbProvider.getData(command);

            if (dtCommand.Rows.Count > 0)
            {
                command.CommandText = " update `jadwal_broadcast`  set ";
                command.CommandText += " `id_jadwal`=?id_jadwal,";
                command.CommandText += " `reg_type`=?reg_type,";
                command.CommandText += " `reg_name`=?reg_name,";
                command.CommandText += " `pengulangan_max`=?pengulangan_max,";
                command.CommandText += " `pengulangan_hitung`=?pengulangan_hitung, ";
                command.CommandText += " `Pengulangan_Jeda_Hari`=?Pengulangan_Jeda_Hari, ";
                command.CommandText += " `Waktu_Eksekusi_Berikut`=?Waktu_Eksekusi_Berikut, ";
                command.CommandText += " `Waktu_Eksekusi_Terakhir`=?Waktu_Eksekusi_Terakhir,";
                command.CommandText += " `status`=?status";
                command.CommandText += " where `id_jadwal`=?id_jadwal";

                command.Parameters.Clear();
                command.Parameters.Add(new MySqlParameter("id_jadwal", brcdID));
            }
            else
            {
                command.Parameters.Clear();
                command.Parameters.Add(new MySqlParameter("id_jadwal", null));

                command.CommandText = "INSERT INTO `jadwal_broadcast` ";
                command.CommandText += "( `id_jadwal` , `reg_type` , `reg_name` , `pengulangan_max` , `pengulangan_hitung` , `Pengulangan_Jeda_Hari` , `Waktu_Eksekusi_Berikut` , `Waktu_Eksekusi_Terakhir` , `status` ) ";
                command.CommandText += "VALUES ( ?id_jadwal,?reg_type , ?reg_name , ?pengulangan_max, ?pengulangan_hitung, ?Pengulangan_Jeda_Hari,?Waktu_Eksekusi_Berikut ,?Waktu_Eksekusi_Terakhir,?status )";
            }

            String[] register = this.Cmb_Name.SelectedValue.ToString().Split('-');
            command.Parameters.Add(new MySqlParameter("reg_type", register[0]));
            command.Parameters.Add(new MySqlParameter("reg_name", register[1]));
            command.Parameters.Add(new MySqlParameter("pengulangan_max", this.Txt_MaxLoop.Text));
            command.Parameters.Add(new MySqlParameter("pengulangan_hitung", this.Txt_CurrLoop.Text));
            command.Parameters.Add(new MySqlParameter("Pengulangan_Jeda_Hari", this.Txt_Interval.Text));
            command.Parameters.Add(new MySqlParameter("Waktu_Eksekusi_Berikut", this.dtNextExecute.Value.ToString("yyyy-MM-dd HH:mm:ss")));
            command.Parameters.Add(new MySqlParameter("Waktu_Eksekusi_Terakhir", this.dtLastExecute.Value.ToString("yyyy-MM-dd HH:mm:ss")));
            command.Parameters.Add(new MySqlParameter("status", this.Cmb_Status.Text));

            dbProvider.Exec(command);
            dbProvider.dbClose();
        }