Ejemplo n.º 1
0
        public Error InsertOrUpdateBrandCategorySalesPerson(BrandCategorySalesPersonModel acctMgr, UserModel user, string lockGuid)
        {
            var error = validateAddressModel(acctMgr);

            if (!error.IsError)
            {
                // Check that the lock is still current
                if (!db.IsLockStillValid(typeof(BrandCategorySalesPerson).ToString(), acctMgr.Id, lockGuid))
                {
                    error.SetError(EvolutionResources.errRecordChangedByAnotherUser, "UserId");
                }
                else
                {
                    BrandCategorySalesPerson temp = null;
                    if (acctMgr.Id != 0)
                    {
                        temp = db.FindBrandCategorySalesPerson(acctMgr.Id);
                    }
                    if (temp == null)
                    {
                        temp = new BrandCategorySalesPerson();
                    }

                    var before = MapToEntity(temp);

                    MapToEntity(acctMgr, temp);

                    db.InsertOrUpdateBrandCategorySalesPerson(temp);
                    acctMgr.Id = temp.Id;

                    logChanges(before, temp, user);
                }
            }
            return(error);
        }
Ejemplo n.º 2
0
        public BrandCategorySalesPersonModel MapToModel(BrandCategorySalesPerson item)
        {
            var newItem = Mapper.Map <BrandCategorySalesPerson, BrandCategorySalesPersonModel>(item);

            newItem.BrandCategoryName   = item.BrandCategory.CategoryName;
            newItem.UserName            = (item.User.FirstName + " " + item.User.LastName).Trim().WordCapitalise();
            newItem.SalesPersonTypeName = item.LOVItem.ItemText;

            return(newItem);
        }
Ejemplo n.º 3
0
 public void MapToEntity(BrandCategorySalesPersonModel model, BrandCategorySalesPerson entity)
 {
     Mapper.Map <BrandCategorySalesPersonModel, BrandCategorySalesPerson>(model, entity);
 }
Ejemplo n.º 4
0
        public BrandCategorySalesPerson MapToEntity(BrandCategorySalesPerson entity)
        {
            var newItem = Mapper.Map <BrandCategorySalesPerson, BrandCategorySalesPerson>(entity);

            return(newItem);
        }
Ejemplo n.º 5
0
 private void logChanges(BrandCategorySalesPerson before, BrandCategorySalesPerson after, UserModel user)
 {
     AuditService.LogChanges(typeof(BrandCategorySalesPerson).ToString(), BusinessArea.CustomerAccountManager, user, before, after);
 }