zoukankan      html  css  js  c++  java
  • Convert.ToInt32(string '000000003') 变成了 3

    Convert.ToInt32(string '000000003') 变成了 3

    但是在查询的时候需要用的是string 这里的convert.toint32 反而起了坏作用,不是所有的时候都要用convert,

      public int InvalidEntry(FormCollection collection)
            {
                int startNumber = Convert.ToInt32(collection["StartNumber"]);
                int endNumber = Convert.ToInt32(collection["EndNumber"]);
                DateTime refundDate = Convert.ToDateTime(collection["RefundDate"]);
                string refundRemark = collection["RefundRemark"];
                int number = endNumber - startNumber;
                if (number > -1)
                {
                    int result = 0;
                    for (int i = startNumber; i <= endNumber; i++)
                    {
                        InvoiceInfor invoiceInforerror = this.OMService.GetInvoiceInforDetailByNumber(Convert.ToString(i).PadLeft(8, '0'));
                        //1为未开
                        if (invoiceInforerror.Status == (int)EnumInvoiceInforStatus.NotOpen)
                        {
                            invoiceInforerror.Status = (int)EnumInvoiceInforStatus.Invalid;//三为废票
                            invoiceInforerror.Remark = "该票是废票,缘由:" + refundRemark;
                            invoiceInforerror.BillingDate = refundDate;
                            invoiceInforerror.Biller = this.UserContext.LoginInfo.UserName;
                            invoiceInforerror.RefundMoney = 0;
                            if (this.OMService.SaveInvoiceInfor(invoiceInforerror))
                            {
                                //录入废票日志
                                string context = "录入废票;废票ID:" + invoiceInforerror.ID + ";错票号码:" + invoiceInforerror.Number + ";错票缘由:" + invoiceInforerror.Remark;
                                this.OMService.SaveOMLog(2, "InvoiceInfor", invoiceInforerror.ID, context, this.UserContext.LoginInfo.UserID, this.UserContext.LoginInfo.UserName,0);
                                result = 0;
                            }
                            else
                            {
                                //保存失败
                                result = 2;
                            }
                        }
                        else
                        {
                            result = 3;
                        }
                    }
                    return result;
                }
                else
                {
                    //截止号码必须大于或等于起始号码
                    return 1;
                }
    
            }
  • 相关阅读:
    git 常用命令
    centos 7 mini 安装
    python打印杨辉三角
    python 求100内的素数/质数
    字符串与bytes
    format
    Python字符串格式化
    数据结构
    ARM工作模式
    C语言实现字符串逆序输出
  • 原文地址:https://www.cnblogs.com/zhaokunbokeyuan256/p/6477564.html
Copyright © 2011-2022 走看看