private void SetDefaultSettingsForIntegrator(Integrator model) { var creatorId = "DefaultSettings:Creator:" + model.Id; var elements = RedisService.GetValuesByIds<Element>(RedisService.GetAllActiveModelIds<Element>()).FilterByUIMode<Element>(GetFilterByCurrentMode("OTA")); if (elements != null) { foreach (var element in elements) { var prop = new CustomProperty { Id = element.Id }; var elementDetails = GetElementDetailList(element.Id).Where(x => x.Status == 1).ToList(); if (element.Type == (int)ElementType.单选按钮 || element.Type == (int)ElementType.多选列表) { if (elementDetails.Any()) { prop.Value = !element.Name.Equals(OTAConfigKeys.IsAutoDownload.ToString()) ? elementDetails[0].Value : elementDetails[1].Value; } } else { prop.Value = "优化了系统,修改了部分bug。"; } RedisService.SetEntryInHash<CustomProperty>(creatorId, "CustomProperty:" + prop.Id, prop); } } }
public ActionResult IntegratorEdit(string id) { Integrator model = new Integrator(); var currentDesignCompanyId = UserAccessDataControlService.GetCurrentDesignCompanyId(); if (!string.IsNullOrEmpty(currentDesignCompanyId)) { model = RedisService.GetSubModel<DesignCompany, Integrator>(currentDesignCompanyId, id); } return View(model); }
public ActionResult IntegratorEdit(Integrator model) { if (!ValidateModel()) { return RedirectToAction("IntegratorEdit", new { id = model.Id }); } var currentDesignCompanyId = UserAccessDataControlService.GetCurrentDesignCompanyId(); if (!string.IsNullOrEmpty(currentDesignCompanyId)) { RedisService.SetSubModel<DesignCompany, Integrator>(currentDesignCompanyId, model); } return RedirectToAction("IntegratorList"); }
public ActionResult IntegratorAdd(Integrator model) { if (!ValidateModel()) { return RedirectToAction("IntegratorAdd"); } var currentDesignCompanyId = UserAccessDataControlService.GetCurrentDesignCompanyId(); var allIntegrators = RedisService.GetAllSubModelsByType<DesignCompany, Integrator>(currentDesignCompanyId); var hasSameNameIntegrator = allIntegrators.Exists(x => x.Name.ToUpper() == model.Name.ToUpper().Trim()); if (hasSameNameIntegrator) { TempData["errorMsg"] = "集成商不能重复!"; return RedirectToAction("IntegratorAdd"); } if (!string.IsNullOrEmpty(currentDesignCompanyId)) { model.Id = Guid.NewGuid().ToString(); RedisService.SetSubModel<DesignCompany, Integrator>(currentDesignCompanyId, model); // add default settings SetDefaultSettingsForIntegrator(model); } return RedirectToAction("IntegratorList"); }