protected void Button1_Click1(object sender, EventArgs e) { if (Convert.ToInt32(Request.QueryString["k"]) == 5) { //添加新数据 Daxu.Entity.nav areainfo = new Daxu.Entity.nav(); areainfo.navname = TextBox1.Text.ToString(); areainfo.fid = Request.QueryString["id"].ToString(); Daxu.BLL.navBll.InsertInav(areainfo); //获取刚才插入的id string sql = "select top 1 * from nav order by id desc"; Daxu.Entity.nav navinfo=Daxu.BLL.navBll.getInavModel(sql); string str = ConfigurationManager.ConnectionStrings["SqlServerConnectionString"].ConnectionString; SqlConnection conn = new SqlConnection(str); string sql1 = "insert into Dyimg (id) values (@id)"; SqlCommand cmd = new SqlCommand(sql1, conn); conn.Open(); cmd.Parameters.AddWithValue("@id",navinfo.id); cmd.ExecuteNonQuery(); conn.Close(); Response.Redirect("lanmu.aspx"); } else { //更新数据 Daxu.Entity.nav areainfo = new Daxu.Entity.nav(); areainfo.navname = TextBox1.Text.ToString(); areainfo.id = Convert.ToInt32(Request.QueryString["id"]); Daxu.BLL.navBll.UpdateInav(areainfo); Response.Redirect("lanmu.aspx"); } }
protected void Button1_Click1(object sender, EventArgs e) { UserHandle.UserHandle.InitModules_Admin("YQLJ"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Edit)) { if (HiddenField1.Value == "0") { //添加新数据 Daxu.Entity.nav areainfo = new Daxu.Entity.nav(); areainfo.navname = TextBox1.Text.ToString(); areainfo.manId = "1"; areainfo.fid = "0"; areainfo.tYpeid = "100"; areainfo.url = _url.Text; Daxu.BLL.navBll.InsertInav(areainfo); Response.Redirect("lanmu.aspx"); } else { //更新数据 Daxu.Entity.nav areainfo = new Daxu.Entity.nav(); areainfo.navname = TextBox1.Text.ToString(); areainfo.fid = "0"; areainfo.url = _url.Text; areainfo.manId = "1"; areainfo.id = Convert.ToInt32(Request.QueryString["id"]); Daxu.BLL.navBll.UpdateInav(areainfo); Response.Redirect("lanmu.aspx"); } } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='../baseinfo/info.aspx';</script>"); } }
protected void Button1_Click1(object sender, EventArgs e) { UserHandle.UserHandle.InitModules_Admin("LMGLXT"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Add)) { if (HiddenField1.Value == "0") { //添加新数据 Daxu.Entity.nav areainfo = new Daxu.Entity.nav(); areainfo.navname = TextBox1.Text.ToString(); areainfo.fid = "0"; areainfo.tYpeid = "100"; if (ZLMTB.Checked) { areainfo.Zlmtb = "1"; } else { areainfo.Zlmtb = "0"; } if (_Sqfw.Checked) { areainfo.Sqfw = "1"; } else { areainfo.Sqfw = "0"; } areainfo.Lmlx = LMLX.SelectedValue;//0产品类型 1新闻类型 2单页面类型 3下载类型 4音乐类型 5广告类型 6其他 if (FileUpload1.HasFile) { areainfo.LmImg = updata("-1"); } areainfo.url = _URL.Text; areainfo.px = Convert.ToInt32(_Px.Text); Daxu.BLL.navBll.InsertInav(areainfo); //获取刚才插入的id string sql = "select top 1 * from nav order by id desc"; Daxu.Entity.nav navinfo = Daxu.BLL.navBll.getInavModel(sql); Daxu.Entity.nav NavEd = new Daxu.Entity.nav(); NavEd.rootpart = Convert.ToString(navinfo.id); NavEd.id = Convert.ToInt32(navinfo.id); Daxu.BLL.navBll.UpdateInav(NavEd); if (LMLX.SelectedValue == "2") { string str = ConfigurationManager.ConnectionStrings["SqlServerConnectionString"].ConnectionString; SqlConnection conn = new SqlConnection(str); string sql1 = "insert into Dyimg (id) values (@id)"; SqlCommand cmd = new SqlCommand(sql1, conn); conn.Open(); cmd.Parameters.AddWithValue("@id", navinfo.id); cmd.ExecuteNonQuery(); conn.Close(); } Response.Write("<script>alert(\"提示:添加成功!\");location.href='../area/lanmu.aspx';</script>"); } else { //更新数据 string LMIMG = null; string SQFW = null; Daxu.Entity.nav areainfo = new Daxu.Entity.nav(); areainfo.navname = TextBox1.Text.ToString(); areainfo.fid = "0"; areainfo.url = _URL.Text; if (FileUpload1.HasFile) { LMIMG = updata(Convert.ToString(Request.QueryString["id"])); areainfo.LmImg = LMIMG; } else { LMIMG = _LmImgHID.Value; } if (ZLMTB.Checked) { areainfo.Zlmtb = "1"; } else { areainfo.Zlmtb = "0"; } if (_Sqfw.Checked) { areainfo.Sqfw = "1"; } else { areainfo.Sqfw = "0"; } areainfo.px = Convert.ToInt32(_Px.Text); areainfo.Lmlx = LMLX.SelectedValue;//0产品类型 1新闻类型 2单页面类型 3下载类型 4音乐类型 5广告类型 6其他 areainfo.id = Convert.ToInt32(Request.QueryString["id"]); Daxu.BLL.navBll.UpdateInav(areainfo); //更新时候如果选中子栏目同步:子栏目中的所有“栏目类型”,“栏目图片”,“URL”,“授权访问”全部和跟栏目同步 if (ZLMTB.Checked) { string sql = "update nav set Lmlx=" + areainfo.Lmlx + ",LmImg='" + LMIMG + "',url='" + _URL.Text + "',Sqfw='" + areainfo.Sqfw + "' where rootpart=" + _rootpart.Value + ""; Daxu.BLL.navBll.GetNavFunction(sql); } else { Daxu.BLL.navBll.GetNavFunction("update nav set Zlmtb=0 where rootpart='" + _rootpart.Value + "' and fid<>0 and tYpeid<>100"); } Response.Redirect("lanmu.aspx"); } } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='lanmu.aspx';</script>"); } }
//执行排序 protected void zxpx_Click(object sender, EventArgs e) { for (int i = 0; i < lanmulist.Items.Count; i++) { TextBox tx = (TextBox)lanmulist.Items[i].FindControl("_Px"); Daxu.Entity.nav navinfo = new Daxu.Entity.nav(); navinfo.px = Convert.ToInt32(Convert.ToInt32(navinfo.px) + Convert.ToInt32(tx.Text)); navinfo.id = Convert.ToInt32(((LinkButton)lanmulist.Items[i].FindControl("del")).CommandArgument); Daxu.BLL.navBll.UpdateInav(navinfo); } Bind(); }
//授权访问 protected void sqfw_Click(object sender, EventArgs e) { for (int i = 0; i < lanmulist.Items.Count; i++) { CheckBox cb = (CheckBox)lanmulist.Items[i].FindControl("_Sqfw"); if (cb.Checked) { Daxu.Entity.nav navinfo = new Daxu.Entity.nav(); navinfo.Sqfw = "1"; navinfo.id = Convert.ToInt32(((LinkButton)lanmulist.Items[i].FindControl("del")).CommandArgument); Daxu.BLL.navBll.UpdateInav(navinfo); } else { Daxu.Entity.nav navinfo = new Daxu.Entity.nav(); navinfo.Sqfw = "0"; navinfo.id = Convert.ToInt32(((LinkButton)lanmulist.Items[i].FindControl("del")).CommandArgument); Daxu.BLL.navBll.UpdateInav(navinfo); } } Response.Write("<script>alert(\"提示:修改成功!\");window.location='" + Request.RawUrl + "';</script>"); }
protected void SAVE_Click(object sender, EventArgs e) { if (UpdateId.Value != "0") { if (LanMDrlist.SelectedValue == UpdateId1.Value) { Daxu.Entity.nav navinfo = new Daxu.Entity.nav(); navinfo.navname = Convert.ToString(TxtName.Text); navinfo.px = Convert.ToInt32(SZPX.Text); navinfo.mbname = Convert.ToString(MBLX.Value); navinfo.Lmlx = LMLX.SelectedValue; navinfo.LmImg = LanMuPic.Value; navinfo.url = _url.Text; string fileth = "~/upload/images/" + Daxu.BLL.navBll.getInavModel("select * from nav where id='" + Convert.ToInt32(UpdateId.Value) + "'").LmImg; FileInfo filee = new FileInfo(Server.MapPath(fileth)); if (filee.Exists) { filee.Delete(); } navinfo.id = Convert.ToInt32(UpdateId.Value); Daxu.BLL.navBll.UpdateInav(navinfo); Bind(); loadDrList(Convert.ToString(IDSc.Value).Trim()); Response.Write("<script>alert(\"提示:修改成功!\");window.location='" + Request.RawUrl + "';</script>"); } else //移动操作 { //执行增加-或者-移动 Daxu.Entity.nav NavEd = Daxu.BLL.navBll.getInavModel("select * from nav where id=" + UpdateId1.Value + ""); //是否移动根目录 int i = Daxu.BLL.navBll.GetInavZDYLMYD(Convert.ToString(IDSc.Value).Trim(), UpdateId1.Value, NavEd.rootpart); if (i > 0) { Response.Write("<script>alert(\"移动成功!!\");window.location='" + Request.RawUrl + "';</script>"); } else { Response.Write("<script>alert(\"移动失败!!\");window.location='" + Request.RawUrl + "';</script>"); } Bind(); } } else { Daxu.Entity.nav navinfo = new Daxu.Entity.nav(); navinfo.navname = Convert.ToString(TxtName.Text);//栏目名称 navinfo.px = Convert.ToInt32(SZPX.Text);//排序 navinfo.mbname = Convert.ToString(MBLX.Value);//模板名称 if (LanMDrlist.SelectedValue == YDDrList.SelectedValue) { //执行增加 navinfo.rootpart = Convert.ToString(Request.QueryString["id"]); navinfo.fid = LanMDrlist.SelectedValue; Daxu.Entity.nav EntitNav = Daxu.BLL.navBll.getInavModel("select top 1 * from nav where id='" + Convert.ToInt32(Request.QueryString["id"]) + "'"); //如果父级栏目设置子栏目同步,并且没有选在栏目类型的情况下 if ((EntitNav.Zlmtb == "1") && (LMLX.SelectedValue == "-1")) { navinfo.Lmlx = EntitNav.Lmlx;//栏目类型同步到下一级 } else { navinfo.Lmlx = LMLX.SelectedValue; } navinfo.url = _url.Text; navinfo.LmImg = LanMuPic.Value; //Daxu.BLL.navBll.InsertInav(navinfo); //单页图文类型新增后 try { int id = Daxu.BLL.navBll.InsertEntity<nav>(navinfo); Dyimg dyimg = new Dyimg(); dyimg.id = id; Daxu.BLL.DyimgBLL.InsertEntity<Dyimg>(dyimg); } catch (Exception ex) { Response.Write("<script>alert(\"" + ex.Message + "!\");</script>"); } Bind(); Response.Write("<script>alert(\"增加成功!\");</script>"); } } }
//加载鲜花属性 private void navinfo() { Daxu.Entity.nav nav1 = new nav(); //用途 string sql0 = "select * from nav where Lmlx=7 and tYpeid=100"; nav1 = Daxu.BLL.navBll.getInavModel(sql0); CS1.InnerHtml = nav1.navname; string cs_l0 = "select * from nav where fid='" + Convert.ToString(nav1.id) + "'"; _yhuse.DataSource = Daxu.BLL.navBll.GetInavDataTable(cs_l0); _yhuse.DataTextField = "navname"; _yhuse.DataValueField = "id"; _yhuse.DataBind(); nav1 = null; string sql1 = "select * from nav where Lmlx=8 and tYpeid=100"; nav1 = Daxu.BLL.navBll.getInavModel(sql1); CS2.InnerHtml = nav1.navname; string cs_l1 = "select * from nav where fid='" + Convert.ToString(nav1.id) + "'"; _festival.DataSource = Daxu.BLL.navBll.GetInavDataTable(cs_l1); _festival.DataTextField = "navname"; _festival.DataValueField = "id"; _festival.DataBind(); nav1 = null; string sql2 = "select * from nav where Lmlx=9 and tYpeid=100"; nav1 = Daxu.BLL.navBll.getInavModel(sql2); CS3.InnerHtml = nav1.navname; string cs_l2 = "select * from nav where fid='" + Convert.ToString(nav1.id) + "'"; _brand.DataSource = Daxu.BLL.navBll.GetInavDataTable(cs_l2); _brand.DataTextField = "navname"; _brand.DataValueField = "id"; _brand.DataBind(); nav1 = null; string sql3 = "select * from nav where Lmlx=10 and tYpeid=100"; nav1 = Daxu.BLL.navBll.getInavModel(sql3); CS4.InnerHtml = nav1.navname; string cs_l3 = "select * from nav where fid='" + Convert.ToString(nav1.id) + "'"; _count.DataSource = Daxu.BLL.navBll.GetInavDataTable(cs_l3); _count.DataTextField = "navname"; _count.DataValueField = "id"; _count.DataBind(); nav1 = null; string sql4 = "select * from nav where Lmlx=11 and tYpeid=100"; nav1 = Daxu.BLL.navBll.getInavModel(sql4); CS5.InnerHtml = nav1.navname; string cs_l4 = "select * from nav where fid='" + Convert.ToString(nav1.id) + "'"; _color.DataSource = Daxu.BLL.navBll.GetInavDataTable(cs_l4); _color.DataTextField = "navname"; _color.DataValueField = "id"; _color.DataBind(); nav1 = null; string sql5 = "select * from nav where Lmlx=12 and tYpeid=100"; nav1 = Daxu.BLL.navBll.getInavModel(sql5); CS6.InnerHtml = nav1.navname; string cs_l5 = "select * from nav where fid='" + Convert.ToString(nav1.id) + "'"; _object.DataSource = Daxu.BLL.navBll.GetInavDataTable(cs_l5); _object.DataTextField = "navname"; _object.DataValueField = "id"; _object.DataBind(); nav1 = null; string sql6 = "select * from nav where Lmlx=13 and tYpeid=100"; nav1 = Daxu.BLL.navBll.getInavModel(sql6); CS7.InnerHtml = nav1.navname; string cs_l6 = "select * from nav where fid='" + Convert.ToString(nav1.id) + "'"; _pricestring.DataSource = Daxu.BLL.navBll.GetInavDataTable(cs_l6); _pricestring.DataTextField = "navname"; _pricestring.DataValueField = "id"; _pricestring.DataBind(); }
protected void submit_Click(object sender, EventArgs e) { if (MusicUrl.HasFile) { string fileth = ""; string fid = MusicUrl.FileName; if (file(fid)) { if (PdMusic(MusicUrl.FileName))//存在—删除老的-改名 { fid = MusicUrl.FileName; fileth = "~/upload/images/" + fid; FileInfo filee = new FileInfo(Server.MapPath(fileth)); if (filee.Exists) { filee.Delete(); } fileth = ""; fid = fid.Substring(0, fid.LastIndexOf('.')) + "_LM_ImgMc_" + DateTime.Now.ToString("yyyyHHmmssfff") + Path.GetExtension(fid); fileth = "~/upload/images/" + fid; MusicUrl.SaveAs(Server.MapPath(fileth)); } else { string fileth0 = "~/upload/images/" + NameBx.Value; FileInfo filee = new FileInfo(Server.MapPath(fileth0)); if (filee.Exists) { filee.Delete(); } fid = MusicUrl.FileName; string fileth1 = "~/upload/images/" + fid; MusicUrl.SaveAs(Server.MapPath(fileth1)); } } else { Response.Write("<script type=\"text/javascript\">alert(\"上传格式错误!\"); window.location='" + Request.RawUrl + "'</script>"); } Daxu.Entity.nav navInfo = new Daxu.Entity.nav(); navInfo.url = _URL.Text; navInfo.LmImg = fid; //存值 Session["navInfo"] = ""; Session["LMImg"] = ""; Session["LMurl"] = ""; Session["LMImg"] = navInfo.LmImg; Session["LMurl"] = navInfo.url; Session["navInfo"] = navInfo; string st = navInfo.LmImg + "," + navInfo.url; StringBuilder sb = new StringBuilder(); sb.AppendFormat("<script type=\"text/javascript\">alert(\"上传成功!\"); ;window.returnValue = \"{0}\";window.close();</script>", st); Response.Write(Convert.ToString(sb)); } else { Response.Write("<script type=\"text/javascript\">alert(\"没有上传的文件!\"); window.location='" + Request.RawUrl + "'</script>"); } }