using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Mtxfw.VipSite { public partial class Admin_Member_Pics_add : Mtxfw.Utility.MemberBase { public Mtxfw.DAL.user_Goods daoGoods = new Mtxfw.DAL.user_Goods(); public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(""); public String strTitle = "",strBody = ""; public int gtype = 0; protected override void OnLoad(EventArgs e) { base.OnLoad(e); string hostname = Request.Url.Host; if (!IsPostBack) { if (Session["IFPassword"] == null) { Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_Pics_add.aspx"); } if (IFStores != 1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (MemberJS.IndexOf("滚动图片管理") == -1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } Data_Bind(); } Btn_Insert.Click += delegate(object s, EventArgs ex) { if (Text_GoodsName.Text != "") { try { Mtxfw.Model.user_Goods model = new Mtxfw.Model.user_Goods(); model.GoodsName = Text_GoodsName.Text; model.GoodsPrices = 0; model.GoodsPrices0 = 0; model.GoodsPrices1 = 0; model.GoodsPrices2 = 0; model.GoodsPic = hiddenphoto.Value; model.GoodsUrl = Text_GoodsUrl.Text; model.GoodsBody = ""; model.starttime = ""; model.endtime = ""; model.AddTime = DateTime.Now; model.utype = Convert.ToInt32(GoodsType.SelectedItem.Value); model.gtype = 0; daoGoods.Add(model); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = Card; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "添加滚动图片,标题:" + model.GoodsName + ""; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); ClientScript.RegisterStartupScript(this.GetType(), "", ""); } catch { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } }; Btn_Update.Click += delegate(object s, EventArgs ex) { if (Hidd_ID.Value != "" && Text_GoodsName.Text != "") { try { Int32 ID = int.Parse(Hidd_ID.Value); Mtxfw.Model.user_Goods model = daoGoods.GetModel(ID); model.GoodsName = Text_GoodsName.Text; model.GoodsPic = hiddenphoto.Value; model.GoodsUrl = Text_GoodsUrl.Text; model.utype = Convert.ToInt32(GoodsType.SelectedItem.Value); daoGoods.Update(model); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = Card; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "更新滚动图片,标题:" + model.GoodsName + ""; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); ClientScript.RegisterStartupScript(this.GetType(), "", ""); } catch { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } }; } protected void Data_Bind() { if (Request.UrlReferrer != null) { Hidd_Url.Value = Request.UrlReferrer.ToString(); } else { Hidd_Url.Value = "Admin_Member_Pics.aspx"; } if (Request.QueryString["ID"] == null) { strTitle = "添加新图片"; Page.Title = strTitle + " - " + GetWebName; Btn_Update.Visible = false; } else { strTitle = "更新图片"; Page.Title = strTitle + " - " + GetWebName; Btn_Insert.Visible = false; Mtxfw.Model.user_Goods model = daoGoods.GetModel(int.Parse(Request.QueryString["ID"])); if (model != null) { Text_GoodsName.Text = model.GoodsName; Hidd_ID.Value = model.Id.ToString(); Text_GoodsUrl.Text = model.GoodsUrl; strBody = model.GoodsBody; hiddenphoto.Value= model.GoodsPic; for (int i = 0; i < GoodsType.Items.Count; i++) { if (model.utype.ToString() == GoodsType.Items[i].Value) { GoodsType.Items[i].Selected = true; } else { GoodsType.Items[i].Selected = false; } } } } } } }