コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (function.isAjax())
            {
                string action = Request.Form["action"];
                string result = "";
                switch (action)
                {
                case "modelname":
                    result = SeeModelName();
                    break;

                default:
                    break;
                }
                Response.Write(result); Response.Flush(); Response.End();
                return;
            }
            if (!IsPostBack)
            {
                ModelList_DP.DataSource = pubBll.Sel();
                ModelList_DP.DataBind();
                string bread = "<li class='active'>{0}</li>";
                //-------------------------------------------------------------
                if (Mid > 0)
                {
                    M_Pub       pubMod   = pubBll.SelReturnModel(Mid);
                    M_AdminInfo adminMod = B_Admin.GetLogin();
                    string      prowinfo = B_Role.GetPowerInfoByIDs(adminMod.RoleList);
                    if (!adminMod.IsSuperAdmin() && !prowinfo.Contains("," + pubMod.PubTableName + ","))
                    {
                        function.WriteErrMsg("无权限管理该互动模型!!");
                    }
                    ModelList_DP.SelectedValue = pubMod.PubTableName;
                    PubTableName.Enabled       = false;
                    PubLogin.Checked           = pubMod.PubLogin == 1;
                    PubLoginUrls.Visible       = PubLogin.Checked;
                    PubLoginUrl.Text           = pubMod.PubLoginUrl;
                    bread = string.Format(bread, "修改[" + pubMod.PubName + "]");
                    #region Menu操作
                    switch (Menu)
                    {
                    case "edit":
                    {
                        PubType.Enabled        = false;
                        Lbtitle.Text           = "修改模块信息";
                        PubName.Text           = pubMod.PubName;
                        PubClass.SelectedValue = pubMod.PubClass.ToString();
                        PubType.SelectedValue  = pubMod.PubType.ToString();

                        if (pubMod.PubOneOrMore == 2)
                        {
                            PubOneOrMore.SelectedValue = "2";
                            PubOneOrMorenum.Visible    = true;
                            PubOneOrMorenum.Text       = pubMod.PubOneOrMore.ToString();
                        }
                        else
                        {
                            PubIPOneOrMorenum.Visible  = false;
                            PubOneOrMore.SelectedValue = pubMod.PubOneOrMore.ToString();
                        }

                        if (pubMod.PubIPOneOrMore < 2)
                        {
                            PubIPOneOrMorenum.Visible    = false;
                            PubIPOneOrMore.SelectedValue = pubMod.PubIPOneOrMore.ToString();
                        }
                        else
                        {
                            PubIPOneOrMore.SelectedValue = "2";
                            PubIPOneOrMorenum.Visible    = true;
                            PubIPOneOrMorenum.Text       = pubMod.PubIPOneOrMore.ToString();
                        }
                        Interval_T.Text = pubMod.Interval.ToString();
                        if (!string.IsNullOrEmpty(pubMod.PubTableName))
                        {
                            PubTableName.Text = pubMod.PubTableName.Replace("ZL_Pub_", "");
                        }
                        PubTemplate_hid.Value  = pubMod.PubTemplate;
                        PubLoadstr.Text        = pubMod.PubLoadstr;
                        PubIsTrue.Checked      = pubMod.PubIsTrue == 1 ? true : false;
                        PubCode.Checked        = pubMod.PubCode == 1 ? true : false;
                        PubOpenComment.Checked = pubMod.PubOpenComment == 1 ? true : false;
                        //CookieNum_Rad.SelectedValue = (pubinfo.PubTimeSlot < 1 ? 0 : 1).ToString();
                        //CookieNum_T.Text = pubinfo.PubTimeSlot < 1 ? "1" : pubinfo.PubTimeSlot.ToString();
                        RaPublic.Checked = pubMod.Pubid == 1 ? true : false;
                        Pubkeep.Text     = pubMod.Pubkeep.ToString();
                        Puberrmsg.Text   = pubMod.Puberrmsg.ToString();
                        if (pubMod.PubEndTime.ToString() == "9999-12-31 23:59:59")
                        {
                            PubEndTime.Text = "";
                        }
                        else
                        {
                            PubEndTime.Text = pubMod.PubEndTime.ToString().Replace("/", "-");
                        }
                        PubInputTM_hid.Value = pubMod.PubInputTM;
                        PubInputLoadStr.Text = pubMod.PubInputLoadStr;
                        Pubinfo.Text         = pubMod.Pubinfo;
                        PubGourl.Text        = pubMod.PubGourl;
                        pubflag.Checked      = pubMod.PubFlag == 1;
                        if (!string.IsNullOrEmpty(pubMod.PubPermissions))
                        {
                            CheckBox1.Checked = pubMod.PubPermissions.Contains("Look");
                            CheckBox2.Checked = pubMod.PubPermissions.Contains("Edit");
                            CheckBox3.Checked = pubMod.PubPermissions.Contains("Del");
                            CheckBox4.Checked = pubMod.PubPermissions.Contains("Sen");
                        }
                    }
                    break;

                    case "copy":
                    {
                        PubTableName.Enabled = true;
                        PubName.Attributes.Add("onkeyup", "Getpy('PubName','PubTableName','PubLoadstr','PubInputLoadStr')");
                        Lbtitle.Text                 = "复制模块信息";
                        PubName.Text                 = "新建" + pubMod.PubName;
                        PubClass.SelectedValue       = pubMod.PubClass.ToString();
                        PubType.SelectedValue        = pubMod.PubType.ToString();
                        PubOneOrMore.SelectedValue   = pubMod.PubOneOrMore.ToString();
                        PubIPOneOrMore.SelectedValue = pubMod.PubIPOneOrMore.ToString();
                        if (!string.IsNullOrEmpty(pubMod.PubTableName))
                        {
                            PubTableName.Text = pubMod.PubTableName.Replace("ZL_Pub_", "");
                        }
                        PubTemplate_hid.Value  = pubMod.PubTemplate;
                        PubLoadstr.Text        = "XJ" + pubMod.PubLoadstr;
                        PubIsTrue.Checked      = pubMod.PubIsTrue == 1 ? true : false;
                        PubCode.Checked        = pubMod.PubCode == 1 ? true : false;
                        PubOpenComment.Checked = pubMod.PubOpenComment == 1 ? true : false;
                        Pubkeep.Text           = pubMod.Pubkeep.ToString();
                        Puberrmsg.Text         = pubMod.Puberrmsg.ToString();
                        if (pubMod.PubEndTime.ToString() == "9999-12-31 23:59:59")
                        {
                            PubEndTime.Text = "";
                        }
                        else
                        {
                            PubEndTime.Text = pubMod.PubEndTime.ToString().Replace("/", "-");
                        }
                        PubInputTM_hid.Value = pubMod.PubInputTM;
                        PubInputLoadStr.Text = "XJ" + pubMod.PubInputLoadStr;
                        Pubinfo.Text         = pubMod.Pubinfo;
                        PubGourl.Text        = pubMod.PubGourl;

                        if (!string.IsNullOrEmpty(pubMod.PubPermissions))
                        {
                            CheckBox1.Checked = pubMod.PubPermissions.Contains("Look");
                            CheckBox2.Checked = pubMod.PubPermissions.Contains("Edit");
                            CheckBox3.Checked = pubMod.PubPermissions.Contains("Del");
                            CheckBox4.Checked = pubMod.PubPermissions.Contains("Sen");
                        }
                    }
                    break;

                    case "delete":
                    {
                        pubMod.PubIsDel = 1;
                        pubBll.GetUpdate(pubMod);
                        function.WriteErrMsg("存档成功", "PubManage.aspx");
                    }
                    break;

                    case "truedelete":
                    {
                        pubBll.GetDelete(Mid);
                        B_Role.DelPower(pubMod.PubTableName);
                        function.WriteSuccessMsg("删除成功", "PubRecycler.aspx");
                    }
                    break;

                    case "revert":
                    {
                        pubMod.PubIsDel = 0;
                        pubBll.InsertUpdate(pubMod);
                        function.WriteSuccessMsg("还原成功", "PubRecycler.aspx");
                    }
                    break;
                    }
                    #endregion
                }
                else
                {
                    PubName.Attributes.Add("onkeyup", "Getpy('PubName','PubTableName','PubLoadstr','PubInputLoadStr')");
                    ModelList_DP.Items.Insert(0, new ListItem("请选择模型", ""));
                    bread = string.Format(bread, "添加互动");
                }
                Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Content/ContentManage.aspx'>内容管理</a></li><li><a href='PubManage.aspx'>互动模块</a></li>" + bread);
            }
        }