예제 #1
0
        public IEnumerable<User> SearchUserPaged(UserSearchJsonPatch json, PagingInfo pageInfo)
        {
            if (json == null || pageInfo == null)
                throw new ArgumentNullException(" json or pageInfo is null ");

            IList<Core.Business.User> userlist = new List<Core.Business.User>();

            SqlServerUtility sql = new SqlServerUtility();
            if (!string.IsNullOrEmpty(json.RealName))
            {
                sql.AddParameter("@realname", SqlDbType.NVarChar, json.RealName);
            }

            if (!string.IsNullOrEmpty(json.Name))
            {
                sql.AddParameter("@name", SqlDbType.NVarChar, json.Name);
            }

            if (json.Gender != null)
            {
                if (json.Gender.Value == 1)
                {
                    sql.AddParameter("@gender", SqlDbType.NVarChar, "��");
                }
                else
                {
                    sql.AddParameter("@gender", SqlDbType.NVarChar, "Ů");
                }
            }

            if (json.PostRank != null && json.PostRank.Value != Guid.Empty)
            {
                sql.AddParameter("@postrank", SqlDbType.UniqueIdentifier, json.PostRank.Value);
            }
            if (json.Education != null && json.Education.Value != Guid.Empty)
            {
                sql.AddParameter("@educaion", SqlDbType.UniqueIdentifier, json.Education);
            }
            if (json.StartAge != null)
            {
                sql.AddParameter("@startage", SqlDbType.Int, json.StartAge.Value);
            }
            if (json.EndAge != null)
            {
                sql.AddParameter("@endage", SqlDbType.Int, json.EndAge.Value);
            }
            if (json.IsPhone != null)
            {
                sql.AddParameter("@isphone", SqlDbType.Bit, json.IsPhone);
            }
            if (!string.IsNullOrEmpty(json.Phone))
            {
                sql.AddParameter("@phone", SqlDbType.NVarChar, json.Phone);
            }
            if (json.IsMobile != null)
            {
                sql.AddParameter("@ismobile", SqlDbType.Bit, json.IsMobile.Value);
            }
            if (!string.IsNullOrEmpty(json.Mobile))
            {
                sql.AddParameter("@name", SqlDbType.NVarChar, json.Mobile);
            }
            if (json.IsEmail != null)
            {
                sql.AddParameter("@isemail", SqlDbType.Bit, json.IsEmail.Value);
            }
            if (!string.IsNullOrEmpty(json.Email))
            {
                sql.AddParameter("@email", SqlDbType.NVarChar, json.Email);
            }

            if (json.UserType != null)
            {
                sql.AddParameter("@name", SqlDbType.Int, json.UserType.Value);
            }

            if (json.Unit != null)
            {
                sql.AddParameter("@unit", SqlDbType.UniqueIdentifier, json.Unit.Value);
            }

            if (!string.IsNullOrEmpty(json.Department))
            {
                sql.AddParameter("@department", SqlDbType.NVarChar, json.Department);
            }
            if (json.StartRegisterTime != null && json.StartRegisterTime.Value > DateTime.MinValue)
            {
                sql.AddParameter("@startregistertime", SqlDbType.DateTime, json.StartRegisterTime.Value);
            }
            if (json.EndRegisterTime != null && json.EndRegisterTime.Value > DateTime.MinValue && json.EndRegisterTime.Value >= json.StartRegisterTime.Value)
            {
                sql.AddParameter("@endregistertime", SqlDbType.DateTime, json.EndRegisterTime.Value);
            }
            if (json.Status != null)
            {
                sql.AddParameter("@status", SqlDbType.Int, json.Status.Value);
            }

            int lowband = (pageInfo.CurrentPage - 1) * pageInfo.PageSize;

            int highband = pageInfo.CurrentPage * pageInfo.PageSize;

            sql.AddParameter("@lowban", SqlDbType.Int, lowband);
            sql.AddParameter("@highban", SqlDbType.Int, highband);

            SqlDataReader reader = sql.ExecuteSPReader("usp_SearchUserPaged");

            if (reader != null)
            {
                while (reader.Read() && !reader.IsClosed)
                {
                    Core.Business.User user = new Core.Business.User();

                    if (!reader.IsDBNull(0)) user.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) user.UserID = reader.GetString(1);
                    if (!reader.IsDBNull(2)) user.PostRankID = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) user.EducationID = reader.GetGuid(3);
                    if (!reader.IsDBNull(4)) user.PicURL = reader.GetString(4);
                    if (!reader.IsDBNull(5)) user.Name = reader.GetString(5);
                    if (!reader.IsDBNull(6)) user.Password = reader.GetString(6);
                    if (!reader.IsDBNull(7)) user.Gender = reader.GetString(7);
                    if (!reader.IsDBNull(8)) user.BirthDate = reader.GetDateTime(8);
                    if (!reader.IsDBNull(9)) user.Address = reader.GetString(9);
                    if (!reader.IsDBNull(10)) user.Mailcode = reader.GetString(10);
                    if (!reader.IsDBNull(11)) user.Fax = reader.GetString(11);
                    if (!reader.IsDBNull(12)) user.Phone = reader.GetString(12);
                    if (!reader.IsDBNull(13)) user.MobilePhone = reader.GetString(13);
                    if (!reader.IsDBNull(14)) user.Email = reader.GetString(14);
                    if (!reader.IsDBNull(15)) user.Specialty = reader.GetString(15);
                    if (!reader.IsDBNull(16)) user.Resume = reader.GetString(16);
                    if (!reader.IsDBNull(17)) user.Remark = reader.GetString(17);
                    if (!reader.IsDBNull(18)) user.UnitID = reader.GetGuid(18);
                    if (!reader.IsDBNull(19)) user.UserType = reader.GetInt32(19);
                    if (!reader.IsDBNull(20)) user.Discourse = reader.GetString(20);
                    if (!reader.IsDBNull(21)) user.Acquire = reader.GetString(21);
                    if (!reader.IsDBNull(22)) user.RegDate = reader.GetDateTime(22);
                    if (!reader.IsDBNull(23)) user.LastActiveTime = reader.GetDateTime(23);
                    if (!reader.IsDBNull(24)) user.Status = reader.GetInt32(24);
                    if (!reader.IsDBNull(25)) user.Unit = reader.GetString(25);
                    if (!reader.IsDBNull(26)) user.Duty = reader.GetString(26);
                    if (!reader.IsDBNull(27)) user.FeildID = reader.GetGuid(27);

                    user.MarkOld();
                    userlist.Add(user);
                }
                reader.Close();
            }
            return userlist;
        }
