Ejemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string UserName = txtUserName.Text.Trim();
        string PassWord = txtPassWord.Text.Trim();

        if (UserName == "" || PassWord == "")
        {
            BasePage.Alertback(Page, "请输入用户名和密码");
            return;
        }
        PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord + "fan<>?", "MD5");
        bool b = new AdminBll().ExistName(UserName, PassWord);

        if (b)
        {
            string LastLoginIP   = BasePage.GetClientIP();
            string LastLoginTime = DateTime.Now.ToString();
            Cookies.SaveCookie("User_Name", UserName, 0);
            AdminBll ad = new AdminBll();
            ad.UpdateLogin(LastLoginIP, UserName);
            AdminModel model = ad.Getid(UserName);
            Cookies.SaveCookie("ModelPower", model.ModelPower.ToString(), 0);
            Cookies.SaveCookie("LoginTime", model.LoginTime.ToString(), 0);
            Cookies.SaveCookie("User_Id", model.id.ToString(), 0);
            string MD5UserName = FormsAuthentication.HashPasswordForStoringInConfigFile(model.id.ToString() + UserName + "Cookies?", "MD5");
            Cookies.SaveCookie("MD5Name", MD5UserName, 0);
            Response.Redirect("default.aspx");
        }
        else
        {
            BasePage.AlertAndRedirect(Page, "用户名或密码错误!", "Login.aspx");
        }
    }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\">数据库字段替换</span>";
         string checklogin = new AdminBll().CheckLogin("10");
         if (checklogin != "true")
         {
             BasePage.Alertback(checklogin);
             Response.End();
         }
         string[] ss = DbHelperSQL.connectionString.Split(';')[1].Split('=');
         DataSet  ds = TabelName(ss[1]);
         ddlTable.DataSource     = ds;
         ddlTable.DataTextField  = "Name";
         ddlTable.DataValueField = "Name";
         ddlTable.DataBind();
         ddlTable.Items.Insert(0, new ListItem("请选择表名", ""));
         ddlTable.SelectedValue = Request.QueryString["tablename"];
         if (!String.IsNullOrEmpty(Request.QueryString["tablename"]))
         {
             DataSet ds2 = tableColumns(Request.QueryString["tablename"]);
             ddltableColumns.DataSource     = ds2;
             ddltableColumns.DataTextField  = "Name";
             ddltableColumns.DataValueField = "Name";
             ddltableColumns.DataBind();
             ddltableColumns.Items.Insert(0, new ListItem("请选择字段", ""));
             //  DropDownList2.SelectedValue = Request.QueryString["tableColumns"];
         }
         HiddenField1.Value = DbHelperSQL.connectionString.ToString();
     }
 }
Ejemplo n.º 3
0
    //del
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "92"))
        {
            BasePage.Alertback("您没有删除的权限!");
            Response.End();
        }
        //当前点击按钮,获取传过来的ID
        LinkButton lb    = (LinkButton)sender;
        string     delid = lb.CommandArgument;
        int        id    = BasePage.GetRequestId(delid);
        //检查有无下级
        int exit = new CommonBll().GetRecordCount(datatable, "tid=" + id + " and PageType=0");

        if (exit > 0)
        {
            BasePage.Alertback("请先删除子栏目!");
            Response.End();
        }

        bool b = new CommonBll().Delete(datatable, id);

        if (b)
        {
            BasePage.JscriptPrint(Page, "删除成功!", "diypage.aspx");
        }
    }
Ejemplo n.º 4
0
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        ////检查有没删除的权限
        if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "cd" + mid))
        {
            BasePage.Alertback(Page, "您没有删除此栏目的权限!");
            return;
        }

        //当前点击按钮,获取传过来的ID
        LinkButton lb    = (LinkButton)sender;
        string     delid = lb.CommandArgument;
        int        id    = BasePage.GetRequestId(delid);

        //检查是否存在子栏目
        int bc = new CommonBll().GetRecordCount("GL_Class", "ParentId=" + id);

        if (bc > 0)
        {
            BasePage.Alertback(Page, "请先删除子栏目!");
            return;
        }
        else
        {
            bool b = new CommonBll().Delete("GL_Class", id);
            if (b)
            {
                BasePage.JscriptPrint(Page, "删除成功!", "back");
            }
        }
    }
Ejemplo n.º 5
0
    //add or edit
    protected void Button1_Click(object sender, EventArgs e)
    {
        BlockModel model = new BlockModel();

        model.Title    = txtPageName.Text;
        model.Contents = txtcontents.Text;
        model.AddDate  = DateTime.Now.ToString();
        model.id       = id;
        if (id == 0)
        {
            if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "23"))
            {
                BasePage.Alertback("您没有删除的权限!");
                Response.End();
            }
            int i = new BlockBll().Add(model);
            if (i > 0)
            {
                BasePage.JscriptPrint(Page, "添加成功!", "block.aspx");
            }
        }
        else
        {
            bool b = new BlockBll().Update(model);
            if (b)
            {
                BasePage.JscriptPrint(Page, "修改成功!", "block.aspx");
            }
        }
    }
