protected void btnSave_Click(object sender, EventArgs p1) { if (Id > 0) { #region __________Edit__________ model = bll.GetModel(Id); model.C_SubTitle = txtC_SubTitle.Text; model.N_OrderId = int.Parse(txtN_OrderId.Text); model.N_Need = int.Parse(drpNeed.SelectedValue); model.Parentid = int.Parse(drpType.SelectedValue); model.N_Type = int.Parse(drpUnit.SelectedValue); if (bll.Update(model)) { //B_operationLog.CreateOperationLog(B_operationLog.operationLogType.Edit, "", ""); MessageBox.JSLoad(this, "alert('保存成功!');window.location.href='biceitem.aspx?Sysid=" + sysid + "'"); } #endregion } else { #region __________Add__________ model.N_SysId = int.Parse(hidsysid.Value); model.C_SubTitle = txtC_SubTitle.Text; model.N_OrderId = int.Parse(txtN_OrderId.Text); model.N_Need = int.Parse(drpNeed.SelectedValue); model.Parentid = int.Parse(drpType.SelectedValue); model.N_Type = int.Parse(drpUnit.SelectedValue); if (bll.Add(model)) { //B_operationLog.CreateOperationLog(B_operationLog.operationLogType.Add, "", ""); MessageBox.JSLoad(this, "alert('保存成功!');window.location.href='biceitem.aspx?Sysid=" + sysid + "'"); } #endregion } }
private void InitData() { JBind.BindList(drpType, bll.GetList(0, "N_SubId,C_SubTitle", "Parentid=0 and N_SysId=" + sysid, "").Tables[0], "C_SubTitle", "N_SubId"); //省份 drpType.Items.Insert(0, new ListItem("一级目录", "0")); JBind.BindList(drpUnit, new MW.BLL.B_Voteunit().GetList(0, "N_SubId,C_SubTitle", "N_SysId=" + sysid, "").Tables[0], "C_SubTitle", "N_SubId"); //省份 //drpUnit.Items.Insert(0, new ListItem("请选择", "0")); hidsysid.Value = sysid.ToString(); if (Id > 0) {//edit model = bll.GetModel(Id); if (model != null) { txtC_SubTitle.Text = model.C_SubTitle; txtN_OrderId.Text = model.N_OrderId.ToString(); drpNeed.SelectedValue = model.N_Need.ToString(); drpType.SelectedValue = model.Parentid.ToString(); drpUnit.SelectedValue = model.N_Type.ToString(); if (BaseVote.ShowSysEdit(sysid)) { drpUnit.Enabled = false; } } } else { drpType.SelectedValue = parentid.ToString(); } }