Пример #1
0
        /// <summary>
        /// This function deleted live lead record from table
        /// </summary>
        /// <param name="emailId">emailId</param>
        public void DeleteLiveLead(string emailId)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var liveLeadRepo =
                        new LiveLeadRepository(new EFRepository <LiveLead>(), unitOfWork);

                    ObjectSet <LiveLead> liveLeadObjSet =
                        ((CurrentDeskClientsEntities)liveLeadRepo.Repository.UnitOfWork.Context).LiveLeads;

                    //Get required live lead row
                    var selectedLiveLead =
                        liveLeadObjSet.Where(liveLead => liveLead.EmailAddress == emailId).FirstOrDefault();

                    liveLeadRepo.Delete(selectedLiveLead);
                    liveLeadRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #2
0
        /// <summary>
        /// This method returns true if passed emailID exists in LiveLead table
        /// </summary>
        /// <param name="emailID">emailID</param>
        /// <param name="organizationID">organizationID</param>
        /// <returns>bool</returns>
        public bool CheckIfEmailExistsInLiveLead(string emailID, int organizationID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var liveLeadRepo =
                        new LiveLeadRepository(new EFRepository <LiveLead>(), unitOfWork);


                    ObjectSet <LiveLead> liveLeadObjSet =
                        ((CurrentDeskClientsEntities)liveLeadRepo.Repository.UnitOfWork.Context).LiveLeads;

                    //Return true if email id exists else false
                    return
                        (liveLeadObjSet.Where(
                             lead => lead.EmailAddress == emailID && lead.FK_OrganizationID == organizationID)
                         .FirstOrDefault() != null
                            ? true
                            : false);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(true);
            }
        }
Пример #3
0
        /// <summary>
        /// This Function Will add new livelead to database
        /// </summary>
        /// <param name="liveLead">liveLead</param>
        /// <returns>bool depending upon result</returns>
        public bool AddNewLiveLead(LiveLead liveLead)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var liveLeadRepo =
                        new LiveLeadRepository(new EFRepository <LiveLead>(), unitOfWork);

                    liveLeadRepo.Add(liveLead);
                    liveLeadRepo.Save();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }