/// <summary>
        /// 对象提交处理。
        /// </summary>
        /// <param name="isSubmit"></param>
        /// <returns></returns>
        protected virtual int ObjectSubmit(bool isSubmit)
        {
            //string[] updateProperty = new string[] { MB.WinBase.UIDataEditHelper.ENTITY_DOC_STATE };
            //object wiseObject = MB.Util.MyReflection.Instance.PropertyMemberwiseClone(_BindingSource.Current);
            //if(isSubmit)
            //    MB.Util.MyReflection.Instance.InvokePropertyForSet(wiseObject, MB.WinBase.UIDataEditHelper.ENTITY_DOC_STATE, MB.Util.Model.DocState.Submit);
            //else
            //    MB.Util.MyReflection.Instance.InvokePropertyForSet(wiseObject, MB.WinBase.UIDataEditHelper.ENTITY_DOC_STATE, MB.Util.Model.DocState.Progress);

            //MB.WinBase.UIDataEditHelper.Instance.SetEntityState(wiseObject, MB.Util.Model.EntityState.Modified);
            //int re = ObjectDataSave(wiseObject, updateProperty);
            //if (re > 0) {
            //    MB.WinBase.Binding.BindingSourceHelper.Instance.SetCtlReadOnly(_EditColumnCtlBinding, isSubmit);
            //    _ClientRuleObject.RaiseAfterDocStateChanged(_BindingSource.Current);

            //}
            object mainEntity = _BindingSource.Current;
            int    re         = _ClientRuleObject.Submit(mainEntity, !isSubmit);

            if (re >= 0)
            {
                //if (isSubmit)
                //    MB.Util.MyReflection.Instance.InvokePropertyForSet(mainEntity, MB.WinBase.UIDataEditHelper.ENTITY_DOC_STATE, MB.Util.Model.DocState.Submit);
                //else
                //    MB.Util.MyReflection.Instance.InvokePropertyForSet(mainEntity, MB.WinBase.UIDataEditHelper.ENTITY_DOC_STATE, MB.Util.Model.DocState.Progress);

                //刷新当前编辑的对象。

                _ClientRuleObject.RefreshEntity((int)_ClientRuleObject.MainDataTypeInDoc, _BindingSource.Current);

                _BindingSource.RaiseListChangedEvents = false;
                MB.WinBase.UIDataEditHelper.Instance.SetEntityState(mainEntity, MB.Util.Model.EntityState.Persistent);
                MB.WinBase.Binding.BindingSourceHelper.Instance.SetCtlReadOnly(_EditColumnCtlBinding, isSubmit);
                _BindingSource.EndEditNoRaiseEvent();
                _BindingSource.RaiseListChangedEvents = true;

                MB.Util.Model.DocState docState = MB.WinBase.UIDataEditHelper.Instance.GetEntityDocState(mainEntity);
                OnDocStateChanged(mainEntity, docState);
                //_ClientRuleObject.RaiseAfterDocStateChanged(mainEntity);
            }

            return(re);
        }
Example #2
0
        /// <summary>
        /// 对象提交处理。
        /// </summary>
        /// <param name="isSubmit"></param>
        /// <returns></returns>
        protected virtual int ObjectSubmit(bool isSubmit)
        {
            object mainEntity = _EditBindingSource.Current;
            int    re         = _ClientRuleObject.Submit(mainEntity, !isSubmit);

            if (re >= 0)
            {
                //刷新当前编辑的对象。
                _ClientRuleObject.RefreshEntity((int)_ClientRuleObject.MainDataTypeInDoc, _EditBindingSource.Current);
                _EditBindingSource.RaiseListChangedEvents = false;
                MB.WinBase.UIDataEditHelper.Instance.SetEntityState(mainEntity, MB.Util.Model.EntityState.Persistent);
                MB.WinBase.Binding.BindingSourceHelper.Instance.SetCtlReadOnly(_EditColumnCtlBinding, isSubmit);
                _EditBindingSource.EndEditNoRaiseEvent();
                _EditBindingSource.RaiseListChangedEvents = true;

                MB.Util.Model.DocState docState = MB.WinBase.UIDataEditHelper.Instance.GetEntityDocState(mainEntity);
                OnDocStateChanged(mainEntity, docState);
            }
            return(re);
        }