Ejemplo n.º 6
0
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        //当前点击按钮,获取传过来的ID
        LinkButton lb    = (LinkButton)sender;
        string     delid = lb.CommandArgument;
        int        id    = BasePage.GetRequestId(delid);

        if (id == 1 || id == 2)//文章和产品模型
        {
            BasePage.Alertback(Page, "不能删除系统模型!");
            return;
        }
        //检查此模型是否有栏目
        int bc = new CommonBll().GetRecordCount("GL_Class", "ModelId=" + id);

        if (bc > 0)
        {
            BasePage.Alertback(Page, "请先删除此模型下的栏目 !");
            return;
        }
        bool b = new CommonBll().Delete("GL_Model", id);

        if (b)
        {
            BasePage.JscriptPrint(Page, "删除成功!", "Model.aspx");
        }
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int userid = BasePage.GetRequestId(Cookies.GetCookie("User_Id"));

        if (userid == 1 || userid == 2)
        {
            if (!Page.IsPostBack)
            {
                ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\">管理员管理</span><a href=\"AdminAdd.aspx\" class=\"add\">添加管理员</a>";
                string checklogin = new AdminBll().CheckLogin("no");
                if (checklogin != "true")
                {
                    BasePage.Alertback(checklogin);
                    Response.End();
                }
                string strwhere = "";
                if (Cookies.GetCookie("User_Id") == "2")//屏蔽超级管理
                {
                    strwhere = "id>1";
                }
                DataSet ds = new DataSet();
                //ds = new AdminBll().GetList(strwhere);
                ds = new CommonBll().GetList("", "gl_admin", strwhere, "LastLoginTime desc");
                Repeater1.DataSource = ds;
                Repeater1.DataBind();
            }
        }
        else
        {
            //BasePage.Alertback("您还没登录或没有管理此内容权限!");
            //Response.End();
            //其它管理员直接跳到修改页面
            Response.Redirect("AdminAdd.aspx?id=" + userid);
        }
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        picPath = Request.QueryString["p"];                                    //图片路径
        id      = Request.QueryString["id"];
        int Standard_Width  = BasePage.GetRequestId(Request.QueryString["w"]); //裁剪后的图片宽度
        int Standard_Height = BasePage.GetRequestId(Request.QueryString["h"]); //裁剪后的图片高度

        iw = Standard_Width.ToString();
        ih = Standard_Height.ToString();
        if (!Page.IsPostBack)
        {
            string checklogin = new GL.Bll.AdminBll().CheckLogin("no");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            if (String.IsNullOrEmpty(iw.ToString()) || String.IsNullOrEmpty(ih.ToString()))
            {
                Response.Write("<script>alert('参数传递错误!')</script>");
                Response.End();
            }
            if (Request.QueryString["ac"] == "next")
            {
                if (String.IsNullOrEmpty(picPath) || String.IsNullOrEmpty(Standard_Width.ToString()) || String.IsNullOrEmpty(Standard_Height.ToString()))
                {
                    Response.Write("<script>alert('请先上传图片再按裁剪!')</script>");
                    Response.End();
                }
                if (!File.Exists(Server.MapPath(picPath)))
                {
                    Response.Write("<script>alert('参数传递错误,图片不存在!')</script>");
                    Response.End();
                }
                target.ImageUrl = picPath;

                System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile(Server.MapPath(picPath));
                if (imgPhoto.Width <= Standard_Width || imgPhoto.Height <= Standard_Height)//图片的宽高度小于裁剪后的宽高度时
                {
                    //BasePage.Alertback("此图片已是标准大小,不需要裁剪!");
                    imgPhoto.Dispose();
                    // Response.Write("<script>alert('此图片已是小图,不需要裁剪!')</script>");
                    //Response.End();
                    ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script type=\"text/javascript\">alert('此图片已是小图,不需要裁剪');parent.imgJcropsuccess('" + id + "','" + picPath + "');</script>");
                }
                imgPhoto.Dispose();
                string[] fs = picPath.Split('.');
                if (fs[1] != "jpg")
                {
                    //Response.Write("<script>alert('仅支持jpg格式图片!')</script>");
                    // BasePage.Alertback("仅支持jpg格式图片");
                    // Response.End();
                    ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script type=\"text/javascript\">alert('仅支持jpg格式图片!');parent.imgJcropsuccess('" + id + "','" + picPath + "');</script>");
                }
            }
        }
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        id = BasePage.GetRequestId(Request.QueryString["id"]);
        if (!Page.IsPostBack)
        {
            string btxt = "<a href=\"block.aspx\" class=\"home\">方块碎片</a>";
            if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "23"))
            {
                btxt += "<a href=\"block.aspx?Ac=add\" class=\"add\">添加方块碎片</a>";
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = btxt;
            string checklogin = new AdminBll().CheckLogin("17");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            if (!String.IsNullOrEmpty(Request.QueryString["Ac"]))
            {
                action = Request.QueryString["Ac"];
            }
            else
            {
                action = "show";
            }
            //txtModelName.ReadOnly = true;
            if (id != 0)
            {
                BlockModel model = new BlockBll().GetModel(id);
                txtPageName.Text    = model.Title;
                txtPageName.Enabled = false;
                txtcontents.Text    = model.Contents;
                Button1.Text        = "确认修改";
            }
            else
            {
                string  strwhere  = "";
                DataSet ds        = new DataSet();
                int     PageSize  = 25;
                int     PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页
                ds = new CommonBll().GetListPage("", datatable, strwhere, "id desc", PageSize, PageIndex);
                Repeater1.DataSource = ds;
                Repeater1.DataBind();

                int totalrecord = new CommonBll().GetRecordCount(datatable, strwhere);//总记录数
                if (totalrecord == 0)
                {
                    txtpage.Text = "<p align=\"center\" class=\"red\">暂无相关数据</p>";
                }
                else if (totalrecord > PageSize)
                {
                    txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
            }
        }
    }
Ejemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"UserGroup.aspx\">会员组管理</a><a class=\"add\" href=\"?action=Add\">添加新组</a>";
            string checklogin = new AdminBll().CheckLogin("14");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            if (!String.IsNullOrEmpty(Request.QueryString["action"]))
            {
                action = Request.QueryString["action"];
            }
            else
            {
                action = "show";
            }
            id = BasePage.GetRequestId(Request.QueryString["id"]);
            if (!String.IsNullOrEmpty(Request.QueryString["id"]))
            {
                UserGroupModel model = new UserGroupBll().GetModel(id);
                bool           b     = new CommonBll().Exists(datatable, id);
                if (b)
                {
                    Literal1.Text     = "修改会员组";
                    Button3.Text      = "确认修改";
                    txtGroupName.Text = model.GroupName;
                    txtShowOnReg.Text = model.ShowOnReg.ToString();
                    txtDescript.Text  = model.Descript;
                    SetChecked(this.PowerList, model.PowerList, ",");
                }
            }
            else
            {
                DataSet ds        = new DataSet();
                int     PageSize  = 25;
                int     PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页
                ds = new CommonBll().GetListPage("", datatable, "", "id desc", PageSize, PageIndex);
                Repeater1.DataSource = ds;
                Repeater1.DataBind();


                int totalrecord = new CommonBll().GetRecordCount(datatable, "");//总记录数
                if (totalrecord == 0)
                {
                    txtpage.Text = "<p align=\"center\">无相关信息</p>";
                }
                else if (totalrecord > PageSize)
                {
                    txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
            }
        }
    }