예제 #2
0
        public List<UnitInfo> SelectUnitinfoBySearchConditionPageInfo(string name, string province, int subject, string code, int flag, int state, Guid type, PagingInfo paginginfo)
        {
            List<UnitInfo> units = new List<UnitInfo>();

            #region Init Filter

            StringBuilder sbFilter = new StringBuilder();
            int pageNum = default(int);
            int pageSize = default(int);

            sbFilter.Append(" 1=1 ");

            if (!string.IsNullOrEmpty(name))
            {
                sbFilter.Append(" and UnitName like '%");
                sbFilter.Append(name.Replace("'", "").Replace("\"", ""));
                sbFilter.Append("%'");
            }
            if (CY.Utility.Common.StringHelper.IsGuid(province))
            {
                if ((new Guid(province)) != System.Guid.Empty)
                {
                    sbFilter.Append(" and ProvinceId ='");
                    sbFilter.Append(province.ToString());
                    sbFilter.Append("'");
                }

            }
            if (subject > 0 && subject < 3)
            {
                sbFilter.Append(" and Subjection=");
                sbFilter.Append(subject.ToString());
            }

            if (!string.IsNullOrEmpty(code))
            {
                sbFilter.Append(" and WordCode  like '");
                sbFilter.Append(province.ToString());
                sbFilter.Append("'");
            }

            if (flag > 0 && flag < 3)
            {
                sbFilter.Append(" and IsCooperantUnit =");
                sbFilter.Append(flag.ToString());
            }

            if (state > 0 && state < 3)
            {
                sbFilter.Append(" and AuditingState =");
                sbFilter.Append(state.ToString());
            }
            if (type != System.Guid.Empty)
            {
                sbFilter.Append(" AND UnitType= '");
                sbFilter.Append(type.ToString());
                sbFilter.Append("'");
            }

            if (paginginfo != null)
            {
                if (paginginfo.CurrentPage > 0)
                {
                    pageNum = paginginfo.CurrentPage;
                }
                else
                {
                    pageNum = 1;
                }

                if (paginginfo.PageSize > 0)
                {
                    pageSize = paginginfo.PageSize;
                }
                else
                {
                    pageSize = int.MaxValue;
                }
            }

            #endregion

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Tables", SqlDbType.VarChar, "UnitInfo");
            sql.AddParameter("@PK", SqlDbType.VarChar, "Id");
            sql.AddParameter("@Fields", SqlDbType.VarChar, "Id");
            sql.AddParameter("@Filter", SqlDbType.VarChar, sbFilter.ToString());
            sql.AddParameter("@PageNumber", SqlDbType.Int, pageNum);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageSize);

            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            System.Guid id = System.Guid.Empty;
            UnitInfo unit = null;
            if (reader != null && !reader.IsClosed)
            {

                while (reader.Read())
                {
                    if (!reader.IsDBNull(0)) id = reader.GetGuid(0);
                    if (id != System.Guid.Empty)
                    {
                        unit = CY.CSTS.Core.Business.UnitInfo.Load(id);
                        if (unit != null)
                        {
                            units.Add(unit);
                        }
                    }
                }
                reader.Close();
            }

            return units;
        }
예제 #3
0
        public IEnumerable<NewsContent> Search(NewsSearchJson json, PagingInfo pageInfo)
        {
            if (json == null || pageInfo == null)
                throw new ArgumentNullException("the json or pageinfo is null ");

            IList<Core.Business.NewsContent> newsContentlist = new List<Core.Business.NewsContent>();

            SqlServerUtility sql = new SqlServerUtility();

            if (!string.IsNullOrEmpty(json.Title))
            {

                sql.AddParameter("@title", SqlDbType.NVarChar, json.Title);
            }

            if (json.PublishStartTime != null && json.PublishStartTime.Value > DateTime.MinValue)
            {
                sql.AddParameter("@publishstartdate", SqlDbType.DateTime, json.PublishStartTime.Value);
            }

            if (json.PublishEndTime != null && json.PublishEndTime.Value > DateTime.MinValue)
            {
                sql.AddParameter("@publishenddate", SqlDbType.DateTime, json.PublishEndTime.Value);
            }

            if (json.CheckStartTime != null && json.CheckStartTime.Value > DateTime.MinValue)
            {
                sql.AddParameter("@checkstartdate", SqlDbType.DateTime, json.CheckStartTime.Value);
            }

            if (json.CheckEndTime != null && json.CheckEndTime.Value > DateTime.MinValue)
            {
                sql.AddParameter("@checkenddate", SqlDbType.DateTime, json.CheckEndTime.Value);
            }

            if (!string.IsNullOrEmpty(json.Tag))
            {
                sql.AddParameter("@tag", SqlDbType.NVarChar, json.Tag);
            }

            if (!string.IsNullOrEmpty(json.Source))
            {
                sql.AddParameter("@source", SqlDbType.NVarChar, json.Source);
            }

            if (!string.IsNullOrEmpty(json.Author))
            {
                sql.AddParameter("@author", SqlDbType.NVarChar, json.Author);
            }

            if (!string.IsNullOrEmpty(json.Checker))
            {
                sql.AddParameter("@checker", SqlDbType.NVarChar, json.Checker);
            }

            if (json.StartTraffic != null && json.StartTraffic >= 0)
            {
                sql.AddParameter("@starttraffic", SqlDbType.Int, json.StartTraffic.Value);
            }

            if (json.EndTraffic != null && json.EndTraffic >= 0)
            {
                sql.AddParameter("@endtraffic", SqlDbType.Int, json.EndTraffic.Value);
            }

            if (json.Module != null && json.Module.Value != Guid.Empty)
            {
                sql.AddParameter("@moduleid", SqlDbType.UniqueIdentifier, json.Module.Value);
            }
            if (json.Unit != null && json.Unit.Value != Guid.Empty)
            {
                sql.AddParameter("@unit", SqlDbType.UniqueIdentifier, json.Unit.Value);
            }

            if (json.IsCenter != null)
            {
                sql.AddParameter("@center", SqlDbType.Int, json.IsCenter.Value);
            }

            int lowBand = (pageInfo.CurrentPage - 1) * pageInfo.PageSize;

            int highBand = pageInfo.CurrentPage * pageInfo.PageSize;

            sql.AddParameter("@lowBand", SqlDbType.Int, lowBand);

            sql.AddParameter("@highBand", SqlDbType.Int, highBand);

            SqlDataReader reader = sql.ExecuteSPReader("usp_SearchNew");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.NewsContent newsContent = new Core.Business.NewsContent();

                    if (!reader.IsDBNull(0)) newsContent.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) newsContent.ModuleID = reader.GetGuid(1);
                    if (!reader.IsDBNull(2)) newsContent.Title = reader.GetString(2);
                    if (!reader.IsDBNull(3)) newsContent.Content = reader.GetString(3);
                    if (!reader.IsDBNull(4)) newsContent.PublishTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) newsContent.Tag = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) newsContent.Annex = reader.GetInt32(6);
                    if (!reader.IsDBNull(7)) newsContent.Status = reader.GetInt32(7);
                    if (!reader.IsDBNull(8)) newsContent.Source = reader.GetString(8);
                    if (!reader.IsDBNull(9)) newsContent.Author = reader.GetString(9);
                    if (!reader.IsDBNull(10)) newsContent.Checker = reader.GetString(10);
                    if (!reader.IsDBNull(11)) newsContent.CheckTime = reader.GetDateTime(11);
                    if (!reader.IsDBNull(12)) newsContent.Index = reader.GetInt32(12);
                    if (!reader.IsDBNull(13)) newsContent.Traffic = reader.GetInt64(13);
                    if (!reader.IsDBNull(14)) newsContent.SortTime = reader.GetDateTime(14);
                    if (!reader.IsDBNull(15)) newsContent.ModuleName = reader.GetString(15);
                    if (!reader.IsDBNull(16)) newsContent.CenterId = reader.GetGuid(16);
                    if (!reader.IsDBNull(17)) newsContent.CenterName = reader.GetString(17);

                    newsContent.MarkOld();

                    newsContentlist.Add(newsContent);
                }
                reader.Close();
            }
            return newsContentlist;
        }
