AccessDAL/Vote.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using MyShop.IDAL;
using MyShop.Model;

namespace MyShop.AccessDAL
{
    public class Vote : IVote
    {

        private ConfigInfo configInfo = new ConfigInfo();
        private string tableName = "Ljh_Vote";

        public Vote()
        {
            if (!string.IsNullOrEmpty(configInfo.TablePrefix.Trim()))
                tableName = configInfo.TablePrefix + "Vote";
        }

        #region IVote member


        /// <summary>
        /// add  
        /// </summary>
        /// <param name="model"></param>
        /// <returns>返回ID, 如果发生错误则返回-1</returns>
        public int Add(VoteInfo model)
        {
            if (model == null)
            {
                return -1;
            }
            string commandText = "insert into " + this.tableName + "(Title,Content,Number,VoteTime,EndTime,VoteType,IsSelected)  values(@Title,@Content,@Number,@VoteTime,@EndTime,@VoteType,@IsSelected)  ";
            OleDbParameter[] commandParameters = 
                {
                Database.MakeInParam("@Title", OleDbType.VarWChar		,	0	,model.Title	),
                Database.MakeInParam("@Content", OleDbType.VarWChar	,	0	,model.Content	),
                Database.MakeInParam("@Number", OleDbType.VarWChar	,	0	,model.Number	),
                Database.MakeInParam("@VoteTime", OleDbType.Date	,	8	,model.VoteTime	),
                Database.MakeInParam("@EndTime", OleDbType.Date	,	8	,model.EndTime	),
                Database.MakeInParam("@VoteType", OleDbType.UnsignedTinyInt	,	1	,model.VoteType	),
                Database.MakeInParam("@IsSelected", OleDbType.UnsignedTinyInt	,	1	,model.IsSelected	)
         };

            int intIdentity = -1;
            try
            {
                Database.ExecuteNonQuery(CommandType.Text, out intIdentity, commandText, commandParameters);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return intIdentity;
        }


后面还有 187 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。