/// <summary> /// Insert new TAIKHOAN /// </summary> /// <param name="businessObject">TAIKHOAN object</param> /// <returns>true for successfully saved</returns> public bool Insert(TAIKHOAN businessObject, int?bacsiID) { if (!businessObject.IsValid) { businessObject.ShowErrorMessage();//throw new InvalidBusinessObjectException(businessObject.BrokenRulesList.ToString()); } bool ans = _dataObject.Insert(businessObject); if (bacsiID != 0 || bacsiID != null) { try { BACSIFactory BACSIService = new BACSIFactory(); BACSI bacsi = BACSIService.GetByPrimaryKey(new BACSIKeys((int)bacsiID)); bacsi.TAIKHOANID = businessObject.ID; BACSIService.Update(bacsi); } catch { } } return(ans); }
/// <summary> /// delete by primary key /// </summary> /// <param name="keys">primary key</param> /// <returns>true for succesfully deleted</returns> public bool Delete(TAIKHOANKeys keys) { BACSIFactory BACSIService = new BACSIFactory(); try { BACSI bacsi = BACSIService.GetAllEntities().ToList() .Where(p => p.TAIKHOANID == keys.ID) .FirstOrDefault(); bacsi.TAIKHOANID = null; BACSIService.Update(bacsi); } catch { } return(_dataObject.Delete(keys)); }