Example #1
0
 protected void ExtendedGridView1_RowCommand(object sender, CommandEventArgs e)
 {
     if ((e.CommandName == "EditIP") || (e.CommandName == "DelIP"))
     {
         GridViewRow row         = ((GridView)sender).Rows[Convert.ToInt32(e.CommandArgument)];
         string      commandName = e.CommandName;
         if (commandName != null)
         {
             if (!(commandName == "EditIP"))
             {
                 if (!(commandName == "DelIP"))
                 {
                     return;
                 }
             }
             else
             {
                 this.Context.Items.Add("startIP", ((Label)row.FindControl("LblStartIP")).Text);
                 this.Context.Items.Add("endIP", ((Label)row.FindControl("LblEndIP")).Text);
                 this.Context.Items.Add("address", row.Cells[2].Text);
                 base.Server.Transfer("IPAdd.aspx?Action=Edit");
                 return;
             }
             StatIPInfo info = new StatIPInfo();
             info.StartIP = StringHelper.EncodeIP(((Label)row.FindControl("LblStartIP")).Text);
             info.EndIP   = StringHelper.EncodeIP(((Label)row.FindControl("LblEndIP")).Text);
             if (IPStorage.Delete(info))
             {
                 this.ExtendedGridView1.DataBind();
             }
         }
     }
 }
Example #2
0
        private void AddIP()
        {
            StatIPInfo info = new StatIPInfo();

            info.StartIP = StringHelper.EncodeIP(this.TxtStartIP.Text);
            info.EndIP   = StringHelper.EncodeIP(this.TxtEndIP.Text);
            CompareIP(info);
            info.Address = DataSecurity.FilterBadChar(this.TxtIPAddress.Text);
            if (IPStorage.Add(info))
            {
                AdminPage.WriteSuccessMsg("网站统计IP添加成功!", "IPAdd.aspx");
            }
            else
            {
                AdminPage.WriteErrMsg("<li>网站统计IP添加失败,添加的IP地址段与系统已存在的记录重叠或来源详细地址重复!</li>");
            }
        }
Example #3
0
        private void EditIP()
        {
            StatIPInfo info    = new StatIPInfo();
            StatIPInfo oldInfo = new StatIPInfo();

            info.StartIP    = StringHelper.EncodeIP(this.TxtStartIP.Text);
            info.EndIP      = StringHelper.EncodeIP(this.TxtEndIP.Text);
            info.Address    = DataSecurity.FilterBadChar(this.TxtIPAddress.Text);
            oldInfo.StartIP = StringHelper.EncodeIP(this.HdnOldStartIP.Value);
            oldInfo.EndIP   = StringHelper.EncodeIP(this.HdnOldEndIP.Value);
            CompareIP(info);
            if (IPStorage.Update(info, oldInfo))
            {
                AdminPage.WriteSuccessMsg("网站统计IP修改成功!", "IPManage.aspx");
            }
            else
            {
                AdminPage.WriteErrMsg("<li>网站统计IP修改失败,修改的IP地址段与系统已存在的记录重叠或来源详细地址重复!</li>");
            }
        }
Example #4
0
 protected void ExtendedGridView1_DataBound(object sender, EventArgs e)
 {
     this.LblCount.Text = IPStorage.GetTotal().ToString();
 }