public bool Delete(Int64 Id)
        {
            FloorRentInfoManager       floorInfoManager       = new FloorRentInfoManager();
            BillingReceivedInfoManager billingReceivedManager = new BillingReceivedInfoManager();
            BillingInfoPerMonthManager billingInfoManager     = new BillingInfoPerMonthManager();

            var exist = Repository.GetById(Id);

            exist.UpdatedBy = Log.UserId.ToString();
            exist.UpdatedOn = new LoginInfo().CurrentTime;
            exist.IsActive  = false;
            exist.IsCurrent = false;
            Repository.SaveOrUpdate(exist);


            var floorRentExist       = floorInfoManager.GetAll().Where(x => x.TenantInfoId == Id && x.IsActive).ToList();
            var billingReceivedExist = billingReceivedManager.GetAll().Where(x => x.TenantInfoId == Id && x.IsActive).ToList();
            var billingInfoExist     = billingInfoManager.GetAll().Where(x => x.TenantInfoId == Id && x.IsActive).ToList();

            foreach (var floors in floorRentExist)
            {
                var existFloor = floorInfoManager.GetById(floors.Id);
                floors.IsActive  = false;
                floors.IsCurrent = false;
                floors.UpdatedBy = Log.UserId.ToString();
                floors.UpdatedOn = new LoginInfo().CurrentTime;


                floorInfoManager.SaveOrUpdateDelete(existFloor);
            }

            foreach (var billingReceive in billingReceivedExist)
            {
                var existBillingReceive = billingReceivedManager.GetById(billingReceive.Id);

                billingReceive.IsActive  = false;
                billingReceive.UpdatedBy = Log.UserId.ToString();
                billingReceive.UpdatedOn = new LoginInfo().CurrentTime;


                billingReceivedManager.SaveOrUpdateDelete(existBillingReceive);
            }


            foreach (var billingInfo in billingInfoExist)
            {
                var existBillingInfo = billingInfoManager.GetById(billingInfo.Id);

                billingInfo.IsActive  = false;
                billingInfo.UpdatedBy = Log.UserId.ToString();
                billingInfo.UpdatedOn = new LoginInfo().CurrentTime;


                billingInfoManager.SaveOrUpdateDelete(existBillingInfo);
            }


            return(Repository.Done());
        }
        public bool Delete(Int64 Id)
        {
            BillingReceivedInfoManager billingReceivedManager = new BillingReceivedInfoManager();
            BillingInfoPerMonthManager billingInfoManager     = new BillingInfoPerMonthManager();

            var exist = Repository.GetById(Id);

            var multipleFloorExist = Repository.GetAll().Where(x => x.TenantInfoId == exist.TenantInfoId && x.IsActive && x.IsCurrent).ToList();

            exist.UpdatedBy = Log.UserId.ToString();
            exist.UpdatedOn = new LoginInfo().CurrentTime;
            exist.IsActive  = false;
            exist.IsCurrent = false;
            Repository.SaveOrUpdate(exist);


            if (multipleFloorExist.Count == 1)
            {
                var billingReceivedExist = billingReceivedManager.GetAll().Where(x => x.TenantInfoId == exist.TenantInfoId && x.IsActive).ToList();
                var billingInfoExist     = billingInfoManager.GetAll().Where(x => x.TenantInfoId == exist.TenantInfoId && x.IsActive).ToList();


                foreach (var billingReceive in billingReceivedExist)
                {
                    var existBillingReceive = billingReceivedManager.GetById(billingReceive.Id);

                    billingReceive.IsActive  = false;
                    billingReceive.UpdatedBy = Log.UserId.ToString();
                    billingReceive.UpdatedOn = new LoginInfo().CurrentTime;


                    billingReceivedManager.SaveOrUpdateDelete(existBillingReceive);
                }


                foreach (var billingInfo in billingInfoExist)
                {
                    var existBillingInfo = billingInfoManager.GetById(billingInfo.Id);

                    billingInfo.IsActive  = false;
                    billingInfo.UpdatedBy = Log.UserId.ToString();
                    billingInfo.UpdatedOn = new LoginInfo().CurrentTime;


                    billingInfoManager.SaveOrUpdateDelete(existBillingInfo);
                }
            }

            else
            {
                var TotalRent   = (exist.RentSpaceSFT * exist.SftRate);
                var TotalAIT    = (TotalRent * exist.LessAITPercent) / 100;
                var CurrentDues = TotalRent - TotalAIT - exist.AdvancePay;
                var CommonDues  = (exist.RentSpaceSFT * exist.CommonBillRateSFT);


                var billingInfoExist = billingInfoManager.GetAll().Where(x => x.TenantInfoId == exist.TenantInfoId && x.IsActive).FirstOrDefault();

                var existBillingInfo = billingInfoManager.GetById(billingInfoExist.Id);

                existBillingInfo.IsActive  = true;
                existBillingInfo.UpdatedBy = Log.UserId.ToString();
                existBillingInfo.UpdatedOn = new LoginInfo().CurrentTime;

                existBillingInfo.CurrentDuesRent = existBillingInfo.CurrentDuesRent - CurrentDues;
                existBillingInfo.CurrentDuesRent = Math.Abs(existBillingInfo.CurrentDuesRent);

                existBillingInfo.CurrentDuesCommon = existBillingInfo.CurrentDuesCommon - CommonDues;
                existBillingInfo.CurrentDuesCommon = Math.Abs(existBillingInfo.CurrentDuesCommon);

                billingInfoManager.SaveOrUpdateDelete(existBillingInfo);
            }


            return(Repository.Done());
        }