public async Task <IActionResult> Put(int id, [FromBody] fw_cusgoods value) { var single = _fwCusgoodsRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <fw_cusgoods>(single, value, new string[] { "TypeName", "GoodsName", "GoodsPrice", "HouseCode", "OrderNo", "CusName", "Mobile", "Remark" }); single.UpdatedAt = DateTime.Now; //更新字段内容 if (User.Identity is ClaimsIdentity identity) { if (!string.IsNullOrEmpty(value.TakeBy)) { single.TakeBy = identity.Name ?? "test"; single.TakeTime = DateTime.Now; } else { single.CreatedBy = identity.Name ?? "test"; } } _fwCusgoodsRpt.Commit(); return(new NoContentResult()); }
/// <summary> /// 实现ESRI的对象复制方法 /// </summary> /// <param name="pInObject">原始对象</param> /// <param name="pOverwriteObject">复制后的对象</param> public static void ObjectCopy(object pInObject, ref object pOverwriteObject) { IObjectCopy objectCopy = new ObjectCopy(); object copyedObj = objectCopy.Copy(pInObject); objectCopy.Overwrite(copyedObj, ref pOverwriteObject); }
public static void CopyMap(IMap pMap, IMap targetMap) { IObjectCopy objectCopyClass = new ObjectCopy(); object obj = objectCopyClass.Copy(pMap); object imap1 = targetMap; objectCopyClass.Overwrite(obj, ref imap1); }
public static void CopyMap(IMap imap_0, IMap imap_1) { IObjectCopy copy = new ObjectCopy(); object pInObject = copy.Copy(imap_0); object pOverwriteObject = imap_1; copy.Overwrite(pInObject, ref pOverwriteObject); }
private void method_0(IMap imap_1, IMap imap_2) { IObjectCopy objectCopy = new ObjectCopy(); object pInObject = objectCopy.Copy(imap_1); object obj = imap_2; objectCopy.Overwrite(pInObject, ref obj); }
/// <summary> /// 同步布局 /// </summary> public void copyToPageLayout() { IObjectCopy objectCopy = new ObjectCopy(); //对象拷贝接口 object copyFromMap = mapControl.Map; //地图对象 object copyMap = objectCopy.Copy(copyFromMap); //将axMapControl1的地图对象拷贝 object copyToMap = pagelayoutcontrol.ActiveView.FocusMap; //axPageLayoutControl1活动视图中的地图 objectCopy.Overwrite(copyMap, ref copyToMap); //将axMapControl1地图对象覆盖axPageLayout1当前地图 }
private async Task SavePaymentRecord(Model.Payment payment, PaymentResponse paymentResult) { _logger.Verbose($"Calling SavePaymentRecord"); var paymentEntity = new Data.Payment(); ObjectCopy <Model.Payment, Data.Payment> .Copy(payment, paymentEntity); paymentEntity.PaymentStatus = (int)paymentResult.PaymentStatus; paymentEntity.UniqueId = paymentResult.UniqueIdentifier; await _paymentRepository.Create(paymentEntity); }
/// <inheritdoc cref="ObjectCopyExtensions.CopyTo{TSource, TDestination}(TSource, TDestination)"/> public static TDestination CopyTo <TSource, TDestination>(this TSource source) where TSource : class where TDestination : class, new() { if (source is null) { throw new ArgumentNullException(nameof(source)); } TDestination destination = new(); ObjectCopy <TSource, TDestination> .Copy(source, destination); return(destination); }
public void Update(Worker worker) { if (!Contains(worker.Key)) { Add(worker); } else { var target = Items[worker.Key]; ObjectCopy.Copy(worker, target); } }
public void Update(Message message) { if (!Items.Keys.Contains(message.MessageName)) { Add(message); } else { var target = Items[message.Key]; ObjectCopy.Copy(message, target); } }
/// <summary> /// 将源对象的字段、属性赋值到目标对象的同名、同类型的字段、属性 /// </summary> /// <typeparam name="TSource">源对象类型</typeparam> /// <typeparam name="TDestination">目标对象类型</typeparam> /// <param name="source">源对象</param> /// <param name="destination">目标对象</param> public static void CopyTo <TSource, TDestination>(this TSource source, TDestination destination) where TSource : class where TDestination : class { if (source is null) { throw new ArgumentNullException(nameof(source)); } if (destination is null) { throw new ArgumentNullException(nameof(destination)); } ObjectCopy <TSource, TDestination> .Copy(source, destination); }
public async Task <Model.Payment> Get(int id) { _logger.Verbose($"Calling Payment Repository Get {id}"); var paymentEntity = await _paymentRepository.GetById(id); if (paymentEntity == null) { return(null); } var payment = new Model.Payment(); ObjectCopy <Data.Payment, Model.Payment> .Copy(paymentEntity, payment); payment.CardNumber = MaskCardNumber(payment.CardNumber); return(payment); }
public async Task <IActionResult> Put(int id, [FromBody] set_group value) { var single = _setGroupRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <set_group>(single, value, "address", "contractDate1", "contractDate2", "contractNo", "coupons", "linkMan", "mobile", "name", "remark"); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "test"; } _setGroupRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] fw_houseinfo value) { var single = _fwHouseinfoRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <fw_houseinfo>(single, value, new string[] { "floor", "houseType", "tags", "remark" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "test"; } _fwHouseinfoRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] kc_goods value) { var single = _kcGoodsRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <kc_goods>(single, value, new string[] { "name", "typeId", "unit", "goodsCode", "minAmount", "remark", "goodsNo", "price", "GoodsBrand" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _kcGoodsRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] yx_orderservice value) { var single = _yxOrderserviceRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy(single, value, "OrderNo", "ServiceType", "ServiceCode", "ServiceTime", "Times", "Price", "remark", "Operator"); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "test"; } _yxOrderserviceRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] set_agent value) { var single = _setAgentRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <set_agent>(single, value, new string[] { "name", "typeName", "linkMan", "mobile", "address", "contractNo", "contractDate1", "contractDate2", "commissionType", "commissionRate", "remark" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _setAgentRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] yx_customer value) { var single = _yxCustomerRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <yx_customer>(single, value, new string[] { "customerName", "sex", "mobile", "address", "birthday", "remark" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _yxCustomerRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] yx_serviceitem value) { var single = _yxServiceitemRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy(single, value, "name", "typeId", "unit", "itemCode", "integral", "remark", "price"); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "test"; } _yxServiceitemRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] kc_supplier value) { var single = _kcSupplierRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <kc_supplier>(single, value, new string[] { "name", "address", "linkMan", "tel", "linkManTitle", "linkManTel", "faxNo", "remark", "city" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _kcSupplierRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] set_allhouse_price value) { var single = _setAllhousePriceRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <set_allhouse_price>(single, value, new string[] { "name", "halfPriceHours", "allPriceHours", "leaveTime", "addFeeHours", "addAllDay", "addAllHours", "remark" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _setAllhousePriceRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] sms_template value) { var single = _smsTemplateRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <sms_template>(single, value, new string[] { "tmp_name", "to_business", "tmp_content", "remark" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _smsTemplateRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] set_paytype value) { var single = _setPaytypeRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <set_paytype>(single, value, new string[] { "IsReturn", "Name", "PayType", "IsIntegral", "IsDefault", "Remark" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _setPaytypeRpt.Commit(); return(new NoContentResult()); }
public async Task <IActionResult> Put(int id, [FromBody] set_photo value) { var single = _setPhotoRpt.GetSingle(id); if (single == null) { return(NotFound()); } ObjectCopy.Copy <set_photo>(single, value, new string[] { "tags", "typeName" }); //更新字段内容 single.UpdatedAt = DateTime.Now; if (User.Identity is ClaimsIdentity identity) { single.CreatedBy = identity.Name ?? "admin"; } _setPhotoRpt.Commit(); return(new NoContentResult()); }
/// <summary> /// 将源对象的字段、属性赋值到目标对象的同名、同类型的字段、属性 /// </summary> /// <typeparam name="TSource">源对象类型</typeparam> /// <typeparam name="TDestination">目标对象类型</typeparam> /// <param name="source">源对象</param> /// <param name="destination">目标对象</param> /// <param name="ignoreCase">忽略名称大小写</param> /// <param name="nonPublic">是否复制私有字段、属性</param> public static void CopyTo <TSource, TDestination>(this TSource source, TDestination destination, bool ignoreCase = false, bool nonPublic = false) where TSource : class where TDestination : class { if (source is null) { throw new ArgumentNullException(nameof(source)); } if (destination is null) { throw new ArgumentNullException(nameof(destination)); } if (ignoreCase) { if (nonPublic) { ObjectIgnoreCaseAllCopy <TSource, TDestination> .Copy(source, destination); return; } ObjectIgnoreCaseCopy <TSource, TDestination> .Copy(source, destination); return; } if (nonPublic) { ObjectAllCopy <TSource, TDestination> .Copy(source, destination); return; } ObjectCopy <TSource, TDestination> .Copy(source, destination); }
public void Assign(IClone src) { if (null == src) { throw new COMException("Invalid objact."); } if (!(src is TriangleElementClass)) { throw new COMException("Bad object type."); } TriangleElementClass triangleElementClass = (TriangleElementClass)src; this.m_elementName = triangleElementClass.Name; this.m_elementType = triangleElementClass.Type; this.m_autoTrans = triangleElementClass.AutoTransform; this.m_scaleRef = triangleElementClass.ReferenceScale; this.m_rotation = triangleElementClass.Angle; this.m_size = triangleElementClass.Size; this.m_anchorPointType = triangleElementClass.AnchorPoint; IObjectCopy objectCopyClass = new ObjectCopy(); if (null != triangleElementClass.CustomProperty) { if (triangleElementClass.CustomProperty is IClone) { this.m_customProperty = ((IClone)triangleElementClass.CustomProperty).Clone(); } else if (triangleElementClass.CustomProperty is IPersistStream) { this.m_customProperty = objectCopyClass.Copy(triangleElementClass.CustomProperty); } else if (triangleElementClass.CustomProperty.GetType().IsSerializable) { MemoryStream memoryStream = new MemoryStream(); BinaryFormatter binaryFormatter = new BinaryFormatter(); binaryFormatter.Serialize(memoryStream, triangleElementClass.CustomProperty); memoryStream = new MemoryStream(memoryStream.ToArray()); this.m_customProperty = binaryFormatter.Deserialize(memoryStream); } } if (null == triangleElementClass.SpatialReference) { this.m_nativeSR = null; } else { this.m_nativeSR = objectCopyClass.Copy(triangleElementClass.SpatialReference) as ISpatialReference; } if (null == triangleElementClass.FillSymbol) { this.m_fillSymbol = null; } else { this.m_fillSymbol = objectCopyClass.Copy(triangleElementClass.FillSymbol) as ISimpleFillSymbol; } if (null == triangleElementClass.Geometry) { this.m_triangle = null; this.m_pointGeometry = null; } else { this.m_triangle = objectCopyClass.Copy(triangleElementClass.Geometry) as IPolygon; this.m_pointGeometry = objectCopyClass.Copy(((IArea)this.m_triangle).Centroid) as IPoint; } }