示例#1
0
        public void RecoveryDeleteNo()
        {
            try
            {
                if (this.ProjectLine != null)
                {
                    ProjectLine _numHeader = Session.FindObject <ProjectLine>
                                                 (new BinaryOperator("Code", this.ProjectLine.Code));

                    XPCollection <ProjectLineItem2> _numLines = new XPCollection <ProjectLineItem2>
                                                                    (Session, new GroupOperator(GroupOperatorType.And,
                                                                                                new BinaryOperator("This", this, BinaryOperatorType.NotEqual),
                                                                                                new BinaryOperator("ProjectLine", _numHeader)),
                                                                    new SortProperty("No", DevExpress.Xpo.DB.SortingDirection.Ascending));
                    if (_numLines != null)
                    {
                        int i = 0;
                        foreach (ProjectLineItem2 _numLine in _numLines)
                        {
                            i          += 1;
                            _numLine.No = i;
                            _numLine.Save();
                            //_numLine.Session.CommitTransaction();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Tracing.Tracer.LogError(" BusinessObject = ProjectLineItem2 " + ex.ToString());
            }
        }
        public void RecoveryUpdateNo()
        {
            try
            {
                if (this.ProjectLine != null)
                {
                    ProjectLine _numHeader = Session.FindObject <ProjectLine>
                                                 (new BinaryOperator("Code", this.ProjectLine.Code));

                    XPCollection <ProjectLineService> _numLines = new XPCollection <ProjectLineService>
                                                                      (Session, new BinaryOperator("ProjectLine", _numHeader),
                                                                      new SortProperty("No", DevExpress.Xpo.DB.SortingDirection.Ascending));
                    if (_numLines != null)
                    {
                        int i1 = 0;
                        foreach (ProjectLineService _numLine in _numLines)
                        {
                            i1         += 1;
                            _numLine.No = i1;
                            _numLine.Save();
                        }
                        i1 = 1;
                    }
                }
            }
            catch (Exception ex)
            {
                Tracing.Tracer.LogError(" BusinessObject = ProjectLineService " + ex.ToString());
            }
        }