Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LPWeb.Model.User2LeadSource model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update User2LeadSource set ");
#warning 系统发现缺少更新的字段,请手工确认如此更新是否正确!
            strSql.Append("UserID=@UserID,");
            strSql.Append("LeadSourceID=@LeadSourceID");
            strSql.Append(" where UserID=@UserID and LeadSourceID=@LeadSourceID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",       SqlDbType.Int, 4),
                new SqlParameter("@LeadSourceID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.LeadSourceID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LPWeb.Model.User2LeadSource GetModel(int UserID, int LeadSourceID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 UserID,LeadSourceID from User2LeadSource ");
            strSql.Append(" where UserID=@UserID and LeadSourceID=@LeadSourceID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",       SqlDbType.Int, 4),
                new SqlParameter("@LeadSourceID", SqlDbType.Int, 4)
            };
            parameters[0].Value = UserID;
            parameters[1].Value = LeadSourceID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["UserID"].ToString() != "")
                {
                    model.UserID = int.Parse(ds.Tables[0].Rows[0]["UserID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LeadSourceID"].ToString() != "")
                {
                    model.LeadSourceID = int.Parse(ds.Tables[0].Rows[0]["LeadSourceID"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(LPWeb.Model.User2LeadSource model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into User2LeadSource(");
            strSql.Append("UserID,LeadSourceID)");
            strSql.Append(" values (");
            strSql.Append("@UserID,@LeadSourceID)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",       SqlDbType.Int, 4),
                new SqlParameter("@LeadSourceID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.LeadSourceID;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }