Exemplo n.º 1
0
        /// <summary>字符串增加一个数字,一般用于编码递增</summary>
        /// <param name="Source">原字符串</param>
        /// <param name="Number">增加的数字</param>
        /// <returns>返回字符串</returns>
        public static string StrAddNumber(string Source, int Number)
        {
            if (Number == 0)
            {
                return(Source);
            }
            if (Source == "")
            {
                return(Number.ToString());
            }
            string Head = "";
            string Num  = "";

            for (int i = Source.Length - 1; i >= 0; i--)
            {
                if (Char.IsNumber(Source[i]))
                {
                    Num = Source[i] + Num;
                }
                else
                {
                    Head = Source.Substring(0, i + 1);
                    break;
                }
            }
            if (Source == Head)
            {
                return(Source);
            }
            else
            {
                Int64 i64 = LibConvert.StrToInt64(Num) + Number;
                return(Head + DupeString("0", Num.Length - i64.ToString().Length) + i64.ToString());
            }
        }
Exemplo n.º 2
0
 /// <summary>构造函数,参数必须为YYYYMM格式</summary>
 /// <param name="aStr"></param>
 public FinaceDate(string aStr)
 {
     if (aStr.Length != 6)
     {
         throw new Exception("FinaceDate类构造函数参数格式非法,必须为yyyyMM格式!");
     }
     date = new DateTime(LibConvert.StrToInt(aStr.Substring(0, 4)), LibConvert.StrToInt(aStr.Substring(4, 2)), 1, 0, 0, 0);
 }
Exemplo n.º 3
0
        public override int GetIdentity()
        {
            DataSet ds = new DataSet();

            SqlToDataSet(ds, "select @@identity", null);
            if (ds.Tables[0].Rows.Count == 0)
            {
                return(0);
            }
            else
            {
                return(LibConvert.ObjToInt(ds.Tables[0].Rows[0][0]));
            }
        }
Exemplo n.º 4
0
 /// <summary>取得配置信息</summary>
 /// <param name="Name">配置名称</param>
 /// <returns></returns>
 public static string GetConfig(string Name)
 {
     return(LibConvert.NullToStr(ConfigurationManager.AppSettings[Name]));
 }