protected void gv_catelist_RowUpdating(object sender, GridViewUpdateEventArgs e) { InfoSortInfo infoSortInfo = InfoSortInfo.Read((int)this.gv_catelist.DataKeys[e.RowIndex].Value); if (infoSortInfo.SortStatus == 1) { infoSortInfo.SortStatus = 0; } else { infoSortInfo.SortStatus = 1; } infoSortInfo.Update(); this.BindData(); }
protected void bt_save_Click(object sender, EventArgs e) { for (int i = 0; i < this.gv_catelist.Rows.Count; i++) { CheckBox checkBox = this.gv_catelist.Rows[i].FindControl("checkbox1") as CheckBox; if (checkBox.Checked) { InfoSortInfo infoSortInfo = InfoSortInfo.Read((int)this.gv_catelist.DataKeys[i].Value); infoSortInfo.SortName = ((TextBox)this.gv_catelist.Rows[i].FindControl("tb_sortname")).Text; infoSortInfo.SortUrl = ((TextBox)this.gv_catelist.Rows[i].FindControl("tb_sortUrl")).Text; infoSortInfo.SortType = int.Parse(((DropDownList)this.gv_catelist.Rows[i].FindControl("ddl_sortType")).SelectedValue); infoSortInfo.SortOrder = int.Parse(((TextBox)this.gv_catelist.Rows[i].FindControl("tb_sortOrder")).Text); infoSortInfo.Update(); } } this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('保存成功!');", true); this.BindData(); }
protected void bt_add_Click(object sender, EventArgs e) { if (this.hf_id.Value == "0") { int sortLevel = 0; if (this.ddl_cate.SelectedValue != "0") { InfoSortInfo infoSortInfo = InfoSortInfo.Read(int.Parse(this.ddl_cate.SelectedValue)); sortLevel = infoSortInfo.SortLevel + 1; } InfoSortInfo infoSortInfo2 = new InfoSortInfo(0, int.Parse(this.ddl_module.SelectedValue), sortLevel, int.Parse(this.ddl_cate.SelectedValue), this.tb_sortname.Text, int.Parse(this.ddl_sortType.Text), this.tb_sortUrl.Text, int.Parse(this.tb_sortOrder.Text), "", "", "", "", "", DateTime.Now, 1); infoSortInfo2.Insert(); this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('添加成功!');", true); } else { InfoSortInfo infoSortInfo3 = InfoSortInfo.Read(int.Parse(this.hf_id.Value)); infoSortInfo3.ModuleId = int.Parse(this.ddl_module.SelectedValue); if (infoSortInfo3.Id.ToString() != this.ddl_cate.SelectedValue) { infoSortInfo3.Pid = int.Parse(this.ddl_cate.SelectedValue); } if (this.ddl_cate.SelectedValue != "0") { infoSortInfo3.SortLevel = InfoSortInfo.Read(int.Parse(this.ddl_cate.SelectedValue)).SortLevel + 1; } else { infoSortInfo3.SortLevel = 0; } infoSortInfo3.SortType = int.Parse(this.ddl_sortType.SelectedValue); infoSortInfo3.SortName = this.tb_sortname.Text; infoSortInfo3.SortUrl = this.tb_sortUrl.Text; infoSortInfo3.SortOrder = int.Parse(this.tb_sortOrder.Text); infoSortInfo3.SortPath = this.tb_sortPath.Text; infoSortInfo3.SortFileName = this.tb_sortFileName.Text; infoSortInfo3.SortTitle = this.tb_sortTitle.Text; infoSortInfo3.Keywords = this.tb_keywords.Text; infoSortInfo3.Description = this.tb_description.Text; infoSortInfo3.Update(); this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('修改成功!');", true); } this.BindData(); }