/// <summary> /// 向IP库插入一条IP信息 /// </summary> /// <param name="startIP"></param> /// <param name="endIP"></param> /// <param name="pro_name"></param> /// <param name="city_name"></param> /// <param name="class_ID"></param> public void insertIP(string startIP, string endIP, string pro_name, string city_name, int class_ID) { M_IP_para m_IP_para = new M_IP_para(); m_IP_para.startIP = getSumIp(startIP); m_IP_para.endIP = getSumIp(endIP); m_IP_para.pro_name = pro_name; m_IP_para.city_name = city_name; m_IP_para.class_ID = class_ID; string sqlStr = "insert into ZL_IPpara (startIP,endIP,pro_name,city_name,class_ID) values (@startIP,@endIP,@pro_name,@city_name,@class_ID)"; SqlParameter[] Parameters = new SqlParameter[] { new SqlParameter("@startIP", SqlDbType.Int), new SqlParameter("@endIP", SqlDbType.Int), new SqlParameter("@pro_name", SqlDbType.VarChar), new SqlParameter("@city_name", SqlDbType.VarChar), new SqlParameter("@class_ID", SqlDbType.Int) }; Parameters[0].Value = m_IP_para.startIP; Parameters[1].Value = m_IP_para.endIP; Parameters[2].Value = m_IP_para.pro_name; Parameters[3].Value = m_IP_para.city_name; Parameters[4].Value = m_IP_para.class_ID; SqlHelper.ExistsSql(sqlStr, Parameters); }
public M_IP_para searchIPByID(int IP_ID) { M_IP_para m_IP_para = new M_IP_para(); DataTable dt = searchIP("*", " where IP_ID=" + IP_ID); m_IP_para.IP_ID = Convert.ToInt32(dt.Rows[0]["IP_ID"].ToString()); m_IP_para.class_ID = Convert.ToInt32(dt.Rows[0]["class_ID"].ToString()); m_IP_para.pro_name = dt.Rows[0]["pro_name"].ToString(); m_IP_para.city_name = dt.Rows[0]["city_name"].ToString(); m_IP_para.startIP = Convert.ToInt32(dt.Rows[0]["startIP"].ToString()); m_IP_para.endIP = Convert.ToInt32(dt.Rows[0]["endIP"].ToString()); return(m_IP_para); }
protected void submit_Click(object sender, EventArgs e) { B_IPOperation b_ipoperation = new B_IPOperation(); M_IP_para m_IP_para = new M_IP_para(); m_IP_para.IP_ID = Convert.ToInt32(Request.QueryString["ID"]); m_IP_para.class_ID = Convert.ToInt32(class_ID.SelectedValue); m_IP_para.startIP = b_ipoperation.getSumIp(startIP.Text.Trim()); m_IP_para.endIP = b_ipoperation.getSumIp(endIp.Text.Trim()); m_IP_para.pro_name = pro_name.Text; m_IP_para.city_name = city_name.Text; b_ipoperation.updateIP(m_IP_para); }
public void updateIP(M_IP_para m_IP_para) { string cmd = "update ZL_IPpara set startIP=@startIP,endIp=@endIP,pro_name=@pro_name,city_name=@city_name,class_ID=@class_ID where IP_ID=@IP_ID"; SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@startIP", SqlDbType.BigInt), new SqlParameter("@endIP", SqlDbType.BigInt), new SqlParameter("@pro_name", SqlDbType.VarChar), new SqlParameter("@city_name", SqlDbType.VarChar), new SqlParameter("@class_ID", SqlDbType.Int), new SqlParameter("@IP_ID", SqlDbType.Int), }; parameter[0].Value = m_IP_para.startIP; parameter[1].Value = m_IP_para.endIP; parameter[2].Value = m_IP_para.pro_name; parameter[3].Value = m_IP_para.city_name; parameter[4].Value = m_IP_para.class_ID; parameter[5].Value = m_IP_para.IP_ID; SqlHelper.ExecuteNonQuery(CommandType.Text, cmd, parameter); }
protected void Page_Load(object sender, EventArgs e) { ZoomLa.Common.function.AccessRulo(); B_Admin badmin = new B_Admin(); if (!IsPostBack) { B_IPOperation b_ipoperation = new B_IPOperation(); DataTable datatable = b_ipoperation.searchAllClass(); class_ID.DataSource = datatable; class_ID.DataBind(); int IP_ID = Convert.ToInt32(Request.QueryString["ID"].ToString()); M_IP_para m_IP_para = b_ipoperation.searchIPByID(IP_ID); class_ID.SelectedValue = m_IP_para.class_ID.ToString(); startIP.Text = getIP(Convert.ToInt32(m_IP_para.startIP)); endIp.Text = getIP(Convert.ToInt32(m_IP_para.endIP)); pro_name.Text = m_IP_para.pro_name; city_name.Text = m_IP_para.city_name; } }
public int insert(M_IP_para model) { return(Sql.insert(strTableName, model.GetParameters(), model.GetParas(), model.GetFields())); }
public bool UpdateByID(M_IP_para model) { return(Sql.UpdateByIDs(strTableName, PK, model.IP_ID.ToString(), model.GetFieldAndPara(), model.GetParameters())); }