public async Task <ResponseAC> AddRole(RoleAC roleAC, long userId, string loginUserName)
        {
            ResponseAC responeAC = new ResponseAC();

            if (!await _dbTeleBilling_V01Context.MstRole.AnyAsync(x => x.RoleName.ToLower() == roleAC.RoleName.Trim().ToLower() && !x.IsDelete))
            {
                MstRole mstRole = new MstRole();
                mstRole.IsActive      = true;
                mstRole.RoleName      = roleAC.RoleName.Trim();
                mstRole.CreatedBy     = userId;
                mstRole.CreatedDate   = DateTime.Now;
                mstRole.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();
                try
                {
                    await _dbTeleBilling_V01Context.AddAsync(mstRole);

                    await _dbTeleBilling_V01Context.SaveChangesAsync();

                    await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.AddRole, loginUserName, userId, "Role(" + roleAC.RoleName.Trim() + ")", (int)EnumList.ActionTemplateTypes.Add, mstRole.RoleId);
                }
                catch (Exception e)
                {
                    throw e;
                }
                responeAC.Message    = _iStringConstant.RoleAddedSuccessfully;
                responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
            }
            else
            {
                responeAC.Message    = _iStringConstant.RoleExists;
                responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Error);
            }
            return(responeAC);
        }
Example #2
0
        public async Task <ResponseAC> AddTemplate(long userId, TemplateDetailAC templateDetailAC, string loginUserName)
        {
            ResponseAC responseAC = new ResponseAC();

            if (await _dbTeleBilling_V01Context.Emailtemplate.FirstOrDefaultAsync(x => x.EmailTemplateTypeId == templateDetailAC.EmailTemplateTypeId) == null)
            {
                Emailtemplate emailTemplate = _mapper.Map <Emailtemplate>(templateDetailAC);
                emailTemplate.CreatedBy     = userId;
                emailTemplate.CreatedDate   = DateTime.Now;
                emailTemplate.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();
                await _dbTeleBilling_V01Context.AddAsync(emailTemplate);

                await _dbTeleBilling_V01Context.SaveChangesAsync();

                responseAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
                responseAC.Message    = _iStringConstant.TemplateAddedSuccessfully;

                await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.AddEmailTemplate, loginUserName, userId, "Email template(" + emailTemplate.Subject + ")", (int)EnumList.ActionTemplateTypes.Add, emailTemplate.Id);
            }
            else
            {
                responseAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Error);
                responseAC.Message    = _iStringConstant.TemplateTypeAlreadyExists;
            }
            return(responseAC);
        }
        public async Task <ResponseAC> EditHandset(HandsetDetailAC handsetDetailAC, long userId)
        {
            ResponseAC responeAC = new ResponseAC();

            if (!await _dbTeleBilling_V01Context.MstHandsetdetail.AnyAsync(x => x.Id != handsetDetailAC.Id && x.Name.ToLower().Trim() == handsetDetailAC.Name.Trim().ToLower() && !x.IsDelete))
            {
                MstHandsetdetail mstHandsetDetail = await _dbTeleBilling_V01Context.MstHandsetdetail.FirstOrDefaultAsync(x => x.Id == handsetDetailAC.Id && !x.IsDelete);

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

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

                #endregion

                mstHandsetDetail.Name        = handsetDetailAC.Name.Trim();
                mstHandsetDetail.UpdatedBy   = userId;
                mstHandsetDetail.UpdatedDate = DateTime.Now;
                _dbTeleBilling_V01Context.Update(mstHandsetDetail);
                await _dbTeleBilling_V01Context.SaveChangesAsync();

                responeAC.Message    = _iStringConstant.HandsetUpdateSuccessfully;
                responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
            }
            else
            {
                responeAC.Message    = _iStringConstant.HandsetAlreadyExists;
                responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Error);
            }
            return(responeAC);
        }
