GuiLei.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utils;
using WebClass;

public partial class GuiLei : WebPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.getDangQianYongHu();
        if (!IsPostBack)
            init();
    }

    private void init()
    {
        var v = Request.getQueryString("v").Split(',').Select(m => m.toInt(0)).ToList();
        ViewState["v"] = v;
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (ViewState["v"] == null)
        {
            Page.AlertThis("请选择需要设置的企业!");
            return;
        }

        var list = ViewState["v"] as List<int>;
        int rowaffect = 0;
        using (var db = new huadushuiEntities())
        {
            list.ForEach(z =>
            {
                var c = db.tb_Company.FirstOrDefault(m => m.Id == z);
                if (c != null)
                    c.guilei = RadioButtonList1.Items[RadioButtonList1.SelectedIndex].Value.toInt(0);
                rowaffect += db.SaveChanges();
                db.savecompanyhistory(c.Id, "设置企业归类为[" + RadioButtonList1.Items[RadioButtonList1.SelectedIndex].Text + "],操作人:" + this.dangqianyonghu);    
            });
           
        }
        if (rowaffect > 0)
            Page.AlertThisWithCallBack("设置成功!");
        else
            Page.AlertThis("设置失败!");
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。