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;
                }
    
            }
  • 相关阅读:
    相对路径与绝对路径问题
    javaee自定义servlet的步骤
    Struts1.X与Spring集成——另外一种方案
    菜鸟也能学cocos2dx3.0 浅析刀塔传奇(下)
    JAVA之了解类载入器Classloader
    IOS 编程中引用第三方的方类库的方法及常见问题
    通过eclipse的egit插件提交提示Auth fail
    定时器0的方式1 定时器1的方式1 数码管和led
    MongoDB入门学习(四):MongoDB的索引
    J2EE--JDBC
  • 原文地址:https://www.cnblogs.com/zhaokunbokeyuan256/p/6477564.html
Copyright © 2011-2022 走看看