Example #4
0
        public async Task <bool> SaveRequestTraseLog(long TransactionId, long Addedby, long actionId = 0, string description = null)
        {
            bool            result     = false;
            Requesttracelog requestlog = new Requesttracelog();

            try
            {
                requestlog.TransactionId = TransactionId;
                requestlog.CreatedById   = Addedby;

                //requestlog.IsMobile = HttpContext.Current.Request.Browser.IsMobileDevice;
                //requestlog.Browser = HttpContext.Current.Request.Browser.Browser;

                requestlog.CreatedDate = DateTime.Now;
                requestlog.ActionId    = actionId;
                requestlog.Description = description;
                await _dbTeleBilling_V01Context.AddAsync(requestlog);

                await _dbTeleBilling_V01Context.SaveChangesAsync();

                result = true;
            }
            catch (Exception)
            {
                result = false;
            }
            return(result);
        }
Example #5
0
        public async Task <ResponseAC> AddPackage(long userId, PackageDetailAC packageDetailAC, string loginUserName)
        {
            ResponseAC responseAC = new ResponseAC();

            if (!await _dbTeleBilling_V01Context.Providerpackage.AnyAsync(x => x.Name.ToLower() == packageDetailAC.Name.ToLower() && !x.IsDelete))
            {
                Providerpackage providerPackage = new Providerpackage();
                providerPackage               = _mapper.Map <Providerpackage>(packageDetailAC);
                providerPackage.CreatedBy     = userId;
                providerPackage.IsActive      = true;
                providerPackage.CreatedDate   = DateTime.Now;
                providerPackage.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();

                await _dbTeleBilling_V01Context.AddAsync(providerPackage);

                await _dbTeleBilling_V01Context.SaveChangesAsync();

                await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.AddPackage, loginUserName, userId, "Package(" + providerPackage.Name + ")", (int)EnumList.ActionTemplateTypes.Add, providerPackage.Id);

                responseAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
                responseAC.Message    = _iStringConstant.PackageAddedSuccessfully;
            }
            else
            {
                responseAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Error);
                responseAC.Message    = _iStringConstant.PackageAlreadyExists;
            }
            return(responseAC);
        }
Example #6
0
        private bool SaveRequestTraseLog(long TransactionId, long Addedby, long actionId = 0, string description = null)
        {
            bool            result     = false;
            Requesttracelog requestlog = new Requesttracelog();

            try
            {
                using (var _dbTeleBillingContext = new telebilling_v01Context())
                {
                    requestlog.TransactionId = TransactionId;
                    requestlog.CreatedById   = Addedby;

                    requestlog.CreatedDate = DateTime.Now;
                    requestlog.ActionId    = actionId;
                    requestlog.Description = description;

                    _dbTeleBillingContext.AddAsync(requestlog);
                    _dbTeleBillingContext.SaveChangesAsync();
                }
                result = true;
            }
            catch (Exception)
            {
                result = false;
            }
            return(result);
        }
        public async Task <ResponseAC> AddProvider(long userId, ProviderAC providerAC, string loginUserName)
        {
            ResponseAC responeAC = new ResponseAC();

            if (!await _dbTeleBilling_V01Context.Provider.AnyAsync(x => x.ContractNumber.ToLower() == providerAC.ContractNumber.ToLower() && !x.IsDelete))
            {
                TeleBillingUtility.Models.Provider provider = new TeleBillingUtility.Models.Provider();
                provider               = _mapper.Map <TeleBillingUtility.Models.Provider>(providerAC);
                provider.IsActive      = true;
                provider.CreatedDate   = DateTime.Now;
                provider.CreatedBy     = userId;
                provider.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();

                await _dbTeleBilling_V01Context.AddAsync(provider);

                await _dbTeleBilling_V01Context.SaveChangesAsync();


                foreach (var serviceType in providerAC.ServiceTypes)
                {
                    Providerservice providerService = new Providerservice();
                    providerService.ProviderId    = provider.Id;
                    providerService.ServiceTypeId = serviceType.Id;
                    await _dbTeleBilling_V01Context.AddAsync(providerService);

                    await _dbTeleBilling_V01Context.SaveChangesAsync();
                }

                #region Added Provider Contact Detail
                List <Providercontactdetail> providerContactDetails = new List <Providercontactdetail>();
                foreach (var item in providerAC.ProviderContactDetailACList)
                {
                    Providercontactdetail providerContectDatail = new Providercontactdetail();
                    providerContectDatail            = _mapper.Map <Providercontactdetail>(item);
                    providerContectDatail.ProviderId = provider.Id;
                    providerContactDetails.Add(providerContectDatail);
                }

                await _dbTeleBilling_V01Context.AddRangeAsync(providerContactDetails);

                await _dbTeleBilling_V01Context.SaveChangesAsync();

                #endregion

                await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.AddProvider, loginUserName, userId, "Provider(" + provider.Name + ")", (int)EnumList.ActionTemplateTypes.Add, provider.Id);

                responeAC.Message    = _iStringConstant.ProviderAddedSuccessfully;
                responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
            }
            else
            {
                responeAC.Message    = _iStringConstant.ContractNumberExists;
                responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Error);
            }
            return(responeAC);
        }
        public async Task <ResponseAC> resetPassword(EmployeeProfileDetailAC employeeProfileDetailAC, long userId)
        {
            ResponseAC  responeAC   = new ResponseAC();
            MstEmployee mstEmployee = new MstEmployee();

            try
            {
                mstEmployee = await _dbTeleBilling_V01Context.MstEmployee.FindAsync(employeeProfileDetailAC.UserId);

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

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

                    #endregion

                    mstEmployee.Password    = employeeProfileDetailAC.NewPassword;
                    mstEmployee.UpdatedBy   = userId;
                    mstEmployee.UpdatedDate = DateTime.Now;

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

                    responeAC.Message    = "Password Reset Successfully";
                    responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
                    await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.ResetPassword, mstEmployee.FullName, userId, string.Empty, (int)EnumList.ActionTemplateTypes.ResetPassword, mstEmployee.UserId);
                }
                else
                {
                    responeAC.Message    = "Employee does not found";
                    responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Error);
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(responeAC);
        }
