public void Add(IpCollectionEntity info) { try { StringBuilder strSql = new StringBuilder(); // strSql.Append("insert into t_ip_acquisition_rule (rule_name,rule_url,rule_rex)values("); // strSql.Append("'" + info.RuleName + "',"); // strSql.Append("'" + info.RuleUrl + "',"); // strSql.Append("'" + info.RuleRex + "')"); strSql.Append( "insert into t_ip_acquisition_rule (rule_name,rule_url,rule_rex)values(@name,@url,@rex)"); SQLiteParameter[] parameters = new SQLiteParameter[] { new SQLiteParameter("@name", info.RuleName), new SQLiteParameter("@url", info.RuleUrl), new SQLiteParameter("@rex", info.RuleRex) }; ExecuteNonQuery(strSql.ToString(), parameters); } catch (Exception) { throw; } }
private void btn_add_ip_rule_Click(object sender, EventArgs e) { IpCollectionBll bll = new IpCollectionBll(); IpCollectionEntity info = new IpCollectionEntity() { RuleName = txt_ip_rule_name.Text, RuleUrl = txt_ip_rule_url.Text, RuleRex = rtxt_ip_rule_rex.Text }; bll.Add(info); Init_Ip_Rule(); }
private void btn_edit_ip_rule_Click(object sender, EventArgs e) { IpCollectionEntity info = new IpCollectionEntity() { RuleName = txt_ip_rule_name.Text, RuleUrl = txt_ip_rule_url.Text, RuleRex = rtxt_ip_rule_rex.Text, Id = int.Parse(lb_ip_rule_id.Text) }; IpCollectionBll bll = new IpCollectionBll(); bll.Update(info); Init_Ip_Rule(); }
public void Update(IpCollectionEntity info) { try { string str = "update t_ip_acquisition_rule set rule_name=@name,rule_url=@url,rule_rex=@rex where id=@id"; SQLiteParameter[] parameters = new SQLiteParameter[] { new SQLiteParameter("@name", info.RuleName), new SQLiteParameter("@url", info.RuleUrl), new SQLiteParameter("@rex", info.RuleRex), new SQLiteParameter("@id", info.Id) }; ExecuteNonQuery(str, parameters); } catch (Exception) { throw; } }
public void Update(IpCollectionEntity info) { IpCollectionDal dal = new IpCollectionDal(); dal.Update(info); }
public void Add(IpCollectionEntity info) { IpCollectionDal dal = new IpCollectionDal(); dal.Add(info); }