예제 #4
0
        public IEnumerable<UnitInfo> SearchUnitPaged(UnitSearchJsonPatch json, PagingInfo pageInfo)
        {
            try
            {
                if (json == null || pageInfo == null)
                    throw new ArgumentException("json or pageinfo is null ");

                IList<Core.Business.UnitInfo> unitInfolist = new List<Core.Business.UnitInfo>();
                SqlServerUtility sql = new SqlServerUtility();

                if (!string.IsNullOrEmpty(json.Name))
                {
                    sql.AddParameter("@name", SqlDbType.NVarChar, json.Name);
                }
                if (!string.IsNullOrEmpty(json.Alias))
                {
                    sql.AddParameter("@alias", SqlDbType.NVarChar, json.Alias);
                }
                if (json.Province != null)
                {
                    sql.AddParameter("@province", SqlDbType.UniqueIdentifier, json.Province.Value);
                }
                if (json.City != null)
                {
                    sql.AddParameter("@city", SqlDbType.UniqueIdentifier, json.City.Value);
                }
                if (json.IsCorp != null)
                {
                    sql.AddParameter("@iscorp", SqlDbType.Int, json.IsCorp.Value);
                }
                if (json.UnitType != null)
                {
                    sql.AddParameter("@unittype", SqlDbType.UniqueIdentifier, json.UnitType.Value);
                }
                if (json.TradeSort != null)
                {
                    sql.AddParameter("@tradesort", SqlDbType.UniqueIdentifier, json.TradeSort.Value);
                }
                if (json.StartAuditingDate != null)
                {
                    sql.AddParameter("@startauditdate", SqlDbType.DateTime, json.StartAuditingDate.Value);
                }
                if (json.EndAuditingDate != null)
                {
                    sql.AddParameter("@endauditdate", SqlDbType.DateTime, json.EndAuditingDate.Value);
                }
                if (json.State != null)
                {
                    sql.AddParameter("@state", SqlDbType.Int, json.State.Value);
                }

                int lowband = (pageInfo.CurrentPage - 1) * pageInfo.PageSize;

                int highband = pageInfo.CurrentPage * pageInfo.PageSize;

                sql.AddParameter("@lowband", SqlDbType.Int, lowband);

                sql.AddParameter("@highband", SqlDbType.Int, highband);

                SqlDataReader reader = sql.ExecuteSPReader("usp_SelectUnitPaged");

                if (reader != null)
                {
                    while (reader.Read())
                    {
                        Core.Business.UnitInfo unitInfo = new Core.Business.UnitInfo();

                        if (!reader.IsDBNull(0)) unitInfo.Id = reader.GetGuid(0);
                        if (!reader.IsDBNull(1)) unitInfo.UnitName = reader.GetString(1);
                        if (!reader.IsDBNull(2)) unitInfo.Alias = reader.GetString(2);
                        if (!reader.IsDBNull(3)) unitInfo.ProvinceID = reader.GetGuid(3);
                        if (!reader.IsDBNull(4)) unitInfo.CityID = reader.GetGuid(4);
                        if (!reader.IsDBNull(5)) unitInfo.Address = reader.GetString(5);
                        if (!reader.IsDBNull(6)) unitInfo.Postalcode = reader.GetString(6);
                        if (!reader.IsDBNull(7)) unitInfo.Tel = reader.GetString(7);
                        if (!reader.IsDBNull(8)) unitInfo.Fax = reader.GetString(8);
                        if (!reader.IsDBNull(9)) unitInfo.Website = reader.GetString(9);
                        if (!reader.IsDBNull(10)) unitInfo.Email = reader.GetString(10);
                        if (!reader.IsDBNull(11)) unitInfo.UnitType = reader.GetGuid(11);
                        if (!reader.IsDBNull(12)) unitInfo.Ownership = reader.GetString(12);
                        if (!reader.IsDBNull(13)) unitInfo.DrtificialPerson = reader.GetString(13);
                        if (!reader.IsDBNull(14)) unitInfo.DrtificialPersonDutyID = reader.GetGuid(14);
                        if (!reader.IsDBNull(15)) unitInfo.DrtificialPersonTel = reader.GetString(15);
                        if (!reader.IsDBNull(16)) unitInfo.LinkDepartdement = reader.GetString(16);
                        if (!reader.IsDBNull(17)) unitInfo.Linkman = reader.GetString(17);
                        if (!reader.IsDBNull(18)) unitInfo.LinkmanDutyID = reader.GetGuid(18);
                        if (!reader.IsDBNull(19)) unitInfo.LinkmanTel = reader.GetString(19);
                        if (!reader.IsDBNull(20)) unitInfo.ChargeDepartMent = reader.GetString(20);
                        if (!reader.IsDBNull(21)) unitInfo.BankAccountName = reader.GetString(21);
                        if (!reader.IsDBNull(22)) unitInfo.BankName = reader.GetString(22);
                        if (!reader.IsDBNull(23)) unitInfo.BankAccount = reader.GetString(23);
                        if (!reader.IsDBNull(24)) unitInfo.Certificate = reader.GetString(24);
                        if (!reader.IsDBNull(25)) unitInfo.Rel_certificate = reader.GetString(25);
                        if (!reader.IsDBNull(26)) unitInfo.WorkCode = reader.GetString(26);
                        if (!reader.IsDBNull(27)) unitInfo.Synopsis = reader.GetString(27);
                        if (!reader.IsDBNull(28)) unitInfo.InstrumentSection = reader.GetString(28);
                        if (!reader.IsDBNull(29)) unitInfo.VindicatorCount = reader.GetInt32(29);
                        if (!reader.IsDBNull(30)) unitInfo.Subjection = reader.GetInt32(30);
                        if (!reader.IsDBNull(31)) unitInfo.TradeSortID = reader.GetGuid(31);
                        if (!reader.IsDBNull(32)) unitInfo.IsModification = reader.GetInt32(32);
                        if (!reader.IsDBNull(33)) unitInfo.IsCooperantUnit = reader.GetInt32(33);
                        if (!reader.IsDBNull(34)) unitInfo.Operation = reader.GetString(34);
                        if (!reader.IsDBNull(35)) unitInfo.Remark = reader.GetString(35);
                        if (!reader.IsDBNull(36)) unitInfo.InstrumentCount = reader.GetInt32(36);
                        if (!reader.IsDBNull(37)) unitInfo.InfoDutyDepartment = reader.GetString(37);
                        if (!reader.IsDBNull(38)) unitInfo.AuditingState = reader.GetInt32(38);
                        if (!reader.IsDBNull(39)) unitInfo.Assessor = reader.GetString(39);
                        if (!reader.IsDBNull(40)) unitInfo.AuditingDate = reader.GetDateTime(40);
                        if (!reader.IsDBNull(41)) unitInfo.CreatDate = reader.GetDateTime(41);
                        if (!reader.IsDBNull(42)) unitInfo.UpdateDate = reader.GetDateTime(42);
                        if (!reader.IsDBNull(43)) unitInfo.Annex = reader.GetInt32(43);
                        if (!reader.IsDBNull(44)) unitInfo.UnitInWorkPerson = reader.GetGuid(44);
                        if (!reader.IsDBNull(45)) unitInfo.UnitApplicationUserType = reader.GetInt32(45);
                        if (!reader.IsDBNull(46)) unitInfo.Count = reader.GetInt64(46);
                        unitInfo.MarkOld();

                        unitInfolist.Add(unitInfo);
                    }
                    reader.Close();
                }
                return unitInfolist;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }