コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XHD.Model.crm_customer_grab model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update crm_customer_grab set ");
            strSql.Append("pubpri_detail_Id=@pubpri_detail_Id,");
            strSql.Append("factory_Id=@factory_Id,");
            strSql.Append("Customer_Id=@Customer_Id,");
            strSql.Append("Customer_name=@Customer_name,");
            strSql.Append("C_createId=@C_createId,");
            strSql.Append("C_createName=@C_createName,");
            strSql.Append("C_createDate=@C_createDate");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@pubpri_detail_Id", MySqlDbType.Int32,      11),
                new MySqlParameter("@factory_Id",       MySqlDbType.VarChar,    60),
                new MySqlParameter("@Customer_Id",      MySqlDbType.Int32,      11),
                new MySqlParameter("@Customer_name",    MySqlDbType.VarChar,   200),
                new MySqlParameter("@C_createId",       MySqlDbType.Int32,      11),
                new MySqlParameter("@C_createName",     MySqlDbType.VarChar,    60),
                new MySqlParameter("@C_createDate",     MySqlDbType.DateTime),
                new MySqlParameter("@Id",               MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.pubpri_detail_Id;
            parameters[1].Value = model.factory_Id;
            parameters[2].Value = model.Customer_Id;
            parameters[3].Value = model.Customer_name;
            parameters[4].Value = model.C_createId;
            parameters[5].Value = model.C_createName;
            parameters[6].Value = model.C_createDate;
            parameters[7].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XHD.Model.crm_customer_grab DataRowToModel(DataRow row)
 {
     XHD.Model.crm_customer_grab model = new XHD.Model.crm_customer_grab();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["pubpri_detail_Id"] != null && row["pubpri_detail_Id"].ToString() != "")
         {
             model.pubpri_detail_Id = int.Parse(row["pubpri_detail_Id"].ToString());
         }
         if (row["factory_Id"] != null)
         {
             model.factory_Id = row["factory_Id"].ToString();
         }
         if (row["Customer_Id"] != null && row["Customer_Id"].ToString() != "")
         {
             model.Customer_Id = int.Parse(row["Customer_Id"].ToString());
         }
         if (row["Customer_name"] != null)
         {
             model.Customer_name = row["Customer_name"].ToString();
         }
         if (row["C_createId"] != null && row["C_createId"].ToString() != "")
         {
             model.C_createId = int.Parse(row["C_createId"].ToString());
         }
         if (row["C_createName"] != null)
         {
             model.C_createName = row["C_createName"].ToString();
         }
         if (row["C_createDate"] != null && row["C_createDate"].ToString() != "")
         {
             model.C_createDate = DateTime.Parse(row["C_createDate"].ToString());
         }
     }
     return(model);
 }
コード例 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(XHD.Model.crm_customer_grab model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into crm_customer_grab(");
            strSql.Append("pubpri_detail_Id,factory_Id,Customer_Id,Customer_name,C_createId,C_createName,C_createDate)");
            strSql.Append(" values (");
            strSql.Append("@pubpri_detail_Id,@factory_Id,@Customer_Id,@Customer_name,@C_createId,@C_createName,@C_createDate)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@pubpri_detail_Id", MySqlDbType.Int32,    11),
                new MySqlParameter("@factory_Id",       MySqlDbType.VarChar,  60),
                new MySqlParameter("@Customer_Id",      MySqlDbType.Int32,    11),
                new MySqlParameter("@Customer_name",    MySqlDbType.VarChar, 200),
                new MySqlParameter("@C_createId",       MySqlDbType.Int32,    11),
                new MySqlParameter("@C_createName",     MySqlDbType.VarChar,  60),
                new MySqlParameter("@C_createDate",     MySqlDbType.DateTime)
            };
            parameters[0].Value = model.pubpri_detail_Id;
            parameters[1].Value = model.factory_Id;
            parameters[2].Value = model.Customer_Id;
            parameters[3].Value = model.Customer_name;
            parameters[4].Value = model.C_createId;
            parameters[5].Value = model.C_createName;
            parameters[6].Value = model.C_createDate;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XHD.Model.crm_customer_grab GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,pubpri_detail_Id,factory_Id,Customer_Id,Customer_name,C_createId,C_createName,C_createDate from crm_customer_grab ");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32)
            };
            parameters[0].Value = Id;

            XHD.Model.crm_customer_grab model = new XHD.Model.crm_customer_grab();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(XHD.Model.crm_customer_grab model)
 {
     return(dal.Update(model));
 }
コード例 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(XHD.Model.crm_customer_grab model)
 {
     return(dal.Add(model));
 }