/// <summary> /// Thêm thẻ chọn /// </summary> /// <param name="listId"></param> /// <returns></returns> public JsonResult AddNewListCustomer(List <string> listId, bool isAdd) { var result = new MessageReport(); try { var list = _tblCustomerService.GetAllActiveByListIdForUpload(listId).ToList(); if (list.Any()) { GetSetFromSessionCustomer(list, isAdd); } result.Message = "Thêm mới thành công"; result.isSuccess = true; } catch (Exception ex) { result.Message = ex.Message; result.isSuccess = false; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage GetListCustomerWantToUse(CardUploadAPI listUpload) { //Lấy người dùng hiện tại var user = listUpload.CurrentUser; var model = new SelectListModelCardUploadReturn(); model.ListSelfHost = listUpload.ListSelfHost; model.ListController = listUpload.ListController; model.ListEmployee = new List <Employee>(); model.IsUseNewDate = listUpload.ListFilter.isusenewdate; if (listUpload.ListFilter.isall) { var customergroups = GetListChild("", listUpload.ListFilter.customergroupid); model.ListCustomer = _tblCustomerService.GetAllByFirst(listUpload.ListFilter.key, "", customergroups, "", "", listUpload.ListFilter.accesslevelids); } else { model.ListCustomer = _tblCustomerService.GetAllActiveByListIdForUpload(listUpload.ListCustomerId).ToList(); } if (model.ListCustomer.Any()) { foreach (var itemCustomer in model.ListCustomer) { foreach (var itemController in model.ListController) { var map = new Employee(); map.CardNumber = "0"; map.AccessLevelID = itemCustomer.AccessLevelID.Trim(); map.ControllerIDs = itemController.ControllerID.ToString(); map.UserID = user.Id; map.UserIDofFinger = itemCustomer.UserIDofFinger; map.Fingers1 = itemCustomer.Finger1; map.Fingers2 = itemCustomer.Finger2; map.VerifyTypeID = 0; if (listUpload.ListFilter.isusenewdate) { map.ExpireDate = Convert.ToDateTime(listUpload.ListFilter.newdateexpire).ToString("yyyyMMdd").Trim(); } else { map.ExpireDate = Convert.ToDateTime(itemCustomer.AccessExpireDate).ToString("yyyyMMdd").Trim(); } model.ListEmployee.Add(map); } } } var content = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json"); return(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = content, RequestMessage = Request }); }