示例#1
0
 private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(depIdTextBox.Text.Trim()))
     {
         if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             dep = (MDep)DataMaster.GetObjectById(typeof(MDep), depIdTextBox.Text);
             DataMaster.Delete(dep);
             BindData();
         }
     }
 }
示例#2
0
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (depIdTextBox.Enabled == true)
            {
                dep = new MDep();
            }
            else
            {
                dep = (MDep)DataMaster.GetObjectById(typeof(MDep), depIdTextBox.Text);
            }

            dep.DepId        = depIdTextBox.Text;
            dep.DepName      = depNameTextBox.Text;
            dep.DepStatus    = "OK";
            dep.ModifiedBy   = lbl_UserName.Text;
            dep.ModifiedDate = DateTime.Now;
            if (depIdTextBox.Enabled == true)
            {
                try
                {
                    DataMaster.SavePersistence(dep);
                }
                catch (NHibernate.NonUniqueObjectException)
                {
                    RecreateBalloon();
                    balloonHelp.Caption = "Validasi data kurang";
                    balloonHelp.Content = "Bagian " + depIdTextBox.Text + " sudah pernah diinput, silahkan input bagian yang lain";
                    balloonHelp.ShowBalloon(depIdTextBox);
                    depIdTextBox.Focus();
                    return;
                }

                ModuleControlSettings.SaveLog(ListOfAction.Insert, depIdTextBox.Text, ListOfTable.MDep, lbl_UserName.Text);
            }

            else
            {
                DataMaster.UpdatePersistence(dep);
                ModuleControlSettings.SaveLog(ListOfAction.Update, depIdTextBox.Text, ListOfTable.MDep, lbl_UserName.Text);
            }


            BindData();
        }
示例#3
0
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (depIdTextBox.Enabled == true)
            {
                dep = new MDep();
            }
            else
            {
                dep = (MDep)DataMaster.GetObjectById(typeof(MDep), depIdTextBox.Text);
            }

            dep.DepId     = depIdTextBox.Text;
            dep.DepName   = depIdTextBox.Text;
            dep.DepStatus = depStatusTextBox.Text;

            if (depIdTextBox.Enabled == true)
            {
                try
                {
                    DataMaster.SavePersistence(dep);
                }
                catch (NHibernate.NonUniqueObjectException)
                {
                    RecreateBalloon();
                    balloonHelp.Caption = "Validasi data kurang";
                    balloonHelp.Content = "Bagian " + depIdTextBox.Text + " sudah pernah diinput, silahkan input bagian yang lain";
                    balloonHelp.ShowBalloon(depIdTextBox);
                    depIdTextBox.Focus();
                    return;
                }
            }

            else
            {
                DataMaster.UpdatePersistence(dep);
            }


            BindData();
        }