/// <summary> /// 添加一级信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddOne_Click(object sender, EventArgs e) { string pName = this.txtOne.Text.Trim(); string pChar = this.txtChar.Text.Trim(); if (pName.Length == 0 || pChar.Length == 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('名称和字符信息不能为空!');", true); return; } AreaInfo item = new AreaInfo(); item.areaName = pName; item.charIndex = pChar; item.parentId = 0; item.status = 0; item.remark = ""; int num = AreaInfoService.Add(item); if (num > 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('添加成功!');", true); } LoadOneInfo(); }
protected void btnRegion_Click(object sender, EventArgs e) { string pid = this.ddlProvince.SelectedValue; string cid = ddlCity.SelectedValue; if (pid == "0" || cid == "0") { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('请选择省市分类!');", true); return; } string regionName = this.txtRegion.Text.Trim(); string cCh = this.txtC.Text.Trim(); if (regionName.Length == 0 || cCh.Length == 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('商圈名称和字符信息不能为空!');", true); return; } AreaInfo item = new AreaInfo(); item.areaName = regionName; item.charIndex = cCh; item.parentId = Convert.ToInt32(cid); item.status = 0; item.remark = ""; int num = AreaInfoService.Add(item); if (num > 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('添加成功!');", true); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('添加失败!');", true); } this.GetRegion(cid); }
/// <summary> /// 添加市信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddTwo_Click(object sender, EventArgs e) { string pid = this.ddlOne.SelectedValue; if (pid == "0") { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('请选择省级分类!');", true); return; } string twoName = this.txtTwo.Text.Trim(); string cCh = txtCharCity.Text.Trim(); if (twoName.Length == 0 || cCh.Length == 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('市名称和字符信息不能为空!');", true); return; } AreaInfo item = new AreaInfo(); item.areaName = twoName; item.charIndex = cCh; item.parentId = Convert.ToInt32(pid); item.status = 0; item.remark = ""; int num = AreaInfoService.Add(item); if (num > 0) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('添加成功!');", true); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('添加失败!');", true); } GetTwo(pid); }