public ActionResult TrackerItem(string enterpriseKey, string itemKey = StringHelper.Empty) { TrackerEntity entity = new TrackerEntity(); //TrackerEntity.Empty; if (GuidHelper.IsInvalidOrEmpty(itemKey) == false) { entity = TrackerBLL.Instance.Get(itemKey); } this.ViewBag.EnterpriseKey = enterpriseKey; return View(entity); }
public ActionResult TrackerItem(string enterpriseKey, string itemKey, TrackerEntity originalEntity) { bool isSuccessful = false; string displayMessage = string.Empty; TrackerEntity targetEntity = null; if (GuidHelper.IsInvalidOrEmpty(itemKey) == true) { targetEntity = new TrackerEntity(); targetEntity.RelativeKey = enterpriseKey; targetEntity.RelativeName = EnterpriseBLL.Instance.Get(enterpriseKey).CompanyName; targetEntity.TrackerCategory = "EnterpriseTracker"; targetEntity.CreateTime = DateTime.Now; targetEntity.CreateUserKey = BusinessUserBLL.CurrentUser.UserGuid.ToString(); targetEntity.CreateUserName = BusinessUserBLL.CurrentUser.UserNameDisplay; SetTargetContractEntityValue(originalEntity, ref targetEntity); isSuccessful = TrackerBLL.Instance.Create(targetEntity); } else { targetEntity = TrackerBLL.Instance.Get(itemKey); SetTargetContractEntityValue(originalEntity, ref targetEntity); isSuccessful = TrackerBLL.Instance.Update(targetEntity); } if (isSuccessful == true) { displayMessage = "数据保存成功"; } else { displayMessage = "数据保存失败"; } return Json(new LogicStatusInfo(isSuccessful, displayMessage)); }
private void SetTargetContractEntityValue(TrackerEntity originalEntity, ref TrackerEntity targetEntity) { targetEntity.CanUsable = originalEntity.CanUsable; targetEntity.TrackerDesc = originalEntity.TrackerDesc; targetEntity.TrackerTime = originalEntity.TrackerTime; targetEntity.TrackerTitle = originalEntity.TrackerTitle; targetEntity.TrackerType = originalEntity.TrackerType; targetEntity.TrackerUserName = originalEntity.TrackerUserName; }