Ejemplo n.º 1
0
        void LoadPrevOrNextIssueItem(bool bPrev)
        {
            string strError = "";

            IssueItem new_issueitem = GetPrevOrNextIssueItem(bPrev,
                                                             out strError);

            if (new_issueitem == null)
            {
                goto ERROR1;
            }

            // 保存当前事项
            int nRet = FinishOneIssueItem(out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            LoadIssueItem(new_issueitem);

            // 在listview中滚动到可见范围
            new_issueitem.HilightListViewItem(true);
            this.Text = "册信息";
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Ejemplo n.º 2
0
        // 填充编辑界面数据
        int FillEditing(IssueItem issueitem,
                        out string strError)
        {
            strError = "";

            if (issueitem == null)
            {
                strError = "issueitem参数值为空";
                return(-1);
            }

            string strXml = "";
            int    nRet   = issueitem.BuildRecord(out strXml,
                                                  out strError);

            if (nRet == -1)
            {
                return(-1);
            }

            nRet = this.issueEditControl_editing.SetData(strXml,
                                                         issueitem.RecPath,
                                                         issueitem.Timestamp,
                                                         out strError);
            if (nRet == -1)
            {
                return(-1);
            }


            return(0);
        }
Ejemplo n.º 3
0
        // 从集合中和视觉上同时删除
        public void PhysicalDeleteItem(
            IssueItem issueitem)
        {
            // 从listview中消失
            issueitem.DeleteFromListView();

            this.Remove(issueitem);
        }
Ejemplo n.º 4
0
 // 设置全部isueitem事项的Parent域
 public void SetParentID(string strParentID)
 {
     for (int i = 0; i < this.Count; i++)
     {
         IssueItem item = this[i];
         if (item.Parent != strParentID) // 避免连带无谓地修改item.Changed 2009/3/6
         {
             item.Parent = strParentID;
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 以记录路径定位一个事项
        /// </summary>
        /// <param name="strRegisterNo"></param>
        /// <returns></returns>
        public IssueItem GetItemByRecPath(string strRecPath)
        {
            for (int i = 0; i < this.Count; i++)
            {
                IssueItem item = this[i];
                if (item.RecPath == strRecPath)
                {
                    return(item);
                }
            }

            return(null);
        }
Ejemplo n.º 6
0
        // Undo标记删除
        // return:
        //      false   没有必要Undo
        //      true    已经Undo
        public bool UndoMaskDeleteItem(IssueItem issueitem)
        {
            if (issueitem.ItemDisplayState != ItemDisplayState.Deleted)
            {
                return(false);   // 要Undo的事项根本就不是Deleted状态,所以谈不上Undo
            }
            // 因为不知道上次标记删除前数据是否改过,因此全当改过
            issueitem.ItemDisplayState = ItemDisplayState.Changed;
            issueitem.Changed          = true;

            // 刷新
            issueitem.RefreshListView();
            return(true);
        }
Ejemplo n.º 7
0
        // 为编辑目的的初始化
        // parameters:
        //      issueitems   容器。用于UndoMaskDelete
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="issueitem">要编辑的期事项</param>
        /// <param name="issueitems">事项所在的集合</param>
        /// <param name="strError"></param>
        /// <returns></returns>
        public int InitialForEdit(
            IssueItem issueitem,
            IssueItemCollection issueitems,
            out string strError)
        {
            strError = "";

            this.IssueItem  = issueitem;
            this.IssueItems = issueitems;

            this.StartIssueItem = issueitem;

            return(0);
        }
Ejemplo n.º 8
0
        // 2008/11/28
        public List <string> GetParentIDs()
        {
            List <string> results = new List <string>();

            for (int i = 0; i < this.Count; i++)
            {
                IssueItem item        = this[i];
                string    strParentID = item.Parent;
                if (results.IndexOf(strParentID) == -1)
                {
                    results.Add(strParentID);
                }
            }

            return(results);
        }
Ejemplo n.º 9
0
        void LoadIssueItem(IssueItem issueitem)
        {
            if (issueitem != null)
            {
                string strError = "";
                int    nRet     = FillEditing(issueitem, out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, "LoadIssueItem() 发生错误: " + strError);
                    return;
                }
            }
            if (issueitem != null &&
                issueitem.ItemDisplayState == ItemDisplayState.Deleted)
            {
                // 已经标记删除的事项, 不能进行修改。但是可以观察
                this.issueEditControl_editing.SetReadOnly(ReadOnlyStyle.All);
                this.checkBox_autoSearchDup.Enabled = false;

                this.button_editing_undoMaskDelete.Enabled = true;
                this.button_editing_undoMaskDelete.Visible = true;
            }
            else
            {
                this.issueEditControl_editing.SetReadOnly(ReadOnlyStyle.Librarian);

                this.button_editing_undoMaskDelete.Enabled = false;
                this.button_editing_undoMaskDelete.Visible = false;
            }

            this.issueEditControl_editing.GetValueTable -= new GetValueTableEventHandler(issueEditControl_editing_GetValueTable);
            this.issueEditControl_editing.GetValueTable += new GetValueTableEventHandler(issueEditControl_editing_GetValueTable);

            this.IssueItem = issueitem;

            SetOkButtonState();
        }
Ejemplo n.º 10
0
        // 标记删除
        public void MaskDeleteItem(
            bool bRemoveFromList,
            IssueItem issueitem)
        {
            if (issueitem.ItemDisplayState == ItemDisplayState.New)
            {
                PhysicalDeleteItem(issueitem);
                return;
            }


            issueitem.ItemDisplayState = ItemDisplayState.Deleted;
            issueitem.Changed          = true;

            // 从listview中消失?
            if (bRemoveFromList == true)
            {
                issueitem.DeleteFromListView();
            }
            else
            {
                issueitem.RefreshListView();
            }
        }
Ejemplo n.º 11
0
        public IssueItem Clone()
        {
            IssueItem newObject = new IssueItem();

            newObject.ItemDisplayState = this.ItemDisplayState;

            newObject.RecPath    = this.RecPath;
            newObject.m_bChanged = this.m_bChanged;
            newObject.OldRecord  = this.OldRecord;


            // 放入最新鲜的内容
            newObject.CurrentRecord = this.RecordDom.OuterXml;


            newObject.RecordDom = new XmlDocument();
            newObject.RecordDom.LoadXml(this.RecordDom.OuterXml);

            newObject.Timestamp    = ByteArray.GetCopy(this.Timestamp);
            newObject.ListViewItem = null; // this.ListViewItem;
            newObject.Error        = null; // this.Error;

            return(newObject);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 以RefID定位一个事项
        /// </summary>
        /// <param name="strRefID"></param>
        /// <returns></returns>
        public IssueItem GetItemByRefID(string strRefID,
                                        List <IssueItem> excludeItems)
        {
            for (int i = 0; i < this.Count; i++)
            {
                IssueItem item = this[i];

                // 需要排除的事项
                if (excludeItems != null)
                {
                    if (excludeItems.IndexOf(item) != -1)
                    {
                        continue;
                    }
                }

                if (item.RefID == strRefID)
                {
                    return(item);
                }
            }

            return(null);
        }
Ejemplo n.º 13
0
        public IssueItem Clone()
        {
            IssueItem newObject = new IssueItem();

            newObject.ItemDisplayState = this.ItemDisplayState;

            newObject.RecPath = this.RecPath;
            newObject.m_bChanged = this.m_bChanged;
            newObject.OldRecord = this.OldRecord;


            // 放入最新鲜的内容
            newObject.CurrentRecord = this.RecordDom.OuterXml;


            newObject.RecordDom = new XmlDocument();
            newObject.RecordDom.LoadXml(this.RecordDom.OuterXml);

            newObject.Timestamp = ByteArray.GetCopy(this.Timestamp);
            newObject.ListViewItem = null;  // this.ListViewItem;
            newObject.Error = null; // this.Error;

            return newObject;
        }
Ejemplo n.º 14
0
        // parameters:
        //      order_refid_change_table   订购记录的 refid 变迁情况
        //      item_refid_change_table 发生过修改的册refid对照表。key为旧值,value为新值
        /// <summary>
        /// 根据一个 XML 字符串内容,构建出集合内的若干事项
        /// </summary>
        /// <param name="nodeIssueCollection">XmlNode对象,本方法将使用其下属的 dprms:issue 元素来构造事项</param>
        /// <param name="list">ListView 对象。构造好的事项会显示到其中</param>
        /// <param name="order_refid_change_table">订购记录的 refid 变迁情况</param>
        /// <param name="bRefreshRefID">构造事项的过程中,是否要刷新每个事项的 RefID 成员值</param>
        /// <param name="item_refid_change_table">发生过修改的册refid对照表。key为旧值,value为新值</param>
        /// <param name="strError">返回出错信息</param>
        /// <returns>-1: 出错。错误信息在 strError 中; 0: 成功</returns>
        public int ImportFromXml(XmlNode nodeIssueCollection,
                                 ListView list,
                                 Hashtable order_refid_change_table,
                                 bool bRefreshRefID,
                                 Hashtable item_refid_change_table,
                                 out string strError)
        {
            strError = "";
            int nRet = 0;

            if (nodeIssueCollection == null)
            {
                return(0);
            }

            XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());

            nsmgr.AddNamespace("dprms", DpNs.dprms);

            XmlNodeList nodes = nodeIssueCollection.SelectNodes("dprms:issue", nsmgr);

            for (int i = 0; i < nodes.Count; i++)
            {
                XmlNode node = nodes[i];

                IssueItem issue_item = new IssueItem();
                nRet = issue_item.SetData("",
                                          node.OuterXml,
                                          null,
                                          out strError);
                if (nRet == -1)
                {
                    return(-1);
                }

                if (bRefreshRefID == true)
                {
                    issue_item.RefID = Guid.NewGuid().ToString();
                }

                if (item_refid_change_table != null &&
                    item_refid_change_table.Count > 0)
                {
                    // 更换<orderInfo>里的<distribute>中的refid字符串
                    nRet = issue_item.ReplaceOrderInfoItemRefID(item_refid_change_table,
                                                                out strError);
                    if (nRet == -1)
                    {
                        return(-1);
                    }
                }

                if (order_refid_change_table != null &&
                    order_refid_change_table.Count > 0)
                {
                    // 更换<orderInfo>里的<refID>中的refid字符串
                    nRet = issue_item.ReplaceOrderInfoRefID(order_refid_change_table,
                                                            out strError);
                    if (nRet == -1)
                    {
                        return(-1);
                    }
                }

                this.Add(issue_item);
                issue_item.ItemDisplayState = ItemDisplayState.New;
                issue_item.AddToListView(list);

                issue_item.Changed = true;
            }

            return(0);
        }
Ejemplo n.º 15
0
        private void issueEditControl_editing_ControlKeyDown(object sender, ControlKeyEventArgs e)
        {
            bool bUp = false;

            if (e.e.KeyCode == Keys.OemOpenBrackets && e.e.Control == true)
            {
                bUp = true; // 从上面拷贝
            }
            else if (e.e.KeyCode == Keys.OemCloseBrackets && e.e.Control == true)
            {
                bUp = false;    // 从下面拷贝
            }
            else
            {
                return;
            }

            string    strError  = "";
            IssueItem issueitem = GetPrevOrNextItem(bUp, out strError);

            if (issueitem == null)
            {
                return;
            }
            switch (e.Name)
            {
            case "PublishTime":
                this.issueEditControl_editing.PublishTime = issueitem.PublishTime;
                break;

            case "State":
                this.issueEditControl_editing.State = issueitem.State;
                break;

            case "Issue":
                this.issueEditControl_editing.Issue = issueitem.Issue;
                break;

            case "Zong":
                this.issueEditControl_editing.Zong = issueitem.Zong;
                break;

            case "Volume":
                this.issueEditControl_editing.Volume = issueitem.Volume;
                break;

            case "OrderInfo":
                this.issueEditControl_editing.OrderInfo = issueitem.OrderInfo;
                break;

            case "Comment":
                this.issueEditControl_editing.Comment = issueitem.Comment;
                break;

            case "BatchNo":
                this.issueEditControl_editing.BatchNo = issueitem.BatchNo;
                break;

            case "RecPath":
                //this.entityEditControl_editing.RecPath = bookitem.RecPath;
                break;

            default:
                Debug.Assert(false, "未知的栏目名称 '" + e.Name + "'");
                return;
            }
        }
Ejemplo n.º 16
0
        // 标记删除
        public void MaskDeleteItem(
            bool bRemoveFromList,
            IssueItem issueitem)
        {
            if (issueitem.ItemDisplayState == ItemDisplayState.New)
            {
                PhysicalDeleteItem(issueitem);
                return;
            }


            issueitem.ItemDisplayState = ItemDisplayState.Deleted;
            issueitem.Changed = true;

            // 从listview中消失?
            if (bRemoveFromList == true)
                issueitem.DeleteFromListView();
            else
            {
                issueitem.RefreshListView();
            }
        }
Ejemplo n.º 17
0
        // Undo标记删除
        // return:
        //      false   没有必要Undo
        //      true    已经Undo
        public bool UndoMaskDeleteItem(IssueItem issueitem)
        {
            if (issueitem.ItemDisplayState != ItemDisplayState.Deleted)
                return false;   // 要Undo的事项根本就不是Deleted状态,所以谈不上Undo

            // 因为不知道上次标记删除前数据是否改过,因此全当改过
            issueitem.ItemDisplayState = ItemDisplayState.Changed;
            issueitem.Changed = true;

            // 刷新
            issueitem.RefreshListView();
            return true;
        }
Ejemplo n.º 18
0
        // 从集合中和视觉上同时删除
        public void PhysicalDeleteItem(
            IssueItem issueitem)
        {
            // 从listview中消失
            issueitem.DeleteFromListView();

            this.Remove(issueitem);
        }
Ejemplo n.º 19
0
        // parameters:
        //      order_refid_change_table   订购记录的 refid 变迁情况
        //      item_refid_change_table 发生过修改的册refid对照表。key为旧值,value为新值
        /// <summary>
        /// 根据一个 XML 字符串内容,构建出集合内的若干事项
        /// </summary>
        /// <param name="nodeIssueCollection">XmlNode对象,本方法将使用其下属的 dprms:issue 元素来构造事项</param>
        /// <param name="list">ListView 对象。构造好的事项会显示到其中</param>
        /// <param name="order_refid_change_table">订购记录的 refid 变迁情况</param>
        /// <param name="bRefreshRefID">构造事项的过程中,是否要刷新每个事项的 RefID 成员值</param>
        /// <param name="item_refid_change_table">发生过修改的册refid对照表。key为旧值,value为新值</param>
        /// <param name="strError">返回出错信息</param>
        /// <returns>-1: 出错。错误信息在 strError 中; 0: 成功</returns>
        public int ImportFromXml(XmlNode nodeIssueCollection,
            ListView list,
            Hashtable order_refid_change_table,
            bool bRefreshRefID,
            Hashtable item_refid_change_table,
            out string strError)
        {
            strError = "";
            int nRet = 0;

            if (nodeIssueCollection == null)
                return 0;

            XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
            nsmgr.AddNamespace("dprms", DpNs.dprms);

            XmlNodeList nodes = nodeIssueCollection.SelectNodes("dprms:issue", nsmgr);
            for (int i = 0; i < nodes.Count; i++)
            {
                XmlNode node = nodes[i];

                IssueItem issue_item = new IssueItem();
                nRet = issue_item.SetData("",
                    node.OuterXml,
                    null,
                    out strError);
                if (nRet == -1)
                    return -1;

                if (bRefreshRefID == true)
                    issue_item.RefID = Guid.NewGuid().ToString();

                if (item_refid_change_table != null
                    && item_refid_change_table.Count > 0)
                {
                    // 更换<orderInfo>里的<distribute>中的refid字符串
                    nRet = issue_item.ReplaceOrderInfoItemRefID(item_refid_change_table,
                        out strError);
                    if (nRet == -1)
                        return -1;
                }

                if (order_refid_change_table != null
                    && order_refid_change_table.Count > 0)
                {
                    // 更换<orderInfo>里的<refID>中的refid字符串
                    nRet = issue_item.ReplaceOrderInfoRefID(order_refid_change_table,
                        out strError);
                    if (nRet == -1)
                        return -1;
                }

                this.Add(issue_item);
                issue_item.ItemDisplayState = ItemDisplayState.New;
                issue_item.AddToListView(list);

                issue_item.Changed = true;
            }

            return 0;
        }