Esempio n. 1
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public bool Update(LPWeb.Model.Company_Lead_Sources model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Company_Lead_Sources set ");
            strSql.Append("LeadSource=@LeadSource,");
            strSql.Append("DefaultUserId=@DefaultUserId,");
            strSql.Append("Default=@Default");
            strSql.Append(" where LeadSourceID=@LeadSourceID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LeadSourceID",  SqlDbType.Int,        4),
                new SqlParameter("@LeadSource",    SqlDbType.NVarChar, 150),
                new SqlParameter("@DefaultUserId", SqlDbType.Int,        4),
                new SqlParameter("@Default",       SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.LeadSourceID;
            parameters[1].Value = model.LeadSource;
            parameters[2].Value = model.DefaultUserId;
            parameters[3].Value = model.Default;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LPWeb.Model.Company_Lead_Sources model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Company_Lead_Sources(");
            strSql.Append("LeadSource,DefaultUserId,Default)");
            strSql.Append(" values (");
            strSql.Append("@LeadSource,@DefaultUserId,@Default)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LeadSource",    SqlDbType.NVarChar, 150),
                new SqlParameter("@DefaultUserId", SqlDbType.Int,        4),
                new SqlParameter("@Default",       SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.LeadSource;
            parameters[1].Value = model.DefaultUserId;
            parameters[2].Value = model.Default;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LPWeb.Model.Company_Lead_Sources GetModel(int LeadSourceID)
        {
            StringBuilder strSql = new StringBuilder();

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

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["LeadSourceID"].ToString() != "")
                {
                    model.LeadSourceID = int.Parse(ds.Tables[0].Rows[0]["LeadSourceID"].ToString());
                }
                model.LeadSource = ds.Tables[0].Rows[0]["LeadSource"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(LPWeb.Model.Company_Lead_Sources model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Company_Lead_Sources set ");
            strSql.Append("LeadSource=@LeadSource,");
            strSql.Append("DefaultUserId=@DefaultUserId,");
            strSql.Append("[Default]=@Default");
            strSql.Append(" where LeadSourceID=@LeadSourceID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LeadSourceID",  SqlDbType.Int,        4),
                new SqlParameter("@LeadSource",    SqlDbType.NVarChar, 150),
                new SqlParameter("@DefaultUserId", SqlDbType.Int,        4),
                new SqlParameter("@Default",       SqlDbType.Bit)
            };
            parameters[0].Value = model.LeadSourceID;
            parameters[1].Value = model.LeadSource;
            parameters[2].Value = model.DefaultUserId;
            parameters[3].Value = model.Default;

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