protected void ChangeCreator() { OrderEntity orderEntity = this.OrderEntity; if (this.EditForm.OperationType == OperationTypes.Add) { var curentLoginUser = this.OrderEntity.LoginUser; #region 判断是否与创建人一致 var posts = (this.OrderEntity.LoginUser as LoginUserData).PostInfos; EmployeerData ownerInfo = orderEntity.GetOwnerInfo(); var finds = posts.Where(item => item.Company.Value.ToString() == ownerInfo.Company.Value.ToString()); if (finds.Count() > 0) { curentLoginUser = finds.First(); } finds = finds.Where(item => item.Department.Value.ToString() == ownerInfo.Department.Value.ToString()); if (finds.Count() > 0) { curentLoginUser = finds.First(); } finds = finds.Where(item => item.Post.Value.ToString() == ownerInfo.Post.Value.ToString()); if (finds.Count() > 0) { curentLoginUser = finds.First(); } #endregion if (curentLoginUser != this.OrderEntity.LoginUser) { EmployeerData CreateUser = curentLoginUser; orderEntity.SetObjValue("Entity.CREATECOMPANYID", CreateUser.Company.Value); orderEntity.SetObjValue("Entity.CREATECOMPANYNAME", CreateUser.Company.Text); orderEntity.SetObjValue("Entity.CREATEDEPARTMENTID", CreateUser.Department.Value); orderEntity.SetObjValue("Entity.CREATEDEPARTMENTNAME", CreateUser.Department.Text); orderEntity.SetObjValue("Entity.CREATEPOSTID", CreateUser.Post.Value); orderEntity.SetObjValue("Entity.CREATEPOSTNAME", CreateUser.Post.Text); orderEntity.LoginUser = CreateUser; } } }