/// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(LPWeb.Model.LoanTask_CompletionEmails model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into LoanTask_CompletionEmails(");
            strSql.Append("LoanTaskid,TemplEmailId,[Enabled])");
            strSql.Append(" values (");
            strSql.Append("@LoanTaskid,@TemplEmailId,@Enabled)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LoanTaskid",   SqlDbType.Int, 4),
                new SqlParameter("@TemplEmailId", SqlDbType.Int, 4),
                new SqlParameter("@Enabled",      SqlDbType.Bit)
            };
            parameters[0].Value = model.LoanTaskid;
            parameters[1].Value = model.TemplEmailId;
            parameters[2].Value = model.Enabled;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LPWeb.Model.LoanTask_CompletionEmails model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update LoanTask_CompletionEmails set ");
            strSql.Append("LoanTaskid=@LoanTaskid,");
            strSql.Append("TemplEmailId=@TemplEmailId,");
            strSql.Append("[Enabled]=@Enabled");
            strSql.Append(" where TaskCompletionEmailId=@TaskCompletionEmailId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LoanTaskid",            SqlDbType.Int, 4),
                new SqlParameter("@TemplEmailId",          SqlDbType.Int, 4),
                new SqlParameter("@TaskCompletionEmailId", SqlDbType.Int, 4),
                new SqlParameter("@Enabled",               SqlDbType.Bit)
            };
            parameters[0].Value = model.LoanTaskid;
            parameters[1].Value = model.TemplEmailId;
            parameters[2].Value = model.TaskCompletionEmailId;
            parameters[3].Value = model.Enabled;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LPWeb.Model.LoanTask_CompletionEmails GetModel(int TaskCompletionEmailId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 TaskCompletionEmailId,LoanTaskid,TemplEmailId,[Enabled] from LoanTask_CompletionEmails ");
            strSql.Append(" where TaskCompletionEmailId=@TaskCompletionEmailId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskCompletionEmailId", SqlDbType.Int, 4)
            };
            parameters[0].Value = TaskCompletionEmailId;

            LPWeb.Model.LoanTask_CompletionEmails model = new LPWeb.Model.LoanTask_CompletionEmails();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["TaskCompletionEmailId"] != null && ds.Tables[0].Rows[0]["TaskCompletionEmailId"].ToString() != "")
                {
                    model.TaskCompletionEmailId = int.Parse(ds.Tables[0].Rows[0]["TaskCompletionEmailId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LoanTaskid"] != null && ds.Tables[0].Rows[0]["LoanTaskid"].ToString() != "")
                {
                    model.LoanTaskid = int.Parse(ds.Tables[0].Rows[0]["LoanTaskid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TemplEmailId"] != null && ds.Tables[0].Rows[0]["TemplEmailId"].ToString() != "")
                {
                    model.TemplEmailId = int.Parse(ds.Tables[0].Rows[0]["TemplEmailId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Enabled"] != null)
                {
                    model.Enabled = Convert.ToBoolean(ds.Tables[0].Rows[0]["Enabled"]);
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }