/// <summary> /// 修改 /// </summary> /// <param name="model">PromoShareConditionType對象</param> /// <returns>更新結果</returns> public int Update(PromoShareConditionType model) { try { return _psctDao.Update(model); } catch (Exception ex) { throw new Exception("PromoShareConditionTypeMgr-->Update-->" + ex.Message, ex); } }
/// <summary> /// 通過id獲取PromoShareConditionType對象 /// </summary> /// <param name="condtion_type_id">編號</param> /// <returns>PromoShareConditionType對象</returns> public PromoShareConditionType Get(int condtion_type_id) { PromoShareConditionType model = new PromoShareConditionType(); string sql = "SELECT condition_type_id,condition_type_desc,condition_type_name,condition_type_status FROM promo_share_condition_type WHERE condition_type_id=" + condtion_type_id; try { model = _access.getSinggleObj<PromoShareConditionType>(sql); } catch (Exception ex) { throw new Exception("PromoShareConditionType-->Get-->" + ex.Message + sql, ex); } return model; }
/// <summary> /// 修改 /// </summary> /// <param name="model">PromoShareConditionType對象</param> /// <returns>更新結果</returns> public int Update(PromoShareConditionType model) { int result = 0; StringBuilder sbSql = new StringBuilder(); sbSql.Append("set sql_safe_updates=0;"); sbSql.AppendFormat("UPDATE promo_share_condition_type set condition_type_desc='{0}',condition_type_name='{1}',condition_type_status='{2}' WHERE promo_id='{3}';", model.condition_type_desc, model.condition_type_name, model.condition_type_status, model.condition_type_id); sbSql.Append("set sql_safe_updates=1;"); try { result = _access.execCommand(sbSql.ToString()); } catch (Exception ex) { throw new Exception("PromoShareConditionTypeDao-->Update-->" + ex.Message + sbSql.ToString(), ex); } return result; }
/// <summary> /// 新增 /// </summary> /// <param name="model">PromoShareConditionType對象</param> /// <returns>新增后的標識</returns> public int Add(PromoShareConditionType model) { StringBuilder sbSql = new StringBuilder(); sbSql.Append("INSERT INTO promo_share_condition(condition_type_desc,condition_type_name,condition_type_status) "); sbSql.AppendFormat(" VALUES('{0}','{1}','{2}');SELECT @@IDENTITY;", model.condition_type_desc, model.condition_type_name, model.condition_type_status); try { DataTable _dt = _access.getDataTable(sbSql.ToString()); if (_dt.Rows.Count > 0) { return Convert.ToInt32(_dt.Rows[0][0]); } else { return 0; } } catch (Exception ex) { throw new Exception("PromoShareConditionTypeDao-->Add-->" + ex.Message + sbSql.ToString(), ex); } }