using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Common;
|
using System.Data;
|
|
namespace CY.WebForm.Pages.personnel
|
{
|
//吴辉
|
//修改员工负责区域
|
public partial class CCManageAddress : BasePage
|
{
|
Sys_CitySiteBLL bll_Sys_CitySiteBLL = null;
|
OA_StaffBLL bll_OA_StaffBLL = null;
|
|
public static string treeHtml = ""; //树形参数
|
public string CheckedHtml = ""; //选中值
|
|
//实例化
|
public CCManageAddress()
|
{
|
bll_Sys_CitySiteBLL = new Sys_CitySiteBLL();
|
bll_OA_StaffBLL = new OA_StaffBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
GetCheckedHtml();
|
InitialData();
|
}
|
}
|
|
public void GetCheckedHtml()
|
{
|
Model.OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_OA_Staff != null)
|
{
|
CheckedHtml = "-";
|
string[] MangeCountryS = m_OA_Staff.ManageCountry.Trim(',').Split(',');
|
foreach (var item in MangeCountryS)
|
{
|
CheckedHtml += (item + "-");
|
}
|
string[] MangeCountryS1 = m_OA_Staff.ManageCountry1.Trim(',').Split(',');
|
foreach (var item in MangeCountryS1)
|
{
|
CheckedHtml += (item + "-");
|
}
|
}
|
}
|
|
//获取遍历结果
|
public void InitialData()
|
{
|
|
treeHtml = "{GetMenuRoleId:'0', id: 99999, parentId: 900009, name: '全国', open: true },";
|
|
List<Sys_CitySite> m_ProvinceList = bll_Sys_CitySiteBLL.SelectAllNextModel(0, 0, 1) as List<Sys_CitySite>;
|
foreach (var m_Province in m_ProvinceList)
|
{
|
treeHtml = treeHtml + "{GetMenuRoleId:'0', id: " + m_Province.Keyid + ", parentId: 99999, name: '" + m_Province.Name + "' },";
|
|
List<Sys_CitySite> m_CityList = bll_Sys_CitySiteBLL.SelectAllNextModel(m_Province.Keyid, 0, 2) as List<Sys_CitySite>;
|
foreach (var m_City in m_CityList)
|
{
|
treeHtml = treeHtml + "{GetMenuRoleId:'0', id: " + m_City.Keyid + ", parentId: " + m_City.ProvinceId + ", name: '" + m_City.Name + "' },";
|
|
List<Sys_CitySite> m_CountryList = bll_Sys_CitySiteBLL.SelectAllNextModel(m_Province.Keyid, m_City.Keyid, 3) as List<Sys_CitySite>;
|
foreach (var m_Country in m_CountryList)
|
{
|
treeHtml = treeHtml + "{GetMenuRoleId:'" + m_Province.Keyid + "-" + m_City.Keyid + "-" + m_Country.Keyid + "-', id: " + m_Country.Keyid + ", parentId: " + m_Country.CityId + ", name: '" + m_Country.Name + "' },";
|
}
|
}
|
}
|
treeHtml = treeHtml.Trim(',');
|
}
|
|
//保存角色权限
|
protected void btn_SaveRole_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
string Roles = Request["hideRoles"].ToString2();
|
string[] RolesArry = Roles.Split(',');
|
Dictionary<string, string> MenusJionRole = new Dictionary<string, string>();
|
string Province = ",";
|
string City = ",";
|
string Country = ",";
|
string Country1 = ",";
|
int i = 0;
|
foreach (var itemRole in RolesArry)
|
{
|
string MenuAll = itemRole.Trim('-');
|
string[] MenuAllArry = MenuAll.Split('-');
|
if (Province.IndexOf(("," + MenuAllArry[0] + ",")) < 0)
|
Province += (MenuAllArry[0] + ",");
|
if (City.IndexOf(("," + MenuAllArry[1] + ",")) < 0)
|
City += (MenuAllArry[1] + ",");
|
if (Country.Length < 7800)
|
{
|
Country += (MenuAllArry[2] + ",");
|
}
|
else
|
{
|
Country1 += (MenuAllArry[2] + ",");
|
}
|
i++;
|
}
|
Province = Province.Trim(',');
|
City = City.Trim(',');
|
Country = Country.Trim(',');
|
Model.OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
m_OA_Staff.ManageProvince = Province;
|
m_OA_Staff.ManageCity = City;
|
m_OA_Staff.ManageCountry = Country;
|
m_OA_Staff.ManageCountry1 = Country1;
|
|
bool result = bll_OA_StaffBLL.UpdateModel(m_OA_Staff);
|
if (result)
|
{
|
InitialData();
|
JavaScript.MessageBox("保存成功", this, true, true);
|
}
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
}
|
}
|