Esempio n. 1
0
 public CustomerGroup(CustomerGroupEntity CustomerGroupEntity) : base(CustomerGroupEntity)
 {
     if (CustomerGroupEntity.CustomerEntities != null)
     {
         this.Customers = new HashSet <Customer>();
         foreach (CustomerEntity CustomerEntity in CustomerGroupEntity.CustomerEntities)
         {
             CustomerEntity.CustomerGroupId = CustomerGroupEntity.Id;
             this.Customers.Add(new Customer(CustomerEntity));
         }
     }
 }
Esempio n. 2
0
        public CustomerGroupEntity Create(EmployeeEntity EmployeeEntity, CustomerGroupEntity CustomerGroupEntity)
        {
            if (CustomerGroupEntity == null)
            {
                throw new NotFoundException();
            }
            CustomerGroup CustomerGroup = new CustomerGroup(CustomerGroupEntity);

            UnitOfWork.CustomerGroupRepository.AddOrUpdate(CustomerGroup);
            UnitOfWork.Complete();
            return(Get(EmployeeEntity, CustomerGroup.Id));
        }
Esempio n. 3
0
 public bool Delete(Guid Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         CustomerGroupEntity _CustomerGroupEntity = new CustomerGroupEntity(Id);
         if (adapter.FetchEntity(_CustomerGroupEntity))
         {
             adapter.DeleteEntity(_CustomerGroupEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
Esempio n. 4
0
        public int CreateOrUpdateCustomerGroup(int StoreId, int LoggedInUserId, CustomerGroupEntity customerGroup)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[4];
                param[0] = new SqlParameter("store_id", StoreId);
                param[1] = new SqlParameter("LoggedInUserId", LoggedInUserId);
                param[2] = new SqlParameter("customer_group_id", customerGroup.customer_group_id);
                param[3] = new SqlParameter("name", customerGroup.name);

                var result = CustomerGroupEntityGenericRepository.ExecuteSQL <int>("EXEC InsertOrUpdateCustomerGroup", param).ToList <int>().FirstOrDefault();



                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 5
0
        public CustomerGroupEntity GetCustomerGroupDetail(int StoreId, int LoggedInUserId = 0, int customerGroupID = 0)
        {
            CustomerGroupEntity CustomerGroupDetail = new CustomerGroupEntity();

            if (customerGroupID > 0)
            {
                try
                {
                    SqlParameter[] param = new SqlParameter[] {
                        new SqlParameter("StoreId", StoreId),
                        new SqlParameter("LoggedInUserId", LoggedInUserId),
                        new SqlParameter("customer_group_id", customerGroupID)
                    };
                    CustomerGroupDetail = CustomerGroupEntityGenericRepository.ExecuteSQL <CustomerGroupEntity>("GetCustomerGroupDetails", param).ToList <CustomerGroupEntity>().FirstOrDefault();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }

            return(CustomerGroupDetail);
        }
Esempio n. 6
0
        public bool Update(Guid Id, string Name, bool IsEnable)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                CustomerGroupEntity _CustomerGroupEntity = new CustomerGroupEntity(Id);
                if (adapter.FetchEntity(_CustomerGroupEntity))
                {

                    _CustomerGroupEntity.Name = Name;
                    _CustomerGroupEntity.IsEnable = IsEnable;
                    adapter.SaveEntity(_CustomerGroupEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
Esempio n. 7
0
 public bool Update(CustomerGroupEntity _CustomerGroupEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_CustomerGroupEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Esempio n. 8
0
        public bool Update(CustomerGroupEntity _CustomerGroupEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(CustomerGroupFields.Id == _CustomerGroupEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_CustomerGroupEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Esempio n. 9
0
 public CustomerGroupEntity SelectOne(Guid Id)
 {
     CustomerGroupEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         CustomerGroupEntity _CustomerGroupEntity = new CustomerGroupEntity(Id);
         if (adapter.FetchEntity(_CustomerGroupEntity))
         {
             toReturn = _CustomerGroupEntity;
         }
     }
     return toReturn;
 }
Esempio n. 10
0
        public CustomerGroupEntity Insert(string Name, bool IsEnable)
        {
            CustomerGroupEntity _CustomerGroupEntity = new CustomerGroupEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _CustomerGroupEntity.Name = Name;
                _CustomerGroupEntity.IsEnable = IsEnable;
                adapter.SaveEntity(_CustomerGroupEntity, true);
            }
            return _CustomerGroupEntity;
        }
Esempio n. 11
0
 public CustomerGroupEntity Insert(CustomerGroupEntity _CustomerGroupEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_CustomerGroupEntity, true);
     }
     return _CustomerGroupEntity;
 }
Esempio n. 12
0
        public CustomerGroupEntity Update(EmployeeEntity EmployeeEntity, Guid CustomerGroupId, CustomerGroupEntity CustomerGroupEntity)
        {
            CustomerGroupEntity.Id = CustomerGroupId;
            CustomerGroup CustomerGroup = new CustomerGroup(CustomerGroupEntity);

            UnitOfWork.CustomerGroupRepository.AddOrUpdate(CustomerGroup);
            UnitOfWork.Complete();
            return(Get(EmployeeEntity, CustomerGroup.Id));
        }
Esempio n. 13
0
 public CustomerGroupEntity Update(Guid CustomerGroupId, [FromBody] CustomerGroupEntity CustomerGroupEntity)
 {
     return(CustomerGroupService.Update(EmployeeEntity, CustomerGroupId, CustomerGroupEntity));
 }
Esempio n. 14
0
 public CustomerGroupEntity Create([FromBody] CustomerGroupEntity CustomerGroupEntity)
 {
     return(CustomerGroupService.Create(EmployeeEntity, CustomerGroupEntity));
 }
Esempio n. 15
0
 public HttpResponseMessage CreateOrUpdateCustomerGroup(int StoreId, int LoggedInUserId, CustomerGroupEntity CustomerGroupEntity)
 {
     try
     {
         var result = _CustomerGroupService.CreateOrUpdateCustomerGroup(StoreId, LoggedInUserId, CustomerGroupEntity);
         return(Request.CreateResponse(HttpStatusCode.OK, result));
     }
     catch (Exception)
     {
         throw;
     }
 }