Beispiel #1
0
        public Item2 InsertNewItem(int index)
        {
            this.DisableUpdate();   // 防止闪动。彻底解决问题。2009/10/13 

            try
            {
                Item2 item = new Item2(this);

                item.AddToTable(this.dpTable1, index);

                this.Items.Insert(index, item);

                if (this.GetDefaultRecord != null)
                {
                    GetDefaultRecordEventArgs e = new GetDefaultRecordEventArgs();
                    this.GetDefaultRecord(this, e);

                    string strDefaultRecord = e.Xml;

                    if (String.IsNullOrEmpty(strDefaultRecord) == true)
                        goto END1;

                    string strError = "";
                    // 根据缺省XML订购记录填充必要的字段
                    int nRet = SetDefaultRecord(item,
                        strDefaultRecord,
                        true,
                        out strError);
                    if (nRet == -1)
                        throw new Exception(strError);
                }
            END1:

                item.State = ItemState.New;

                return item;
            }
            finally
            {
                this.EnableUpdate();
            }
        }
Beispiel #2
0
 void orderCrossControl1_GetDefaultRecord(object sender, GetDefaultRecordEventArgs e)
 {
     if (this.GetDefaultRecord != null)
         this.GetDefaultRecord(sender, e);
 }
Beispiel #3
0
        public Item InsertNewItem(int index)
        {
            this.DisableUpdate();   // 防止闪动。彻底解决问题。2009/10/13 

            try
            {

                this.tableLayoutPanel_content.RowCount += 1;
                this.tableLayoutPanel_content.RowStyles.Insert(index + 1, new System.Windows.Forms.RowStyle());

                Item item = new Item(this);

                item.InsertToTable(this.tableLayoutPanel_content, index);

                this.Items.Insert(index, item);

                if (this.GetDefaultRecord != null)
                {
                    GetDefaultRecordEventArgs e = new GetDefaultRecordEventArgs();
                    this.GetDefaultRecord(this, e);

                    string strDefaultRecord = e.Xml;

                    if (String.IsNullOrEmpty(strDefaultRecord) == true)
                        goto END1;

                    string strError = "";
                    // 根据缺省XML订购记录填充必要的字段
                    int nRet = SetDefaultRecord(item,
                        strDefaultRecord,
                        true,
                        out strError);
                    if (nRet == -1)
                        throw new Exception(strError);
                }
            END1:

                item.State = ItemState.New;

                return item;
            }
            finally
            {
                this.EnableUpdate();
            }
        }
Beispiel #4
0
        // 获得缺省记录
        internal string GetDefaultXml()
        {
            if (this.GetDefaultRecord != null)
            {
                GetDefaultRecordEventArgs e = new GetDefaultRecordEventArgs();
                this.GetDefaultRecord(this, e);

                return e.Xml;
            }
            return "";
        }