private void frmPenanggungjawabRakUpdate_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (this.DialogResult == DialogResult.OK)
     {
         if (this.Caller is frmPenanggungjawabRakBrowse)
         {
             frmPenanggungjawabRakBrowse frmCaller = (frmPenanggungjawabRakBrowse)this.Caller;
             frmCaller.RefreshDataPJ();
             frmCaller.FindDetail("RowID", _rowID.ToString());
         }
     }
 }
        private void cmdSave_Click(object sender, EventArgs e)
        {
            //try
            //{
            switch (formMode)
            {
            case enumFormMode.New:

                try
                {
                    _rowID = Guid.NewGuid();
                    using (Database db = new Database())
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_PenanggungjawabRak_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeRak", SqlDbType.VarChar, _kode));
                        db.Commands[0].Parameters.Add(new Parameter("@Nama", SqlDbType.VarChar, cboNama.SelectedValue));
                        db.Commands[0].Parameters.Add(new Parameter("@TglTransaksi", SqlDbType.DateTime, txtTgl.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            case enumFormMode.Update:
                try
                {
                    using (Database db = new Database())
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_PenanggungjawabRak_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeRak", SqlDbType.VarChar, _kode));
                        db.Commands[0].Parameters.Add(new Parameter("@Nama", SqlDbType.VarChar, cboNama.SelectedValue));
                        db.Commands[0].Parameters.Add(new Parameter("@TglTransaksi", SqlDbType.DateTime, txtTgl.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                break;
            }
            MessageBox.Show("Data telah tersimpan");
            this.DialogResult = DialogResult.OK;
            frmPenanggungjawabRakBrowse frmCaller = (frmPenanggungjawabRakBrowse)this.Caller;

            frmCaller.RefreshDataPJ();
            this.Close();
            frmCaller.Show();

            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //    //Error.LogError(ex);
            //}
        }