private void BindCompanyInfo(DistribtionOEMUserCompanyDetailInfo info) { this.ddlIncomeGroup.DataSource = IncomeGroupService.QueryIncomeGroup(this.CurrentCompany.CompanyId, null); this.ddlIncomeGroup.DataTextField = "Name"; this.ddlIncomeGroup.DataValueField = "Id"; this.ddlIncomeGroup.DataBind(); this.ddlIncomeGroup.Items.Insert(0, new ListItem("-请选择-", "")); string incomeGroupId = Request.QueryString["IncomeGroupId"]; if (info.IncomeGroupId.HasValue) { this.ddlIncomeGroup.SelectedValue = info.IncomeGroupId.Value.ToString(); } this.lblAccountNo.Text = info.UserName; this.lblCompanyType.Text = info.CompanyType.GetDescription() + "(" + info.AccountType.GetDescription() + ")"; this.hfldAddressCode.Value = AddressShow.GetAddressJson(info.Area, info.Province, info.City, info.District); this.txtAddress.Text = info.Address; this.txtPostCode.Text = info.ZipCode; this.txtCompanyPhone.Text = info.OfficePhones; this.txtFaxes.Text = info.Faxes; this.txtLinkman.Text = info.Contact; this.txtLinkManPhone.Text = info.ContactPhone; this.txtEmail.Text = info.ContactEmail; this.txtQQ.Text = info.ContactQQ; BindEnterprise(info); }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); if (!IsPostBack) { string companyId = Request.QueryString["CompanyId"]; string incomeGroupId = Request.QueryString["IncomeGroupId"]; string strAccountType = Request.QueryString["AccountType"]; if (!string.IsNullOrWhiteSpace(companyId)) { this.addGroup.HRef = "IncomeGroupAdd.aspx?CompanyId=" + companyId + "&IncomeGroupId=" + incomeGroupId + "&AccountType=" + strAccountType; DistribtionOEMUserCompanyDetailInfo info = DistributionOEMService.QueryDistributionOEMUserDetailInfo(Guid.Parse(companyId)); if (info != null) { BindCompanyInfo(info); } } } }
public DistribtionOEMUserCompanyDetailInfo QueryDistributionOEMUserDetail(Guid companyId) { string sql = @"SELECT Com.Id,[Type],AccountType,Com.Name,AbbreviateName,Com.[Address],Com.[Enabled],Audited,OrginationCode, OfficePhones,Faxes,RegisterTime,AuditTime,EffectTime,Com.LastLoginTime,Manager,Contact,EmergencyContact, IsVip,IsOem,Area,OperatorAccount,IsOpenExternalInterface, Emp.LastLoginIP,Emp.LastLoginLocation,Emp.[Login] as UserName,Emp.[Password] as UserPassword, Manager.Cellphone,Manager.Email,Manager.MSN,Manager.Name,Manager.QQ, EmC.OfficePhone,EmC.Cellphone,EmC.Name, Contact.Name,Contact.OfficePhone,Contact.Cellphone,Contact.Email,Contact.MSN,Contact.QQ, Contact.CertNo, Addr.Avenue,Addr.City,Addr.District,Addr.Province,Addr.ZipCode,Emp.LastLoginTime, CP.ValidityStart,CP.ValidityEnd,Com.IsOem,TIncome.Name,TIncome.Id FROM T_Company Com LEFT JOIN dbo.T_IncomeGroupRelation TRel ON TRel.Company =Com.Id LEFT JOIN dbo.T_IncomeGroup TIncome ON TRel.IncomeGroup = TIncome.Id LEFT JOIN T_Employee Emp on Emp.IsAdministrator = 1 and Com.Id = Emp.[Owner] LEFT JOIN T_Contact Manager on Com.Manager = Manager.Id LEFT JOIN T_Contact EmC on Com.EmergencyContact = EmC.Id LEFT JOIN T_Contact Contact on Com.Contact = Contact.Id LEFT JOIN T_Address Addr on Com.[Address] = Addr.Id LEFT JOIN T_CompanyParameter CP on Com.Id = CP.Company WHERE Com.Id = @CompanyId"; DistribtionOEMUserCompanyDetailInfo result = null; using (var dbOpeator = new DbOperator(Provider, ConnectionString)) { dbOpeator.AddParameter("CompanyId", companyId); using (DbDataReader reader = dbOpeator.ExecuteReader(sql)) { if (reader.Read()) { result = new DistribtionOEMUserCompanyDetailInfo { CompanyId = reader.GetGuid(0), CompanyType = (CompanyType)reader.GetInt32(1), AccountType = (AccountBaseType)reader.GetInt32(2), CompanyName = reader.GetString(3), AbbreviateName = reader.GetString(4), Enabled = reader.GetBoolean(6), Audited = reader.GetBoolean(7), RegisterTime = reader.GetDateTime(11), IsOpenExternalInterface = reader.GetBoolean(22), Contact = reader.IsDBNull(35) ? string.Empty : reader.GetString(35), ContactPhone = reader.IsDBNull(37) ? string.Empty : reader.GetString(37), ContactEmail = reader.IsDBNull(38) ? string.Empty : reader.GetString(38), ContactMSN = reader.IsDBNull(39) ? string.Empty : reader.GetString(39), ContactQQ = reader.IsDBNull(40) ? String.Empty : reader.GetString(40), CertNo = reader.IsDBNull(41) ? string.Empty : reader.GetString(41), EmergencyCall = reader.IsDBNull(33) ? string.Empty : reader.GetString(33), EmergencyContact = reader.IsDBNull(34) ? string.Empty : reader.GetString(34), ManagerCellphone = reader.IsDBNull(27) ? string.Empty : reader.GetString(27), ManagerEmail = reader.IsDBNull(28) ? string.Empty : reader.GetString(28), ManagerMsn = reader.IsDBNull(29) ? string.Empty : reader.GetString(29), ManagerName = reader.IsDBNull(30) ? string.Empty : reader.GetString(30), ManagerQQ = reader.IsDBNull(31) ? string.Empty : reader.GetString(31), UserName = reader.GetString(25), UserPassword = reader.GetString(26), OperatorAccount = reader.IsDBNull(21) ? string.Empty : reader.GetString(21) }; result.Faxes = reader.IsDBNull(10) ? string.Empty : reader.GetString(10); result.OrginationCode = reader.IsDBNull(8) ? string.Empty : reader.GetString(8); if (!reader.IsDBNull(12)) { result.AuditTime = reader.GetDateTime(12); } result.Address = reader.IsDBNull(42) ? string.Empty : reader.GetString(42); result.City = reader.IsDBNull(43) ? string.Empty : reader.GetString(43); result.District = reader.IsDBNull(44) ? string.Empty : reader.GetString(44); result.Province = reader.IsDBNull(45) ? string.Empty : reader.GetString(45); result.ZipCode = reader.IsDBNull(46) ? string.Empty : reader.GetString(46); if (!reader.IsDBNull(23)) { result.LastLoginIP = reader.GetString(23); } if (!reader.IsDBNull(24)) { result.LastLoginLocation = reader.GetString(24); } if (!reader.IsDBNull(47)) { result.LastLoginTime = reader.GetDateTime(47); } if (!reader.IsDBNull(48)) { result.PeriodStartOfUse = reader.GetDateTime(48); } if (!reader.IsDBNull(49)) { result.PeriodEndOfUse = reader.GetDateTime(49); } result.OfficePhones = reader.IsDBNull(9) ? string.Empty : reader.GetString(9); if (!reader.IsDBNull(12)) { result.AuditTime = reader.GetDateTime(12); } if (!reader.IsDBNull(14)) { result.LastLoginTime = reader.GetDateTime(14); } result.Area = reader.IsDBNull(20) ? string.Empty : reader.GetString(20); result.IsOem = reader.GetBoolean(50); if (!reader.IsDBNull(51)) { result.IncomeGroupName = reader.GetString(51); } if (!reader.IsDBNull(52)) { result.IncomeGroupId = reader.GetGuid(52); } } } } return(result); }