public void Click() { UserHandle.UserHandle.InitModules_Admin("XWGL"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Edit)) { //添加操作 Daxu.Entity.newlist newlistinfo = new Daxu.Entity.newlist(); newlistinfo.name = name.Text; newlistinfo.datetime = DateTime.Now.ToString("yyyy年MM月dd日"); if (_Tj.Checked == true) { newlistinfo.tj = "1"; } else { newlistinfo.tj = "0"; } if (_Sqfw.Checked == true) { newlistinfo.Sqfw = "1"; } else { newlistinfo.Sqfw = "0"; } newlistinfo.title = _title.Text; newlistinfo.Keywords = _Keywords.Text; newlistinfo.Description = _Description.Text; newlistinfo.conter = conter.Value; newlistinfo.fenlei = fenlei.SelectedValue; newlistinfo.Jjie = _jjie.Text; newlistinfo.fbt = _fbt.Text; newlistinfo.laiyuan = laiyuan.Text; newlistinfo.px = Convert.ToInt32(_px.Text); newlistinfo.Url = Convert.ToString(Session["url"]); newlistinfo.cnen = Convert.ToString(Session["newcnen"]); newlistinfo.DengJI = Convert.ToString(tools.methods.GetFulanmu(Convert.ToInt32(fenlei.SelectedValue))); if (HiddenField1.Value == "0") { Daxu.BLL.newlistBll.InsertInewlist(newlistinfo); Response.Write("<script>alert(\"添加成功!\");location.href='../new/new.aspx';</script>"); } if (HiddenField1.Value == "1") { newlistinfo.id = Convert.ToInt32(Request.QueryString["id"]); Daxu.BLL.newlistBll.UpdateInewlist(newlistinfo); Response.Write("<script>alert(\"修改成功!\");location.href='../new/new.aspx';</script>"); } Session["url"] = ""; Session["newcnen"] = ""; } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='../baseinfo/info.aspx';</script>"); } }
protected void submit_Click(object sender, EventArgs e) { if (MusicUrl.HasFile) { if (HiddenField1.Value == "1")//修改 { 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('.')) + "_NEWMC_" + 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.newlist newlistInfo = new Daxu.Entity.newlist(); newlistInfo.Url = _URL.Text; newlistInfo.cnen = fid; newlistInfo.datetime = DateTime.Now.ToString("yyyy年MM月dd日"); //存值 Session["newImg"] = ""; Session["newcnen"] = ""; Session["url"] = ""; Session["newImg"] = newlistInfo; Session["newcnen"] = newlistInfo.cnen; Session["url"] = newlistInfo.Url; Response.Write("<script type=\"text/javascript\">alert(\"上传成功!\"); window.location='" + Request.RawUrl + "'</script>"); } else { //新增 string fileth = ""; string fid = MusicUrl.FileName; fid = fid.Substring(0, fid.LastIndexOf('.')) + "_NEWMC_" + DateTime.Now.ToString("yyyyHHmmssfff") + Path.GetExtension(fid); fileth = "~/upload/images/" + fid; MusicUrl.SaveAs(Server.MapPath(fileth)); Daxu.Entity.newlist newlistInfo = new Daxu.Entity.newlist(); newlistInfo.Url = _URL.Text; newlistInfo.cnen = fid; newlistInfo.datetime = DateTime.Now.ToString("yyyy年MM月dd日"); //存值 Session["newImg"] = ""; Session["newcnen"] = ""; Session["url"] = ""; Session["newImg"] = newlistInfo; Session["newcnen"] = newlistInfo.cnen; Session["url"] = newlistInfo.Url; Response.Write("<script type=\"text/javascript\">alert(\"上传成功!\"); window.location='" + Request.RawUrl + "'</script>"); } } else { Response.Write("<script type=\"text/javascript\">alert(\"没有上传的文件!\"); window.location='" + Request.RawUrl + "'</script>"); } }
//授权访问 protected void XZHYFW_Click(object sender, EventArgs e) { UserHandle.UserHandle.InitModules_Admin("XWGL"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Verify)) { for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox check = (CheckBox)GridView1.Rows[i].FindControl("sqfwcbox"); DataKey dataky = GridView1.DataKeys[i]; int dd = Convert.ToInt32(dataky["id"]); Daxu.Entity.newlist newlistInfo = new Daxu.Entity.newlist(); if (check.Checked) { newlistInfo.Sqfw = "1"; } else { newlistInfo.Sqfw = "0"; } newlistInfo.id = dd; Daxu.BLL.newlistBll.UpdateInewlist(newlistInfo); } Response.Write("<script>alert(\"授权成功!\");location.href='" + Request.RawUrl + "';</script>"); } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='../baseinfo/info.aspx';</script>"); } }
//批量排序设置 protected void PX_Click(object sender, EventArgs e) { UserHandle.UserHandle.InitModules_Admin("XWGL"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Px)) { for (int i = 0; i < GridView1.Rows.Count; i++) { TextBox TxtPx = (TextBox)GridView1.Rows[i].FindControl("Px"); DataKey dataky = GridView1.DataKeys[i]; int Id = Convert.ToInt32(dataky["id"]); Daxu.Entity.newlist newlistInfo = new Daxu.Entity.newlist(); newlistInfo.px = Convert.ToInt32(TxtPx.Text); newlistInfo.id = Id; Daxu.BLL.newlistBll.UpdateInewlist(newlistInfo); } Response.Write("<script>alert(\"排序成功!\");location.href='" + Request.RawUrl + "';</script>"); } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='../baseinfo/info.aspx';</script>"); } }
//加载其他信息 protected void Loadnew(int id) { string sql = "select * from newlist where id='" + Convert.ToInt32(id) + "'"; Daxu.Entity.newlist newlistinfo = new Daxu.Entity.newlist(); newlistinfo = Daxu.BLL.newlistBll.getInewlistModel(sql); name.Text = newlistinfo.name; datetime.Text = newlistinfo.datetime; laiyuan.Text = newlistinfo.laiyuan; liulanshu.Text = newlistinfo.liulanshu.ToString(); conter.Value = newlistinfo.conter; _title.Text = newlistinfo.title; _Keywords.Text = newlistinfo.Keywords; _Description.Text = newlistinfo.Description; laiyuan.Text = newlistinfo.laiyuan; _fbt.Text = newlistinfo.fbt; _jjie.Text = newlistinfo.Jjie; _px.Text = Convert.ToString(newlistinfo.px); if ((Session["url"] == "") && (Session["newcnen"] == "")) { QjUrl = newlistinfo.Url; Qjcene = newlistinfo.cnen; } if (newlistinfo.tj == "1") { _Tj.Checked = true; } else { _Tj.Checked = false; } if (newlistinfo.Sqfw == "1") { _Sqfw.Checked = true; } else { _Sqfw.Checked = false; } if (newlistinfo.cnen != null) { _img.ImageUrl = "~/upload/images/" + newlistinfo.cnen; } if (!string.IsNullOrEmpty(Request.QueryString["id"])) { HiddenField1.Value = "1"; } foreach (ListItem listltem in fenlei.Items) { if (listltem.Value == newlistinfo.fenlei) { listltem.Selected = true; } } }
protected void fileUploadBnt_Click(object sender, EventArgs e) { UserHandle.UserHandle.InitModules_Admin("XWGL"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Edit)) { Daxu.Entity.newlist newlist = new Daxu.Entity.newlist(); //上传 DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss fff") string name = DateTime.Now.ToString("yyyyMMddHHssfff") + "." + (FileUpload1.FileName.Substring(FileUpload1.FileName.LastIndexOf(".") + 1)).ToLower(); if (FileUpload1.HasFile) { fileupload(FileUpload1, name); //上传文件 } else { name = "mrsiml.jpg"; } newlist.cnen = name; //修改数据 if (xgoradd.Value == "1") { newlist.id = Convert.ToInt32(reqid.Value); Daxu.BLL.newlistBll.UpdateInewlist(newlist); //Response.Write("<script>alert(\"已经修改成功!\");location.href='imgend1.aspx';</script>"); Loadnew(Convert.ToInt32(reqid.Value)); } else if (scid.Value != "0") { newlist.id = Convert.ToInt32(scid.Value); Daxu.BLL.newlistBll.UpdateInewlist(newlist); xgoradd.Value = "1"; Loadnew(Convert.ToInt32(scid.Value)); } //插入数据 if (xgoradd.Value == "0") { Daxu.BLL.newlistBll.InsertInewlist(newlist); // Response.Write("<script>alert(\"操作成功!\");location.href='imgend1.aspx';</script>"); scid.Value = getid(); Loadnew(Convert.ToInt32(scid.Value)); } } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='../baseinfo/info.aspx';</script>"); } }