コード例 #1
0
 private void frmRiwayatIDWilUpdate_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (this.DialogResult == DialogResult.OK)
     {
         if (this.Caller is frmRiwayatIDWilBrowse)
         {
             frmRiwayatIDWilBrowse frmCaller = (frmRiwayatIDWilBrowse)this.Caller;
             frmCaller.RefreshData();
             frmCaller.FindDetail("Row", _rowID.ToString());
         }
     }
 }
コード例 #2
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (IsValid())
            {
                switch (formMode)
                {
                case enumFormMode.New:
                    using (Database db = new Database())
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_ReIDWil_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@recID", SqlDbType.VarChar, Tools.CreateFingerPrint()));
                        db.Commands[0].Parameters.Add(new Parameter("@tokoID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@wilID", SqlDbType.VarChar, txtWilID.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@wilIDOld", SqlDbType.VarChar, txtWilIDOld.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@keterangan", SqlDbType.VarChar, txtKeterangan.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@lRefresh", SqlDbType.VarChar, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@syncFlag", SqlDbType.Bit, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        dt = db.Commands[0].ExecuteDataTable();

                        if (dt.Rows.Count > 0)
                        {
                            MessageBox.Show("ID wil: " + txtWilID.Text + " sudah ada");
                            txtWilID.SelectAll();
                            txtWilID.Focus();
                            return;
                        }
                    }
                    //);

                    break;

                case enumFormMode.Update:
                    using (Database db = new Database())
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_ReIDWil_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@wilID", SqlDbType.VarChar, txtWilID.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@keterangan", SqlDbType.VarChar, txtKeterangan.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        dt = db.Commands[0].ExecuteDataTable();

                        if (dt.Rows.Count > 0)
                        {
                            MessageBox.Show("ID wil: " + txtWilID.Text + " sudah ada");
                            txtWilID.SelectAll();
                            txtWilID.Focus();
                            return;
                        }
                    }
                    break;
                }
                //MessageBox.Show("Data telah tersimpan");
                this.DialogResult = DialogResult.OK;
                frmRiwayatIDWilBrowse frmCaller = (frmRiwayatIDWilBrowse)this.Caller;
                this.Close();
                frmCaller.RefreshData();
                frmCaller.Show();
            }
        }