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 > -)
{
int result = ;
for (int i = startNumber; i <= endNumber; i++)
{
InvoiceInfor invoiceInforerror = this.OMService.GetInvoiceInforDetailByNumber(Convert.ToString(i).PadLeft(, ''));
//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 = ;
if (this.OMService.SaveInvoiceInfor(invoiceInforerror))
{
//录入废票日志
string context = "录入废票;废票ID:" + invoiceInforerror.ID + ";错票号码:" + invoiceInforerror.Number + ";错票缘由:" + invoiceInforerror.Remark;
this.OMService.SaveOMLog(, "InvoiceInfor", invoiceInforerror.ID, context, this.UserContext.LoginInfo.UserID, this.UserContext.LoginInfo.UserName,);
result = ;
}
else
{
//保存失败
result = ;
}
}
else
{
result = ;
}
}
return result;
}
else
{
//截止号码必须大于或等于起始号码
return ;
} }

Convert.ToInt32(string '000000003') 变成了 3的更多相关文章

  1. (int),Convert.ToInt32(),Int32.Parse(),Int32.TryParsed()的用法总结

    1 (int) 强制转型为整型. 当将long,float,double,decimal等类型转换成int类型时可采用这种方式. double dblNum = 20; int intDblNum = ...

  2. C#整数三种强制类型转换int、Convert.ToInt32()、int.Parse()、string到object 的区别

    1.int适合简单数据类型之间的转换,C#的默认整型是int32(不支持bool型); 2.int.Parse(string sParameter)是个构造函数,参数类型只支持string类型; 3. ...

  3. Convert.ToInt32()、int.Parse()和(int)三者的区别

    Convert.ToInt32将object类类型转换成int类型,如Convert.ToInt32(session["shuzi"]); (int)适合简单数据类型之间的转换: ...

  4. [No000082]Convert和Parse的区别/Convert.ToInt32()与int.Parse()的区别

    (1)这两个方法的最大不同是它们对null值的处理方法: Convert.ToInt32(null)会返回0而不会产生任何异常,但int.Parse(null)则会产生异常. 没搞清楚Convert. ...

  5. C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别

    转自:http://www.cnblogs.com/leolis/p/3968943.html 在编程过程中,数据转换是经常要用到的,C#中数据转换的方法很多,拿将目标对象转换为 整型(int)来讲, ...

  6. C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别 <转>

    作者:Statmoon 出处:http://leolis.cnblogs.com/   在编程过程中,数据转换是经常要用到的,C#中数据转换的方法很多,拿将目标对象转换为整型(int)来讲,有四种方法 ...

  7. Convert.ToInt32()与int.Parse()的区别

    Convert.ToInt32()与int.Parse()的区别 (1)这两个方法的最大不同是它们对null值的处理方法:    Convert.ToInt32(null)会返回0而不会产生任何异常, ...

  8. (int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别

    C#中(int).int.Parse().int.TryParse()和Convert.ToInt32()的区别   原文链接:http://www.cnblogs.com/leolis/p/3968 ...

  9. Convert.ToInt32,int.Parse,int.TryParse,(int)的区别

    1 (int)变量名[强制类型转换] 该转换方式主要用于数字类型转换,从int类型到long,float,double,decimal类型,可以使用隐式转换,但是从long类型到int类型就需要使用显 ...

随机推荐

  1. 为Linux上FireFox安装Flash插件

    废话少说,步骤如下: 1.点击网页上插件缺失处,根据提示下载tar.gz版本的插件,我下载的版本是install_flash_player_11_linux.i386.tar.gz,这个文件被下载到了 ...

  2. python 列表,元组,字符串方法和属性

    python序列包含列表[].元组().字符串三种 -------列表-------------- 一.列表基本内容 1.建立:a=[1,2,3,5],通过[ , ,], >>>b= ...

  3. sql笔记 获取指定数据库下的所有表

    SELECT Name FROM 数据库名称..SysObjects Where XType='U' ORDER BY Name XType='U' 标识查询用户创建的表 S为系统创建的表

  4. jQuery find() 搜索所有段落中的后代 C# find() 第一个匹配元素 Func 有返回值 Action是没有返回值 Predicate 只有一个参数且返回值为bool 表达式树Expression

    所有p后代span Id为 TotalProject 的 select 标签 的后代 option标签 为选中的 text using System; using System.Collections ...

  5. zabbix proxy 安装

    ### 前期准备 ```   # 直接yum安装 ```   ### 安装 ``` # 安装 sqlite zabbix-proxy-sqlite3 yum -y install sqlite sql ...

  6. tony_CENTOS启动方式设置

    方法: 在etc文件夹下面有个初始加载文件是用来启动系统的,系统在启动的时候先去env中找到shell的必要配置,然后把shell启动起来,那么再然后就要启动整个系统了,到底是启动图形界面呢,还是字符 ...

  7. OPPO.1107刷机笔记

    手动 转移任意APP为系统APP的方法流程简述 宗旨: 保持和系统原本同目录下的文件各种设置(权限,所有者,SE上下文),目录结构保持一致即可! 从 /data/app/里将对应的APP文件移动到 / ...

  8. 美团HD(9)-监听点击城市

    DJSelectCityViewController.h // 点击城市发出通知 - (void)tableView:(UITableView *)tableView didSelectRowAtIn ...

  9. javascript (function() { /* code */ })() 自执行函数

    (function(){ function a(){ alert("a"); } })(); 自执行匿名函数: 常见格式:(function() { /* code */ })() ...

  10. __attribute__系列之aligned

    __attribute__的属性aligned,作用是为了设置字节对齐. aligned是对 变量和结构体进行 字节对齐的属性设置. 通过aligned属性设置(aligned(对齐字节数)),可以显 ...