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类型就需要使用显 ...
随机推荐
- oracle调优 浅析有效的游标管理
浅析有效的游标管理 [思路分析] 能够把游标理解成共享的运行计划,当sql不被共享时.常规的解决思路有两个方向: 1.调整共享池的尺寸(共享池的库缓存区中共享运行计划): 2.sql书写时尽量重用绑定 ...
- FileZilla_Server如何配置
安装采用默认直接安装. 2.下图直接点OK 进入主界面,如下 3.配置账户 选择 Edit->USERS 开始创建账户 点击ADD 按钮添加账户user1 点OK 后,回到创建账 ...
- rabbitMq视频教程
http://edu.51cto.com/index.php?do=lesson&id=83136
- Commons-VFS 使用SFTP
http://pro.ctlok.com/2011/06/apache-commons-vfs-for-sftp.html
- testng入门_单元测试
1.定义TestNG 的配置文件 <test name="exampletest1"> <classes> <!--1.只执行com.t ...
- Strategy模式
Strategy模式 Strategy模式要解决的问题和Template模式类似.都是为了把算法的声明和算法的实现解耦.Template模式是通过继承来实现的,而Strategy模式是通过组合来实现的 ...
- doxygen可以生成C/C++代码的文档(根据注释)
类似这样的注释(目前还没用到,先写一个笔记在这,免得忘了) 就像java的注释生成html文档一样
- codeforces #364a Cards
cf的a题没什么好说到,100的量级,每个人给2张牌,使每个人手中的牌点数相等.保证有一种分配方案. 对每个人,先计算出手中的牌的点数,然后循环两遍拿牌就可以. A. Cards time lim ...
- VLC WebPlugin中文
Documentation:WebPlugin 这篇文档讲述的是 VLC media player Web plugins 和怎样在网页使用它 Contents 1 介绍: 构建包含video的Web ...
- 我的第九个java程序--spring和mybatis整合(java project)
思路:入口程序读spring的配置文件-配置文件注入给程序bean--程序拿到bean以操作对象的手法查出程序 入口程序HelloWorld.java package HelloWorld; impo ...