Пример #1
0
        public string GetExpressNo(string expressName)
        {
            string             expressNo = string.Empty;
            List <MExpressNum> List      = QueryList(string.Format("where ExpressName='{0}'", expressName));

            if (List == null || List.Count <= 0)
            {
                return(null);
            }
            MExpressNum mExpressNum = List[0];

            if (mExpressNum.ExrepssNumRule == "否")
            {
                return(null);
            }
            if (mExpressNum.MaxNum == 0)
            {
                expressNo = mExpressNum.ExpressBeforeNum + mExpressNum.ExpressStartNum.ToString().PadLeft(mExpressNum.SerialNum, '0');
            }
            else
            {
                expressNo = mExpressNum.ExpressBeforeNum + (mExpressNum.ExpressStartNum + mExpressNum.MaxNum).ToString().PadLeft(mExpressNum.SerialNum, '0');
            }
            return(expressNo);
        }
Пример #2
0
        /// <summary>
        /// 根据主键ID更新一条记录
        /// </summary>
        /// <param name="model">更新后的实体</param>
        /// <returns>执行结果受影响行数</returns>
        public int Update(MExpressNum model)
        {
            #region SQL语句
            const string sql = @"
UPDATE [T_ExpressNum]
SET 
	 [UUID] = @UUID
	,[ExpressName] = @ExpressName
	,[ModuleId] = @ModuleId
	,[ExrepssNumRule] = @ExrepssNumRule
	,[ExpressStartNum] = @ExpressStartNum
	,[SerialNum] = @SerialNum
	,[MaxNum] = @MaxNum
	,[ExpressBeforeNum] = @ExpressBeforeNum
WHERE [UUID] = @UUID";
            #endregion
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, sql,
                                             new SQLiteParameter("@UUID", SqlHelper.ToNullDBValue(model.UUID)),
                                             new SQLiteParameter("@ExpressName", SqlHelper.ToNullDBValue(model.ExpressName)),
                                             new SQLiteParameter("@ModuleId", SqlHelper.ToNullDBValue(model.ModuleId)),
                                             new SQLiteParameter("@ExrepssNumRule", SqlHelper.ToNullDBValue(model.ExrepssNumRule)),
                                             new SQLiteParameter("@ExpressStartNum", SqlHelper.ToNullDBValue(model.ExpressStartNum)),
                                             new SQLiteParameter("@SerialNum", SqlHelper.ToNullDBValue(model.SerialNum)),
                                             new SQLiteParameter("@MaxNum", SqlHelper.ToNullDBValue(model.MaxNum)),
                                             new SQLiteParameter("@ExpressBeforeNum", SqlHelper.ToNullDBValue(model.ExpressBeforeNum))
                                             ));
        }
Пример #3
0
        /// <summary>
        /// 向数据库中添加一条记录
        /// </summary>
        /// <param name="model">要添加的实体</param>
        /// <returns>插入数据的ID</returns>
        public int Insert(MExpressNum model)
        {
            #region SQL语句
            const string sql = @"
INSERT INTO [T_ExpressNum] (
	 [UUID]
	,[ExpressName]
	,[ModuleId]
	,[ExrepssNumRule]
	,[ExpressStartNum]
	,[SerialNum]
	,[MaxNum]
	,[ExpressBeforeNum]
)
VALUES (
     @UUID
	,@ExpressName
	,@ModuleId
	,@ExrepssNumRule
    ,@ExpressStartNum
	,@SerialNum
	,@MaxNum
	,@ExpressBeforeNum
);";
            #endregion
            var res = SqlHelper.ExecuteNonQuery(CommandType.Text, sql,
                                                new SQLiteParameter("@UUID", SqlHelper.ToNullDBValue(model.UUID)),
                                                new SQLiteParameter("@ExpressName", SqlHelper.ToNullDBValue(model.ModuleId)),
                                                new SQLiteParameter("@ModuleId", SqlHelper.ToNullDBValue(model.ExpressName)),
                                                new SQLiteParameter("@ExrepssNumRule", SqlHelper.ToNullDBValue(model.ExrepssNumRule)),
                                                new SQLiteParameter("@ExpressStartNum", SqlHelper.ToNullDBValue(model.ExpressStartNum)),
                                                new SQLiteParameter("@SerialNum", SqlHelper.ToNullDBValue(model.SerialNum)),
                                                new SQLiteParameter("@MaxNum", SqlHelper.ToNullDBValue(model.MaxNum)),
                                                new SQLiteParameter("@ExpressBeforeNum", SqlHelper.ToNullDBValue(model.ExpressBeforeNum)));
            return(Convert.ToInt32(res));
        }
Пример #4
0
 /// <summary>
 /// 根据主键ID更新一条记录
 /// </summary>
 /// <param name="model">更新后的实体</param>
 /// <returns>执行结果受影响行数</returns>
 public int Update(MExpressNum model)
 {
     return(_dao.Update(model));
 }
Пример #5
0
 /// <summary>
 /// 向数据库中添加一条记录
 /// </summary>
 /// <param name="model">要添加的实体</param>
 /// <returns>插入数据的ID</returns>
 public int Insert(MExpressNum model)
 {
     return(_dao.Insert(model));
 }