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); }
private void ModifyProject(ClosureConsInvtChecking entity, string action) { // 2014-08-05 victor.huang: Recall 或Edit 后不需要重新再生成Task,不然会多生成一条冗余记录 //TaskWorkCondition condition = new TaskWorkCondition(); //condition.ProjectId = entity.ProjectId; //condition.Url = "/closure/Main#/closure/WOCheckList/" + entity.ProjectId; //condition.UserAccount = ClientCookie.UserCode; //condition.UserNameENUS = entity.UserNameENUS; //condition.UserNameZHCN = entity.UserNameZHCN; //taskWorkBll.ReSendTaskWork(condition); if (action == ProjectAction.Edit) { entity.IsHistory = true; entity.LastUpdateTime = DateTime.Now; entity.Update(); var objectCopy = new ObjectCopy(); var newWo = objectCopy.AutoCopy(entity); newWo.Id = Guid.NewGuid(); ClosureConsInvtChecking.Add(newWo); var projectEntity = ProjectInfo.Get(entity.ProjectId, FlowCode.Closure_ConsInvtChecking); projectEntity.Status = ProjectStatus.UnFinish; ProjectInfo.Update(projectEntity); } ProjectInfo.Reset(entity.ProjectId, FlowCode.Closure_ConsInvtChecking); }
public static void PostRemaindList(Remind remind, List <ProjectUsers> remindUsers) { var objectCopy = new ObjectCopy(); List <Remind> listRemind = new List <Remind>(); try { foreach (var users in remindUsers) { var entity = new Remind(); entity = objectCopy.AutoCopy(remind); entity.Id = Guid.NewGuid(); entity.ReceiverNameENUS = users.UserNameENUS; entity.ReceiverNameZHCN = users.UserNameZHCN; entity.ReceiverAccount = users.UserAccount; entity.CreateTime = DateTime.Now; listRemind.Add(entity); } Add(listRemind.ToArray()); } catch (Exception ex) { throw ex; } }
public object Clone() { var clone = new OhlcSymbol(Bars.Clone() as IBars); ObjectCopy.CopyProperties(this, clone); return(clone); }
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); }
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); }
/// <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当前地图 }
public override string Edit() { var taskWork = TaskWork.FirstOrDefault(e => e.ReceiverAccount == ClientCookie.UserCode && e.SourceCode == FlowCode.Closure && e.TypeCode == FlowCode.Closure_ExecutiveSummary && e.RefID == this.ProjectId); taskWork.Status = TaskWorkStatus.UnFinish; taskWork.StatusNameZHCN = "任务"; taskWork.StatusNameENUS = "任务"; var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId); taskWork.ReceiverAccount = closureEntity.AssetActorAccount; taskWork.ReceiverNameENUS = closureEntity.AssetActorNameENUS; taskWork.ReceiverNameZHCN = closureEntity.AssetActorNameZHCN; taskWork.Id = Guid.NewGuid(); taskWork.CreateTime = DateTime.Now; taskWork.Url = TaskWork.BuildUrl(FlowCode.Closure_ExecutiveSummary, this.ProjectId, ""); taskWork.ActivityName = NodeCode.Start; taskWork.ProcInstID = null; taskWork.FinishTime = null; taskWork.ActionName = SetTaskActionName(ProjectId); TaskWork.Add(taskWork); this.IsHistory = true; this.Save(); var objectCopy = new ObjectCopy(); var newEntity = objectCopy.AutoCopy(this); newEntity.Id = Guid.NewGuid(); newEntity.ProcInstID = 0; newEntity.IsHistory = false; newEntity.Add(); var projectEntity = ProjectInfo.Get(this.ProjectId, FlowCode.Closure_ExecutiveSummary); projectEntity.Status = ProjectStatus.UnFinish; ProjectInfo.Update(projectEntity); ProjectInfo.Reset(ProjectId, FlowCode.Closure_ExecutiveSummary); ProjectInfo.Reset(ProjectId, FlowCode.Closure); var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() && e.RefTableName == ClosureExecutiveSummary.TableName).AsNoTracking().ToList(); var newList = new List <Attachment>(); foreach (var att in attList) { var newAtt = objectCopy.AutoCopy(att); newAtt.RefTableID = newEntity.Id.ToString(); newAtt.ID = Guid.NewGuid(); newList.Add(newAtt); } Attachment.Add(newList.ToArray()); return(taskWork.Url); }
static void mmmmm() { //this.m_renderer = GetComponent<SpriteRenderer>(); Material material = Canvas.GetDefaultCanvasMaterial(); //Shader shader = this.m_renderer.material.shader; Shader shader = new Shader(); ObjectCopy.ObjectCopyTo <Shader>(material.shader, shader); AssetDatabase.CreateAsset(shader, "Assets/shader1.shader"); AssetDatabase.Refresh(); }
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); }
public void Edit(int id, PatientDto patientDto) { var entityPatient = unitOfWork.PatientRepository.GetAll().FirstOrDefault(a => a.Id == id); if (entityPatient != null) { patientDto.Id = entityPatient.Id; ObjectCopy.Patch(entityPatient, patientDto); unitOfWork.PatientRepository.Update(entityPatient); unitOfWork.Commit(); } }
public void Update(Worker worker) { if (!Contains(worker.Key)) { Add(worker); } else { var target = Items[worker.Key]; ObjectCopy.Copy(worker, target); } }
/// <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(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 void CopyPropertiesTest() { var firstObject = new TestClass(12.1) { FirstProperty = "Test", SecondProperty = 2 }; var secondObject = new TestClass(24.2); ObjectCopy.CopyProperties(firstObject, secondObject); Assert.AreEqual(firstObject.FirstProperty, secondObject.FirstProperty); Assert.AreEqual(firstObject.SecondProperty, secondObject.SecondProperty); Assert.AreNotEqual(firstObject.ThirdProperty, secondObject.ThirdProperty); }
public IHttpActionResult CreateList(TaskWork entity, List <RemindUserInfo> users) { var taskWorkEntity = new TaskWork(); ObjectCopy objectCopy = new ObjectCopy(); foreach (var remindUserInfo in users) { taskWorkEntity = objectCopy.AutoCopy(entity); taskWorkEntity.ReceiverAccount = remindUserInfo.UserAccount; taskWorkEntity.ReceiverNameENUS = remindUserInfo.UserNameENUS; taskWorkEntity.ReceiverNameZHCN = remindUserInfo.UserNameZHCN; taskWorkEntity.CreateTime = DateTime.Now; Create(taskWorkEntity); } return(Ok()); }
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] 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 void Add(PatientDto patientDto) { var patientEntity = unitOfWork.PatientRepository.GetByNationalCode(patientDto.NationalCode); if (patientEntity == null) { patientEntity = patientFactory.CreateEntity(patientDto); } else { patientDto.Id = patientEntity.Id; ObjectCopy.Patch(patientEntity, patientDto); } unitOfWork.PatientRepository.Add(patientEntity); unitOfWork.Commit(); }
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] 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] 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] 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] 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_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] 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()); }