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>
        /// Insert new NHAPTHUOC
        /// </summary>
        /// <param name="businessObject">NHAPTHUOC object</param>
        /// <returns>true for successfully saved</returns>
        public bool Insert(NHAPTHUOC businessObject)
        {
            if (!businessObject.IsValid)
            {
                businessObject.ShowErrorMessage();//throw new InvalidBusinessObjectException(businessObject.BrokenRulesList.ToString());
            }


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

            try
            {
                CHITIETNHAPFactory CHITIETNHAPService = new CHITIETNHAPFactory();
                businessObject.TONGTIEN = CHITIETNHAPService.GetAllEntities().ToList()
                                          .Where(p => p.NHAPTHUOCID == businessObject.ID)
                                          .Sum(p => p.THANHTIEN)
                                          .Value;
            }
            catch
            {
            }

            return(_dataObject.Update(businessObject));
        }
Exemple #4
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);
        }