using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Web; using SuperMap.RealEstate.CoreFrameWork; using SuperMap.RealEstate.CoreFrameWork.Dictionary.Business; using Business = SuperMap.RealEstate.HighWay.Storage.Business; using HZQR.Common; namespace SuperMap.RealEstate.Personnel.Modules.Department { public partial class BasePage : SuperMap.RealEstate.Web.UI.PageValid { protected string _PROVINCE_ID = Business.CommonHelper.GetConfigValue("UmiformCommodity").Split('|')[2]; protected string _PROVINCE_CODE = Business.CommonHelper.GetConfigValue("PROVINCE_CODE"); /// /// 省份编码 /// public string GoodsProvinceCode { get; set; } /// /// 用户业主单位 /// public string UserProvinceUnit { get; set; } /// /// 统一定价服务区 /// public string WholeServerpartID { get; set; } protected override void OnInit(EventArgs e) { GoodsProvinceCode = ""; WholeServerpartID = Business.CommonHelper.GetConfigValue("UmiformCommodity").Split('|')[0]; try { if (string.IsNullOrWhiteSpace(PassportInfo.ProvinceCode)) { DataTable UserTable = new FrameWork.Business.User(Transaction).ExecuteDataTable( "SELECT USER_MOBILEPHONE,USER_PROVINCE,PROVINCE_UNIT FROM T_USER WHERE User_ID = " + PassportInfo.ID); if (UserTable.Rows.Count > 0) { PassportInfo.ProvinceUnit = UserTable.Rows[0]["PROVINCE_UNIT"].ToString(); PassportInfo.UserMobilephone = UserTable.Rows[0]["USER_MOBILEPHONE"].ToString(); PassportInfo.ProvinceCode = UserTable.Rows[0]["USER_PROVINCE"].ToString(); } } if (!string.IsNullOrWhiteSpace(Request["PROVINCE_CODE"])) { if (Request["PROVINCE_CODE"] != _PROVINCE_ID.ToEncrypt()) { GoodsProvinceCode = Business.CommonHelper.GetProvinceCode(Request["PROVINCE_CODE"].ToDecryptInt32(), Transaction); } Business.SERVERPART _TSERVERPART = new Business.SERVERPART(Transaction); _TSERVERPART.AddSearchParameter("STATISTIC_TYPE", "4000"); _TSERVERPART.AddSearchParameter("PROVINCE_CODE", Request["PROVINCE_CODE"].ToDecrypt()); if (_TSERVERPART.Search()) { WholeServerpartID = _TSERVERPART.KeyID; } } else if (!string.IsNullOrWhiteSpace(Request["SERVERPART_ID"]) && !Request["SERVERPART_ID"].ToDecrypt().Contains(",")) { Business.SERVERPART _SERVERPART = new Business.SERVERPART(Transaction); _SERVERPART.SERVERPART_ID_Encrypt = Request["SERVERPART_ID"]; if (_SERVERPART.Select()) { Business.SERVERPART _TSERVERPART = new Business.SERVERPART(Transaction); _TSERVERPART.AddSearchParameter("STATISTIC_TYPE", "4000"); _TSERVERPART.AddSearchParameter("PROVINCE_CODE", _SERVERPART.PROVINCE_CODE); if (_TSERVERPART.Search()) { WholeServerpartID = _TSERVERPART.KeyID; } if (_SERVERPART.PROVINCE_CODE.ToString() != _PROVINCE_ID.ToEncrypt()) { GoodsProvinceCode = Business.CommonHelper.GetProvinceCode(_SERVERPART.PROVINCE_CODE, Transaction); } } } else { GoodsProvinceCode = PassportInfo.ProvinceCode; FieldEnum _FieldEnum = DictionaryHelper.GetFieldEnum("DIVISION_CODE", GoodsProvinceCode, Transaction); if (_FieldEnum.PropertyObject != null && _FieldEnum.FieldEnum_ID != null) { Business.SERVERPART _TSERVERPART = new Business.SERVERPART(Transaction); _TSERVERPART.AddSearchParameter("STATISTIC_TYPE", "4000"); _TSERVERPART.AddSearchParameter("PROVINCE_CODE", _FieldEnum.FieldEnum_ID); if (_TSERVERPART.Search()) { WholeServerpartID = _TSERVERPART.KeyID; } } } if (!string.IsNullOrWhiteSpace(GoodsProvinceCode) && GoodsProvinceCode != _PROVINCE_CODE) { GoodsProvinceCode = GoodsProvinceCode; } else { GoodsProvinceCode = ""; } UserProvinceUnit = GetOwnerUnit(PassportInfo.ProvinceUnit); } catch { } base.OnInit(e); } public string GetOwnerUnit(string _UserProvinceUnit) { //如果业主单位为空,则取配置中的业主单位 if (string.IsNullOrEmpty(_UserProvinceUnit)) { string _bReportTitle = ""; try { _bReportTitle = ConfigurationManager.AppSettings["bReportTiTle"].TryParseToString(); if (_bReportTitle.Contains("|") || _bReportTitle.Contains(",")) { string[] _str = _bReportTitle.Split(','); for (int i = 0; i < _str.Length; i++) { string strProvince = _str[i]; if (strProvince.Contains(GoodsProvinceCode)) { _UserProvinceUnit = strProvince.Split('|')[0]; } } } else { _UserProvinceUnit = _bReportTitle.Split('|')[0]; } } catch (Exception ex) { LogUtil.WriteLog(ex, "获取配置bReportTiTle异常", DateTime.Now.ToString("yyyyMMddHHmmss_") + "Ex"); } try { if (string.IsNullOrEmpty(_bReportTitle)) { _UserProvinceUnit = ConfigurationManager.AppSettings["bCompanyName"].TryParseToString(); } } catch (Exception ex) { LogUtil.WriteLog(ex, "获取配置bCompanyName异常", DateTime.Now.ToString("yyyyMMddHHmmss_") + "Ex"); } } return _UserProvinceUnit; } } }