private bool ExecuteNonQuery(string commandText, GroupSchemesEntity entity) { List <MySqlParameter> paramsList = GetMySqlParameters(entity); int result = MySqlHelper.ExecuteNonQuery(this.ConnectionString, commandText, paramsList.ToArray()); return(base.ExecuteStatus(result)); }
private List <MySqlParameter> GetMySqlParameters(GroupSchemesEntity entity) { List <MySqlParameter> paramsList = new List <MySqlParameter>(); paramsList.Add(new MySqlParameter("@SchemeID", entity.SchemeID)); paramsList.Add(new MySqlParameter("@GroupID", entity.GroupID)); paramsList.Add(new MySqlParameter("@GroupTypeID", entity.GroupTypeID)); paramsList.Add(new MySqlParameter("@OrderType", entity.OrderType)); paramsList.Add(new MySqlParameter("@CreateTime", DateTime.Now)); paramsList.Add(new MySqlParameter("@UpdateTime", DateTime.Now)); paramsList.Add(new MySqlParameter("@Status", entity.Status)); return(paramsList); }
public bool Insert(GroupSchemesEntity entity) { string commandText = @"INSERT INTO `GroupSchemes` (`SchemeID`, `GroupID`, `GroupTypeID`, `OrderType`, `CreateTime`, `UpdateTime`, `Status`) VALUES ( @SchemeID, @GroupID, @GroupTypeID, @OrderType, @CreateTime, @UpdateTime, @Status );"; return(ExecuteNonQuery(commandText, entity)); }
protected void btnSave_Click(object sender, EventArgs e) { bool result = false; GroupSchemesEntity entity = new GroupSchemesEntity(); entity.SchemeID = this.txtSchemeID.Text.Convert <int>(); entity.GroupID = this.txtGroupID.Text.Convert <int>(); entity.GroupTypeID = this.txtGroupTypeID.Text.Convert <int>(); entity.OrderType = this.txtOrderType.Text.Convert <int>(); entity.Status = this.ddlStatus.SelectedValue.Convert <int>(0); if (this.Action == "Edit") { result = new GroupSchemesBLL().Update(entity); } else if (this.Action == "Add") { result = new GroupSchemesBLL().Insert(entity); } this.Alert(result == true ? "操作成功" : "操作失败", "GroupSchemesList.aspx?acttype=2"); }
/// <summary> /// 更新方案 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Update(GroupSchemesEntity entity) { string commandText = @"Update GroupSchemes Set GroupTypeID =@GroupTypeID,OrderType = @OrderType,UpDateTime=NOW(),Status=@Status Where SchemeID=@SchemeID and GroupID=@GroupID;"; return(ExecuteNonQuery(commandText, entity)); }
/// <summary> /// 禁用方案 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Delete(GroupSchemesEntity entity) { string commandText = @"UPDATE GroupSchemes SET Status = 0,UpDateTime=NOW() Where SchemeID=@SchemeID and GroupID=@GroupID;"; return(ExecuteNonQuery(commandText, entity)); }
/// <summary> /// 更新方案 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Update(GroupSchemesEntity entity) { return(new GroupSchemesDAL().Update(entity)); }
/// <summary> /// 禁用方案 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Delete(GroupSchemesEntity entity) { return(new GroupSchemesDAL().Delete(entity)); }
public bool Insert(GroupSchemesEntity entity) { return(new GroupSchemesDAL().Insert(entity)); }