Example #9
0
        public async Task <ResponseAC> AddOperatorCallLog(long userId, OperatorCallLogDetailAC operatorCallLogDetailAC, string loginUserName)
        {
            ResponseAC      response     = new ResponseAC();
            Operatorcalllog operatorCall = _mapper.Map <Operatorcalllog>(operatorCallLogDetailAC);

            operatorCall.CreatedBy     = userId;
            operatorCall.CreatedDate   = DateTime.Now;
            operatorCall.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();
            await _dbTeleBilling_V01Context.AddAsync(operatorCall);

            await _dbTeleBilling_V01Context.SaveChangesAsync();

            await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.AddOperatorCallLog, loginUserName, userId, "Operator call log(Dialed Number:" + operatorCall.DialedNumber + "Extensino Number:" + operatorCall.ExtensionNumber + ")", (int)EnumList.ActionTemplateTypes.Add, operatorCall.Id);

            response.Message    = _iStringConstant.OperatorCallLogAddedSuccessfully;
            response.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
            return(response);
        }
Example #10
0
        public async Task <ResponseAC> EditDelegate(BillDelegatesAC billDelegatesAC, long userId, string loginUserName)
        {
            ResponseAC responeAC = new ResponseAC();

            if (await _dbTeleBilling_V01Context.Billdelegate.FirstOrDefaultAsync(x => x.Id != billDelegatesAC.Id && x.EmployeeId == billDelegatesAC.Employee.UserId && x.DelegateEmployeeId == billDelegatesAC.DelegateEmployee.UserId && !x.IsDelete) == null)
            {
                TeleBillingUtility.Models.Billdelegate delegateDetail = await _dbTeleBilling_V01Context.Billdelegate.FirstOrDefaultAsync(x => x.Id == billDelegatesAC.Id && !x.IsDelete);

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

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

                #endregion

                delegateDetail.EmployeeId              = billDelegatesAC.Employee.UserId;
                delegateDetail.DelegateEmployeeId      = billDelegatesAC.DelegateEmployee.UserId;
                delegateDetail.AllowBillApproval       = billDelegatesAC.AllowBillApproval;
                delegateDetail.AllowBillIdentification = billDelegatesAC.AllowBillIdentification;
                delegateDetail.UpdatedBy   = userId;
                delegateDetail.UpdatedDate = DateTime.Now;

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

                responeAC.Message    = _iStringConstant.DelegateUpdateSuccessfully;
                responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
                await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.EditDelegate, loginUserName, userId, "Delegate user", (int)EnumList.ActionTemplateTypes.Edit, delegateDetail.Id);
            }
            else
            {
                responeAC.Message    = _iStringConstant.DelegateAlreadyExists;
                responeAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Error);
            }
            return(responeAC);
        }
