Ejemplo n.º 1
0
        public async Task <AssignTelephoneDetailAC> GetAssignedTelephoneById(long id)
        {
            AssignTelephoneDetailAC assignTelephoneDetailAC = new AssignTelephoneDetailAC();

            Telephonenumberallocation telephoneNumberAllocation = await _dbTeleBilling_V01Context.Telephonenumberallocation.Include(x => x.Employee).Include(x => x.TelephoneNumberNavigation).Include(x => x.TelephoneNumberNavigation.Provider).Include(x => x.Employee.Department).FirstAsync(x => x.Id == id);

            assignTelephoneDetailAC = _mapper.Map(telephoneNumberAllocation, assignTelephoneDetailAC);
            assignTelephoneDetailAC.EmployeeData                         = new EmployeeAC();
            assignTelephoneDetailAC.TelephoneNumberData                  = new TelephoneNumberAC();
            assignTelephoneDetailAC.EmployeeData.Department              = telephoneNumberAllocation.Employee.Department.Name;
            assignTelephoneDetailAC.EmployeeData.EmpPfnumber             = telephoneNumberAllocation.EmpPfnumber;
            assignTelephoneDetailAC.EmployeeData.UserId                  = telephoneNumberAllocation.EmployeeId;
            assignTelephoneDetailAC.EmployeeData.FullName                = telephoneNumberAllocation.Employee.FullName;
            assignTelephoneDetailAC.AssignTypeId                         = telephoneNumberAllocation.AssignTypeId;
            assignTelephoneDetailAC.TelephoneNumberData.Id               = telephoneNumberAllocation.TelephoneNumberId;
            assignTelephoneDetailAC.TelephoneNumberData.TelephoneNumber1 = telephoneNumberAllocation.TelephoneNumber;
            assignTelephoneDetailAC.TelephoneNumberData.ProviderId       = telephoneNumberAllocation.TelephoneNumberNavigation.ProviderId;
            assignTelephoneDetailAC.TelephoneNumberData.ProviderName     = telephoneNumberAllocation.TelephoneNumberNavigation.Provider.Name;


            List <Telephonenumberallocationpackage> telePhoneNumberAllocationPackages = await _dbTeleBilling_V01Context.Telephonenumberallocationpackage.Where(x => x.TelephoneNumberAllocationId == telephoneNumberAllocation.Id && !x.IsDelete).ToListAsync();

            assignTelephoneDetailAC.TelePhonePackageDetails = _mapper.Map <List <TelePhonePackageDetails> >(telePhoneNumberAllocationPackages);

            return(assignTelephoneDetailAC);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> EditAssignedTelephone(AssignTelephoneDetailAC assignTelephoneDetailAC)
        {
            string userId   = HttpContext.User.Claims.FirstOrDefault(c => c.Type == "user_id").Value;
            string fullname = HttpContext.User.Claims.FirstOrDefault(c => c.Type == "fullname").Value;

            return(Ok(await _iTelephoneRepository.UpdateAssignedTelephone(Convert.ToInt64(userId), assignTelephoneDetailAC, fullname)));
        }
Ejemplo n.º 3
0
        public async Task <ResponseAC> UpdateAssignedTelephone(long userId, AssignTelephoneDetailAC assignTelephoneDetailAC, string loginUserName)
        {
            ResponseAC responseAC = new ResponseAC();
            Telephonenumberallocation telephoneNumberAllocation = await _dbTeleBilling_V01Context.Telephonenumberallocation.FirstAsync(x => x.Id == assignTelephoneDetailAC.Id);

            #region Transaction Log Entry
            if (telephoneNumberAllocation.TransactionId == null)
            {
                telephoneNumberAllocation.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();
            }

            var jsonSerailzeObj = JsonConvert.SerializeObject(telephoneNumberAllocation);
            await _iLogManagement.SaveRequestTraseLog(Convert.ToInt64(telephoneNumberAllocation.TransactionId), userId, Convert.ToInt64(EnumList.TransactionTraseLog.UpdateRecord), jsonSerailzeObj);

            #endregion

            telephoneNumberAllocation             = _mapper.Map(assignTelephoneDetailAC, telephoneNumberAllocation);
            telephoneNumberAllocation.UpdatedBy   = userId;
            telephoneNumberAllocation.UpdatedDate = DateTime.Now;

            _dbTeleBilling_V01Context.Update(telephoneNumberAllocation);
            await _dbTeleBilling_V01Context.SaveChangesAsync();

            List <Telephonenumberallocationpackage> telePhoneNumberAllocationPackages = await _dbTeleBilling_V01Context.Telephonenumberallocationpackage.Where(x => x.TelephoneNumberAllocationId == telephoneNumberAllocation.Id && !x.IsDelete).ToListAsync();

            foreach (var item in telePhoneNumberAllocationPackages)
            {
                item.IsDelete    = true;
                item.UpdatedBy   = userId;
                item.UpdatedDate = DateTime.Now;
            }

            _dbTeleBilling_V01Context.UpdateRange(telePhoneNumberAllocationPackages);
            _dbTeleBilling_V01Context.SaveChanges();

            #region Update Packages
            telePhoneNumberAllocationPackages = new List <Telephonenumberallocationpackage>();
            foreach (var item in assignTelephoneDetailAC.TelePhonePackageDetails)
            {
                Telephonenumberallocationpackage telePhoneNumberAllocationPackage = new Telephonenumberallocationpackage();
                telePhoneNumberAllocationPackage.PackageId = item.PackageId;
                telePhoneNumberAllocationPackage.ServiceId = item.ServiceId;
                telePhoneNumberAllocationPackage.StartDate = item.StartDate.AddDays(1);
                telePhoneNumberAllocationPackage.EndDate   = item.EndDate.AddDays(1);
                telePhoneNumberAllocationPackage.TelephoneNumberAllocationId = telephoneNumberAllocation.Id;
                telePhoneNumberAllocationPackages.Add(telePhoneNumberAllocationPackage);
            }
            await _dbTeleBilling_V01Context.AddRangeAsync(telePhoneNumberAllocationPackages);

            await _dbTeleBilling_V01Context.SaveChangesAsync();

            #endregion

            await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.EditAssignTelephone, loginUserName, userId, "Assign Telephone(" + telephoneNumberAllocation.TelephoneNumber + ")", (int)EnumList.ActionTemplateTypes.Edit, telephoneNumberAllocation.Id);

            responseAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
            responseAC.Message    = _iStringConstant.AssignedTelePhoneEditSuccessfully;
            return(responseAC);
        }
Ejemplo n.º 4
0
        public async Task <ResponseAC> AddAssignedTelephone(long userId, AssignTelephoneDetailAC assignTelephoneDetailAC, string loginUserName)
        {
            ResponseAC responseAC = new ResponseAC();

            try
            {
                Telephonenumberallocation telephoneNumberAllocation = _mapper.Map <Telephonenumberallocation>(assignTelephoneDetailAC);
                telephoneNumberAllocation.CreatedBy     = userId;
                telephoneNumberAllocation.CreatedDate   = DateTime.Now;
                telephoneNumberAllocation.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();
                telephoneNumberAllocation.IsActive      = true;
                await _dbTeleBilling_V01Context.AddAsync(telephoneNumberAllocation);

                await _dbTeleBilling_V01Context.SaveChangesAsync();

                List <Telephonenumberallocationpackage> telePhoneNumberAllocationPackages = new List <Telephonenumberallocationpackage>();
                foreach (var item in assignTelephoneDetailAC.TelePhonePackageDetails)
                {
                    Telephonenumberallocationpackage telePhoneNumberAllocationPackage = new Telephonenumberallocationpackage();
                    telePhoneNumberAllocationPackage.PackageId = item.PackageId;
                    telePhoneNumberAllocationPackage.ServiceId = item.ServiceId;
                    telePhoneNumberAllocationPackage.StartDate = item.StartDate.AddDays(1);
                    telePhoneNumberAllocationPackage.EndDate   = item.EndDate.AddDays(1);
                    telePhoneNumberAllocationPackage.TelephoneNumberAllocationId = telephoneNumberAllocation.Id;
                    telePhoneNumberAllocationPackages.Add(telePhoneNumberAllocationPackage);
                }

                await _dbTeleBilling_V01Context.AddRangeAsync(telePhoneNumberAllocationPackages);

                await _dbTeleBilling_V01Context.SaveChangesAsync();

                await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.AssignTelephone, loginUserName, userId, "Assign Telephone(" + telephoneNumberAllocation.TelephoneNumber + ")", (int)EnumList.ActionTemplateTypes.Assign, telephoneNumberAllocation.Id);

                responseAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
                responseAC.Message    = _iStringConstant.TelephoneAssignedSuccessfully;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(responseAC);
        }