Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Click event of the btnDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            // --- If Not EditMode
            if (_saveMode != SaveMode.EditMode) return;

            try
            {
                var r = new Workflow
                            {
                                WorkflowId = txtID.Text.Trim()
                            };

                var db = new WorkflowBase();

                if (Confirm("Are you sure to delete this data?") == DialogResult.Yes)
                {
                    DialogResult dlg;

                    using (var f = new LogonPresentation())
                    {
                        dlg = f.ShowDialog(this);
                    }

                    if (dlg == DialogResult.OK)
                    {
                        if ((db.Delete(r) == 1)) ResetData();
                    }
                }

                db.Dispose();

            }
            catch (ArgumentNullException ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Searches the data.
        /// </summary>
        private void SearchData()
        {
            if (InvokeRequired)
            {
                var o = new DelegateThis(SearchData);
                Invoke(o);
            }
            else
            {
                string teks = lblDetail.Text.Trim();

                if (string.IsNullOrEmpty(teks)) return;

                XLPassportForm pass = new XLPassportFormBase().GetById(teks);
                string msg = "";

                if (pass != null)
                {
                    lblHeader.Text = string.Format("Permh. a.n {0}", pass.Name);

                    var db = new WorkflowBase();
                    Workflow wf = db.GetById(pass.WorkFlowXID.ToString().Trim());
                    db.Dispose();

                    msg = wf != null ? wf.WorkflowDescription : "Status tidak diketahui, hubungi petugas!";
                }
                else
                {
                    msg = "No. Permohonan tidak ditemukan!";
                }

                lblDetail.Text = msg;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Validated event of the txtID control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void txtID_Validated(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtID.Text.Trim())) return;

            var db = new WorkflowBase();
            Workflow r = db.GetById(txtID.Text.Trim());
            db.Dispose();

            try
            {
                txtDescription.Text = r.WorkflowDescription;
                txtID.Enabled = false;
                _saveMode = SaveMode.EditMode;
            }
            catch (NullReferenceException)
            {
                _saveMode = SaveMode.AddMode;
            }
        }