示例#1
0
        protected override bool CekValidate()
        {
            bool Result = base.CekValidate();

            if (Result)
            {
                if (EditNmMKaryawan.Text.Trim().Equals(""))
                {
                    ASPMsgCmp.WarningMessage(string.Format(ASPMessage.wm_CANNOTNULL, "Nama Karyawan"));
                    Result = false;
                }
            }

            if (Result)
            {
                if (EditAlamat.Text.Trim().Equals(""))
                {
                    ASPMsgCmp.WarningMessage(string.Format(ASPMessage.wm_CANNOTNULL, "Alamat"));
                    Result = false;
                }
            }

            if (Result)
            {
                if (EditNoHP.Text.Trim().Equals(""))
                {
                    ASPMsgCmp.WarningMessage(string.Format(ASPMessage.wm_CANNOTNULL, "No. HP"));
                    Result = false;
                }
            }

            if (Result)
            {
                if (GMJabatan.IdMJabatan == 0)
                {
                    ASPMsgCmp.WarningMessage(string.Format(ASPMessage.wm_CANNOTNULL, "Jabatan"));
                    Result = false;
                }
            }

            if (Result)
            {
                Result = (ASPMsgCmp.QuestionMessage(ASPMessage.cm_SAVE) == DialogResult.Yes);
            }

            return(Result);
        }
示例#2
0
        protected override void DeleteRecord()
        {
            bool CanDelete = true;

            if (GMode == ASPConstant.ModeBrowse && dataGridView.SelectedRows.Count > 0)
            {
                base.DeleteRecord();
                DataGridViewRow row = dataGridView.SelectedRows[0];
                if (!GDBMKaryawan.SelectById(int.Parse(row.Cells["IdMKaryawan"].Value.ToString()), ref GMKaryawan))
                {
                    GMKaryawan = GDBMKaryawan.Clear();
                    CanDelete  = false;
                }

                if (CanDelete)
                {
                    if (ASPMsgCmp.QuestionMessage("Yakin ingin menghapus " + GMKaryawan.NmMKaryawan + "?") == DialogResult.Yes)
                    {
                        GMKaryawan.IdMUserUpdate = MainForm.FMCurrUser.IdMKaryawan;
                        GMKaryawan.TglUpdate     = GDBMJabatan.GetNow();
                        GMKaryawan.Hapus         = true;

                        if (GDBMKaryawan.Delete(GMKaryawan))
                        {
                            ASPMsgCmp.InfoMessage("Data berhasil dihapus.");
                        }
                        else
                        {
                            ASPMsgCmp.ErrorMessage("Data gagal dihapus.");
                        }
                    }
                }

                GMKaryawan = GDBMKaryawan.Clear();
                ShowData();
                SetMode(ASPConstant.ModeBrowse);
                GetTable();
            }
        }