public async Task <ActionResult <CustomerLevel_CustomerLevelDTO> > Delete([FromBody] CustomerLevel_CustomerLevelDTO CustomerLevel_CustomerLevelDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } if (!await HasPermission(CustomerLevel_CustomerLevelDTO.Id)) { return(Forbid()); } CustomerLevel CustomerLevel = ConvertDTOToEntity(CustomerLevel_CustomerLevelDTO); CustomerLevel = await CustomerLevelService.Delete(CustomerLevel); CustomerLevel_CustomerLevelDTO = new CustomerLevel_CustomerLevelDTO(CustomerLevel); if (CustomerLevel.IsValidated) { return(CustomerLevel_CustomerLevelDTO); } else { return(BadRequest(CustomerLevel_CustomerLevelDTO)); } }
public virtual CustomerLevel CustomerLevelFromDataRow(DataRow dr) { if (dr == null) { return(null); } CustomerLevel entity = new CustomerLevel(); entity.CustomerLevelId = (System.Int32)dr["CustomerLevelID"]; entity.CustomerLevelGuid = (System.Guid)dr["CustomerLevelGUID"]; entity.Name = dr["Name"].ToString(); entity.LevelDiscountPercent = (System.Decimal)dr["LevelDiscountPercent"]; entity.LevelDiscountAmount = (System.Decimal)dr["LevelDiscountAmount"]; entity.LevelHasFreeShipping = (System.Byte)dr["LevelHasFreeShipping"]; entity.LevelAllowsQuantityDiscounts = (System.Byte)dr["LevelAllowsQuantityDiscounts"]; entity.LevelHasNoTax = (System.Byte)dr["LevelHasNoTax"]; entity.LevelAllowsCoupons = (System.Byte)dr["LevelAllowsCoupons"]; entity.LevelDiscountsApplyToExtendedPrices = (System.Byte)dr["LevelDiscountsApplyToExtendedPrices"]; entity.LevelAllowsPo = (System.Byte)dr["LevelAllowsPO"]; entity.DisplayOrder = (System.Int32)dr["DisplayOrder"]; entity.ParentCustomerLevelId = (System.Int32)dr["ParentCustomerLevelID"]; entity.SeName = dr["SEName"].ToString(); entity.ExtensionData = dr["ExtensionData"].ToString(); entity.Deleted = (System.Byte)dr["Deleted"]; entity.CreatedOn = (System.DateTime)dr["CreatedOn"]; entity.SkinId = (System.Int32)dr["SkinID"]; entity.TemplateName = dr["TemplateName"].ToString(); return(entity); }
public async Task <CustomerLevel> Get(long Id) { CustomerLevel CustomerLevel = await DataContext.CustomerLevel.AsNoTracking() .Where(x => x.Id == Id) .Where(x => x.DeletedAt == null) .Select(x => new CustomerLevel() { CreatedAt = x.CreatedAt, UpdatedAt = x.UpdatedAt, Id = x.Id, Code = x.Code, Name = x.Name, Color = x.Color, PointFrom = x.PointFrom, PointTo = x.PointTo, StatusId = x.StatusId, Description = x.Description, Used = x.Used, RowId = x.RowId, Status = x.Status == null ? null : new Status { Id = x.Status.Id, Code = x.Status.Code, Name = x.Status.Name, }, }).FirstOrDefaultAsync(); if (CustomerLevel == null) { return(null); } return(CustomerLevel); }
public ActionResult Details(Guid id) { CustomerLevel item = _iCustomerLevelService.GetById(id); ViewBag.UserId = _iUserInfo.UserId; return(View(item)); }
public async Task <bool> Update(CustomerLevel CustomerLevel) { CustomerLevelDAO CustomerLevelDAO = DataContext.CustomerLevel.Where(x => x.Id == CustomerLevel.Id).FirstOrDefault(); if (CustomerLevelDAO == null) { return(false); } CustomerLevelDAO.Id = CustomerLevel.Id; CustomerLevelDAO.Code = CustomerLevel.Code; CustomerLevelDAO.Name = CustomerLevel.Name; CustomerLevelDAO.Color = CustomerLevel.Color; CustomerLevelDAO.PointFrom = CustomerLevel.PointFrom; CustomerLevelDAO.PointTo = CustomerLevel.PointTo; CustomerLevelDAO.StatusId = CustomerLevel.StatusId; CustomerLevelDAO.Description = CustomerLevel.Description; CustomerLevelDAO.Used = CustomerLevel.Used; CustomerLevelDAO.RowId = CustomerLevel.RowId; CustomerLevelDAO.UpdatedAt = StaticParams.DateTimeNow; await DataContext.SaveChangesAsync(); await SaveReference(CustomerLevel); return(true); }
/// <summary> /// 修改客户等级 /// </summary> /// <param name="cusl"></param> /// <returns></returns> public static int Edit(CustomerLevel cusl) { PSSEntities db = new PSSEntities(); db.Entry <CustomerLevel>(cusl).State = System.Data.Entity.EntityState.Modified; return(db.SaveChanges()); }
/// <summary> /// 添加客户等级 /// </summary> /// <param name="cusl"></param> /// <returns></returns> public static int Add(CustomerLevel cusl) { PSSEntities db = new PSSEntities(); db.CustomerLevel.Add(cusl); return(db.SaveChanges()); }
public async Task <bool> Delete(CustomerLevel CustomerLevel) { if (await ValidateId(CustomerLevel)) { } return(CustomerLevel.IsValidated); }
void Reset() { CustomerLevel.Clear(); CollectedRecipe.Clear(); CollectedSubmaterial.Clear(); Birdcoin = 0; PlayerPrefs.DeleteAll(); }
public async Task <bool> Delete(CustomerLevel CustomerLevel) { await DataContext.CustomerLevel.Where(x => x.Id == CustomerLevel.Id).UpdateFromQueryAsync(x => new CustomerLevelDAO { DeletedAt = StaticParams.DateTimeNow, UpdatedAt = StaticParams.DateTimeNow }); return(true); }
public virtual CustomerLevel UpdateCustomerLevel(CustomerLevel entity) { if (entity.IsTransient()) { return(entity); } CustomerLevel other = GetCustomerLevel(entity.CustomerLevelId); if (entity.Equals(other)) { return(entity); } string sql = @"Update CustomerLevel set [CustomerLevelGUID]=@CustomerLevelGUID , [Name]=@Name , [LevelDiscountPercent]=@LevelDiscountPercent , [LevelDiscountAmount]=@LevelDiscountAmount , [LevelHasFreeShipping]=@LevelHasFreeShipping , [LevelAllowsQuantityDiscounts]=@LevelAllowsQuantityDiscounts , [LevelHasNoTax]=@LevelHasNoTax , [LevelAllowsCoupons]=@LevelAllowsCoupons , [LevelDiscountsApplyToExtendedPrices]=@LevelDiscountsApplyToExtendedPrices , [LevelAllowsPO]=@LevelAllowsPO , [DisplayOrder]=@DisplayOrder , [ParentCustomerLevelID]=@ParentCustomerLevelID , [SEName]=@SEName , [ExtensionData]=@ExtensionData , [Deleted]=@Deleted , [CreatedOn]=@CreatedOn , [SkinID]=@SkinID , [TemplateName]=@TemplateName where CustomerLevelID=@CustomerLevelID" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@CustomerLevelID", entity.CustomerLevelId) , new SqlParameter("@CustomerLevelGUID", entity.CustomerLevelGuid) , new SqlParameter("@Name", entity.Name) , new SqlParameter("@LevelDiscountPercent", entity.LevelDiscountPercent) , new SqlParameter("@LevelDiscountAmount", entity.LevelDiscountAmount) , new SqlParameter("@LevelHasFreeShipping", entity.LevelHasFreeShipping) , new SqlParameter("@LevelAllowsQuantityDiscounts", entity.LevelAllowsQuantityDiscounts) , new SqlParameter("@LevelHasNoTax", entity.LevelHasNoTax) , new SqlParameter("@LevelAllowsCoupons", entity.LevelAllowsCoupons) , new SqlParameter("@LevelDiscountsApplyToExtendedPrices", entity.LevelDiscountsApplyToExtendedPrices) , new SqlParameter("@LevelAllowsPO", entity.LevelAllowsPo) , new SqlParameter("@DisplayOrder", entity.DisplayOrder) , new SqlParameter("@ParentCustomerLevelID", entity.ParentCustomerLevelId) , new SqlParameter("@SEName", entity.SeName ?? (object)DBNull.Value) , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value) , new SqlParameter("@Deleted", entity.Deleted) , new SqlParameter("@CreatedOn", entity.CreatedOn) , new SqlParameter("@SkinID", entity.SkinId) , new SqlParameter("@TemplateName", entity.TemplateName) }; SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray); return(GetCustomerLevel(entity.CustomerLevelId)); }
public async Task <CustomerLevel> Get(long Id) { CustomerLevel CustomerLevel = await UOW.CustomerLevelRepository.Get(Id); if (CustomerLevel == null) { return(null); } return(CustomerLevel); }
// // GET: /Platform/SysDepartment/Edit/5 public ActionResult Edit(Guid?id) { var item = new CustomerLevel(); if (id.HasValue) { item = _iCustomerLevelService.GetById(id.Value); } return(View(item)); }
public static string customerLevel2Str(Util.Resource resource, CustomerLevel level) { switch (level) { case CustomerLevel.LOW: return resource.getMsg("customer_level_low"); case CustomerLevel.MEDIUM: return resource.getMsg("customer_level_medium"); case CustomerLevel.HIGH: return resource.getMsg("customer_level_high"); default: return resource.getMsg("customer_level_medium"); } }
public void SetExp(string name, int exp) { if (CustomerLevel.ContainsKey(name)) { CustomerLevel[name] = exp; } else { CustomerLevel.Add(name, exp); } }
public ActionResult Create([DataSourceRequest] DataSourceRequest request, CustomerLevel customerLevel) { if (ModelState.IsValid) { db.CustomerLevels.Add(customerLevel); db.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public void SetLevel(string name, int level) { if (CustomerLevel.ContainsKey(name)) { CustomerLevel[name] = level; } else { CustomerLevel.Add(name, level); } }
public ActionResult Edit(Guid?id, CustomerLevel collection) { if (!ModelState.IsValid) { return(View(collection)); } _iCustomerLevelService.Save(id, collection); _unitOfWork.Commit(); return(RedirectToAction("Index")); }
public void UpdateLevel(CustomerLevel level) { if (level == null) { throw new ArgumentNullException("level"); } _levelRepository.Update(level); //cache _cacheManager.GetCache(LEVELS_KEYS).Remove(LEVELS_KEYS); }
public async Task <bool> IsCheckSumInvest(CustomerLevel customerLevel) { if (customerLevel == null) { throw new InvalidParameterException(); } if (customerLevel.MaxMoney == 0) { customerLevel.MaxMoney = smartFunds.Common.Constants.MaxDecimal.MaxMoney; } if (customerLevel.IDCustomerLevel != 0) { var customerLevelEdited = await _unitOfWork.CustomerLevelRepository.GetAsync(m => m.IDCustomerLevel == customerLevel.IDCustomerLevel); if (customerLevel.MinMoney == customerLevelEdited.MinMoney && customerLevel.MaxMoney == customerLevelEdited.MaxMoney) { return(true); } var isValueEditExisted = await _unitOfWork.CustomerLevelRepository.FindByAsync(x => x.MinMoney <= customerLevel.MinMoney && x.MaxMoney >= customerLevel.MinMoney && customerLevelEdited.IDCustomerLevel != x.IDCustomerLevel && x.IsDeleted == false); if (isValueEditExisted != null && isValueEditExisted.Any()) { return(false); } isValueEditExisted = await _unitOfWork.CustomerLevelRepository.FindByAsync(x => x.MinMoney <= customerLevel.MaxMoney && x.MaxMoney >= customerLevel.MaxMoney && customerLevelEdited.IDCustomerLevel != x.IDCustomerLevel && x.IsDeleted == false); if (isValueEditExisted != null && isValueEditExisted.Any()) { return(false); } } else { var isValueExisted = await _unitOfWork.CustomerLevelRepository.FindByAsync(x => x.MinMoney <= customerLevel.MinMoney && x.MaxMoney >= customerLevel.MinMoney && x.IsDeleted == false); if (isValueExisted != null && isValueExisted.Any()) { return(false); } isValueExisted = await _unitOfWork.CustomerLevelRepository.FindByAsync(x => x.MinMoney <= customerLevel.MaxMoney && x.MaxMoney >= customerLevel.MaxMoney && x.IsDeleted == false); if (isValueExisted != null && isValueExisted.Any()) { return(false); } } return(true); }
public ActionResult Index() { CustomerLevel s = new CustomerLevel() { CLName = "最低级", CLAgio = 100, CLID = 4 }; //SeleAllCheckDepot.Inset(s); //SeleAllCheckDepot.DeleteKey(2); //SeleAllCheckDepot.Update(3,s); return(View(SeleAllCheckDepot.Selectall())); }
public int InsertLevel(CustomerLevel level) { if (level == null) { throw new ArgumentNullException("level"); } var levelId = _levelRepository.InsertAndGetId(level); //cache _cacheManager.GetCache(LEVELS_KEYS).Remove(LEVELS_KEYS); return(levelId); }
/// <summary> /// 修改客户等级 /// </summary> /// <param name="cusl"></param> /// <returns></returns> public ActionResult EditCusLevel(CustomerLevel cusl) { if (CustomerLevelBLL.Edit(cusl) > 0) { TempData["fg"] = "edit_yes"; } else { TempData["fg"] = "edit_no"; } TempData["tabIndex"] = 2; return(RedirectToAction("Customers")); }
public ActionResult Update([DataSourceRequest] DataSourceRequest request, CustomerLevel customerLevel) { if (ModelState.IsValid) { try { db.Entry(customerLevel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { } } return(RedirectToAction("Index")); }
public void Create_Success_ReturnCategory() { // Arrange var repository = new CustomerLevelRepository(); var input = new CustomerLevel { Name = "category-" + Helper.RandomString(6), Description = "category-" + Helper.RandomString(6), }; // Act var result = repository.Create(input); // Assert Assert.That(result.Name == input.Name && result.Description == result.Description); }
/// <summary> /// 根据等级获取当前卖家的顾客列表 /// <para> /// 需要授权 /// </para> /// <para> /// 接口地址:http://open.1688.com/doc/api/cn/api.htm?ns=cn.alibaba.open&n=acrm.customer.relation.get&v=1 /// </para> /// </summary> /// <param name="level">会员等级</param> /// <param name="pageNum">页面大小 默认最大20</param> /// <param name="pageSize">页号</param> /// <returns>卖家的顾客列表</returns> public IPagedList<CustomerRelation> GetCustomerByLevel(CustomerLevel level, int pageNum = 1, int pageSize = 20) { string url = "http://gw.open.1688.com/openapi/param2/1/cn.alibaba.open/acrm.customer.relation.get/{0}".FormatStr(_context.Config.AppKey); var otherParas = _context.GetParas(); otherParas.Add("pageNum", pageNum.ToString()); otherParas.Add("pageSize", pageSize.ToString()); otherParas.Add("level", ((int)level).ToString()); _context.Util.AddAliApiUrlSignPara(url, otherParas); var results = _context.Util.Send<CustomerSearchResult<CustomerRelation>>(url, otherParas); if (results.TotalCount > 0) { return new PagedList<CustomerRelation>(results.Models, pageNum, pageSize, results.TotalCount); } return new PagedList<CustomerRelation>(new List<CustomerRelation>(), pageNum, pageSize); }
void LoadLevel() { int count = PlayerPrefs.GetInt(nameof(CustomerCount)); CustomerLevel.Clear(); for (int i = 0; i < count; i++) { string key = PlayerPrefs.GetString($"Customer{i}Level"); if (string.IsNullOrEmpty(key)) { continue; } int value = PlayerPrefs.GetInt(key); CustomerLevel.Add(key, value); } }
public CustomerLevel_CustomerLevelDTO(CustomerLevel CustomerLevel) { this.Id = CustomerLevel.Id; this.Code = CustomerLevel.Code; this.Name = CustomerLevel.Name; this.Color = CustomerLevel.Color; this.PointFrom = CustomerLevel.PointFrom; this.PointTo = CustomerLevel.PointTo; this.StatusId = CustomerLevel.StatusId; this.Description = CustomerLevel.Description; this.Used = CustomerLevel.Used; this.RowId = CustomerLevel.RowId; this.Status = CustomerLevel.Status == null ? null : new CustomerLevel_StatusDTO(CustomerLevel.Status); this.CreatedAt = CustomerLevel.CreatedAt; this.UpdatedAt = CustomerLevel.UpdatedAt; this.Errors = CustomerLevel.Errors; }
public async Task <CustomerLevel> Update(CustomerLevel customerLevel) { try { if (customerLevel == null) { throw new InvalidParameterException(); } _unitOfWork.CustomerLevelRepository.Update(customerLevel); await _unitOfWork.SaveChangesAsync(); return(customerLevel); } catch (Exception ex) { throw ex; } }
public async Task <ActionResult <CustomerLevel_CustomerLevelDTO> > Get([FromBody] CustomerLevel_CustomerLevelDTO CustomerLevel_CustomerLevelDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } if (!await HasPermission(CustomerLevel_CustomerLevelDTO.Id)) { return(Forbid()); } CustomerLevel CustomerLevel = await CustomerLevelService.Get(CustomerLevel_CustomerLevelDTO.Id); return(new CustomerLevel_CustomerLevelDTO(CustomerLevel)); }
public async Task <bool> ValidateId(CustomerLevel CustomerLevel) { CustomerLevelFilter CustomerLevelFilter = new CustomerLevelFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = CustomerLevel.Id }, Selects = CustomerLevelSelect.Id }; int count = await UOW.CustomerLevelRepository.Count(CustomerLevelFilter); if (count == 0) { CustomerLevel.AddError(nameof(CustomerLevelValidator), nameof(CustomerLevel.Id), ErrorCode.IdNotExisted); } return(count == 1); }
public CallLog_CustomerLevelDTO(CustomerLevel CustomerLevel) { this.Id = CustomerLevel.Id; this.Name = CustomerLevel.Name; this.Code = CustomerLevel.Code; this.Color = CustomerLevel.Color; this.StatusId = CustomerLevel.StatusId; this.Description = CustomerLevel.Description; this.PointFrom = CustomerLevel.PointFrom; this.PointTo = CustomerLevel.PointTo; this.Errors = CustomerLevel.Errors; }
/// <summary> /// Contains common code block for both Purchase test methods. /// </summary> /// <param name="cLevel">The customer level. </param> private void CommonPurchaseTest(CustomerLevel cLevel) { var customer = new Customer(cLevel); var randBook = mockBookOrderingSystem.Object.ViewAvailableBooks()[0]; mockBookOrderingSystem.Object.OrderBookCopy( customer, randBook); }
public Customer(CustomerLevel _customerLevel) { OrderedBooks = new List<Model.BookCopy>(); CustomerLevel = _customerLevel; }