private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckValid()) { return; } APILicense objApiCode = new APILicense(); objApiCode.Id = _id; objApiCode.APICode = txtAPICode.Text.Trim(); objApiCode.APIKey = BuildLicenseUtil.BuildEncrypt(txtAPICode.Text.Trim()); objApiCode.FK_CompanyID = cboCompany.EditValue.To <int>(); if (_id == -1)//Add Api Code cho công ty! { objApiCode.Insert(); } else { objApiCode.Update(); } new MessageBoxBA().Show("Cập nhật thông tin API License thành công!", "Thông báo", MessageBoxButtonsBA.OK, MessageBoxIconBA.Information); ResetForm(); RefreshGridControl(); } catch (Exception ex) { LogError.WriteLogError("btnSave_Click: ", ex); } }