Example #1
0
        // 只修改金额和注释
        // return:
        //      -1  error
        //      0   succeed
        //      1   partial succeed
        int ModifyPriceAndComment()
        {
            int nRet = 0;
            string strError = "";
            bool bPartialSucceed = false;

            if (this.listView_overdues.CheckedItems.Count == 0)
            {
                strError = "尚未勾选任何事项";
                goto ERROR1;
            }

            // this.StopFillSummary();
            StopFillAmercing(false);
            StopFillAmerced(false);

            List<AmerceItem> modifyprice_items = null;
            nRet = GetCheckedIdList(this.listView_overdues,
                "modifyprice",
                out modifyprice_items,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            Debug.Assert(modifyprice_items != null, "");

            List<AmerceItem> modifycomment_items = null;
            nRet = GetCheckedIdList(this.listView_overdues,
                "modifycomment",
                out modifycomment_items,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            Debug.Assert(modifycomment_items != null, "");

            /*
            List<AmerceItem> appendcomment_items = null;
            nRet = GetCheckedIdList(this.listView_overdues,
                "appendcomment",
                out appendcomment_items,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            Debug.Assert(appendcomment_items != null, "");

             * */
            if (modifyprice_items.Count + modifycomment_items.Count/* + appendcomment_items.Count */ == 0)
            {
                strError = "所勾选的事项中,没有任何发生过价格或注释追加/修改的事项";
                goto ERROR1;
            }

            EnableControls(false);

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在进行 修改金额/注释 的操作: " + this.textBox_readerBarcode.Text + " ...");
            stop.BeginLoop();

            try
            {
                string strReaderXml = "";

                if (modifyprice_items.Count > 0)
                {
                    AmerceItem[] amerce_items_param = new AmerceItem[modifyprice_items.Count];
                    modifyprice_items.CopyTo(amerce_items_param);
                    AmerceItem[] failed_items = null;

                    long lRet = Channel.Amerce(
                        stop,
                        "modifyprice",
                        this.textBox_readerBarcode.Text,
                        amerce_items_param,
                        out failed_items,
                        out strReaderXml,
                        out strError);
                    if (lRet == -1)
                        goto ERROR1;
                    // 部分成功
                    if (lRet == 1)
                    {
                        bPartialSucceed = true;
                        MessageBox.Show(this, strError);
                    }
                }

                /*
                if (appendcomment_items.Count > 0)
                {
                    AmerceItem[] amerce_items_param = new AmerceItem[appendcomment_items.Count];
                    appendcomment_items.CopyTo(amerce_items_param);

                    long lRet = Channel.Amerce(
                        stop,
                        "appendcomment",
                        this.textBox_readerBarcode.Text,
                        amerce_items_param,
                        out strReaderXml,
                        out strError);
                    if (lRet == -1)
                        goto ERROR1;
                }*/

                // 需要的权限高一些,因此放在后面
                if (modifycomment_items.Count > 0)
                {
                    AmerceItem[] amerce_items_param = new AmerceItem[modifycomment_items.Count];
                    modifycomment_items.CopyTo(amerce_items_param);
                    AmerceItem[] failed_items = null;

                    long lRet = Channel.Amerce(
                        stop,
                        "modifycomment",
                        this.textBox_readerBarcode.Text,
                        amerce_items_param,
                        out failed_items,
                        out strReaderXml,
                        out strError);
                    if (lRet == -1)
                        goto ERROR1;
                }

                ClearHtmlAndAmercingDisplay();

#if NO
                // 刷新列表?
                nRet = FillAmercingList(strReaderXml,
    out strError);
                if (nRet == -1)
                {
                    strError = "FillList()发生错误: " + strError;
                    goto ERROR1;
                }
#endif
                BeginFillAmercing(strReaderXml);


                string strXml = "";
                string strReaderBarcode = this.textBox_readerBarcode.Text;
                // 刷新html?
                nRet = LoadReaderHtmlRecord(ref strReaderBarcode,
                    out strXml,
                    out strError);
                if (this.textBox_readerBarcode.Text != strReaderBarcode)
                    this.textBox_readerBarcode.Text = strReaderBarcode;
                if (nRet == -1)
                {
#if NO
                    Global.SetHtmlString(this.webBrowser_readerInfo,
                        "装载读者记录发生错误: " + strError);
#endif
                    this.m_webExternalHost.SetTextString("装载读者记录发生错误: " + strError);
                    goto ERROR1;
                }

                /*
                // 刷新amerced
                nRet = LoadAmercedRecords(this.textBox_readerBarcode.Text,
                    out strError);
                if (nRet == -1)
                {
                    strError = "LoadAmercedRecords()发生错误: " + strError;
                    goto ERROR1;
                }
                 * */

#if NO
                if (this.checkBox_fillSummary.Checked == true)
                    this.BeginFillSummary();
#endif

            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");

                EnableControls(true);
            }

            if (bPartialSucceed == true)
                return 1;
            return 0;
        ERROR1:
            MessageBox.Show(this, strError);
            return -1;
        }
Example #2
0
        int DoAmerce(string strReaderBarcode,
            string strForegiftValue,
            out string strMsg,
            out string strError)
        {
            strMsg = "";
            strError = "";

            int nRet = 0;

            LibraryChannel channel = this.GetChannel();

            byte[] baTimestamp = null;
            string strRecPath = "";
            string[] results = null;
            long lRet = channel.GetReaderInfo(null,
                strReaderBarcode,
                "xml",
                out results,
                out strRecPath,
                out baTimestamp,
                out strError);
            if (lRet == -1)
            {
                strMsg = "办证交押金时获得读者记录发生错误,办证失败,请重新操作。";
            }
            else if (lRet == 0)
            {
                strMsg = "办证交押金时发现卡号读者竟不存在,办证失败,请重新操作。";
            }
            else if (lRet == 1)
            {
                XmlDocument dom = new XmlDocument();
                dom.LoadXml(results[0]);

                string strId = DomUtil.GetAttr(dom.DocumentElement, "overdues/overdue[@reason='押金。']", "id");
                if (String.IsNullOrEmpty(strId))
                {
                    strMsg = "办证交押金时发现费信息竟不存在,办证失败,请到柜台办理。";
                    goto UNDO;
                }

                string strValue = DomUtil.GetAttr(dom.DocumentElement, "overdues/overdue[@reason='押金。']", "price");
                strValue = PriceUtil.OldGetPurePrice(strValue);
                float value = float.Parse(strValue);

                float foregiftValue = float.Parse(strForegiftValue);
                if (value != foregiftValue)
                {
                    strMsg = "您放入的金额是:" + strForegiftValue + ",而您需要交的押金金额为:" + value.ToString();
                    goto UNDO;
                }


                AmerceItem item = new AmerceItem();
                item.ID = strId;
                AmerceItem[] amerce_items = { item };

                AmerceItem[] failed_items = null;
                string strReaderXml = "";
                lRet = channel.Amerce(null,
                    "amerce",
                    strReaderBarcode,
                    amerce_items,
                    out failed_items,
                    out strReaderXml,
                    out strError);
                if (lRet == -1 && lRet == 1)
                {
                    strMsg = "办证时收押金失败,办证失败,请到柜台办理。";
                    goto UNDO;
                }

                nRet = 1;
            }
            else // lRet > 1
            {
                strMsg = "办证交押金时发现卡号为【" + strReaderBarcode + "】读者存在多条,办证失败,请到柜台办理。";
            }

            this.ReturnChannel(channel);
            return nRet;
        UNDO:
            lRet = DeleteReader(strRecPath, baTimestamp, out strError);
            if (lRet == -1)
                strError = "办证过程中交费发生错误(回滚失败):" + strError;
            else
                strError = "办证过程中交费发生错误(回滚成功)";
            this.ReturnChannel(channel);
            return nRet;
        }
Example #3
0
        // return:
        //      -1  error
        //      0   succeed
        //      1   partial succeed
        int UndoAmerce()
        {
            int nRet = 0;
            string strError = "";
            bool bPartialSucceed = false;

            // this.StopFillSummary();
            StopFillAmercing(false);
            StopFillAmerced(false);


            if (this.listView_amerced.CheckedItems.Count == 0)
            {
                strError = "尚未选择要撤回交费的事项";
                goto ERROR1;
            }

            // 2013/12/20
            // 显示用
            List<OverdueItemInfo> overdue_infos = null;
            nRet = GetCheckedOverdueInfos(this.listView_amerced,
                out overdue_infos,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            List<AmerceItem> amerce_items = null;
            nRet = GetCheckedIdList(this.listView_amerced,
                "amerce",
                out amerce_items,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            if (nRet == 0
                || amerce_items == null
                || amerce_items.Count == 0)
            {
                strError = "所选择的要撤回交费的事项,没有有效的id";
                goto ERROR1;
            }

            EnableControls(false);

            DateTime start_time = DateTime.Now;

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在进行 撤回交费 操作: " + this.textBox_readerBarcode.Text + " ...");
            stop.BeginLoop();

            try
            {
                string strReaderXml = "";

                AmerceItem[] amerce_items_param = new AmerceItem[amerce_items.Count];
                amerce_items.CopyTo(amerce_items_param);

                AmerceItem[] failed_items = null;

                long lRet = Channel.Amerce(
                    stop,
                    "undo",
                    this.textBox_readerBarcode.Text,
                    amerce_items_param,
                    out failed_items,
                    out strReaderXml,
                    out strError);
                if (lRet == -1)
                    goto ERROR1;
                // 部分成功
                if (lRet == 1)
                {
                    bPartialSucceed = true;
                    MessageBox.Show(this, strError);
                }

                DateTime end_time = DateTime.Now;

                {
                    // 只打印成功的部分行
                    if (failed_items != null)
                    {
                        foreach (AmerceItem item in failed_items)
                        {
                            foreach (OverdueItemInfo info in overdue_infos)
                            {
                                if (info.ID == item.ID)
                                {
                                    overdue_infos.Remove(info);
                                    break;
                                }
                            }
                        }
                    }

                }

                string strReaderSummary = "";
                if (String.IsNullOrEmpty(strReaderXml) == false)
                    strReaderSummary = Global.GetReaderSummary(strReaderXml);

                string strAmerceOperator = "";
                if (this.Channel != null)
                    strAmerceOperator = this.Channel.UserName;

                List<string> ids = new List<string>();
                // 为数组中每个元素添加AmerceOperator
                if (overdue_infos != null)
                {
                    foreach (OverdueItemInfo item in overdue_infos)
                    {
                        item.AmerceOperator = this.Channel.UserName;
                        ids.Add(item.ID);
                    }
                }

                this.MainForm.OperHistory.AmerceAsync(
                    this.textBox_readerBarcode.Text,
                    strReaderSummary,
                    overdue_infos,
                    strAmerceOperator,
                    start_time,
                    end_time);

                ClearAllDisplay();

#if NO
                // 刷新列表?
                nRet = FillAmercingList(strReaderXml,
    out strError);
                if (nRet == -1)
                {
                    strError = "FillList()发生错误: " + strError;
                    goto ERROR1;
                }
#endif
                BeginFillAmercing(strReaderXml);


                string strXml = "";
                string strReaderBarcode = this.textBox_readerBarcode.Text;
                // 刷新html?
                nRet = LoadReaderHtmlRecord(ref strReaderBarcode,
                    out strXml,
                    out strError);
                if (this.textBox_readerBarcode.Text != strReaderBarcode)
                    this.textBox_readerBarcode.Text = strReaderBarcode;
                if (nRet == -1)
                {
#if NO
                    Global.SetHtmlString(this.webBrowser_readerInfo,
                        "装载读者记录发生错误: " + strError);
#endif
                    this.m_webExternalHost.SetTextString("装载读者记录发生错误: " + strError);
                    goto ERROR1;
                }

#if NO
                // 刷新amerced
                nRet = LoadAmercedRecords(this.textBox_readerBarcode.Text,
                    out strError);
                if (nRet == -1)
                {
                    strError = "LoadAmercedRecords()发生错误: " + strError;
                    goto ERROR1;
                }
#endif
                BeginFillAmerced(this.textBox_readerBarcode.Text, null);

#if NO
                if (this.checkBox_fillSummary.Checked == true)
                    this.BeginFillSummary();
#endif

            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");

                EnableControls(true);
            }

            if (bPartialSucceed == true)
                return 1;

            return 0;
        ERROR1:
            MessageBox.Show(this, strError);
            return -1;
        }
Example #4
0
        // return:
        //      -1  error
        //      0   canceled
        //      1   writed
        int WriteDkywCard(
            AmerceItem[] AmerceItems,
            List<OverdueItemInfo> OverdueInfos,
            string strReaderBarcode,
            string strPrice,
            out string strError)
        {
            strError = "";

            DkywAmerceCardDialog dlg = new DkywAmerceCardDialog();
            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.AmerceForm = this;
            dlg.AmerceItems = AmerceItems;
            dlg.OverdueInfos = OverdueInfos;
            dlg.CardNumber = strReaderBarcode;
            dlg.SubmitPrice = PriceUtil.GetPurePrice(strPrice); // 是否要去除货币单位?
            dlg.StartPosition = FormStartPosition.CenterScreen;
            this.MainForm.AppInfo.LinkFormState(dlg, "AmerceCardDialog_state");
            dlg.ShowDialog(this);
            this.MainForm.AppInfo.UnlinkFormState(dlg);

            if (dlg.DialogResult != DialogResult.OK)
                return 0;

            return 1;
        }
Example #5
0
        // parameters:
        //      bRefreshAll 是否要重新获取两个列表?
        // return:
        //      -1  error
        //      0   succeed
        //      1   partial succeed (strError中没有信息,中途已经MessageBox()报错了)
        internal int Submit(AmerceItem[] amerce_items,
            List<OverdueItemInfo> overdue_infos,
            bool bRefreshAll,
            out string strError)
        {
            strError = "";
            int nRet = 0;
            bool bPartialSucceed = false;

            // this.StopFillSummary();
            StopFillAmercing(false);
            StopFillAmerced(false);

            DateTime start_time = DateTime.Now;

            EnableControls(false);

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在进行 交费 操作: " + this.textBox_readerBarcode.Text + " ...");
            stop.BeginLoop();

            try
            {
                string strReaderXml = "";

                AmerceItem[] failed_items = null;

                long lRet = Channel.Amerce(
                    stop,
                    "amerce",
                    this.textBox_readerBarcode.Text,
                    amerce_items,
                    out failed_items,
                    out strReaderXml,
                    out strError);
                if (lRet == -1)
                {
                    /*
                    if (this.AmerceInterface == "迪科远望")
                    {
                        string strPrice = GetTotalPrice(overdue_infos);

                        strError += "\r\n\r\n但是当前读者的IC卡已经被扣款 " + strPrice + "。请联系卡中心取消该次IC卡扣款。";
                    }
                     * */
                    goto ERROR1;
                }
                // 部分成功
                if (lRet == 1)
                {
                    bPartialSucceed = true;
                    MessageBox.Show(this, strError);
                    // 只打印成功的部分行
                    if (failed_items != null)
                    {
                        foreach (AmerceItem item in failed_items)
                        {
                            foreach (OverdueItemInfo info in overdue_infos)
                            {
                                if (info.ID == item.ID)
                                {
                                    overdue_infos.Remove(info);
                                    break;
                                }
                            }
                        }
                    }
                }

                DateTime end_time = DateTime.Now;

                string strReaderSummary = "";
                if (String.IsNullOrEmpty(strReaderXml) == false)
                    strReaderSummary = Global.GetReaderSummary(strReaderXml);

                string strAmerceOperator = "";
                if (this.Channel != null)
                    strAmerceOperator = this.Channel.UserName;

                List<string> ids = new List<string>();
                // 为数组中每个元素添加AmerceOperator
                if (overdue_infos != null)
                {
                    foreach (OverdueItemInfo item in overdue_infos)
                    {
                        item.AmerceOperator = this.Channel.UserName;
                        ids.Add(item.ID);
                    }
                }

                this.MainForm.OperHistory.AmerceAsync(
                    this.textBox_readerBarcode.Text,
                    strReaderSummary,
                    overdue_infos,
                    strAmerceOperator,
                    start_time,
                    end_time);

                if (bRefreshAll == true)
                    ClearAllDisplay();
                else
                    ClearAllDisplay1();

                if (bRefreshAll == true)
                {
#if NO
                    // 刷新列表?
                    nRet = FillAmercingList(strReaderXml,
        out strError);
                    if (nRet == -1)
                    {
                        strError = "FillList()发生错误: " + strError;
                        goto ERROR1;
                    }
#endif
                    BeginFillAmercing(strReaderXml);

                }
                else
                {
                    // 简单去掉那些已经交费的项目
                    foreach (string id in ids)
                    {
                        ListViewItem item = ListViewUtil.FindItem(this.listView_overdues,
                            id,
                            COLUMN_AMERCING_ID);
                        if (item != null)
                            this.listView_overdues.Items.Remove(item);
                    }

                    // 更新选定信息显示 2013/10/26
                    this.toolStripLabel_amercingMessage.Text = GetAmercingPriceMessage();
                }

                string strXml = "";
                string strReaderBarcode = this.textBox_readerBarcode.Text;
                // 刷新html?
                nRet = LoadReaderHtmlRecord(ref strReaderBarcode,
                    out strXml,
                    out strError);
                if (this.textBox_readerBarcode.Text != strReaderBarcode)
                    this.textBox_readerBarcode.Text = strReaderBarcode;

                if (nRet == -1)
                {
#if NO
                    Global.SetHtmlString(this.webBrowser_readerInfo,
                        "装载读者记录发生错误: " + strError);
#endif
                    this.m_webExternalHost.SetTextString("装载读者记录发生错误: " + strError);
                    goto ERROR1;
                }

                if (bRefreshAll == true)
                {
#if NO
                    // 刷新amerced
                    nRet = LoadAmercedRecords(this.textBox_readerBarcode.Text,
                        out strError);
                    if (nRet == -1)
                    {
                        strError = "LoadAmercedRecords()发生错误: " + strError;
                        goto ERROR1;
                    }
#endif
                    BeginFillAmerced(this.textBox_readerBarcode.Text, null);

                }
                else
                {
#if NO
                    // return:
                    //      -1  error
                    //      0   not found
                    //      1   找到并填入
                    nRet = LoadAmercedRecords(
                        ids,
                        out strError);
                    if (nRet == -1)
                    {
                        strError = "LoadAmercedRecords(ids)发生错误: " + strError;
                        goto ERROR1;
                    }
#endif
                    BeginFillAmerced("", ids);
                }

#if NO
                if (this.checkBox_fillSummary.Checked == true)
                    this.BeginFillSummary();
#endif

            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");

                EnableControls(true);
            }

            if (bPartialSucceed == true)
                return 1;

            return 0;
        ERROR1:
            return -1;
        }
Example #6
0
        void AmerceSubmit()
        {
            int nRet = 0;
            string strError = "";

            // 看看是不是符合服务器要求的交费接口
            if (String.IsNullOrEmpty(this.MainForm.ClientFineInterfaceName) == false)
            {
                // 注:如果服务器端要配置要求前端不用接口,则应明显配置为“<无>”
                string strThisInterface = this.AmerceInterface;
                if (String.IsNullOrEmpty(strThisInterface) == true)
                    strThisInterface = "<无>";

                if (string.Compare(this.MainForm.ClientFineInterfaceName, "cardCenter", true) == 0)
                {
                    if (strThisInterface == "<无>")
                    {
                        strError = "应用服务器要求前端必须采用 CardCenter 类型交费接口 '" + this.MainForm.ClientFineInterfaceName + "'。然而本前端当前配置的交费接口为'" + this.AmerceInterface + "'";
                        goto ERROR1;
                    }

                    // TODO: 是否要排除“迪科远望” 类型 ?
                }
                else if (this.MainForm.ClientFineInterfaceName != strThisInterface)
                {
                    strError = "应用服务器要求前端必须采用交费接口 '" + this.MainForm.ClientFineInterfaceName + "'。然而本前端当前配置的交费接口为'" + this.AmerceInterface + "'";
                    goto ERROR1;
                }
            }


            if (this.listView_overdues.CheckedItems.Count == 0)
            {
                strError = "尚未勾选任何要交费的事项";
                goto ERROR1;
            }

            List<AmerceItem> amerce_items = null;
            nRet = GetCheckedIdList(this.listView_overdues,
                "amerce",
                out amerce_items,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            if (nRet == 0)
            {
                strError = "所勾选的要交费事项中,没有符合条件的事项";
                goto ERROR1;
            }

            AmerceItem[] amerce_items_param = new AmerceItem[amerce_items.Count];
            amerce_items.CopyTo(amerce_items_param);

            // 显示用
            List<OverdueItemInfo> overdue_infos = null;
            nRet = GetCheckedOverdueInfos(this.listView_overdues,
                out overdue_infos,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            if (nRet == 0
                || amerce_items == null
                || amerce_items.Count == 0)
            {
                strError = "尚未选择要交费的事项,或者所选择的事项没有有效的id";
                goto ERROR1;
            }

            // 从IC卡扣款
            if (this.AmerceInterface == "迪科远望")
            {
                string strPrice = GetTotalPrice(overdue_infos);
                // return:
                //      -1  error
                //      0   canceled
                //      1   writed
                nRet = WriteDkywCard(
                    amerce_items_param,
                    overdue_infos,
                    this.textBox_readerBarcode.Text,
                    strPrice,
                    out strError);
                if (nRet == 0)
                    return; // 放弃

                if (nRet == -1)
                    goto ERROR1;
            }
            else if (string.IsNullOrEmpty(this.AmerceInterface) == false
                && this.AmerceInterface != "<无>")
            {
                string strPrice = GetTotalPrice(overdue_infos);
                // return:
                //      -1  error
                //      0   canceled
                //      1   writed
                nRet = WriteCardCenter(
                    this.AmerceInterface,
                    amerce_items_param,
                    overdue_infos,
                    this.textBox_readerBarcode.Text,
                    strPrice,
                    out strError);
                if (nRet == 0)
                    return; // 放弃

                if (nRet == -1)
                    goto ERROR1;
            }
            else
            {
                nRet = Submit(amerce_items_param,
                    overdue_infos,
                    false,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
            }

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Example #7
0
        // parameters:
        //      strFunction 为"amerce" "modifyprice" "modifycomment" 之一
        int GetCheckedIdList(ListView listview,
            string strFunction,
            out List<AmerceItem> amerce_items,
            out string strError)
        {
            strError = "";
            amerce_items = new List<AmerceItem>();
            // 目前两个listview的id列都还是8

            for (int i = 0; i < listview.Items.Count; i++)
            {
                ListViewItem item = listview.Items[i];
                if (item.Checked == false)
                    continue;

                AmercingItemInfo info = null;

                string strID = "";
                string strPrice = "";
                string strComment = "";
                if (listview == this.listView_amerced)
                {
                    // strID = listview.Items[i].SubItems[8].Text;
                    // strPriceComment = listview.Items[i].SubItems[2].Text;
                    strID = ListViewUtil.GetItemText(item, COLUMN_AMERCED_ID);
                    strPrice = ListViewUtil.GetItemText(item, COLUMN_AMERCED_PRICE);
                    strComment = ListViewUtil.GetItemText(item, COLUMN_AMERCED_COMMENT);
                }
                else
                {
                    Debug.Assert(listview == this.listView_overdues, "");
                    strID = ListViewUtil.GetItemText(item, COLUMN_AMERCING_ID);
                    strPrice = ListViewUtil.GetItemText(item, COLUMN_AMERCING_PRICE);
                    strComment = ListViewUtil.GetItemText(item, COLUMN_AMERCING_COMMENT);

                    info = (AmercingItemInfo)item.Tag;
                    Debug.Assert(info != null, "");
                }

                if (String.IsNullOrEmpty(strID) == true)
                {
                    strError = "出现了id为空的行。";
                    return -1;
                }

                // 有星号的才是变更金额
                string strNewPrice = "";
                if (strPrice.Length > 0 && strPrice[0] == '*')
                    strNewPrice = strPrice.Substring(1);

                if (strFunction == "modifyprice")
                {
                    // 如果价格没有变化,则不列入modifyprice
                    if (strNewPrice == "")
                        continue;
                }

                string strExistComment = "";
                string strAppendComment = "";
                ParseCommentString(strComment,
                    out strExistComment,
                    out strAppendComment);

                bool bAppendComment = false;
                bool bCommentChanged = false;   // 注释是否发生过修改?

                if (info != null)
                {
                    if (strExistComment != info.Comment)
                        bCommentChanged = true;
                }

                if (string.IsNullOrEmpty(strAppendComment) == false)
                    bAppendComment = true;

                AmerceItem amerceItem = new AmerceItem();
                amerceItem.ID = strID;

                if (strFunction == "amerce")
                {
                    amerceItem.NewPrice = strNewPrice;
                    if (bCommentChanged == true || bAppendComment == true)
                        amerceItem.NewComment = BuildCommitComment(
                            bCommentChanged,
                            strExistComment,
                            bAppendComment,
                            strAppendComment);
                }
                else if (strFunction == "modifyprice")
                {
                    amerceItem.NewPrice = strNewPrice;
                    if (bCommentChanged == true || bAppendComment == true)
                        amerceItem.NewComment = BuildCommitComment(
                            bCommentChanged,
                            strExistComment,
                            bAppendComment,
                            strAppendComment);
                }
                else if (strFunction == "modifycomment")
                {
                    if (bCommentChanged == true || bAppendComment == true)
                    {
                    }
                    else
                        continue;

                    // 如果已经算做修改价格,则修改注释的功能已经就达到了,这里不必再做
                    if (String.IsNullOrEmpty(strNewPrice) == false)
                        continue;

                    if (bCommentChanged == true || bAppendComment == true)
                        amerceItem.NewComment = BuildCommitComment(
                            bCommentChanged,
                            strExistComment,
                            bAppendComment,
                            strAppendComment);
                }

                amerce_items.Add(amerceItem);
            }

            return amerce_items.Count;
        }