protected void Btn_ReginCancel_Click(object sender, EventArgs e)//重置区域 { TextBox_Regionname1.Text = ""; GridView_Region.DataSource = PCB.SList_CRMRegionBasicInfo(); GridView_Region.DataBind(); UpdatePanel_RegionBasicInfo1.Update(); UpdatePanel_RegionBasicInfo.Update(); }
protected void Btn_NewRegion_Click(object sender, EventArgs e)//确认新增区域 { string name = TextBox_Regionname.Text.Trim().ToString(); string detail = TextBox_RegionDetail.Text.Trim().ToString(); PCB.I_CRMRegionBasicInfo(name, detail); GridView_Region.DataSource = PCB.SList_CRMRegionBasicInfo(); GridView_Region.DataBind(); UpdatePanel_RegionBasicInfo.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('新增成功!')", true); Panel_NewRegion.Visible = false; UpdatePanel_NewRegion.Update(); return; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } if (Request.QueryString["status"] == "GegionSee")//区域查看权限 { Title = "销售区域查看"; Panel_ClientSort.Visible = false; GridView_Region.Columns[3].Visible = false; GridView_Region.Columns[4].Visible = false; Btn_NewStore.Visible = false; GridView_Region.DataSource = PCB.SList_CRMRegionBasicInfo(); GridView_Region.DataBind(); //this.GridView_ClientSort.DataSource = PCB.SList_CRMCustomerSortBasicData(); //this.GridView_ClientSort.DataBind(); } else if (Request.QueryString["status"] == "GegionMange") //区域维护权限 { Title = "销售区域维护"; Panel_ClientSort.Visible = false; GridView_Region.DataSource = PCB.SList_CRMRegionBasicInfo(); GridView_Region.DataBind(); } else if (Request.QueryString["status"] == "SortSee") //区域维护权限 { Title = "销售区域维护"; Panel_RegionBasicInfo1.Visible = false; UpdatePanel_RegionBasicInfo.Visible = false; GridView_ClientSort.Columns[3].Visible = false; GridView_ClientSort.Columns[4].Visible = false; Btn_newSort.Visible = false; GridView_ClientSort.DataSource = PCB.SList_CRMCustomerSortBasicData(); GridView_ClientSort.DataBind(); } else if (Request.QueryString["status"] == "SortMange") //类别维护权限 { Title = "客户类别维护"; Panel_RegionBasicInfo1.Visible = false; UpdatePanel_RegionBasicInfo.Visible = false; GridView_ClientSort.DataSource = PCB.SList_CRMCustomerSortBasicData(); GridView_ClientSort.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e)//确认修改区域 { Guid id = new Guid(Session["region_id"].ToString()); string name = TextBox_Changregion.Text.Trim().ToString(); string detail = TextBox_ChangeDetail.Text.Trim().ToString(); PCB.U_CRMRegionBasicInfo(id, name, detail); GridView_Region.DataSource = PCB.SList_CRMRegionBasicInfo(); GridView_Region.DataBind(); UpdatePanel_RegionBasicInfo.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('修改成功!')", true); Panel_ChangeRegion.Visible = false; UpdatePanel_ChangeRegion.Update(); return; }
protected void GridView_Region_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "dele") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_Region.SelectedIndex = row.RowIndex; GridView_Region.SelectedIndex = -1; string Region_id = e.CommandArgument.ToString(); Guid region_id = new Guid(Region_id); PCB.D_CRMRegionBasicInfo(region_id); GridView_Region.DataSource = PCB.SList_CRMRegionBasicInfo(); GridView_Region.DataBind(); UpdatePanel_RegionBasicInfo.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除成功!')", true); return; } else if (e.CommandName == "Change") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_Region.SelectedIndex = row.RowIndex; GridView_Region.SelectedIndex = -1; string Region_id = e.CommandArgument.ToString(); Guid region_id = new Guid(Region_id); Session["region_id"] = e.CommandArgument.ToString(); Panel_ChangeRegion.Visible = true; UpdatePanel_ChangeRegion.Update(); TextBox_Changregion.Text = row.Cells[1].Text.Trim().ToString(); TextBox_ChangeDetail.Text = row.Cells[2].Text.Trim().ToString().Replace(" ", ""); return; } else if (e.CommandName == "Detail") { Panel_RegionPeople.Visible = true; GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_Region.SelectedIndex = row.RowIndex; GridView_Region.SelectedIndex = -1; string Region_id = e.CommandArgument.ToString(); Guid region_id = new Guid(Region_id); Session["REgion_id"] = e.CommandArgument.ToString(); GridView1_RegionPeople.DataSource = PCB.S_CRMRBI_CRMCIF(region_id); GridView1_RegionPeople.DataBind(); UpdatePanel_RegionPeople.Update(); return; } } //linkbutton链接按钮根据自身Commandname来触发不同事件
protected void Btn_RegionSearch_Click(object sender, EventArgs e)//检索区域 { string name = TextBox_Regionname1.Text.Trim().ToString(); if (name != "") { GridView_Region.DataSource = PCB.S_CRMRBISraech(name); GridView_Region.DataBind(); UpdatePanel_RegionBasicInfo.Update(); } else { GridView_Region.DataSource = PCB.SList_CRMRegionBasicInfo(); } GridView_Region.DataBind(); UpdatePanel_RegionBasicInfo1.Update(); UpdatePanel_RegionBasicInfo.Update(); }
} //linkbutton链接按钮根据自身Commandname来触发不同事件 protected void GridView_Region_PageIndexChanging(object sender, GridViewPageEventArgs e)//区域信息表,下一页,上一页等跳转后台 { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; if (-2 == e.NewPageIndex) { // when click the "GO" Button TextBox txtNewPageIndex = null; GridViewRow pagerRow = GridView_Region.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); // refer to the TextBox with the NewPageIndex value } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex } } else { // when click the first, last, previous and next Button newPageIndex = e.NewPageIndex; } // check to prevent form the NewPageIndex out of the range newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= GridView_Region.PageCount ? GridView_Region.PageCount - 1 : newPageIndex; // specify the NewPageIndex GridView_Region.PageIndex = newPageIndex; GridView_Region.PageIndex = newPageIndex; GridView_Region.DataSource = PCB.SList_CRMRegionBasicInfo(); GridView_Region.DataBind(); UpdatePanel_RegionBasicInfo.Update(); } //读取go前textbox,导航到指定页面
} //读取go前textbox,导航到指定页面 #endregion protected void Bindlingyu() { GridView_Region.DataSource = cb.S_CRMCusSort(labelsource.Text); GridView_Region.DataBind(); UpdatePanel_RegionBasicInfo.Update(); }