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类型就需要使用显 ...
随机推荐
- 进程资源和进程状态 TASK_RUNNING TASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLE
摘要:本文主要介绍进程资源和进程状态.进程资源由两部分组成:内核空间进程资源以及用户空间进程资源.进程状态,就绪/执行状态.等待状态(能够被中断打断).等待状态(不能够被中断打断).停止状态和僵死状态 ...
- 查看tomcat启动文件都干点啥---catalina.bat
在上一次查看tomcat启动文件都干点啥一文中,我们总结出,startup.bat文件的作用就是找到catalina.bat文件,然后把参数传递给它,在startup.bat中,调用catalina. ...
- MongoDB笔记(一):MongoDB介绍及Windows下安装
一.前言 MongoDB火了也蛮久了,关于简介看看这里吧.项目中一直没用上,最近闲的慌就自己学了下,顺便记录下以便今后复习. 本系列是基于MongoDB 2.4.8 windows 64位讲解,后面的 ...
- lua面向对象编程 《lua程序设计》 16章 笔记
Lua中的table就是一种对象,即它拥有状态.拥有独立于其值的标识(self).table与对象一样具有独立于创建者和创建地的征集周期 什么叫对象拥有独立的生命周期? Account = {bala ...
- css学习之overlay
CSS Overlay技巧 作者:大漠 日期:2013-11-10 点击:8 本文由大漠根据SARA SOUEIDAN的<CSS OVERLAY TECHNIQUES>所译,整个译文带 ...
- 递归函数, 匿名函数, yield from
递归函数 函数执行流程 http://pythontutor.com/visualize.html#mode=edit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 ...
- linux杂谈(十一):LDAPserver的搭建
1.LDAP简单介绍 今天我们来介绍LDAPserver的搭建和client的訪问,可是基本的问题在前者.首先我们要知道什么是LDAP. 在日常交谈中.你可能会听到有些人这么说:& ...
- 使用 ObjectDataSource 缓存数据
简介 就计算机科学而言 , 缓存 过程包括成本昂贵的数据或信息的获取 , 以及将备份存储在可快速访问的位置.对于数据驱动的应用程序,大型.复杂的查询通常会消耗大量应用程序执行时间.要提升这类应用程序的 ...
- string 的函数
string 有一个很好用到函数:substr(index). 去掉前index个字符.
- 从一个实例看javascript几种常用格式的转换
要对如图一所示的左侧table的数据按照“总量”进行排序 1,在前端实现 2,数据格式为object,如图二 原创文章,转载请注明:http://www.cnblogs.com/phpgcs java ...