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)); } } }
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)); }
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; }
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; } }
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); }
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; }
public bool Update(CustomerGroupEntity _CustomerGroupEntity, RelationPredicateBucket filter) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { adapter.UpdateEntitiesDirectly(_CustomerGroupEntity, filter); toReturn = true; } return toReturn; }
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; }
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; }
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; }
public CustomerGroupEntity Insert(CustomerGroupEntity _CustomerGroupEntity) { using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { adapter.SaveEntity(_CustomerGroupEntity, true); } return _CustomerGroupEntity; }
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)); }
public CustomerGroupEntity Update(Guid CustomerGroupId, [FromBody] CustomerGroupEntity CustomerGroupEntity) { return(CustomerGroupService.Update(EmployeeEntity, CustomerGroupId, CustomerGroupEntity)); }
public CustomerGroupEntity Create([FromBody] CustomerGroupEntity CustomerGroupEntity) { return(CustomerGroupService.Create(EmployeeEntity, CustomerGroupEntity)); }
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; } }