Example #11
0
        //public async Task<List<NotificationAC>> GetAllNotifications(long userId)
        //{
        //	List<NotificationAC> notificationACs = new List<NotificationAC>();
        //	MstEmployee mstEmployee = await _dbTeleBilling_V01Context.MstEmployee.FirstAsync(x => x.UserId == userId);
        //	if (!string.IsNullOrEmpty(mstEmployee.EmailId))
        //	{
        //		List<Emailreminderlog> emailreminderlogs = await _dbTeleBilling_V01Context.Emailreminderlog.Where(x => !x.IsReadNotification && x.EmailTo.Trim().ToLower() == mstEmployee.EmailId.ToLower().Trim()).Include(x => x.Template).OrderBy(x => x.CreatedDateInt).ToListAsync();
        //		if (emailreminderlogs.Any()) {
        //			foreach(var item in emailreminderlogs)
        //			{
        //				item.IsReadNotification = true;
        //			}
        //			_dbTeleBilling_V01Context.UpdateRange(emailreminderlogs);
        //			await _dbTeleBilling_V01Context.SaveChangesAsync();

        //			notificationACs = _mapper.Map<List<NotificationAC>>(emailreminderlogs);
        //		}
        //	}
        //	return notificationACs;
        //}

        //public async Task<long> ReadNotification(long id) {
        //	Emailreminderlog emailreminderlog = await _dbTeleBilling_V01Context.Emailreminderlog.Where(x=>x.Id == id).Include(x=>x.EmployeeBill).Include(x=>x.EmployeeBill.Employee).FirstAsync();
        //	emailreminderlog.IsReadNotification = true;
        //	_dbTeleBilling_V01Context.Update(emailreminderlog);
        //	await _dbTeleBilling_V01Context.SaveChangesAsync();
        //	return 0;
        //}

        public async Task <bool> ReadAllNotification(long userId)
        {
            List <Notificationlog> notificationlogs = await _dbTeleBilling_V01Context.Notificationlog.Where(x => x.UserId == userId && x.IsReadNotification == false).ToListAsync();

            if (notificationlogs.Any())
            {
                foreach (var item in notificationlogs)
                {
                    item.IsReadNotification = true;
                }
                _dbTeleBilling_V01Context.UpdateRange(notificationlogs);
                await _dbTeleBilling_V01Context.SaveChangesAsync();
            }
            return(true);
        }
        public async Task <ResponseAC> AddConfiguration(long userId, TeleBillingUtility.Models.Configuration configuration, string loginUserName)
        {
            ResponseAC responseAC = new ResponseAC();

            if (configuration.Id == 0)
            {
                configuration.CreatedBy     = 1;
                configuration.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();
                configuration.CreatedDate   = DateTime.Now;
                await _dbTeleBilling_V01Context.AddAsync(configuration);

                await _dbTeleBilling_V01Context.SaveChangesAsync();

                responseAC.Message = _iStringConstant.ConfigurationAddedSuccessfully;
            }
            else
            {
                TeleBillingUtility.Models.Configuration configurationObj = await _dbTeleBilling_V01Context.Configuration.FirstAsync(x => x.Id == configuration.Id);

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

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

                #endregion
                configurationObj             = _mapper.Map(configuration, configurationObj);
                configurationObj.UpdatedBy   = 1;
                configurationObj.UpdatedDate = DateTime.Now;

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

                responseAC.Message = _iStringConstant.ConfigurationUpdateSuccessfully;
            }
            responseAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);
            await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.UpdateReminderNotificaiton, loginUserName, userId, "Reminder & notification", (int)EnumList.ActionTemplateTypes.ReminderNotificaiton, configuration.Id);

            return(responseAC);
        }
