Beispiel #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 static SMS.Model.EnterpriseManage DataRowToModel(DataRow row)
 {
     SMS.Model.EnterpriseManage model = new SMS.Model.EnterpriseManage();
     if (row != null)
     {
         if (row["ID"] != null)
         {
             model.ID = Int32.Parse(row["ID"].ToString());
         }
         if (row["EnterpriseCode"] != null)
         {
             model.EnterpriseCode = row["EnterpriseCode"].ToString();
         }
         if (row["ChannelManager"] != null && row["ChannelManager"].ToString() != "")
         {
             model.ChannelManager = row["ChannelManager"].ToString();
         }
         if (row["CSManager"] != null && row["CSManager"].ToString() != "")
         {
             model.CSManager = row["CSManager"].ToString();
         }
         if (row["Reserve"] != null)
         {
             model.Reserve = row["Reserve"].ToString();
         }
     }
     return(model);
 }
Beispiel #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static bool Update(SMS.Model.EnterpriseManage model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update plat_EnterpriseManage set ");
            strSql.Append("EnterpriseCode=@EnterpriseCode,");
            strSql.Append("ChannelManager=@ChannelManager,");
            strSql.Append("CSManager=@CSManager,");
            strSql.Append("Reserve=@Reserve");
            strSql.Append(" where EnterpriseCode=@EnterpriseCode");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@EnterpriseCode", MySqlDbType.VarChar, 64),
                new MySqlParameter("@ChannelManager", MySqlDbType.VarChar, 16),
                new MySqlParameter("@CSManager",      MySqlDbType.VarChar, 16),
                new MySqlParameter("@Reserve",        MySqlDbType.VarChar, 128)
            };
            parameters[0].Value = model.EnterpriseCode;
            parameters[1].Value = model.ChannelManager;
            parameters[2].Value = model.CSManager;
            parameters[3].Value = model.Reserve;

            int rows = DBUtility.MySqlHelper.ExecuteNonQuery(strSql.ToString(), parameters);

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

            strSql.Append("select count(1) from plat_EnterpriseManage");
            strSql.Append(" where EnterpriseCode=@EnterpriseCode");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@EnterpriseCode", MySqlDbType.VarChar, 64)
            };
            parameters[0].Value = model.EnterpriseCode;
            if (DBUtility.MySqlHelper.Exists(strSql.ToString(), parameters))
            {
                return(Update(model));
            }
            else
            {
                strSql = new StringBuilder();
                strSql.Append("insert into plat_EnterpriseManage(");
                strSql.Append("EnterpriseCode,ChannelManager,CSManager,Reserve)");
                strSql.Append(" values (");
                strSql.Append("@EnterpriseCode,@ChannelManager,@CSManager,@Reserve)");
                MySqlParameter[] parametersInsert =
                {
                    new MySqlParameter("@EnterpriseCode", MySqlDbType.VarChar, 64),
                    new MySqlParameter("@ChannelManager", MySqlDbType.VarChar, 16),
                    new MySqlParameter("@CSManager",      MySqlDbType.VarChar, 16),
                    new MySqlParameter("@Reserve",        MySqlDbType.VarChar, 128)
                };
                parametersInsert[0].Value = model.EnterpriseCode;
                parametersInsert[1].Value = model.ChannelManager;
                parametersInsert[2].Value = model.CSManager;
                parametersInsert[3].Value = model.Reserve;

                int rows = DBUtility.MySqlHelper.ExecuteNonQuery(strSql.ToString(), parametersInsert);
                if (rows > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Beispiel #4
0
 public static bool Update(SMS.Model.EnterpriseManage model)
 {
     return(DAL.EnterpriseManage.Update(model));
 }
Beispiel #5
0
 public static bool Add(SMS.Model.EnterpriseManage model)
 {
     return(DAL.EnterpriseManage.Add(model));
 }