Example #1
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(txtPewarta.Text) || String.IsNullOrWhiteSpace(txtTema.Text))
            {
                iMessage.iBoxOk("Harap mengisi data pewarta dan tema");
            }
            else
            {
                DialogResult result = iMessage.quBoxCon("Simpan Data?");

                if (result == DialogResult.Yes)
                {
                    if (editMode == true)
                    {
                        if (pd.editHeader(dtKebaktian.Value.ToString("yyyyMMdd"), txtTema.Text.Trim(), txtPewarta.Text.Trim()) == true)
                        {
                            headerSave = true;
                            tabControl1.SelectedIndex = 1;
                        }
                        else
                        {
                            iMessage.iBoxOk("Data gagal diubah");
                        }
                    }
                    else
                    {
                        if (pd.savePD(dtKebaktian.Value.ToString("yyyyMMdd"), dtKebaktian.Value.ToShortDateString(),
                                      txtTema.Text.Trim(), txtPewarta.Text.Trim()) == true)
                        {
                            this.headerId = dtKebaktian.Value.ToString("yyyyMMdd");
                            getData();
                            headerSave = true;
                            tabControl1.SelectedIndex = 1;
                        }
                        else
                        {
                            iMessage.iBoxOk("Data gagal disimpan");
                        }
                    }

                    pdTotal       = pd.getTotal();
                    lbltotal.Text = "Total Jemaat : " + Convert.ToString(pdTotal);
                }
            }
        }