using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace Mtxfw.VipSite { public partial class Admin_Member_Products_YunFei0 : Mtxfw.Utility.MemberBase { Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info(); Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results(); private static Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(""); Mtxfw.DAL.freighttemplate daoftem = new Mtxfw.DAL.freighttemplate(); public int gtype = 0; #region 判断页面是否刷新 private bool _refreshState; private bool _isRefresh; /// /// 判断页面是否刷新 /// public bool IsRefresh { get { return _isRefresh; } } protected override void LoadViewState(object savedState) { object[] allStates = (object[])savedState; base.LoadViewState(allStates[0]); _refreshState = (bool)allStates[1]; _isRefresh = _refreshState == (bool)Session["__ISREFRESH"]; } protected override object SaveViewState() { Session["__ISREFRESH"] = _refreshState; object[] allStates = new object[2]; allStates[0] = base.SaveViewState(); allStates[1] = !_refreshState; return allStates; } #endregion protected override void OnLoad(EventArgs e) { base.OnLoad(e); string hostname = Request.Url.Host; gtype = new DAL.host().GetId(hostname); if (!IsPostBack) { if (Session["IFPassword"] == null) { Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_Products_YunFei0.aspx"); } if (IFStores != 1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (MemberJS.IndexOf("运费设置") == -1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } Data_Bind(); Page.Title = "运费设置 - " + GetWebName; } MyPager.PageChanged += delegate(object s, EventArgs ex) { Data_Bind(); }; } protected void Data_Bind() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); MyPager.PageSize = 100; MyPager.RecordCount = daoftem.GetCount("id>0" + sb.ToString()); Mtxfw.Utility.Tools.ToBind(Repeater1, daoftem.GetPager(MyPager, "", "id>0" + sb.ToString() + " Order by id desc")); } protected void Delete_Click(object s, CommandEventArgs ex) { Int32 ID = int.Parse(ex.CommandName); Mtxfw.Model.freighttemplate model = daoftem.GetModel(ID); if (model != null) { daoftem.Delete(ID); 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.tname; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } Data_Bind(); } protected void Run_Click(object s, System.EventArgs e) { CheckBox Check = new CheckBox(); string strs = seclect_Drop.SelectedItem.Value; foreach (RepeaterItem Item in Repeater1.Items) { //在行中查找到该单选框 Check = (CheckBox)Item.FindControl("checka"); int strID = int.Parse(Check.CssClass); if (Check.Checked == true) { if (strs == "0") { Model.freighttemplate model = daoftem.GetModel(strID); if (model != null) { daoftem.Delete(ID); 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.tname; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } } } } Response.Redirect(Request.Url.AbsoluteUri); } } }