public void Save(CustVisitActivityModel entity)
        {
            objCustVisitActivity = new CRM_CustVisitActivityRepository();

            Mapper.CreateMap<CustVisitActivityModel, CRM_CustVisitActivity>();

            CRM_CustVisitActivity objSave = new CRM_CustVisitActivity();

            objSave = Mapper.Map(entity, objSave);

            objCustVisitActivity.Add(objSave);
        }
        public CustVisitActivityModel getByID(DateTime visitDate, string customerID, string createdBy)
        {
            Mapper.CreateMap<CRM_CustVisitActivity, CustVisitActivityModel>();
            objCustVisitActivity = new CRM_CustVisitActivityRepository();

            CRM_CustVisitActivity objEntity = objCustVisitActivity.GetSingle(v => v.VisitedDate == visitDate && v.CustomerID == customerID && v.CreatedBy == createdBy);

            CustVisitActivityModel objResult = new CustVisitActivityModel();

            objResult = Mapper.Map(objEntity, objResult);

            return objResult;
        }
        public void Delete(CustVisitActivityModel entity)
        {
            objCustVisitActivity = new CRM_CustVisitActivityRepository();

            if (objCustVisitActivity.GetAll(v => v.VisitedDate == entity.VisitedDate && v.CustomerID == entity.CustomerID
                && v.CreatedBy == entity.CreatedBy).Count() > 0)
            {
                CRM_CustVisitActivity deleteRecord = objCustVisitActivity.GetSingle(v => v.VisitedDate == entity.VisitedDate && v.CustomerID == entity.CustomerID
                && v.CreatedBy == entity.CreatedBy);

                objCustVisitActivity.Delete(deleteRecord);
            }
        }
        public IList<CustVisitActivityModel> getAll()
        {
            objCustVisitActivity = new CRM_CustVisitActivityRepository();

            Mapper.CreateMap<CRM_CustVisitActivity, CustVisitActivityModel>();

            IList<CRM_CustVisitActivity> objEntity = objCustVisitActivity.GetAll().ToList();

            IList<CustVisitActivityModel> objResult = new List<CustVisitActivityModel>();

            objResult = Mapper.Map(objEntity, objResult);

            return objResult;
        }
        public void Update(CustVisitActivityModel entity)
        {
            objCustVisitActivity = new CRM_CustVisitActivityRepository();

            Mapper.CreateMap<CustVisitActivityModel, CRM_CustVisitActivity>();

            if (objCustVisitActivity.GetAll(v => v.VisitedDate == entity.VisitedDate && v.CustomerID == entity.CustomerID
                && v.CreatedBy == entity.CreatedBy).Count() > 0)
            {
                CRM_CustVisitActivity updateRecord = objCustVisitActivity.GetSingle(v => v.VisitedDate == entity.VisitedDate && v.CustomerID == entity.CustomerID
                && v.CreatedBy == entity.CreatedBy);

                updateRecord = Mapper.Map(entity, updateRecord);

                objCustVisitActivity.Update(updateRecord);
            }
        }