private void Button1_Click(object sender, EventArgs e) { try { string pname = proVal.Value.Trim(); if (string.IsNullOrEmpty(pname)) { Common.MessageBox.Show(this,"属性值不能为空",Common.MessageBox.InfoType.warning); return; } var bl = new DS_PropertyValue_Br(); var md = bl.CreateModel(); md.PropertyValue = pname; md.PropertyID = int.Parse(Request.QueryString["ProID"]); md.Px = 0; bl.Add(md); bl.Sort(md.ID,true); Common.MessageBox.Show(this, "保存成功", Common.MessageBox.InfoType.info, "function(){location='list.aspx?ProID="+md.PropertyID+"'}"); }catch(Exception ex){ Common.WriteLog.SetErrLog(Request.Url.ToString(), "Button1_Click", ex.Message); if (ex.Message.Contains("IX_DS_PropertyValue")) { Common.MessageBox.Show(this, "已存在相同的值", Common.MessageBox.InfoType.error); return; } Common.MessageBox.Show(this, "保存发生意外,请联系管理人员解决。"+ex.Message, Common.MessageBox.InfoType.error); } }
private void Button1_Click(object sender, EventArgs e) { try { string pname = proVal.Value.Trim(); if (string.IsNullOrEmpty(pname)) { Common.MessageBox.Show(this, "属性值不能为空", Common.MessageBox.InfoType.warning); return; } var bl = new DS_PropertyValue_Br(); var md = bl.CreateModel(); md.PropertyValue = pname; md.PropertyID = int.Parse(Request.QueryString["ProID"]); md.Px = 0; bl.Add(md); bl.Sort(md.ID, true); Common.MessageBox.Show(this, "保存成功", Common.MessageBox.InfoType.info, "function(){location='list.aspx?ProID=" + md.PropertyID + "'}"); }catch (Exception ex) { Common.WriteLog.SetErrLog(Request.Url.ToString(), "Button1_Click", ex.Message); if (ex.Message.Contains("IX_DS_PropertyValue")) { Common.MessageBox.Show(this, "已存在相同的值", Common.MessageBox.InfoType.error); return; } Common.MessageBox.Show(this, "保存发生意外,请联系管理人员解决。" + ex.Message, Common.MessageBox.InfoType.error); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["ID"])) { Common.MessageBox.Show(this, "缺少参数", Common.MessageBox.InfoType.warning, "history.back"); return; } int sid = 0; if (!int.TryParse(Request.QueryString["ID"], out sid)) { Common.MessageBox.Show(this, "参数无效", Common.MessageBox.InfoType.warning, "history.back"); return; } Button1.Click += new EventHandler(Button1_Click); if (IsPostBack) { return; } var bl = new DS_PropertyValue_Br(); var md = bl.GetSingle(int.Parse(Request.QueryString["ID"])); proVal.Value = md.PropertyValue; var bl2 = new DS_Property_Br(); var md2 = bl2.GetSingle(md.PropertyID); ViewState["proName"] = md2.ProName; }
protected void LinkButtonPx_Click(object sender, EventArgs e) { var lb = (LinkButton)sender; var bl = new DS_PropertyValue_Br(); bl.Sort(int.Parse(lb.Attributes["pid"]), bool.Parse(lb.Attributes["cn"])); AspNetPager_PageChanged(null, null); }
private void BindDate(string sql, params object[] param) { ViewState["sql"] = sql; int pageCount = 0; var bl = new DS_PropertyValue_Br(); var list = bl.Query(sql,"px", (ToolBar1.AspNetPager.CurrentPageIndex - 1) * ToolBar1.AspNetPager.PageSize, ToolBar1.AspNetPager.PageSize, ref pageCount, param); ToolBar1.AspNetPager.RecordCount = pageCount; Repeater1.DataSource =list; Repeater1.DataBind(); }
private void BindDate(string sql, params object[] param) { ViewState["sql"] = sql; int pageCount = 0; var bl = new DS_PropertyValue_Br(); var list = bl.Query(sql, "px", (ToolBar1.AspNetPager.CurrentPageIndex - 1) * ToolBar1.AspNetPager.PageSize, ToolBar1.AspNetPager.PageSize, ref pageCount, param); ToolBar1.AspNetPager.RecordCount = pageCount; Repeater1.DataSource = list; Repeater1.DataBind(); }
private void Delete(object sender, EventArgs e) { try { string ids = Request.Form["checkboxid"]; if (string.IsNullOrEmpty(ids)) { Common.MessageBox.Show(this, "请选中要删除的记录", Common.MessageBox.InfoType.warning); return; } var bl = new DS_PropertyValue_Br(); bl.Delete(ids); Common.MessageBox.Show(this, "删除成功", Common.MessageBox.InfoType.info); AspNetPager_PageChanged(null, null); }catch (Exception ex) { Common.WriteLog.SetErrLog(Request.Url.ToString(), "Delete", ex.Message); Common.MessageBox.Show(this, "删除发生意外,请联系管理人员解决。" + ex.Message, Common.MessageBox.InfoType.error); } }
private void Button1_Click(object sender, EventArgs e) { try { var bl = new DS_PropertyValue_Br(); string kw = Request.Form["keyword"].Trim(); string sql = ""; object[] param = new object[1]; if (!string.IsNullOrEmpty(kw)) { sql = " categoryName.Contains(@0)"; param[0] = kw; } BindDate(sql, param); }catch (Exception ex) { Common.WriteLog.SetErrLog(Request.Url.ToString(), "Button1_Click", ex.Message); Common.MessageBox.Show(this, "搜索发生意外。" + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["ID"])) { Common.MessageBox.Show(this, "缺少参数", Common.MessageBox.InfoType.warning, "history.back"); return; } int sid = 0; if (!int.TryParse(Request.QueryString["ID"], out sid)) { Common.MessageBox.Show(this, "参数无效", Common.MessageBox.InfoType.warning, "history.back"); return; } Button1.Click+=new EventHandler(Button1_Click); if (IsPostBack) return; var bl = new DS_PropertyValue_Br(); var md = bl.GetSingle(int.Parse(Request.QueryString["ID"])); proVal.Value = md.PropertyValue; var bl2 = new DS_Property_Br(); var md2 = bl2.GetSingle(md.PropertyID); ViewState["proName"] = md2.ProName; }
private void Delete(object sender, EventArgs e) { try { string ids = Request.Form["checkboxid"]; if (string.IsNullOrEmpty(ids)) { Common.MessageBox.Show(this, "请选中要删除的记录", Common.MessageBox.InfoType.warning); return; } var bl = new DS_PropertyValue_Br(); bl.Delete(ids); Common.MessageBox.Show(this, "删除成功", Common.MessageBox.InfoType.info); AspNetPager_PageChanged(null, null); }catch(Exception ex){ Common.WriteLog.SetErrLog(Request.Url.ToString(), "Delete", ex.Message); Common.MessageBox.Show(this, "删除发生意外,请联系管理人员解决。" + ex.Message, Common.MessageBox.InfoType.error); } }
private void Button1_Click(object sender, EventArgs e) { try { var bl = new DS_PropertyValue_Br(); string kw=Request.Form["keyword"].Trim(); string sql = ""; object[] param=new object[1]; if (!string.IsNullOrEmpty(kw)) { sql = " categoryName.Contains(@0)"; param[0] = kw; } BindDate(sql,param); }catch(Exception ex){ Common.WriteLog.SetErrLog(Request.Url.ToString(), "Button1_Click", ex.Message); Common.MessageBox.Show(this,"搜索发生意外。"+ex.Message); } }