protected void btnDocumentType_Click(object sender, EventArgs e)
{
DocumentApplicationCategoryManager DACM = new DocumentApplicationCategoryManager();
IkubInfo.NE.Domain.DocumentApplicationCategory DAC = new Domain.DocumentApplicationCategory();
DAC.DocumentType = new DocumentTypeManager().GetById(new Guid(cboDocumentType.SelectedValue));
DAC.ApplicationCategory = Entity;
//Check here from DocumentApplicationCategory, Whether DAC.DocumentType and Entity Exists or not, if does not exists then allow to come in
if(CHECK_HERE)
{
Entity.DocumentApplicationCategory.Add(DAC);
DACM.Save(DAC);
DACM.Session.CommitChanges();
}
SetUIValues();
}
refer the comments: at place of CHECK_HERE, Put your condition to confirm the data your are trying to insert already exists or not.