Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IMeiWei.Model.business model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update business set ");
            strSql.Append("BusinessId=@BusinessId,");
            strSql.Append("BusinessName=@BusinessName,");
            strSql.Append("BusinessPhone=@BusinessPhone,");
            strSql.Append("BusinessHours=@BusinessHours,");
            strSql.Append("PerCapitaConsumption=@PerCapitaConsumption,");
            strSql.Append("RestaurantHighlights=@RestaurantHighlights,");
            strSql.Append("FirstOffer=@FirstOffer,");
            strSql.Append("VIPOffer=@VIPOffer,");
            strSql.Append("BusinessTypeId=@BusinessTypeId,");
            strSql.Append("IsServerPark=@IsServerPark,");
            strSql.Append("IsServerAllelic=@IsServerAllelic,");
            strSql.Append("BusinessAddress=@BusinessAddress");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@BusinessId",           MySqlDbType.VarChar,   36),
                new MySqlParameter("@BusinessName",         MySqlDbType.VarChar,  100),
                new MySqlParameter("@BusinessPhone",        MySqlDbType.VarChar,  100),
                new MySqlParameter("@BusinessHours",        MySqlDbType.VarChar,  100),
                new MySqlParameter("@PerCapitaConsumption", MySqlDbType.Int32,     11),
                new MySqlParameter("@RestaurantHighlights", MySqlDbType.VarChar, 1000),
                new MySqlParameter("@FirstOffer",           MySqlDbType.VarChar, 1000),
                new MySqlParameter("@VIPOffer",             MySqlDbType.VarChar, 1000),
                new MySqlParameter("@BusinessTypeId",       MySqlDbType.VarChar,   20),
                new MySqlParameter("@IsServerPark",         MySqlDbType.Bit),
                new MySqlParameter("@IsServerAllelic",      MySqlDbType.Bit),
                new MySqlParameter("@BusinessAddress",      MySqlDbType.VarChar, 1000),
                new MySqlParameter("@Id",                   MySqlDbType.Int64, 20)
            };
            parameters[0].Value  = model.BusinessId;
            parameters[1].Value  = model.BusinessName;
            parameters[2].Value  = model.BusinessPhone;
            parameters[3].Value  = model.BusinessHours;
            parameters[4].Value  = model.PerCapitaConsumption;
            parameters[5].Value  = model.RestaurantHighlights;
            parameters[6].Value  = model.FirstOffer;
            parameters[7].Value  = model.VIPOffer;
            parameters[8].Value  = model.BusinessTypeId;
            parameters[9].Value  = model.IsServerPark;
            parameters[10].Value = model.IsServerAllelic;
            parameters[11].Value = model.BusinessAddress;
            parameters[12].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(IMeiWei.Model.business model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into business(");
            strSql.Append("BusinessId,BusinessName,BusinessPhone,BusinessHours,PerCapitaConsumption,RestaurantHighlights,FirstOffer,VIPOffer,BusinessTypeId,IsServerPark,IsServerAllelic,BusinessAddress,BusinessSenderTypeId,BusinessSenderContent)");
            strSql.Append(" values (");
            strSql.Append("@BusinessId,@BusinessName,@BusinessPhone,@BusinessHours,@PerCapitaConsumption,@RestaurantHighlights,@FirstOffer,@VIPOffer,@BusinessTypeId,@IsServerPark,@IsServerAllelic,@BusinessAddress,@BusinessSenderTypeId,@BusinessSenderContent)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@BusinessId",            MySqlDbType.VarChar,   36),
                new MySqlParameter("@BusinessName",          MySqlDbType.VarChar,  100),
                new MySqlParameter("@BusinessPhone",         MySqlDbType.VarChar,  100),
                new MySqlParameter("@BusinessHours",         MySqlDbType.VarChar,  100),
                new MySqlParameter("@PerCapitaConsumption",  MySqlDbType.Int32,     11),
                new MySqlParameter("@RestaurantHighlights",  MySqlDbType.Text),
                new MySqlParameter("@FirstOffer",            MySqlDbType.Text),
                new MySqlParameter("@VIPOffer",              MySqlDbType.Text),
                new MySqlParameter("@BusinessTypeId",        MySqlDbType.VarChar,   36),
                new MySqlParameter("@IsServerPark",          MySqlDbType.Bit),
                new MySqlParameter("@IsServerAllelic",       MySqlDbType.Bit),
                new MySqlParameter("@BusinessAddress",       MySqlDbType.VarChar, 1000),
                new MySqlParameter("@BusinessSenderTypeId",  MySqlDbType.VarChar,   36),
                new MySqlParameter("@BusinessSenderContent", MySqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.BusinessId;
            parameters[1].Value  = model.BusinessName;
            parameters[2].Value  = model.BusinessPhone;
            parameters[3].Value  = model.BusinessHours;
            parameters[4].Value  = model.PerCapitaConsumption;
            parameters[5].Value  = model.RestaurantHighlights;
            parameters[6].Value  = model.FirstOffer;
            parameters[7].Value  = model.VIPOffer;
            parameters[8].Value  = model.BusinessTypeId;
            parameters[9].Value  = model.IsServerPark;
            parameters[10].Value = model.IsServerAllelic;
            parameters[11].Value = model.BusinessAddress;
            parameters[12].Value = model.BusinessSenderTypeId;
            parameters[13].Value = model.BusinessSenderContent;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        public string CreateBusiness(
            string businessId, string businessName, string businessAddress, string businessPhone,
            string businessHours, string percapitaConsumption, string restauranThighLights, string firstOffer,
            string vipOffer, string businessTypeid)
        {
            IMeiWei.BLL.business   bll_business   = new IMeiWei.BLL.business();
            IMeiWei.Model.business model_business = new IMeiWei.Model.business();

            model_business.BusinessId           = businessId;
            model_business.BusinessName         = businessName;
            model_business.BusinessAddress      = businessAddress;
            model_business.BusinessPhone        = businessPhone;
            model_business.BusinessTypeId       = businessTypeid;
            model_business.BusinessHours        = businessHours;
            model_business.FirstOffer           = firstOffer;
            model_business.PerCapitaConsumption = Convert.ToInt32(percapitaConsumption);
            model_business.VIPOffer             = vipOffer;
            model_business.RestaurantHighlights = restauranThighLights;

            bll_business.Add(model_business);

            return("SUCCESS");
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IMeiWei.Model.business GetModel(long Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,BusinessId,BusinessName,BusinessPhone,BusinessHours,PerCapitaConsumption,RestaurantHighlights,FirstOffer,VIPOffer,BusinessTypeId,IsServerPark,IsServerAllelic,BusinessAddress,BusinessSenderTypeId,BusinessSenderContent from business ");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int64)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IMeiWei.Model.business DataRowToModel(DataRow row)
 {
     IMeiWei.Model.business model = new IMeiWei.Model.business();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = long.Parse(row["Id"].ToString());
         }
         if (row["BusinessId"] != null)
         {
             model.BusinessId = row["BusinessId"].ToString();
         }
         if (row["BusinessName"] != null)
         {
             model.BusinessName = row["BusinessName"].ToString();
         }
         if (row["BusinessPhone"] != null)
         {
             model.BusinessPhone = row["BusinessPhone"].ToString();
         }
         if (row["BusinessHours"] != null)
         {
             model.BusinessHours = row["BusinessHours"].ToString();
         }
         if (row["PerCapitaConsumption"] != null && row["PerCapitaConsumption"].ToString() != "")
         {
             model.PerCapitaConsumption = int.Parse(row["PerCapitaConsumption"].ToString());
         }
         if (row["RestaurantHighlights"] != null)
         {
             model.RestaurantHighlights = row["RestaurantHighlights"].ToString();
         }
         if (row["FirstOffer"] != null)
         {
             model.FirstOffer = row["FirstOffer"].ToString();
         }
         if (row["VIPOffer"] != null)
         {
             model.VIPOffer = row["VIPOffer"].ToString();
         }
         if (row["BusinessTypeId"] != null)
         {
             model.BusinessTypeId = row["BusinessTypeId"].ToString();
         }
         if (row["IsServerPark"] != null && row["IsServerPark"].ToString() != "")
         {
             if ((row["IsServerPark"].ToString() == "1") || (row["IsServerPark"].ToString().ToLower() == "true"))
             {
                 model.IsServerPark = true;
             }
             else
             {
                 model.IsServerPark = false;
             }
         }
         if (row["IsServerAllelic"] != null && row["IsServerAllelic"].ToString() != "")
         {
             if ((row["IsServerAllelic"].ToString() == "1") || (row["IsServerAllelic"].ToString().ToLower() == "true"))
             {
                 model.IsServerAllelic = true;
             }
             else
             {
                 model.IsServerAllelic = false;
             }
         }
         if (row["BusinessAddress"] != null)
         {
             model.BusinessAddress = row["BusinessAddress"].ToString();
         }
         if (row["BusinessSenderTypeId"] != null)
         {
             model.BusinessSenderTypeId = row["BusinessSenderTypeId"].ToString();
         }
         if (row["BusinessSenderContent"] != null)
         {
             model.BusinessSenderContent = row["BusinessSenderContent"].ToString();
         }
     }
     return(model);
 }