Example #13
0
        public async Task AddedReminderNotificationLog(long emailTemplateTypeId, long?employeeBillId, bool isReminderMail, string emailTo)
        {
            Emailtemplate emailTemplate = await _dbTeleBilling_V01Context.Emailtemplate.FirstOrDefaultAsync(x => x.EmailTemplateTypeId == emailTemplateTypeId);

            if (emailTemplate != null)
            {
                Emailreminderlog newEmailReminderLog = new Emailreminderlog();
                newEmailReminderLog.CreatedDate    = DateTime.Now;
                newEmailReminderLog.IsReminderMail = isReminderMail;
                newEmailReminderLog.TemplateId     = emailTemplate.Id;
                newEmailReminderLog.EmployeeBillId = employeeBillId;
                newEmailReminderLog.EmailTo        = emailTo != null ? emailTo : string.Empty;

                await _dbTeleBilling_V01Context.AddAsync(newEmailReminderLog);

                await _dbTeleBilling_V01Context.SaveChangesAsync();
            }
        }
        public async Task <ResponseAC> AddTelephone(long userId, TelephoneDetailAC telephoneDetailAC, string loginUserName)
        {
            ResponseAC responseAC = new ResponseAC();

            if (!await _dbTeleBilling_V01Context.Telephonenumber.AnyAsync(x => x.TelephoneNumber1.Trim() == telephoneDetailAC.TelephoneNumber1.Trim() && !x.IsDelete))
            {
                Telephonenumber telephoneNumber = _mapper.Map <Telephonenumber>(telephoneDetailAC);
                telephoneNumber.CreatedBy     = userId;
                telephoneNumber.CreatedDate   = DateTime.Now;
                telephoneNumber.IsActive      = true;
                telephoneNumber.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();

                await _dbTeleBilling_V01Context.AddAsync(telephoneNumber);

                await _dbTeleBilling_V01Context.SaveChangesAsync();

                await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.AddTelephone, loginUserName, userId, "Telephone(" + telephoneNumber.TelephoneNumber1 + ")", (int)EnumList.ActionTemplateTypes.Add, telephoneNumber.Id);

                responseAC.StatusCode = Convert.ToInt32(EnumList.ResponseType.Success);
                responseAC.Message    = _iStringConstant.TelphoneAddedSuccessfully;
            }
            else
            {
                responseAC.StatusCode = Convert.ToInt32(EnumList.ResponseType.Error);
                responseAC.Message    = _iStringConstant.TelphoneAlreadyExists;
            }
            return(responseAC);
        }
        public async Task <bool> DeleteExcelMapping(long userId, long id, string loginUserName)
        {
            Mappingexcel mappingExcel = await _dbTeleBilling_V01Context.Mappingexcel.FirstOrDefaultAsync(x => x.Id == id);

            List <Mappingexcel> mappingExcelMerge = new List <Mappingexcel>();

            mappingExcelMerge = await _dbTeleBilling_V01Context.Mappingexcel.Where(x => x.MappedMappingId == id && x.IsCommonMapped == true).ToListAsync();

            if (mappingExcelMerge != null)
            {
                _dbTeleBilling_V01Context.RemoveRange(mappingExcelMerge);
                await _dbTeleBilling_V01Context.SaveChangesAsync();
            }


            if (mappingExcel != null)
            {
                mappingExcel.IsDelete    = true;
                mappingExcel.UpdatedBy   = userId;
                mappingExcel.UpdatedDate = DateTime.Now;
                _dbTeleBilling_V01Context.Update(mappingExcel);
                await _dbTeleBilling_V01Context.SaveChangesAsync();

                List <Mappingexcelcolumn> excelcolumnlst = new List <Mappingexcelcolumn>();
                excelcolumnlst = await _dbTeleBilling_V01Context.Mappingexcelcolumn.Where(x => x.MappingExcelId == mappingExcel.Id).ToListAsync();

                if (excelcolumnlst != null)
                {
                    _dbTeleBilling_V01Context.RemoveRange(excelcolumnlst);
                    await _dbTeleBilling_V01Context.SaveChangesAsync();
                }
                await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.DeleteExcelMapping, loginUserName, userId, "Excel mapping", (int)EnumList.ActionTemplateTypes.Delete, mappingExcel.Id);

                return(true);
            }
            return(false);
        }
        public async Task <ResponseAC> AddMemo(MemoAC memoAC, long userId, string loginUserName)
        {
            ResponseAC responseAC = new ResponseAC();
            Memo       memo       = _mapper.Map <Memo>(memoAC);

            memo.Id            = 0;
            memo.CreatedBy     = userId;
            memo.CreatedDate   = DateTime.Now;
            memo.TransactionId = _iLogManagement.GenerateTeleBillingTransctionID();
            memo.RefrenceNo    = memoAC.ProviderName + "/INV/" + memoAC.Month + "/" + memo.Year;
            _dbTeleBilling_V01Context.Add(memo);
            await _dbTeleBilling_V01Context.SaveChangesAsync();

            List <Memobills>  billMemos   = new List <Memobills>();
            List <Billmaster> billMasters = new List <Billmaster>();

            foreach (long item in memoAC.BillIds)
            {
                Memobills memoBill = new Memobills();
                memoBill.BillId        = item;
                memoBill.MemoId        = memo.Id;
                memoBill.TransactionId = memo.TransactionId;
                memoBill.CreatedBy     = userId;
                memoBill.CreatedDate   = DateTime.Now;
                billMemos.Add(memoBill);

                Billmaster billMaster = await _dbTeleBilling_V01Context.Billmaster.FirstOrDefaultAsync(x => x.Id == item);

                billMaster.UpdatedBy    = userId;
                billMaster.BillStatusId = Convert.ToInt16(EnumList.BillStatus.MemoCreated);
                billMaster.UpdatedDate  = DateTime.Now;
                billMasters.Add(billMaster);
            }

            if (billMemos.Any())
            {
                await _dbTeleBilling_V01Context.AddRangeAsync(billMemos);

                await _dbTeleBilling_V01Context.SaveChangesAsync();
            }


            if (billMasters.Any())
            {
                _dbTeleBilling_V01Context.UpdateRange(billMasters);
                await _dbTeleBilling_V01Context.SaveChangesAsync();

                memo = await _dbTeleBilling_V01Context.Memo.Where(x => x.Id == memo.Id && !x.IsDelete).Include(x => x.Provider).FirstOrDefaultAsync();

                #region Send Mail For Create Memo
                TeleBillingUtility.Models.Configuration configuration = await _dbTeleBilling_V01Context.Configuration.FirstOrDefaultAsync();

                List <MstEmployee> mstEmployees = await _dbTeleBilling_V01Context.MstEmployee.Where(x => !x.IsDelete && x.IsActive && x.IsPresidentOffice).ToListAsync();

                if (configuration != null && configuration.NSendMemo)
                {
                    foreach (var item in billMasters)
                    {
                        if (mstEmployees.Any())
                        {
                            foreach (var employee in mstEmployees)
                            {
                                if (!string.IsNullOrEmpty(employee.EmailId))
                                {
                                    Emailtemplate emailTemplate = new Emailtemplate();
                                    Dictionary <string, string> replacements = new Dictionary <string, string>();
                                    EnumList.Month month = (EnumList.Month)item.BillMonth;

                                    replacements.Add("{BillMonth}", month.ToString());
                                    replacements.Add("{BillYear}", item.BillYear.ToString());
                                    replacements.Add("{RefrenceNo}", memo.RefrenceNo);
                                    replacements.Add("{newEmpName}", employee.FullName);
                                    replacements.Add("{MemoSubject}", memo.Subject);
                                    replacements.Add("{BillNumber}", item.BillNumber);
                                    replacements.Add("{BillAmount}", memo.TotalAmount.ToString());
                                    replacements.Add("{Provider}", memo.Provider.Name);

                                    if (await _iEmailSender.SendEmail(Convert.ToInt64(EnumList.EmailTemplateType.SendMemo), replacements, employee.EmailId))
                                    {
                                        await _iEmailSender.AddedReminderNotificationLog(Convert.ToInt64(EnumList.EmailTemplateType.SendMemo), null, false, employee.EmailId);
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion


                #region Notification For Memo
                List <Notificationlog> notificationlogs = new List <Notificationlog>();
                if (mstEmployees.Any())
                {
                    foreach (var item in mstEmployees)
                    {
                        notificationlogs.Add(_iLogManagement.GenerateNotificationObject(item.UserId, userId, Convert.ToInt16(EnumList.NotificationType.SendMemo), memo.Id));
                    }
                    await _iLogManagement.SaveNotificationList(notificationlogs);
                }
                #endregion
            }

            await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.AddMemo, loginUserName, userId, "Memo(" + memo.RefrenceNo + ")", (int)EnumList.ActionTemplateTypes.Add, memo.Id);

            responseAC.Message    = _iStringConstant.MemoAddedsuccessfully;
            responseAC.StatusCode = Convert.ToInt16(EnumList.ResponseType.Success);

            return(responseAC);
        }