private static IList<Imginfo> get(string sql) { List<Imginfo> keywords = new List<Imginfo>(); string connnectionString = ConfigurationManager.ConnectionStrings["SqlServerConnectionString"].ConnectionString; SqlConnection conn = new SqlConnection(connnectionString); conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); //SqlDataAdapter sda = new SqlDataAdapter(cmd); //DataSet ds = new DataSet(); //DataTable table = sda.Fill(ds); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Imginfo sk = new Imginfo(); sk.id = (int)dr["id"]; sk.imgname = (string)dr["imgname"]; sk.rq = (int)dr["rq"]; keywords.Add(sk); } dr.Close(); conn.Close(); return keywords; }
//批量排序设置 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.Imginfo ImgInfo = new Daxu.Entity.Imginfo(); ImgInfo.px = Convert.ToInt32(TxtPx.Text); ImgInfo.id = Id; Daxu.BLL.Imgesbll.UpdateImges(ImgInfo); } Response.Write("<script>alert(\"排序成功!\");location.href='" + Request.RawUrl + "';</script>"); } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='../baseinfo/info.aspx';</script>"); } }
//过期自动下架 protected void infodata() { string sql = "select * from img where 1=1 and opentime=1"; List<Daxu.Entity.Imginfo> imginfolist = new List<Daxu.Entity.Imginfo>(); imginfolist = Daxu.BLL.Imgesbll.GeImagesData(sql) as List<Daxu.Entity.Imginfo>; foreach (Daxu.Entity.Imginfo userinfoed in imginfolist) { TimeSpan time = Convert.ToDateTime(userinfoed.DateTimeCon) - Convert.ToDateTime(DateTime.Now); if (time.Days < 0) { Daxu.Entity.Imginfo imginfoend = new Daxu.Entity.Imginfo(); imginfoend.opentime = "0"; imginfoend.DateTimeCon = DateTime.Now; imginfoend.id = Convert.ToInt32(userinfoed.id); Daxu.BLL.Imgesbll.UpdateImges(imginfoend); } } }
//上传轮换展示图 //protected void updatazs_Click(object sender, EventArgs e) //{ // UserHandle.UserHandle.InitModules_Admin("CPGLXT"); // if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Add)) // { // Daxu.Entity.Imginfo imginfo = new Imginfo(); // // string str = "select * from img where id='" + Convert.ToInt32(scid.Value) + "'"; // if (imgmr.Value != "00") // { // imginfo.img = imgmr.Value; // } // else // { // imginfo.img = "mrsiml.jpg"; // } // //上传展示图 // if (FileUpload11.HasFile) // { // string File1 = DateTime.Now.ToString("yyMMddHHssfff") + "." + (FileUpload11.FileName.Substring(FileUpload11.FileName.LastIndexOf(".") + 1)).ToLower(); // fileupload(FileUpload11, File1); // imginfo.imgLH1 = File1 + ","; // } // else // { // imginfo.imgLH1 = "mrsiml.jpg" + ","; // } // //FileUpload2 // if (FileUpload2.HasFile) // { // string File2 = DateTime.Now.ToString("MMddHHssfff") + "." + (FileUpload2.FileName.Substring(FileUpload2.FileName.LastIndexOf(".") + 1)).ToLower(); // fileupload(FileUpload2, File2); // imginfo.imgLH1 += File2 + ","; // } // else // { // imginfo.imgLH1 += "mrsiml.jpg" + ","; // } // //FileUpload3 // if (FileUpload3.HasFile) // { // string File3 = DateTime.Now.ToString("yyMMHHssfff") + "." + (FileUpload3.FileName.Substring(FileUpload3.FileName.LastIndexOf(".") + 1)).ToLower(); // fileupload(FileUpload3, File3); // imginfo.imgLH1 += File3 + ","; // } // else // { // imginfo.imgLH1 += "mrsiml.jpg" + ","; // } // //FileUpload4 // if (FileUpload4.HasFile) // { // string File4 = DateTime.Now.ToString("yyMMddHHssff") + "." + (FileUpload4.FileName.Substring(FileUpload4.FileName.LastIndexOf(".") + 1)).ToLower(); // fileupload(FileUpload4, File4); // imginfo.imgLH1 += File4 + ","; // } // else // { // imginfo.imgLH1 += "mrsiml.jpg" + ","; // } // //FileUpload5 // if (FileUpload5.HasFile) // { // string File5 = DateTime.Now.ToString("yMdHsfff") + "." + (FileUpload5.FileName.Substring(FileUpload5.FileName.LastIndexOf(".") + 1)).ToLower(); // fileupload(FileUpload5, File5); // imginfo.imgLH1 += File5 + ","; // } // else // { // imginfo.imgLH1 += "mrsiml.jpg" + ","; // } // //修改数据 // if (xgoradd.Value == "1") // { // Daxu.BLL.Imgesbll.UpdateImges( imginfo, Convert.ToInt32(reqid.Value)); // } // //插入数据 // if (xgoradd.Value == "0") // { // Daxu.BLL.Imgesbll.InsertImages( imginfo); // scid.Value = getid(); // xgoradd.Value = "1"; // } // } // else // { // Response.Write("<script>alert(\"对不起权限不足!\");location.href='img.aspx';</script>"); // } //} protected string updatas() { Daxu.Entity.Imginfo imginfo = new Imginfo(); UserHandle.UserHandle.InitModules_Admin("CPGLXT"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Add)) { string sql = "select * from img where id='" + Convert.ToInt32(reqid.Value) + "'"; Daxu.Entity.Imginfo ImgInfo = Daxu.BLL.Imgesbll.getImagesModel(sql); if (imgmr.Value != "00") { imginfo.img = imgmr.Value; } else { imginfo.img = "mrsiml.jpg"; } //上传展示图 if (FileUpload11.HasFile) { string fileth = "~/upload/images/" + ImgInfo.imgLH1; FileInfo filee = new FileInfo(Server.MapPath(fileth));//删除以前的老文件 if (filee.Exists) { filee.Delete(); } string File1 = "IMG_" + DateTime.Now.ToString("yyMMddHHssfff") + "." + (FileUpload11.FileName.Substring(FileUpload11.FileName.LastIndexOf(".") + 1)).ToLower(); fileupload(FileUpload11, File1); imginfo.imgLH1 = File1 + ","; } else { imginfo.imgLH1 = "mrsiml.jpg" + ","; } //FileUpload2 if (FileUpload2.HasFile) { string File2 = "IMG_" + DateTime.Now.ToString("MMddHHssfff") + "." + (FileUpload2.FileName.Substring(FileUpload2.FileName.LastIndexOf(".") + 1)).ToLower(); fileupload(FileUpload2, File2); imginfo.imgLH1 += File2 + ","; } else { imginfo.imgLH1 += "mrsiml.jpg" + ","; } //FileUpload3 if (FileUpload3.HasFile) { string File3 = "IMG_" + DateTime.Now.ToString("yyMMHHssfff") + "." + (FileUpload3.FileName.Substring(FileUpload3.FileName.LastIndexOf(".") + 1)).ToLower(); fileupload(FileUpload3, File3); imginfo.imgLH1 += File3 + ","; } else { imginfo.imgLH1 += "mrsiml.jpg" + ","; } //FileUpload4 if (FileUpload4.HasFile) { string File4 = "IMG_" + DateTime.Now.ToString("yyMMddHHssff") + "." + (FileUpload4.FileName.Substring(FileUpload4.FileName.LastIndexOf(".") + 1)).ToLower(); fileupload(FileUpload4, File4); imginfo.imgLH1 += File4 + ","; } else { imginfo.imgLH1 += "mrsiml.jpg" + ","; } //FileUpload5 if (FileUpload5.HasFile) { string File5 = "IMG_" + DateTime.Now.ToString("yMdHsfff") + "." + (FileUpload5.FileName.Substring(FileUpload5.FileName.LastIndexOf(".") + 1)).ToLower(); fileupload(FileUpload5, File5); imginfo.imgLH1 += File5 + ","; } else { imginfo.imgLH1 += "mrsiml.jpg" + ","; } //if (FileUpload1.HasFile || FileUpload2.HasFile || FileUpload3.HasFile || FileUpload4.HasFile || FileUpload5.HasFile) //{ // Daxu.BLL.Imgesbll.UpdateImges( imginfo, Convert.ToInt32(reqid.Value)); //} } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='img.aspx';</script>"); } return Convert.ToString(imginfo.imgLH1); }
//上传省略图 //protected void updatasl_Click(object sender, EventArgs e) //{ // UserHandle.UserHandle.InitModules_Admin("CPGLXT"); // if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Add)) // { // Daxu.Entity.Imginfo imginfo = new Imginfo(); // //上传 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"; // } // imginfo.img = name; // imginfo.Price = 0; // imginfo.YjPrice = 0; // //修改数据 // if (xgoradd.Value == "1") // { // Daxu.BLL.Imgesbll.UpdateImges( imginfo, Convert.ToInt32(reqid.Value)); // //Response.Write("<script>alert(\"已经修改成功!\");location.href='imgend1.aspx';</script>"); // xs(Convert.ToInt32(reqid.Value)); // } // else if (scid.Value != "0") // { // Daxu.BLL.Imgesbll.UpdateImges( imginfo, Convert.ToInt32(scid.Value)); // xgoradd.Value = "1"; // xs(Convert.ToInt32(scid.Value)); // } // //插入数据 // if (xgoradd.Value == "0") // { // Daxu.BLL.Imgesbll.InsertImages( imginfo); // scid.Value = getid(); // xgoradd.Value = "1"; // xs(Convert.ToInt32(scid.Value)); // } // } // else // { // Response.Write("<script>alert(\"对不起权限不足!\");location.href='img.aspx';</script>"); // } //} protected string updata() { Daxu.Entity.Imginfo imginfo = new Imginfo(); UserHandle.UserHandle.InitModules_Admin("CPGLXT"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Add)) { string sql = "select * from img where id='" + Convert.ToInt32(reqid.Value) + "'"; Daxu.Entity.Imginfo ImgInfo = Daxu.BLL.Imgesbll.getImagesModel(sql); //上传 DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss fff") string name = "IMG_" + DateTime.Now.ToString("yyyyMMddHHssfff") + "." + (FileUpload1.FileName.Substring(FileUpload1.FileName.LastIndexOf(".") + 1)).ToLower(); if (FileUpload1.HasFile) { string fileth = "~/upload/images/" + ImgInfo.img; FileInfo filee = new FileInfo(Server.MapPath(fileth));//删除以前的老文件 if (filee.Exists) { filee.Delete(); } fileupload(FileUpload1, name); //上传文件 imginfo.img = name; } else { name = "mrsiml.jpg"; } } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='img.aspx';</script>"); } return Convert.ToString(imginfo.img); }
public void GetChick() { UserHandle.UserHandle.InitModules_Admin("CPGLXT"); if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Add)) { Daxu.Entity.Imginfo imginfo = new Imginfo(); imginfo.fenlei = profenlei.SelectedValue; imginfo.DownId = Convert.ToInt32(downType.SelectedValue); string sqlnav = "select * from nav where id='" + Convert.ToInt32(profenlei.SelectedValue) + "' "; Daxu.Entity.nav navinfo = Daxu.BLL.navBll.getInavModel(sqlnav); if (_imgcx.Checked) { imginfo.imgcx = "1";//推荐产品 } else { imginfo.imgcx = "0";//推荐产品 } if (_imgTj.Checked) { imginfo.imgTj = "1";//销售排行 } else { imginfo.imgTj = "0";//销售排行 } if (_imgph.Checked) { imginfo.imgph = "1";//销售排行 } else { imginfo.imgph = "0";//销售排行 } if (_imgnewpro.Checked) { imginfo.imgnewpro = "1";//销售排行 } else { imginfo.imgnewpro = "0";//销售排行 } if (_rmKeywords.Checked == true) { imginfo.rmKeywords = "1"; } else { imginfo.rmKeywords = "0"; } if (_DIYjimg.Checked == true) { imginfo.DIYjimg = "1"; } else { imginfo.DIYjimg = "0"; } //开启限制时间 if (_opentime.Checked) { imginfo.opentime = "1"; } else { imginfo.opentime = "0"; } if (_imgcx.Checked == true) { imginfo.imgcx = "1"; } else { imginfo.imgcx = "0"; } if (!string.IsNullOrEmpty(Convert.ToString(_integral.Text))) { imginfo.integral = Convert.ToInt32(_integral.Text); } imginfo.Description = _Description.Text; imginfo.title = _title.Text; imginfo.Keywords = _Keywords.Text; imginfo.Gm = Convert.ToInt32(_Gm.Text); //到期时间 if (!string.IsNullOrEmpty(_DateTimeCon.Text)) { imginfo.DateTimeCon = Convert.ToDateTime(_DateTimeCon.Text); } imginfo.imgname = _imgname.Text;//产品名称 imginfo.model = _model.Text;//使用型号 imginfo.YjPrice = Convert.ToDecimal(_YjPrice.Text);//外型尺寸 imginfo.Price = Convert.ToDecimal(_Price.Text); imginfo.contenr = _contenr.Value; //fck内容 imginfo.px = Convert.ToInt32(_px.Text); imginfo.gs = gs.Value; //fck概述 imginfo.tdia = tdia.Value; //fck特点 imginfo.jscs = jscs.Value; //fck技术参数 imginfo.xhpj = xhpj.Value; //fck型号配件 //父级栏目数组 imginfo.DengJI = Convert.ToString(tools.methods.GetFulanmu(Convert.ToInt32(profenlei.SelectedValue))); imginfo.color = _color.Text;//颜色 imginfo.img = updata(); if (FileUpload11.HasFile || FileUpload2.HasFile || FileUpload3.HasFile || FileUpload4.HasFile || FileUpload5.HasFile) { imginfo.imgLH1 = updatas(); } //鲜花属性 用途 if (!string.IsNullOrEmpty(_yhuse.SelectedValue)) { imginfo.yhuse = _yhuse.SelectedValue; } //鲜花属性 节日 if (!string.IsNullOrEmpty(_festival.SelectedValue)) { imginfo.festival = _festival.SelectedValue; } //鲜花属性 花材 if (!string.IsNullOrEmpty(_brand.SelectedValue)) { imginfo.brand = _brand.SelectedValue; } //鲜花属性 支数 if (!string.IsNullOrEmpty(_count.SelectedValue)) { imginfo.count = _count.SelectedValue; } //鲜花属性 颜色 if (!string.IsNullOrEmpty(_color.SelectedValue)) { imginfo.color = _color.SelectedValue; } //鲜花属性 对象 if (!string.IsNullOrEmpty(_object.SelectedValue)) { imginfo.Object = _object.SelectedValue; } //鲜花属性 对象 if (!string.IsNullOrEmpty(_pricestring.SelectedValue)) { imginfo.pricestring = _pricestring.SelectedValue; } //修改数据 if (xgoradd.Value == "1") { imginfo.id = Convert.ToInt32(Request.QueryString["id"]); Daxu.BLL.Imgesbll.UpdateImges(imginfo); Response.Write("<script>alert(\"已经修改成功!\");location.href='img.aspx';</script>"); } //插入数据 if (xgoradd.Value == "0") { Daxu.BLL.Imgesbll.InsertImages(imginfo); Response.Write("<script>alert(\"添加成功!\");location.href='img.aspx';</script>"); } } else { Response.Write("<script>alert(\"对不起权限不足!\");location.href='img.aspx';</script>"); } }