public ActionResult ADItem(string enterpriseKey, string itemKey, ForeOrderEntity originalEntity) { bool isSuccessful = false; string displayMessage = string.Empty; ForeOrderEntity targetEntity = null; if (GuidHelper.IsInvalidOrEmpty(itemKey) == true) { targetEntity = new ForeOrderEntity(); targetEntity.OwnerKey = enterpriseKey; targetEntity.OwnerName = EnterpriseBLL.Instance.Get(enterpriseKey).CompanyNameShort; targetEntity.ForeOrderCategory = "AD"; targetEntity.RelativeKey = GuidHelper.EmptyString; targetEntity.RelativeName = "广告张贴"; targetEntity.CreateTime = DateTime.Now; targetEntity.CreateUserKey = BusinessUserBLL.CurrentUser.UserGuid.ToString(); SetTargetForeOrderEntityValue(originalEntity, ref targetEntity); isSuccessful = ForeOrderBLL.Instance.Create(targetEntity); } else { targetEntity = ForeOrderBLL.Instance.Get(itemKey); SetTargetForeOrderEntityValue(originalEntity, ref targetEntity); isSuccessful = ForeOrderBLL.Instance.Update(targetEntity); } if (isSuccessful == true) { displayMessage = "数据保存成功"; } else { displayMessage = "数据保存失败"; } return Json(new LogicStatusInfo(isSuccessful, displayMessage)); }
private void SetTargetForeOrderEntityValue(ForeOrderEntity originalEntity, ref ForeOrderEntity targetEntity) { targetEntity.CanUsable = originalEntity.CanUsable; targetEntity.ForeOrderCount = originalEntity.ForeOrderCount; targetEntity.ForeOrderDate = originalEntity.ForeOrderDate; targetEntity.ForeOrderDateEnd = originalEntity.ForeOrderDateEnd; targetEntity.ForeOrderDesc = originalEntity.ForeOrderDesc; targetEntity.ForeOrderMemo1 = originalEntity.ForeOrderMemo1; targetEntity.ForeOrderMemo2 = originalEntity.ForeOrderMemo2; targetEntity.ForeOrderPaid = originalEntity.ForeOrderPaid; targetEntity.ForeOrderStatus = originalEntity.ForeOrderStatus; targetEntity.ForeOrderTitle = originalEntity.ForeOrderTitle; targetEntity.ForeOrderType = originalEntity.ForeOrderType; targetEntity.ForeOrderUnitFee = originalEntity.ForeOrderUnitFee; targetEntity.ForeOrderPayDate = originalEntity.ForeOrderPayDate; targetEntity.CommissionDate = originalEntity.CommissionDate; targetEntity.CommissionFee = originalEntity.CommissionFee; targetEntity.CommissionIsDrawed = originalEntity.CommissionIsDrawed; targetEntity.CommissionOther = originalEntity.CommissionOther; }