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 > -)
{
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的更多相关文章
- (int),Convert.ToInt32(),Int32.Parse(),Int32.TryParsed()的用法总结
1 (int) 强制转型为整型. 当将long,float,double,decimal等类型转换成int类型时可采用这种方式. double dblNum = 20; int intDblNum = ...
- C#整数三种强制类型转换int、Convert.ToInt32()、int.Parse()、string到object 的区别
1.int适合简单数据类型之间的转换,C#的默认整型是int32(不支持bool型); 2.int.Parse(string sParameter)是个构造函数,参数类型只支持string类型; 3. ...
- Convert.ToInt32()、int.Parse()和(int)三者的区别
Convert.ToInt32将object类类型转换成int类型,如Convert.ToInt32(session["shuzi"]); (int)适合简单数据类型之间的转换: ...
- [No000082]Convert和Parse的区别/Convert.ToInt32()与int.Parse()的区别
(1)这两个方法的最大不同是它们对null值的处理方法: Convert.ToInt32(null)会返回0而不会产生任何异常,但int.Parse(null)则会产生异常. 没搞清楚Convert. ...
- C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别
转自:http://www.cnblogs.com/leolis/p/3968943.html 在编程过程中,数据转换是经常要用到的,C#中数据转换的方法很多,拿将目标对象转换为 整型(int)来讲, ...
- C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别 <转>
作者:Statmoon 出处:http://leolis.cnblogs.com/ 在编程过程中,数据转换是经常要用到的,C#中数据转换的方法很多,拿将目标对象转换为整型(int)来讲,有四种方法 ...
- Convert.ToInt32()与int.Parse()的区别
Convert.ToInt32()与int.Parse()的区别 (1)这两个方法的最大不同是它们对null值的处理方法: Convert.ToInt32(null)会返回0而不会产生任何异常, ...
- (int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别
C#中(int).int.Parse().int.TryParse()和Convert.ToInt32()的区别 原文链接:http://www.cnblogs.com/leolis/p/3968 ...
- Convert.ToInt32,int.Parse,int.TryParse,(int)的区别
1 (int)变量名[强制类型转换] 该转换方式主要用于数字类型转换,从int类型到long,float,double,decimal类型,可以使用隐式转换,但是从long类型到int类型就需要使用显 ...
随机推荐
- JS 取得当前日期时间(文本形式)
//-------------------------------------- // 取得当前时间,来自网上,作者不详 //------------------------------------- ...
- web.xml文件中配置mime下载文件类型(转)
转自:http://5aijava.iteye.com/blog/166600 TOMCAT在默认情况下下载.rar的文件是把文件当作text打开,以至于IE打开RAR文件为乱码,如果遇到这种情况时不 ...
- 说说C#的数学类,Math,浮点数(上)
说说C#的数学类,Math,浮点数 C#语言支持下图所看到的的数值类型,各自是整数,浮点数和小数 可能不是非常清楚,可是细致看看还是能看清楚的. 在一个C#程序中,整数(没有小数点的数)被觉得是一个i ...
- MATLAB读取黑白图像显示却是黑色,24位深转8位深黑白图像解决方法
1.24位深转8位深: ps将24位深原图.png保存为GIF图256即为8位,再将8位gif图转为需要的.png,即转为8位深png图. 2.MATLAB读取黑白图像显示几乎全为黑色: 这是最近处理 ...
- Android模拟器Genymotion安装apk
一.下载apk 选择你需要安装的apk进行下载,下载完以后放在与adb.exe同一目录下: 看我的 二.安装apk遇到的问题 开启Genymotion模拟器,然后cmd到你的platform-tool ...
- java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
1.错误描写叙述 java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map at servic ...
- SpringCloud系列六:Eureka的自我保护模式、IP选择、健康检查
1. 回顾 前面讲了很多Eureka的用法,比如Eureka Server.Eureka Server的高可用.Eureka Server的用户认证(虽然未完全实现).元数据等, 这章将讲解剩下的自我 ...
- rxjs1
<li *ngFor="let fruit of fruitsList; let i = index;">{{i}}-{{fruit.name}}-{{fruit.pr ...
- NIO之Charset类字符编码对象
Charset类字符编码对象 介绍 java中使用Charset来表示编码对象 This class defines methods for creating decoders and encoder ...
- atitit.解决struts2 SpringObjectFactory.getClassInstance NullPointerException v2 q31
atitit.解决struts2 SpringObjectFactory.getClassInstance NullPointerExceptionv2 q31 1. #--现象 java.lang. ...