Exemple #1
0
        /// <summary>
        /// Update existing CHITIETNHAP
        /// </summary>
        /// <param name="businessObject">CHITIETNHAP object</param>
        /// <returns>true for successfully saved</returns>
        public bool Update(CHITIETNHAP businessObject)
        {
            if (!businessObject.IsValid)
            {
                businessObject.ShowErrorMessage();//throw new InvalidBusinessObjectException(businessObject.BrokenRulesList.ToString());
            }

            bool ans;

            ans = _dataObject.Update(businessObject);

            try
            {
                NHAPTHUOCFactory NHAPTHUOCService = new NHAPTHUOCFactory();
                NHAPTHUOC        nhapthuoc        = NHAPTHUOCService.GetAllEntities().ToList()
                                                    .Where(p => p.ID == businessObject.NHAPTHUOCID)
                                                    .FirstOrDefault();
                NHAPTHUOCService.Update(nhapthuoc);
            }
            catch
            {
            }

            return(ans);
        }
Exemple #2
0
        /// <summary>
        /// delete by primary key
        /// </summary>
        /// <param name="keys">primary key</param>
        /// <returns>true for succesfully deleted</returns>
        public bool Delete(CHITIETNHAPKeys keys)
        {
            CHITIETNHAP a = GetAllEntities().ToList().Where(p => p.ID == keys.ID).FirstOrDefault();

            bool ans;

            ans = _dataObject.Delete(keys);

            try
            {
                NHAPTHUOCFactory NHAPTHUOCService = new NHAPTHUOCFactory();
                NHAPTHUOC        nhapthuoc        = NHAPTHUOCService.GetAllEntities().ToList()
                                                    .Where(p => p.ID == a.NHAPTHUOCID)
                                                    .FirstOrDefault();
                NHAPTHUOCService.Update(nhapthuoc);
            }
            catch
            {
            }

            return(ans);
        }