void BackIssue() { if (!(this.m_item is IssueBindingItem)) { return; } IssueBindingItem issue = (IssueBindingItem)this.m_item; string strError = ""; int nRet = 0; // 收尾上次的对象,从编辑器到对象 if (this.orderDesignControl1.Changed == true && issue != null) { // 将order控件中的信息修改兑现到IssueBindingItem对象中 nRet = this.bindingControl1.GetFromOrderControl( this.orderDesignControl1, issue, out strError); if (nRet == -1) { goto ERROR1; } if (nRet == 2) // 期信息有进一步变化,需要设置到编辑器 { string strOrderInfoMessage = ""; // 根据期信息初始化采购控件 // return: // -1 出错 // 0 没有找到对应的采购信息 // 1 找到采购信息 nRet = this.bindingControl1.InitialOrderControl( issue, this.orderDesignControl1, out strOrderInfoMessage, out strError); if (nRet == -1) { goto ERROR1; } if (nRet == 0) { this.orderDesignControl1.Visible = false; this.orderDesignControl1.Clear(); issue = null; return; } } // this.m_issue.Changed = true; this.orderDesignControl1.Changed = false; } return; ERROR1: MessageBox.Show(this, strError); }
private void bindingControl1_CellFocusChanged(object sender, FocusChangedEventArgs e) { string strError = ""; int nRet = 0; // 收尾上次的对象,从编辑器到对象 BackItem(); #if ORDERDESIGN_CONTROL BackIssue(); #endif // 从册对象到编辑器 if (e.NewFocusObject is Cell) { Cell cell = null; cell = (Cell)e.NewFocusObject; if (/*cell.item != this.m_item * &&*/cell.item != null ) { nRet = this.entityEditControl1.SetData(cell.item.Xml, cell.item.RecPath, null, out strError); if (nRet == -1) { goto ERROR1; } if (cell.item.Calculated == true || cell.item.Deleted == true || cell.item.Locked == true || (cell.item.ParentItem != null && cell.item.ParentItem.Locked == true)) { this.entityEditControl1.SetReadOnly("all"); } else { this.entityEditControl1.SetReadOnly("binding"); } this.entityEditControl1.Changed = false; this.m_item = cell.item; this.entityEditControl1.ContentControl.Invalidate(); // 背景有可能改变 this.entityEditControl1.Visible = true; this.orderDesignControl1.Visible = false; return; } } #if ORDERDESIGN_CONTROL // 从期对象到编辑器 if (e.NewFocusObject is IssueBindingItem) { IssueBindingItem issue = null; issue = (IssueBindingItem)e.NewFocusObject; if (issue != this.m_item && String.IsNullOrEmpty(issue.PublishTime) == false && issue.Virtual == false) { string strOrderInfoMessage = ""; // 根据期信息初始化采购控件 // return: // -1 出错 // 0 没有找到对应的采购信息 // 1 找到采购信息 nRet = this.bindingControl1.InitialOrderControl( issue, this.orderDesignControl1, out strOrderInfoMessage, out strError); if (nRet == -1) { goto ERROR1; } if (nRet == 0) { goto END1; } this.m_item = issue; this.orderDesignControl1.Visible = true; this.entityEditControl1.Visible = false; return; } } #endif // END1: this.orderDesignControl1.Visible = false; this.orderDesignControl1.Clear(); this.m_item = null; this.entityEditControl1.Visible = false; this.entityEditControl1.Clear(); return; ERROR1: MessageBox.Show(this, strError); }