private DistributionOEMUserCondition getCondition() { var parameter = new DistributionOEMUserCondition(); parameter.CompanyId = this.CurrentCompany.CompanyId; if (!string.IsNullOrWhiteSpace(this.txtBeginTime.Text)) { parameter.RegisterBeginTime = DateTime.Parse(this.txtBeginTime.Text); } if (!string.IsNullOrWhiteSpace(this.txtEndTime.Text)) { parameter.RegisterEndTime = DateTime.Parse(this.txtEndTime.Text).AddDays(1).AddMilliseconds(-3); } if (!string.IsNullOrWhiteSpace(this.txtUserNo.Text)) { parameter.UserNo = this.txtUserNo.Text.Trim(); } if (!string.IsNullOrWhiteSpace(this.ddlStatus.Text)) { parameter.Enable = this.ddlStatus.Text == "1"; } if (!string.IsNullOrWhiteSpace(this.txtAbbreviateName.Text)) { parameter.AbbreviateName = txtAbbreviateName.Text.Trim(); } if (!string.IsNullOrWhiteSpace(this.txtContactName.Text)) { parameter.ContactName = this.txtContactName.Text.Trim(); } if (!string.IsNullOrWhiteSpace(this.ddlIncomeGroup.SelectedValue)) { parameter.IncomeGroup = Guid.Parse(this.ddlIncomeGroup.SelectedValue); } return(parameter); }
public object QueryDistrutionUserList(Pagination pagination, DistributionOEMUserCondition condition) { condition.CompanyId = this.CurrentCompany.CompanyId; condition.IsOwnerAll = false; if (condition.RegisterEndTime.HasValue) { condition.RegisterEndTime = condition.RegisterEndTime.Value.AddDays(1).AddMilliseconds(-3); } var distributionOemUser = from item in DistributionOEMService.QueryDistributionOEMUserList(condition, pagination) select new { RegisterTime = item.RegisterTime, Login = item.Login, AbbreviateName = item.AbbreviateName, IncomeGroupName = item.IncomeGroupName, IncomeGroupId = item.IncomeGroupId, CompanyId = item.CompanyId }; return(new { Pagination = pagination, UserList = distributionOemUser }); }
public IEnumerable <DistributionOEMUserListView> QueryDistributionOEMUserList(DistributionOEMUserCondition condition, Pagination pagination) { var result = new List <DistributionOEMUserListView>(); using (DbOperator dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("@i_Owner", condition.CompanyId); if (condition.IsOwnerAll.HasValue) { dbOperator.AddParameter("@i_IsOwnerAll", condition.IsOwnerAll); } else { dbOperator.AddParameter("@i_IsOwnerAll", true); } dbOperator.AddParameter("@i_RegisterBeginTime", condition.RegisterBeginTime.HasValue ? condition.RegisterBeginTime.Value : (DateTime?)null); dbOperator.AddParameter("@i_RegisterEndTime", condition.RegisterEndTime.HasValue ? condition.RegisterEndTime.Value : (DateTime?)null); if (!string.IsNullOrWhiteSpace(condition.UserNo)) { dbOperator.AddParameter("@i_UserNo", condition.UserNo); } if (condition.Enable.HasValue) { dbOperator.AddParameter("@i_Enable", condition.Enable); } if (!string.IsNullOrWhiteSpace(condition.ContactName)) { dbOperator.AddParameter("@i_Contact", condition.ContactName); } if (condition.IncomeGroup.HasValue) { dbOperator.AddParameter("@i_IncomeGroup", condition.IncomeGroup); } if (!string.IsNullOrWhiteSpace(condition.AbbreviateName)) { dbOperator.AddParameter("@i_AbbreviateName", condition.AbbreviateName); } if (pagination != null) { dbOperator.AddParameter("@i_pageSize", pagination.PageSize); dbOperator.AddParameter("@i_pageIndex", pagination.PageIndex); } System.Data.Common.DbParameter totalCount = dbOperator.AddParameter("@o_RowCount"); totalCount.DbType = System.Data.DbType.Int32; totalCount.Direction = System.Data.ParameterDirection.Output; using (var reader = dbOperator.ExecuteReader("[dbo].[P_DistributionUserListPagination]", System.Data.CommandType.StoredProcedure)) { while (reader.Read()) { var user = new DistributionOEMUserListView(); user.RegisterTime = reader.GetDateTime(0); user.AbbreviateName = reader.GetString(1); user.Type = (CompanyType)reader.GetInt32(2); user.AccountType = (AccountBaseType)reader.GetInt32(3); user.ContactName = reader.GetString(4); user.CompanyId = reader.GetGuid(5); user.Enabled = reader.GetBoolean(6); user.Login = reader.GetString(7); user.IncomeGroupName = reader.IsDBNull(8) ? string.Empty : reader.GetString(8); if (!reader.IsDBNull(9)) { user.IncomeGroupId = reader.GetGuid(9); } result.Add(user); } } if (pagination != null && pagination.GetRowCount) { pagination.RowCount = (int)totalCount.Value; } } return(result); }
/// <summary> /// 查询某个OEM下的用户 /// </summary> /// <param name="condition">查询条件</param> /// <param name="pagination">分页信息</param> public static IEnumerable <DistributionOEMUserListView> QueryDistributionOEMUserList(DistributionOEMUserCondition condition, Pagination pagination) { var repository = Factory.CreateDistributionOEMRepository(); return(repository.QueryDistributionOEMUserList(condition, pagination)); }