Ejemplo n.º 11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        ModelFieldModel m = new ModelFieldModel();

        m.FieldName   = "GL_" + txtFieldName.Text.Trim();//自定义字段加前缀,区别于系统字段
        m.FieldName2  = txtFieldName2.Text.Trim();
        m.FieldType   = int.Parse(txtFieldType.SelectedValue);
        m.FieldIsNull = txtFieldIsNully.Checked ? 0 : 1;
        m.FieldOnOff  = txtFieldOnOffy.Checked ? 0 : 1;
        m.FieldPx     = int.Parse(txtFieldPx.Text);
        m.FieldIntro  = txtFieldIntro.Text;
        m.Modeid      = mid;
        m.FieldVaules = txtvalue.Text;
        m.id          = id;
        if (id == 0)
        {
            //取得该模型数据表名称
            ModelModel mo = new ModelBll().GetModel(mid);
            bool       bo = DbHelperSQL.ColumnExists(mo.ModelTable, txtFieldName.Text);
            if (bo)
            {
                BasePage.Alertback(Page, "字段名称已经存在于数据中");
                return;
            }
            else
            {
                //在数据库中添加字段
                string fieldtype;
                if (txtFieldType.Text == "1")
                {
                    fieldtype = " int";
                }
                else
                {
                    fieldtype = " nvarchar(50)";
                }
                string column     = "GL_" + txtFieldName.Text.Trim() + fieldtype;
                string sqlContent = "alter table " + mo.ModelTable + " add " + column + "";
                object obj        = DbHelperSQL.GetSingle(sqlContent.ToString());

                int i = new ModelFieldBll().Add(m);
                if (i > 0)
                {
                    BasePage.JscriptPrint(Page, "添加成功!", "ModelField.aspx?mid=" + mid);
                }
            }
        }
        else
        {
            bool b = new ModelFieldBll().Update(m);
            if (b)
            {
                BasePage.JscriptPrint(Page, "修改成功!", "ModelField.aspx?mid=" + mid);
            }
        }
    }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string checklogin = new AdminBll().CheckLogin("2");

        if (checklogin != "true")
        {
            BasePage.Alertback(checklogin);
            Response.End();
        }
        if (!Page.IsPostBack)
        {
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"Seoall.aspx\" class=\"home\">SEO批量设置</a><a class=\"add\" href=\"?action=class\">栏目批量设置</a><a href=\"?action=diypage\" class=\"add\">单页批量设置</a>";
            DataSet ds        = new DataSet();
            int     PageSize  = 20;
            int     PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页
            string  ac        = Request.QueryString["action"];
            if (ac == "class")
            {
                string strwhere = "ClassType=0";
                ds = new CommonBll().GetListPage("", "GL_Class", strwhere, "ModelId asc,px desc,id desc", PageSize, PageIndex);
                Repeater1.DataSource = ds;
                Repeater1.DataBind();


                int totalrecord = new CommonBll().GetRecordCount("GL_Class", strwhere);//总记录数
                txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                if (totalrecord > PageSize)
                {
                    txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
                else
                {
                    txtpage.Text = "";
                }
            }
            if (Request.QueryString["action"] == "diypage")
            {
                string strwhere = "PageType=0";
                ds = new CommonBll().GetListPage("", "GL_DIYPage", strwhere, "id desc", PageSize, PageIndex);
                Repeater2.DataSource = ds;
                Repeater2.DataBind();
                int totalrecord = new CommonBll().GetRecordCount("GL_DIYPage", strwhere);//总记录数
                txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                if (totalrecord > PageSize)
                {
                    txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
                else
                {
                    txtpage.Text = "";
                }
            }
        }
    }
Ejemplo n.º 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string checklogin = new AdminBll().CheckLogin("no");
         if (checklogin != "true")
         {
             BasePage.Alertback(checklogin);
             Response.End();
         }
         ((Literal)Master.FindControl("breadcrumbs")).Text = Cookies.GetCookie("User_Name") + " 您好!欢迎使用" + new CommonBll().GetTitle("GL_WebConfig", "SiteName", 1) + "网站管理后台。";
     }
 }
Ejemplo n.º 14
0
    //add or edit
    protected void Button1_Click(object sender, EventArgs e)
    {
        DiyPageModel model = new DiyPageModel();

        model.PageName = txtPageName.Text;

        model.PageContents = txtcontents.Text;
        model.EditTime     = DateTime.Now;
        if (!String.IsNullOrEmpty(txtseotitle.Text))
        {
            model.SeoTitle = txtseotitle.Text;
        }
        else
        {
            model.SeoTitle = txtPageName.Text;
        }
        model.SeoKeyword     = txtkeyword.Text;
        model.SeoDescription = txtSeoDescription.Text;
        model.Px             = BasePage.GetRequestId(txtpx.Text);
        model.Tid            = BasePage.GetRequestId(ddltid.SelectedValue);
        model.PageType       = 0;
        model.PagePicUrl     = txtPicUrl.Text;

        model.PageContentsField = SetCheckedBox.GetChecked(this.txtpagecontentsfield, ",");

        model.id = id;
        if (id == 0)
        {
            if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
            {
                BasePage.Alertback("您没有添加新单页的权限!");
                Response.End();
            }
            int i = new DiyPageBll().Add(model);
            if (i > 0)
            {
                BasePage.JscriptPrint(Page, "添加成功!", "DiyPage.aspx?tid=" + ddltid.SelectedValue);
            }
        }
        else
        {
            bool b = new DiyPageBll().Update(model);
            if (b)
            {
                BasePage.JscriptPrint(Page, "修改成功!", "DiyPage.aspx?tid=" + ddltid.SelectedValue);
            }
        }
    }
Ejemplo n.º 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"model.aspx\" class=\"home\">模型管理</a><a href=\"ModelAdd.aspx\" class=\"add\">添加新模型</a>";
         string checklogin = new AdminBll().CheckLogin("1");
         if (checklogin != "true")
         {
             BasePage.Alertback(checklogin);
             Response.End();
         }
         DataSet ds = new DataSet();
         ds = new CommonBll().GetList("", "GL_Model", "", "id asc");
         Repeater1.DataSource = ds;
         Repeater1.DataBind();
     }
 }
Ejemplo n.º 16
0
    //delall
    protected void Button2_Click(object sender, EventArgs e)
    {
        string allid = Request.Form["checkbox"];

        if (!String.IsNullOrEmpty(allid))
        {
            bool b = new CommonBll().DeleteList(datatable, allid);
            if (b)
            {
                BasePage.JscriptPrint(Page, "批量删除成功!", "#");
            }
        }
        else
        {
            BasePage.Alertback("请选择要删除的选项!");
            return;
        }
    }
Ejemplo n.º 17
0
    //审核通过
    protected void Button2_Click1(object sender, EventArgs e)
    {
        string allid = Request.Form["checkbox"];

        if (!String.IsNullOrEmpty(allid))
        {
            bool b = new ArticleBll().Update1(datatable, "Verific", "0", allid);
            if (b)
            {
                BasePage.JscriptPrint(Page, "批量操作成功!", "products.aspx?mid=" + mid + "&ac=sh");
            }
        }
        else
        {
            BasePage.Alertback(Page, "请先选择要操作的选项ID");
            return;
        }
    }
Ejemplo n.º 18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"error.aspx\">运行错误记录</a>";
         string checklogin = new AdminBll().CheckLogin("20");
         if (checklogin != "true")
         {
             BasePage.Alertback(checklogin);
             Response.End();
         }
         string t = GreateFiles.Read_File(Server.MapPath("~/error.txt"));
         if (!String.IsNullOrEmpty(t))
         {
             txtcon.Text = t.Replace("\r", "<br/>");
         }
     }
 }
Ejemplo n.º 19
0
    //del
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "23"))
        {
            BasePage.Alertback("您没有删除的权限!");
            Response.End();
        }
        //当前点击按钮,获取传过来的ID
        LinkButton lb    = (LinkButton)sender;
        string     delid = lb.CommandArgument;
        int        id    = BasePage.GetRequestId(delid);

        bool b = new CommonBll().Delete(datatable, id);

        if (b)
        {
            BasePage.JscriptPrint(Page, "删除成功!", "block.aspx");
        }
    }
Ejemplo n.º 20
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        DiyPageModel model = new DiyPageModel();

        model.PageName = txtpagename1.Text;
        model.PageType = 1;
        model.EditTime = DateTime.Now;
        int i = new DiyPageBll().Add(model);

        if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
        {
            BasePage.Alertback("您没有添加新单页的权限!");
            Response.End();
        }
        else
        {
            if (i > 0)
            {
                BasePage.JscriptPrint(Page, "添加成功!", "DiyPage.aspx");
            }
        }
    }
Ejemplo n.º 21
0
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        //当前点击按钮,获取传过来的ID
        LinkButton lb    = (LinkButton)sender;
        string     delid = lb.CommandArgument;

        if (delid == "1")
        {
            BasePage.Alertback(Page, "不能删除超级管理员");
            return;
        }
        bool b = new CommonBll().DeleteList("GL_Admin", delid);

        if (Request.UrlReferrer != null)
        {
            ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
        }
        if (b)
        {
            BasePage.AlertAndRedirect(Page, "删除成功!", ViewState["UrlReferrer"].ToString());
        }
    }
Ejemplo n.º 22
0
    //添加广告位
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (showhide("22"))
        {
            ADModel am = new ADModel();
            am.ADtitle    = txtwtitle.Text;
            am.ADShowHide = BasePage.GetRequestId(Rshowhide.SelectedValue);
            am.ADwidth    = BasePage.GetRequestId(txtwwidth.Text);
            am.ADheight   = BasePage.GetRequestId(txtwheight.Text);
            am.ADcontents = txtwcontents.Text;
            am.IsAD       = 1; //0为广告,1为广告位
            am.Tid        = 0; //广告位和单条广告时tid都为0
            am.Px         = BasePage.GetRequestId(txtadpx.Text);
            am.id         = id;
            if (id == 0)
            {
                int i = new ADBll().Add(am);

                if (i > 0)
                {
                    BasePage.JscriptPrint(Page, "添加成功!", "AD.aspx?tid=" + i);
                }
            }
            else
            {
                bool b = new ADBll().Update(am);
                if (b)
                {
                    BasePage.JscriptPrint(Page, "修改成功!", "AD.aspx?tid=" + id);
                }
            }
        }
        else
        {
            BasePage.Alertback("添加失败,您不能添加广告位!");
            Response.End();
        }
    }
Ejemplo n.º 23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ac = Request.QueryString["ac"];
     id = BasePage.GetRequestId(Request.QueryString["id"]);
     if (!Page.IsPostBack)
     {
         ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"searchkey.aspx\" class=\"home\">搜索关键词</a>";
         string checklogin = new AdminBll().CheckLogin("no");
         if (checklogin != "true")
         {
             BasePage.Alertback(checklogin);
             Response.End();
         }
         if (id != 0)
         {
             SearchModel s = new SearchBll().GetModel(id);
             txtkey.Text = s.keyword;
             txtnum.Text = s.num.ToString();
             txtpx.Text  = s.px.ToString();
         }
         else
         {
             int    PageSize  = 30;
             int    PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]);
             string strwhere  = "";
             int    all       = new CommonBll().GetRecordCount(datatable, strwhere);
             if (all > 0)
             {
                 Repeater1.DataSource = new CommonBll().GetListPage("", datatable, strwhere, "px desc,num desc", PageSize, PageIndex);
                 Repeater1.DataBind();
                 if (all > PageSize)
                 {
                     fy.InnerHtml = GetPage.GetAspxPager(all, PageSize, PageIndex);
                 }
             }
         }
     }
 }
Ejemplo n.º 24
0
    //add or edit
    protected void Button4_Click(object sender, EventArgs e)
    {
        id = BasePage.GetRequestId(Request.QueryString["id"]);
        UserModel model = new UserModel();

        model.UserName = txtUserName.Text;
        model.GroupID  = BasePage.GetRequestId(ddlGroupID.SelectedValue);
        if (id != 0)//编辑时
        {
            if (!String.IsNullOrEmpty(txtPassWord.Text.Trim()))
            {
                model.PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassWord.Text.Trim() + "<>?", "MD5");
            }
            else
            {
                if (!String.IsNullOrEmpty(HiddenField1.Value))
                {
                    model.PassWord = HiddenField1.Value;
                }
                else
                {
                    BasePage.Alertback("操作超时,请刷新后重试");
                    return;
                }
            }
        }
        else
        {
            if (String.IsNullOrEmpty(txtPassWord.Text.Trim()))
            {
                BasePage.Alertback("密码不能为空,请重新输入");
                return;
            }
            else
            {
                model.PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassWord.Text.Trim() + "<>?", "MD5");
            }
        }

        model.Locked     = BasePage.GetRequestId(txtLocked.Text);
        model.Email      = txtEmail.Text;
        model.QQ         = txtQQ.Text;
        model.City       = Request.Form["ddlProvince"] + "," + Request.Form["ddlCity"] + "," + Request.Form["ddlArea"];
        model.Address    = txtAddress.Text;
        model.Sex        = BasePage.GetRequestId(txtSex.SelectedValue);
        model.UserFace   = txtface.Value;
        model.Company    = txtCompany.Text;
        model.Tel        = txtTel.Text;
        model.WenXin     = txtWenXin.Text;
        model.Source     = txtSource.Text;
        model.RegDate    = DateTime.Parse(DateTime.Now.ToString());
        model.LoginTimes = 0;
        model.id         = id;
        if (id == 0)
        {
            int exit = new CommonBll().GetRecordCount("GL_User", "UserName='******'");
            if (exit > 0)
            {
                BasePage.Alertback(Page, "用户名" + txtUserName.Text.Trim() + "已经存在,请用其它名称!");
            }
            else
            {
                int i = new UserBll().Add(model);
                if (i > 0)
                {
                    BasePage.JscriptPrint(Page, "添加成功!", "User.aspx");
                }
            }
        }
        else
        {
            int ex = new CommonBll().GetRecordCount("GL_User", "UserName='******' and id<>" + id);
            if (ex > 0)
            {
                BasePage.Alertback(txtUserName.Text + " 用户名已存在!");
            }
            else
            {
                bool bb = new UserBll().Update(model);
                if (bb)
                {
                    BasePage.JscriptPrint(Page, "修改成功!", "User.aspx");
                }
            }
        }
    }
Ejemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string txtAction  = "";
            string checklogin = new AdminBll().CheckLogin("1");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            int id = BasePage.GetRequestId(Request.QueryString["id"]);

            string type = Request.QueryString["type"];
            DrModelType.SelectedValue = type;
            if (type == "1")
            {
                modeltype = true;//产品模型
            }

            if (id != 0)
            {
                txtAction       = "修改模型信息";
                txtAction2.Text = "修改模型信息";
                Button1.Text    = "确认修改";
                ModelModel model = new ModelBll().GetModel(id);
                txtModelName.Text         = model.ModelName;
                txtModelTable.Text        = model.ModelTable;
                txtModelTable.Enabled     = false;
                txtItemName.Text          = model.ItemName;
                txtItemUnit.Text          = model.ItemUnit;
                RaModelLock.SelectedValue = model.ModelLock.ToString();
                DrModelType.SelectedValue = model.ModelType.ToString();
                txtclassnum.Text          = model.ModelClassLayer.ToString();
                if (model.ModelType == 1)//0文章1产品
                {
                    modeltype = true;
                }
                DrModelType.Enabled = false;
                if (!String.IsNullOrEmpty(model.ModeContent))
                {
                    //0模型内容可选字段`1模型栏目可选字段`2内容字段名称`3模型列表可选字段`4提示语`5发表审核选择
                    string[] aa   = model.ModeContent.Split('`');
                    string[] tips = aa[4].Split('|');
                    txt0.Text  = tips[0];
                    txt1.Text  = tips[1];
                    txt2.Text  = tips[2];
                    txt3.Text  = tips[3];
                    txt4.Text  = tips[4];
                    txt5.Text  = tips[5];
                    txt6.Text  = tips[6];
                    txt7.Text  = tips[7];
                    txt8.Text  = tips[8];
                    txt9.Text  = tips[9];
                    txt10.Text = tips[10];
                    if (!modeltype)                                                    //文章模型
                    {
                        SetCheckedBox.SetChecked(this.txtModeContent, aa[0], ",");     //模型内容可选
                        SetCheckedBox.SetChecked(this.txtmodelcheckclass, aa[1], ","); //栏目可选
                        txt25.Text = aa[2];
                        SetCheckedBox.SetChecked(this.txtchecklist, aa[3], ",");       //模型列表可选
                        txta11.Text             = tips[11];
                        ddlsendsh.SelectedValue = aa[5].ToString();
                    }
                    else
                    {                                                                  //0模型内容可选字段`1模型栏目可选字段`2内容字段名称`3模型列表可选字段`4提示语`5发表审核选择
                        SetCheckedBox.SetChecked(this.txtModeContent2, aa[0], ",");    //模型内容可选
                        SetCheckedBox.SetChecked(this.txtmodelcheckclass, aa[1], ","); //栏目可选
                        txt26.Text = aa[2];
                        SetCheckedBox.SetChecked(this.txtchecklist, aa[3], ",");       //模型列表可选

                        txtp11.Text             = tips[11];
                        txtp12.Text             = tips[12];
                        txtp13.Text             = tips[13];
                        txtp14.Text             = tips[14];
                        txtp15.Text             = tips[15];
                        ddlsendsh.SelectedValue = aa[5].ToString();
                    }
                }
            }
            else
            {
                txtAction       = "添加新模型";
                txtAction2.Text = "添加新模型";
            }

            ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\"></span>" + txtAction;
        }
    }
Ejemplo n.º 26
0
    ////添加广告
    protected void Button2_Click(object sender, EventArgs e)
    {
        int     adtid = BasePage.GetRequestId(ddltid.SelectedValue);  //已有广告位
        int     adtype = BasePage.GetRequestId(Rdtype.SelectedValue); //展示类型
        int     adwidth = BasePage.GetRequestId(txtwidth1.Text), adheight = BasePage.GetRequestId(txtheight1.Text);
        ADModel am = new ADModel();

        am.ADtitle    = txtttile.Text;
        am.Tid        = adtid;
        am.ADShowHide = BasePage.GetRequestId(rashowhide.SelectedValue);
        am.ADtype     = adtype;
        am.ADurl      = txtfile.Text;
        am.ADhttpurl  = txthttp.Text;
        am.Px         = BasePage.GetRequestId(txtpx.Text);
        am.IsAD       = 0;
        //如果已有广告位时,宽高读取广告位的
        if (adtid != 0)
        {
            ADModel ad = new ADBll().GetModel(adtid);
            adwidth  = BasePage.GetRequestId(ad.ADwidth.ToString());
            adheight = BasePage.GetRequestId(ad.ADheight.ToString());
        }
        am.ADwidth  = adwidth;
        am.ADheight = adheight;

        //展示类型为代码时
        if (adtype == 2)
        {
            //代码
            am.ADcontents = txtcontents.Text;
        }

        else if (adtype == 1)
        {
            //图片
            if (String.IsNullOrEmpty(txthttp.Text.Trim()) || txthttp.Text == "#")
            {
                am.ADcontents = "<img src=\"" + txtfile.Text.Trim() + "\" width=\"" + adwidth + "\" height=\"" + adheight + "\" alt=\"\" />";
            }
            else
            {
                am.ADcontents = "<a href=\"" + txthttp.Text + "\"><img src=\"" + txtfile.Text.Trim() + "\" width=\"" + adwidth + "\" height=\"" + adheight + "\" alt=\"\" /></a>";
            }
        }

        am.id = id;
        string gourl = "";

        if (ddltid.SelectedValue == "0")
        {
            gourl = "AD.aspx";
        }
        else
        {
            gourl = "AD.aspx?tid=" + ddltid.SelectedValue;
        }
        if (id == 0)
        {
            if (showhide("18"))
            {
                int i = new ADBll().Add(am);
                if (i > 0)
                {
                    BasePage.JscriptPrint(Page, "添加成功!", gourl);
                }
            }
            else
            {
                BasePage.Alertback("添加失败,你不能添加广告!");
                Response.End();
            }
        }
        else
        {
            bool b = new ADBll().Update(am);
            if (b)
            {
                BasePage.JscriptPrint(Page, "修改成功!", gourl);
            }
        }
    }
Ejemplo n.º 27
0
    protected int tid; //广告位id
    protected void Page_Load(object sender, EventArgs e)
    {
        action = Request.QueryString["ac"];
        id     = BasePage.GetRequestId(Request.QueryString["id"]);
        string checklogin = new AdminBll().CheckLogin("15");

        if (checklogin != "true")
        {
            BasePage.Alertback(checklogin);
            Response.End();
        }
        if (!Page.IsPostBack)
        {
            string bread = "<a href=\"AD.aspx\" class=\"home\">广告列表</a>";
            if (showhide("22"))
            {
                bread += "<a href=\"AD.aspx?ac=add1\" class=\"add\">添加广告位</a>";
            }
            if (showhide("18"))
            {
                bread += "<a class=\"add\" href=\"AD.aspx?ac=add&tid =" + tid + "\">添加新广告</a>";
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = bread;
            tid = BasePage.GetRequestId(Request.QueryString["tid"]);
            if (String.IsNullOrEmpty(action)) //取得列表
            {
                string strwhere = "Tid=0";    //显示广告位和单条广告Tid都为0
                if (tid != 0)
                {
                    strwhere    = "Tid=" + tid;
                    txttxt.Text = "<span class=\"red\">查看广告位下的广告</span>";
                }
                int pagesize  = 20;
                int pageindex = BasePage.GetRequestId(Request.QueryString["Page"]);
                Repeater1.DataSource = new CommonBll().GetListPage("", datatable, strwhere, "ADShowHide asc,isad desc,px desc,id desc", pagesize, pageindex);
                Repeater1.DataBind();
                int all = new CommonBll().GetRecordCount(datatable, strwhere);
                if (all > pagesize)
                {
                    txtfy.Text = GetPage.GetAspxPager(all, pagesize, pageindex);
                }
                else if (all <= 0)
                {
                    txtfy.Text = "<p class=\"red\" align=\"center\">无记录</p>";
                }
            }
            else if (action == "add")//添加广告
            {
                //已有广告列表
                ddltid.DataSource     = new CommonBll().GetList("", datatable, "IsAD=1", "px desc,id desc");
                ddltid.DataTextField  = "ADtitle";
                ddltid.DataValueField = "id";
                ddltid.DataBind();
                ddltid.Items.Insert(0, new ListItem("无广告位", "0"));
                ddltid.SelectedValue = tid.ToString();
                if (id != 0)//修改广告时
                {
                    ADModel ad = new ADBll().GetModel(id);
                    txtttile.Text            = ad.ADtitle;
                    ddltid.SelectedValue     = ad.Tid.ToString();
                    rashowhide.SelectedValue = ad.ADShowHide.ToString();
                    Rdtype.SelectedValue     = ad.ADtype.ToString();
                    txtfile.Text             = ad.ADurl;
                    txthttp.Text             = ad.ADhttpurl;
                    txtheight1.Text          = ad.ADheight.ToString();
                    txtwidth1.Text           = ad.ADwidth.ToString();
                    txtpx.Text       = ad.Px.ToString();
                    txtcontents.Text = ad.ADcontents;
                    Button2.Text     = "修改广告";
                }
            }
            else if (action == "add1" && id != 0)//修改广告位时
            {
                ADModel ame = new ADBll().GetModel(id);
                txtwtitle.Text          = ame.ADtitle;
                Rshowhide.SelectedValue = ame.ADShowHide.ToString();
                txtwwidth.Text          = ame.ADwidth.ToString();
                txtwheight.Text         = ame.ADheight.ToString();
                txtwcontents.Text       = ame.ADcontents;
                txtadpx.Text            = ame.Px.ToString();
                Button1.Text            = "修改广告位";
            }
            else if (action == "del" && id != 0)
            { //删除
                bool b = false;
                //检查是否为广告位,如果是广告位则检查有没广告
                int i = new CommonBll().GetRecordCount(datatable, "id=" + id + " and IsAD=1");
                if (i > 0)
                {
                    //是广告位,检查有没广告
                    int ii = new CommonBll().GetRecordCount(datatable, "Tid=" + id);
                    if (ii > 0)
                    {
                        BasePage.Alertback("请先删除此广告位下的广告。");
                        Response.End();
                    }
                    else
                    {
                        //检查有没广告位管理权
                        if (showhide("22"))
                        {                                              //广告位管理
                            b = new CommonBll().Delete(datatable, id); //删除广告位
                        }
                        else
                        {
                            BasePage.Alertback("删除失败,您不能删除此广告位!");
                            Response.End();
                        }
                    }
                }
                else
                {
                    //非广告位
                    if (showhide("19"))
                    {                                              //删除广告权限
                        b = new CommonBll().Delete(datatable, id); //删除广告位
                    }
                    else
                    {
                        BasePage.Alertback("删除失败,您不能删除此广告!");
                        Response.End();
                    }
                }
                if (Request.UrlReferrer != null)
                {
                    ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
                }
                if (b)
                {
                    BasePage.JscriptPrint(Page, "删除成功!", ViewState["UrlReferrer"].ToString());
                }
            }
            else if (action == "clone" && id != 0)
            {
                //克隆一条广告
                if (showhide("18"))
                {
                    string filename  = "ADtitle,Tid,IsAD,ADtype,ADurl,ADhttpurl,ADcontents,Px,ADheight,ADwidth,ADShowHide";
                    string cstrwhere = "id=" + id;
                    int    ci        = new CommonBll().CloneData(filename, datatable, cstrwhere);
                    if (ci > 0)
                    {
                        if (Request.UrlReferrer != null)
                        {
                            ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
                        }
                        BasePage.JscriptPrint(Page, "克隆成功!", ViewState["UrlReferrer"].ToString());
                    }
                }
            }
        }
    }
Ejemplo n.º 28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"User.aspx\">会员管理</a><a class=\"add\" href=\"?action=Add\">添加会员</a>";
            string checklogin = new AdminBll().CheckLogin("7");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }
            if (!String.IsNullOrEmpty(Request.QueryString["action"]))
            {
                action = Request.QueryString["action"];
            }
            else
            {
                action = "show";
            }
            id = BasePage.GetRequestId(Request.QueryString["id"]);

            DataSet dsUserGroup = new CommonBll().GetList("", "GL_UserGroup", "", "id asc");
            if (action == "Add")
            {
                //用户组
                ddlGroupID.DataSource     = dsUserGroup;
                ddlGroupID.DataTextField  = "GroupName";
                ddlGroupID.DataValueField = "id";
                ddlGroupID.DataBind();

                if (id != 0)
                {
                    //编辑修改
                    Literal1.Text = "修改用户信息";
                    Literal2.Text = "不修改请留空";
                    UserModel model = new UserBll().GetModel(id);
                    ddlGroupID.SelectedValue = model.GroupID.ToString();
                    txtUserName.Text         = model.UserName;
                    HiddenField1.Value       = model.PassWord;
                    txtLocked.SelectedValue  = model.Locked.ToString();
                    txtEmail.Text            = model.Email;
                    txtQQ.Text = model.QQ;
                    string city = model.City;
                    if (city != "")
                    {
                        string[] v = city.Split(',');
                        ddlp = v[0];
                        ddlc = v[1];
                        ddla = v[2];
                    }
                    txtAddress.Text       = model.Address;
                    txtSex.SelectedValue  = model.Sex.ToString();
                    txtregDate.Text       = BasePage.formatDateTime(model.RegDate.ToString());
                    txtlastLoginTime.Text = BasePage.formatDateTime(model.LastLoginTime.ToString());
                    txtlastLoginIP.Text   = model.LastLoginIP;
                    txtloginTimes.Text    = model.LoginTimes.ToString();
                    txtCompany.Text       = model.Company;
                    txtTel.Text           = model.Tel;
                    txtWenXin.Text        = model.WenXin;
                    txtSource.Text        = model.Source;


                    Button4.Text = "确认修改";
                }
            }
            else
            {
                //列表
                //绑定快速查看下拉
                ddlUserGroup.DataSource     = dsUserGroup;
                ddlUserGroup.DataTextField  = "GroupName";
                ddlUserGroup.DataValueField = "id";
                ddlUserGroup.DataBind();
                ddlUserGroup.Items.Insert(0, new ListItem("所有会员组", ""));

                string keywords = Request.QueryString["keywords"];
                string strwhere = "id is not null";
                int    GroupId  = 0;
                if (!String.IsNullOrEmpty(Request.QueryString["GroupId"]))
                {
                    GroupId   = int.Parse(Request.QueryString["GroupId"]);
                    strwhere += " and GroupId=" + GroupId;
                }
                if (!String.IsNullOrEmpty(Request.QueryString["keywords"]))
                {
                    strwhere += " and UserName like '%" + keywords + "%'";
                }
                ddlUserGroup.SelectedValue = GroupId.ToString();
                DataSet ds        = new DataSet();
                int     PageSize  = 25;
                int     PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页
                ds = new CommonBll().GetListPage("", datatable, strwhere, "LastLoginTime desc", PageSize, PageIndex);

                Repeater1.DataSource = ds;
                Repeater1.DataBind();
                int totalrecord = new CommonBll().GetRecordCount(datatable, strwhere);//总记录数
                if (totalrecord == 0)
                {
                    txtpage.Text = "<p align=\"center\" class=\"red\">暂无会员</p>";
                }
                else if (totalrecord > PageSize)
                {
                    txtpage.Text = GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
            }
        }
    }
