private int getTypeIdByTypeName(string typeName) { int typeId = 0; PmsDocumentTypeBiz pmsDocumentTypeBiz = new PmsDocumentTypeBiz(); PmsDocumentType pmsDocumentType = new PmsDocumentType(); pmsDocumentType.TypeName = typeName; IList <PmsDocumentType> listPmsDocumentType = pmsDocumentTypeBiz.SelectPmsDocumentType(pmsDocumentType); if (listPmsDocumentType.Count > 0) { typeId = listPmsDocumentType[0].TypeId; } return(typeId); }
private void InitDocType() { try { PmsDocumentType pmsDocType = new PmsDocumentType(); pmsDocType.Vid = "PM"; PmsDocumentTypeBiz pmsDocTypeBiz = new PmsDocumentTypeBiz(); IList <PmsDocumentType> pmsDocTypeList = pmsDocTypeBiz.SelectDistinctDocType(pmsDocType); dropdownlistDocType.DataSource = pmsDocTypeList; dropdownlistDocType.DataTextField = "TypeName"; dropdownlistDocType.DataValueField = "TypeId"; dropdownlistDocType.DataBind(); dropdownlistDocType.Items.Insert(0, new ListItem()); dropdownlistDocType.Items[0].Text = ""; dropdownlistDocType.Items[0].Value = ""; } catch { Msgbox("Init Document Type failure!"); } }