Exemple #1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (txtIdDepartemen.Text == "" ||txtNamaDepartemen.Text == "")
            {
                MessageBox.Show("Harap isi semua isian");
                return;
            }
            if (lAdd)
            {
                try
                {
                    cmdAdd.Enabled = true;
                    cmdEdit.Enabled = true;
                    cmdSave.Enabled = false;
                    cmdCancel.Enabled = false;

                    MDepartementEntity md = new MDepartementEntity();
                    md.CIdDept = txtIdDepartemen.Text;
                    md.CNamaDept = txtNamaDepartemen.Text;
                    md.CUserId = global_variable.global.gcUSERID;

                    md.Save();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else
            {
                try
                {
                    cmdAdd.Enabled = true;
                    cmdEdit.Enabled = true;
                    cmdSave.Enabled = false;
                    cmdCancel.Enabled = false;

                    MDepartementEntity md = new MDepartementEntity(txtIdDepartemen.Text);
                    md.CNamaDept = txtNamaDepartemen.Text;
                    md.CUserId = global_variable.global.gcUSERID;

                    md.Save();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }

            mDepartemen.GetMulti(null);
            Kalibrasi.global_variable.global.gentDEPARTEMEN = mDepartemen;
            bsDepartemen.ResumeBinding();
            bsDepartemen.MoveLast();
            disableText();

            lAdd = false;
        }
        /// <summary>Creates a new, empty MDepartementEntity object.</summary>
        /// <returns>A new, empty MDepartementEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new MDepartementEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewMDepartement
            // __LLBLGENPRO_USER_CODE_REGION_END

            return toReturn;
        }