Ejemplo n.º 29
0
    //添加修改
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Request.Form["txtTid"]) || string.IsNullOrEmpty(txtTitle.Text))
        {
            BasePage.Alertback("标题名称和所属栏目不能为空");
            return;
        }
        ProductsModel pm = new ProductsModel();

        pm.Languagen = int.Parse(Drlanguage.SelectedValue);
        pm.Title     = txtTitle.Text.Trim();
        int ctid = BasePage.GetRequestId(Request.Form["txtTid"]);

        pm.Tid         = ctid;
        pm.PicUrl      = txtPicUrl.Text;
        pm.BigPhoto    = txtBigPhoto.Text;
        pm.Contents    = txtcontents.Text;
        pm.Contents2   = txtcontents2.Text;
        pm.Contents3   = txtcontents3.Text;
        pm.IsRecommend = txtRecommend.Checked ? 1 : 0;
        pm.IsNew       = txtNew.Checked ? 1 : 0;
        pm.IsPopular   = txtPopular.Checked ? 1 : 0;
        pm.IsSpecial   = txtIsSpecial.Checked ? "1" : "0";

        if (!String.IsNullOrEmpty(txtAddDate.Text))
        {
            pm.AddDate = DateTime.Parse(txtAddDate.Text);
        }
        else
        {
            pm.AddDate = DateTime.Now;
        }

        pm.Px   = BasePage.GetRequestId(txtpx.Text);
        pm.Hits = BasePage.GetRequestId(txtHits.Text);
        if (!string.IsNullOrEmpty(txtPrice.Text))
        {
            pm.Price = decimal.Parse(txtPrice.Text);
        }
        else
        {
            pm.Price = 0;
        }
        if (!String.IsNullOrEmpty(txtPriceMarket.Text))
        {
            pm.PriceMarket = decimal.Parse(txtPriceMarket.Text);
        }
        else
        {
            pm.PriceMarket = 0;
        }
        pm.ProducerName  = txtProducerName.Text;
        pm.ProModel      = txtProModel.Text;
        pm.ProSpecificat = txtProSpecificat.Text;
        pm.Unit          = txtUnit.Text;
        pm.TitleColor    = colortxt.Value;
        if (!String.IsNullOrEmpty(txtTotalNum.Text))
        {
            pm.TotalNum = int.Parse(txtTotalNum.Text);
        }
        else
        {
            pm.TotalNum = 0;
        }

        pm.Comment = BasePage.GetRequestId(ddlComment.SelectedValue);
        pm.Intro   = txtIntro.Text;
        if (!String.IsNullOrEmpty(txtseotitle.Text.Trim()))
        {
            pm.SeoTitle = txtseotitle.Text;
        }
        else
        {
            pm.SeoTitle = txtTitle.Text;
        }
        pm.SeoKeyWord     = txtKeyWord.Text;
        pm.SeoDescription = txtDescription.Text;
        pm.EditDate       = DateTime.Now;
        pm.Inputer        = Cookies.GetCookie("User_Name");
        pm.FilesUrl       = filesurl.Text;
        //if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "ms" + mid))
        //{
        //    pm.Verific = 1;
        //}
        //else
        //{
        //    pm.Verific = 0;
        //}
        pm.Verific = 0;
        pm.ShopId  = BasePage.GetRequestId(txtcompanyid.Value);

        pm.id = id;

        //扩展字段
        string _sql       = "";
        int    modeexists = new CommonBll().GetRecordCount("GL_ModelField", "FieldOnOff=0 and Modeid=" + mid);

        if (modeexists > 0)
        {
            string[] _atype     = Request.Params.GetValues("hideFieldType");  //类型
            string[] _atitle    = Request.Params.GetValues("hideFieldTitle"); //
            string[] _bcontents = Request.Params.GetValues("txtFieldContent");
            if (_atitle != null && _bcontents != null && _atype != null)
            {
                for (int i = 0; i < _atitle.Length; i++)
                {
                    string vv = "'" + _bcontents[i] + "'";
                    if (_atype[i].ToString() == "1")
                    { //数值
                        vv = _bcontents[i];
                    }
                    if (String.IsNullOrEmpty(_sql))
                    {
                        _sql += _atitle[i] + "=" + vv;
                    }
                    else
                    {
                        _sql += "," + _atitle[i] + "=" + vv;
                    }
                }
            }
        }

        //将公司名存进cookies,方便下次添加
        Cookies.SaveCookie("company", txtcompany.Text, 0);
        Cookies.SaveCookie("companyId", txtcompanyid.Value, 0);

        //更新相册

        if (id == 0)
        {
            int i = new ProductsBll().Add(datatable, pm);
            if (i > 0)
            {
                //更新自定义
                if (modeexists > 0)
                {
                    bool bb = new ProductsBll().Updatezd(datatable, _sql, i);
                }

                UpateAlbum(i);
                BasePage.JscriptPrint(Page, "添加成功!" + txtcompanyid.Value, "Products.aspx?mid=" + mid + "&cid=" + ctid + "&language=" + BasePage.GetRequestId(Language));
            }
        }
        else
        {
            bool b = new ProductsBll().Update(datatable, pm);
            if (b)
            {
                //更新自定义
                if (modeexists > 0)
                {
                    bool bb = new ProductsBll().Updatezd(datatable, _sql, id);
                }


                UpateAlbum(id);
                BasePage.JscriptPrint(Page, "修改成功!", hiddenbackurl.Value.ToString());
            }
        }
    }
Ejemplo n.º 30
0
    private string titletips     = "";//字段名
    protected void Page_Load(object sender, EventArgs e)
    {
        //删除相册图片
        if (Request.QueryString["ac"] == "uppic")
        {
            new CommonBll().Delete("GL_Album", BasePage.GetRequestId(Request.QueryString["delid"]));
        }

        mid = BasePage.GetRequestId(Request.QueryString["mid"]);
        if (mid == 1)
        {
            mid = 2;
        }
        id = BasePage.GetRequestId(Request.QueryString["id"]);
        if (!String.IsNullOrEmpty(Request.QueryString["language"]))
        {
            Language = BasePage.GetRequestId(Request.QueryString["Language"]).ToString();
        }

        //根据模型找出数据表名
        ModelModel mo = new ModelBll().GetModel(mid);

        datatable = mo.ModelTable;
        ItemName  = mo.ItemName;
        if (!Page.IsPostBack)
        {
            string checklogin = new AdminBll().CheckLogin("m" + mid);
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            //绑定栏目下拉
            // ClassTreeBind(0, "请选择所属类别", mid, this.txtTid, "ClassType=0 and Languagen=" + Language);
            txtTid.Text = new ClassBll().GetClassSelect(0, "请选择所属类别", mid, "txtTid", "ClassType=0 and Languagen=" + BasePage.GetRequestId(Language) + "", "", "required input-control select-control");


            FieldBind(id);//绑定自定义

            txtAddDate.Text          = BasePage.formatDateTime(DateTime.Now.ToString());
            Drlanguage.SelectedValue = Language.ToString();

            hiddenbackurl.Value = "Products.aspx?mid=" + mid;
            //将公司名读取

            txtcompany.Text    = Cookies.GetCookie("company").ToString();
            txtcompanyid.Value = Cookies.GetCookie("companyId").ToString();

            GetData();//编辑时

            //提示
            if (!String.IsNullOrEmpty(mo.ModeContent))
            {//0模型内容可选字段`1模型栏目可选字段`2内容字段名称`3模型列表可选字段`4提示语`5发表审核选择
                string[] aa = mo.ModeContent.Split('`');
                string[] a  = aa[4].Split('|');
                ModeContent    = aa[0];
                txtTips0.Text  = a[0];
                txtTips1.Text  = a[1];
                txtTips2.Text  = a[2];
                txtTips3.Text  = a[3];
                isw            = a[4];
                ish            = a[5];
                txtTips6.Text  = a[6];
                txtTips7.Text  = a[7];
                txtTips8.Text  = a[8];
                txtTips9.Text  = a[9];
                txtTips10.Text = a[10];
                txtTips11.Text = a[11];
                ibw            = a[12];
                ibh            = a[13];
                txtTips14.Text = a[14];
                txtTips15.Text = a[15];
                titletips      = aa[2];
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"Products.aspx?mid=" + mid + "\">" + ItemName + "管理</a><span class=\"add\">添加" + ItemName + "</span><a href=\"Products.aspx?del=del&mid=" + mid + "\" class=\"del\">" + ItemName + "回收站</a>";
        }
    }