示例#1
0
        public async Task <List <PersonalDetailEntity> > EntitiesSP(SearchEntity query)
        {
            var result = _context.PersonalDetailEntityListSP
                         .FromSqlRaw($"EXEC GetAllPersonalDetails 5").ToList();

            return(result);
        }
示例#2
0
        // This might be best moved into a different class later on.
        public static List <Product> GetProductsForUser(int userId)
        {
            List <Product> result = new List <Product>();

            SearchEntity search = new SearchEntity();

            search.ColumnsToReturn = new List <string>();
            search.ColumnsToReturn.Add("ProductId");

            search.ConnectionString = Constants.CONNECTION_STRING;

            LacesRepo.Condition userIdCond = new LacesRepo.Condition();
            userIdCond.Column   = "SellerId";
            userIdCond.Operator = LacesRepo.Condition.Operators.EqualTo;
            userIdCond.Value    = Convert.ToString(userId);

            LacesRepo.Condition statusCond = new LacesRepo.Condition();
            statusCond.Column   = "ProductStatusId";
            statusCond.Operator = LacesRepo.Condition.Operators.EqualTo;
            statusCond.Value    = Convert.ToString((int)ProductStatusOptions.Removed);
            statusCond.Invert   = true;

            search.Conditions.Add(userIdCond);
            search.Conditions.Add(statusCond);

            search.SchemaName = Constants.SCHEMA_DEFAULT;
            search.TableName  = Constants.TABLE_PRODUCTS;

            result = new GenericRepository <Product>().Read(search);

            return(result);
        }
示例#3
0
        // This may need revisiting in the future. Currently it does a SELECT * rather than naming specific columns,
        // which is not best practice.
        // Additionally, using generics in the DataObject class is not ideal. This should probably be added to the
        // GenericRepository class.
        public T GetByValue <T>(string column, string value, string tableName, string schemaName)
        {
            T result = default(T);

            SearchEntity search = new SearchEntity();

            search.ConnectionString = Constants.CONNECTION_STRING;

            Condition searchCond = new Condition();

            searchCond.Column   = column;
            searchCond.Operator = Condition.Operators.EqualTo;
            searchCond.Value    = value;

            search.Conditions.Add(searchCond);

            search.PageSizeLimit = 1;
            search.SchemaName    = schemaName;
            search.TableName     = tableName;

            List <T> response = new GenericRepository <T>().Read(search);

            if (response.Count > 0)
            {
                result = response[0];
            }

            return(result);
        }
 public FileResult Generate(SearchEntity searchEntity)
 {
     int num;
     var arrayData = this.GetArrayData(searchEntity, out num);
     var str = "根基对账单";
     using (var stream = System.IO.File.OpenRead(base.Server.MapPath(string.Format("~/Excel/Market/{0}.xls", str))))
     {
         var xlBook = new HSSFWorkbook(stream);
         this.GenerateM1(arrayData, xlBook);
         this.GenerateM2(arrayData, xlBook);
         this.GenerateM3(arrayData, xlBook);
         if (xlBook.NumberOfSheets > 3)
         {
             xlBook.RemoveSheetAt(0);
             xlBook.RemoveSheetAt(0);
             xlBook.RemoveSheetAt(0);
             xlBook.FirstVisibleTab = 0;
         }
         var str3 = string.Format("{0}{1:yyMMddHHmmss}.xls", str, DateTime.Now);
         var path = string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, str3);
         if (System.IO.File.Exists(path))
         {
             str3 = str3 + Guid.NewGuid().ToString() + ".xls";
             path = string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, str3);
         }
         using (var stream2 = System.IO.File.OpenWrite(path))
         {
             xlBook.Write(stream2);
         }
         return this.File(path, "application/vnd.ms-excel", str3);
     }
 }
示例#5
0
        private static List <SearchEntity> DonwloadData()
        {
            List <SearchEntity> entities = new List <SearchEntity>();

            string sql        = "select * from AspNetUsers where IsPsychologist = 1";
            string connection = "Server=(localdb)\\mssqllocaldb;Database=aspnet-TWHelp-198A0B6F-A6C5-4A0B-AE3E-A656C11BFDD5;Trusted_Connection=True;MultipleActiveResultSets=true";

            using (SqlConnection sqlConnection = new SqlConnection(connection))
                using (SqlCommand command = new SqlCommand(sql, sqlConnection))
                {
                    sqlConnection.Open();
                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        SearchEntity entity = new SearchEntity()
                        {
                            Id                 = long.Parse(reader["Id"].ToString()),
                            NickName           = reader["UserName"].ToString(),
                            Education          = reader["Education"].ToString(),
                            AreaOfExpertise    = reader["AreaOfExpertise"].ToString(),
                            IsAccountActivated = bool.Parse(reader["IsAccountActivated"].ToString())
                        };

                        entities.Add(entity);
                    }
                }

            return(entities);
        }
示例#6
0
        public IEnumerable <RoomEntity> GetAllPaging(SearchEntity filter, int page, int pageSize, out int totalRow)
        {
            DateTime st = filter.StartDate == null ? DateTime.MinValue : filter.StartDate.Value.Date;
            DateTime et = filter.EndDate == null ? DateTime.MaxValue : filter.EndDate.Value.Date.AddDays(1);

            if (filter.Keywords == null)
            {
                filter.Keywords = "";
            }
            List <RoomEntity> lstroom = new List <RoomEntity>();

            try
            {
                lstroom = _roomRepository.GetAllListRoom().Where(x => x.Status == filter.Status &&
                                                                 (filter.RoomType == null || x.RoomTypeID == filter.RoomType) &&
                                                                 (filter.Province == null || x.ProvinceID == filter.Province) &&
                                                                 (filter.District == null || x.DistrictID == filter.District) &&
                                                                 (filter.Ward == null || x.WardID == filter.Ward) &&
                                                                 (filter.StartDate == null || x.CreateDate >= st || x.CreateDate == null) &&
                                                                 (filter.EndDate == null || x.CreateDate < et || x.CreateDate == null) &&
                                                                 (x.RoomName.Contains(filter.Keywords) || x.Description.Contains(filter.Keywords) || string.IsNullOrEmpty(filter.Keywords))
                                                                 ).OrderByDescending(x => x.CreateDate).ToList();
                totalRow = lstroom.Count();
            }
            catch (Exception ex)
            {
                string FunctionName = string.Format("GetAllPaging('{0}')", lstroom);
                Common.Logs.LogCommon.WriteError(ex.ToString(), FunctionName);
                totalRow = 0;
                return(null);
            }
            return(lstroom.Skip((page) * pageSize).Take(pageSize));
        }
示例#7
0
        private SearchEntity CreateSearchEntity(SearchSpecification search, DatabaseEntity database)
        {
            var queryId      = Guid.NewGuid();
            var searchEntity = new SearchEntity(queryId);

            searchEntity.Name                    = search.Name;
            searchEntity.JobId                   = queryId.ToString();
            searchEntity.InputContainer          = "job-" + queryId.ToString();
            searchEntity.OutputContainer         = "job-" + queryId.ToString();
            searchEntity.DatabaseId              = search.DatabaseName;
            searchEntity.DatabaseType            = database.Type;
            searchEntity.DatabaseContainer       = database.ContainerName;
            searchEntity.Executable              = search.Executable;
            searchEntity.ExecutableArgs          = search.ExecutableArgs;
            searchEntity.ExecutableArgsSanitised = search.ExecutableArgs;
            searchEntity.State                   = SearchState.StagingData;
            searchEntity.StartTime               = DateTime.UtcNow;
            searchEntity.PoolId                  = search.PoolId;
            searchEntity.PoolDisplayName         = search.PoolDisplayName;
            searchEntity.TargetDedicated         = search.TargetDedicated;
            searchEntity.VirtualMachineSize      = search.VirtualMachineSize;
            searchEntity.CompletedTasks          = 0;
            searchEntity.TotalTasks              = search.SearchInputFiles.Count();
            ParseExecutableArgs(search, searchEntity);
            _tableStorageProvider.InsertEntity(searchEntity);
            return(searchEntity);
        }
示例#8
0
        public void SearchEntities_PropKeyEqualsName()
        {
            EtagairCore core = Common.CreateCore(RepositConfig);

            //==== creates entities, with prop
            //----create entities
            Entity toshibaCoreI7 = core.Editor.CreateEntity();

            core.Editor.CreateProperty(toshibaCoreI7, "Name", "Toshiba Satellite Core I7");
            core.Editor.CreateProperty(toshibaCoreI7, "TradeMark", "Toshiba");

            //==== define the search: from the root folder, select all entities having a key prop called 'Name'
            SearchEntity searchEntities = core.Searcher.CreateSearchEntity(SearchFolderScope.All);

            //--Add single criteria: property key text equals to 'Name'
            SearchPropCriterionKeyText criterion = core.Searcher.AddCritPropKeyText(searchEntities, "Name");

            criterion.PropKeyTextType = CritOptionPropKeyTextType.AllKeyType;
            criterion.TextSensitive   = CritOptionTextSensitive.No;
            criterion.TextMatch       = CritOptionTextMatch.TextMatchExact;

            //==== execute the search, get the result: list of found entities
            SearchEntityResult result = core.Searcher.ExecSearchEntity(searchEntities);

            // check found entities
            Assert.AreEqual(1, result.ListEntityId.Count, "One found entities expected");

            bool found;

            found = result.ListEntityId.Contains(toshibaCoreI7.Id);
            Assert.IsTrue(found, "The entity id toshibaCoreI7 should be selected");
        }
示例#9
0
        /// <summary>
        /// search entities under the folder parent.
        /// </summary>
        /// <param name="searchEntity"></param>
        /// <param name="folder"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        private bool SearchInFolder(SearchEntity searchEntity, Folder folder, bool goInsideChilds, SearchEntityResult result)
        {
            // process each entity in the folder source
            foreach (KeyValuePair <string, ObjectType> pair in folder.ListChildId)
            {
                // is it a folder?
                if (pair.Value == ObjectType.Folder)
                {
                    // go inside this folder child?
                    if (goInsideChilds)
                    {
                        // load the folder object
                        Folder folderChild = _reposit.Finder.FindFolderById(pair.Key);

                        SearchInFolder(searchEntity, folderChild, true, result);

                        // process next object
                        continue;
                    }
                }

                // is it an entity?
                if (pair.Value == ObjectType.Entity)
                {
                    // load the entity
                    Entity entity = _reposit.Finder.FindEntityById(pair.Key);

                    // analyze the criteria properties expression for the entity
                    AnalyzeEntityOnCriteria(searchEntity, entity, result);
                }

                // others cases: entity or folder template: do nothing
            }
            return(true);
        }
示例#10
0
        /// <summary>
        /// analyze the criteria properties expression for the entity
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private bool AnalyzeEntityOnCriteria(SearchEntity searchEntity, Entity entity, SearchEntityResult result)
        {
            // create a work/exec object of the criteria expression
            SearchPropBaseWork searchPropBaseWork = CreateAllSearchPropBaseWork(searchEntity.SearchPropRoot);

            // a bool expr, go inside left and right part
            SearchPropBoolExprWork searchPropBoolExprWork = searchPropBaseWork as SearchPropBoolExprWork;

            if (searchPropBoolExprWork != null)
            {
                // create work object on the left side

                // create work object on the right side

                //return searchPropBoolExprWork;

                // ok, no error
                return(true);
            }

            // a final criterion
            SearchPropCriterionKeyTextWork propCritKeyTextWork = searchPropBaseWork as SearchPropCriterionKeyTextWork;

            if (propCritKeyTextWork != null)
            {
                EntitySearcherPropKeyText searcherPropKeyText = new EntitySearcherPropKeyText(_reposit);
                return(searcherPropKeyText.AnalyzeEntityOnCritKeyText(propCritKeyTextWork, entity, result));
            }

            // TODO: others final criterion type


            // not implemented
            throw new Exception("Search property not yet implemented!");
        }
        public void SearchEntities_DefinedFolders_2_OnePropKeyEqualsName_E_F1_2E_F2_2E()
        {
            EtagairCore core = Common.CreateCore(RepositConfig);

            //==== creates entities, with prop
            //----create entities
            Entity toshibaCoreI7 = core.Editor.CreateEntity();

            core.Editor.CreateProperty(toshibaCoreI7, "Name", "Toshiba Satellite Core I7");
            core.Editor.CreateProperty(toshibaCoreI7, "TradeMark", "Toshiba");

            //---- create a folder, under the root
            Folder foldComputers = core.Editor.CreateFolder(null, "computers");

            Entity dellCoreI7 = core.Editor.CreateEntity(foldComputers);

            core.Editor.CreateProperty(dellCoreI7, "Name", "Dell Inspiron 15-5570-sku6");
            core.Editor.CreateProperty(dellCoreI7, "TradeMark", "Dell");

            Entity HPCoreI7 = core.Editor.CreateEntity(foldComputers);

            core.Editor.CreateProperty(HPCoreI7, "Nom", "HP Core i7");
            core.Editor.CreateProperty(HPCoreI7, "TradeMark", "HP");

            //---- create a folder, under the root
            Folder foldOthers = core.Editor.CreateFolder(null, "others");

            Entity asusCoreI7 = core.Editor.CreateEntity(foldOthers);

            core.Editor.CreateProperty(asusCoreI7, "Name", "Asus Core i7");
            core.Editor.CreateProperty(asusCoreI7, "TradeMark", "Asus");

            //==== define the search: from the root folder, select all entities having a key prop called 'Name'
            SearchEntity searchEntities = core.Searcher.CreateSearchEntity(SearchFolderScope.Defined);

            //--Add sources folders, set option: go inside folders childs
            core.Searcher.AddSourceFolder(searchEntities, foldComputers, true);

            // add a second source folder
            core.Searcher.AddSourceFolder(searchEntities, foldOthers, true);

            //--Add single criteria: property key text equals to 'Name'
            SearchPropCriterionKeyText criterion = core.Searcher.AddCritPropKeyText(searchEntities, "Name");

            criterion.TextMatch       = CritOptionTextMatch.TextMatchExact;
            criterion.PropKeyTextType = CritOptionPropKeyTextType.AllKeyType;

            //==== execute the search, get the result: list of found entities
            SearchEntityResult result = core.Searcher.ExecSearchEntity(searchEntities);

            // check found entities
            Assert.AreEqual(2, result.ListEntityId.Count, "2 found entity expected");

            bool found;

            found = result.ListEntityId.Contains(dellCoreI7.Id);
            Assert.IsTrue(found, "The entity id dellCoreI7 should be selected");
            found = result.ListEntityId.Contains(asusCoreI7.Id);
            Assert.IsTrue(found, "The entity id asusCoreI7 should be selected");
        }
示例#12
0
        public static List <Image> GetImagesForProduct(int productId)
        {
            List <Image> result = new List <Image>();

            SearchEntity search = new SearchEntity();

            search.ConnectionString = Constants.CONNECTION_STRING;

            Condition productIdCond = new Condition();

            productIdCond.Column   = "AssociatedEntityId";
            productIdCond.Operator = Condition.Operators.EqualTo;
            productIdCond.Value    = Convert.ToString(productId);

            Condition entityTypeCond = new Condition();

            entityTypeCond.Column   = "ImageEntityTypeId";
            entityTypeCond.Operator = Condition.Operators.EqualTo;
            entityTypeCond.Value    = Convert.ToString((int)ImageEntityTypeOptions.Product);

            search.Conditions.Add(productIdCond);
            search.Conditions.Add(entityTypeCond);

            search.SchemaName = Constants.SCHEMA_DEFAULT;
            search.TableName  = Constants.TABLE_IMAGES;

            result = new GenericRepository <Image>().Read(search);

            return(result);
        }
示例#13
0
        /// <summary>
        /// add it as the root criterion of the unit.
        /// </summary>
        /// <param name="searchEntityUnit"></param>
        /// <param name="keyText"></param>
        /// <returns></returns>
        public SearchPropCriterionKeyText AddCritPropKeyText(SearchEntity searchEntity, string keyText)
        {
            if (searchEntity == null)
            {
                return(null);
            }

            // check the text
            if (string.IsNullOrWhiteSpace(keyText))
            {
                return(null);
            }

            // check that a root criterion does not already exists
            if (searchEntity.SearchPropRoot != null)
            {
                // a criterion already exists!
                return(null);
            }

            SearchPropCriterionKeyText criterionPropKeyText = CreateSearchPropCriterionPropKeyText(keyText);

            searchEntity.SearchPropRoot = criterionPropKeyText;
            return(criterionPropKeyText);
        }
示例#14
0
        public JobPreparationTask GetJobPreparationTask(SearchEntity searchEntity, List <ResourceFile> resourceFiles)
        {
            var stdoutLogUploadCmd = GetUploadCommandLine(searchEntity.OutputContainer + "/JobPrep/\\$TaskLog/stdout-$AZ_BATCH_NODE_ID.txt", "../stdout.txt");
            var stderrLogUploadCmd = GetUploadCommandLine(searchEntity.OutputContainer + "/JobPrep/\\$TaskLog/stderr-$AZ_BATCH_NODE_ID.txt", "../stderr.txt");

            var cmd = string.Format("/bin/bash -c 'query-job-prep.sh {0} {1} {2} {3}; {4}; {5}'",
                                    searchEntity.DatabaseId,
                                    _storageCredentials.Account,
                                    _storageCredentials.Key,
                                    searchEntity.DatabaseContainer,
                                    stdoutLogUploadCmd,
                                    stderrLogUploadCmd);

            return(new JobPreparationTask
            {
                Id = "JobPrep",
                CommandLine = cmd,
                EnvironmentSettings = new[]
                {
                    new EnvironmentSetting("BLOBXFER_STORAGEACCOUNTKEY", _storageCredentials.Key),
                },
                ResourceFiles = resourceFiles,
                UserIdentity = new UserIdentity(new AutoUserSpecification(elevationLevel: ElevationLevel.Admin)),
            });
        }
示例#15
0
        /// <summary>
        /// Create a new searchEntity object.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public SearchEntity CreateSearchEntity(string name, SearchFolderScope scope)
        {
            // check the name
            if (string.IsNullOrWhiteSpace(name))
            {
                return(null);
            }
            if (ListSearchEntity.Find(se => se.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) != null)
            {
                return(null);
            }

            SearchEntity searchEntity = new SearchEntity();

            searchEntity.Name = name;
            searchEntity.SearchFolderScope = scope;

            // manage the root folder case, depending on the scope
            ManageRootFolderCase(searchEntity, scope);

            // save the search object
            ListSearchEntity.Add(searchEntity);

            return(searchEntity);
        }
示例#16
0
        /// <summary>
        /// create a boolean expression.
        /// </summary>
        /// <param name="searchEntityUnit"></param>
        /// <param name="searchPropParent"></param>
        /// <returns></returns>
        public SearchPropBoolExpr AddSearchPropBoolExpr(SearchEntity searchEntity, SearchPropBoolExpr boolExprParent, BoolExprOperand leftOrRight, SearchBoolOperator oper)
        {
            if (searchEntity == null)
            {
                return(null);
            }
            if (boolExprParent == null)
            {
                return(null);
            }

            // check that the criterion does not already exists
            if (searchEntity.SearchPropRoot != null)
            {
                // a criterion already exists!
                return(null);
            }

            // check that the criterion does not already exists
            if (boolExprParent.GetLeftOrRight(leftOrRight) != null)
            {
                return(null);
            }

            SearchPropBoolExpr expr = new SearchPropBoolExpr();

            expr.Operator = oper;

            // set the prop operand to the left or to the right
            boolExprParent.SetLeftOrRight(leftOrRight, expr);
            return(expr);
        }
示例#17
0
        private dynamic OnSearchFriendRequestRequest(dynamic arg)
        {
            var          searchRequest = new SerializeHelper().DeserializeObject <SearchRequest>(Request.Body);
            SearchEntity searchEntity  = searchRequest.Entity;

            if (searchEntity != SearchEntity.IncomingFriendRequests &&
                searchEntity != SearchEntity.OutgoingFriendRequests)
            {
                throw new InvalidOperationException($"Search entity '{ searchEntity }' must not be sent to this controller");
            }

            AccountStateService  stateService   = AccountStateService.Instance;
            FriendRequestService requestService = FriendRequestService.Instance;

            SessionAuth clientAuth = Request.Headers.GetSessionAuth();

            if (!stateService.IsAuthorized(searchRequest.SenderId, clientAuth.ClientToken))
            {
                throw new ClientNotAuthorizedException(searchRequest.SenderId);
            }

            IEnumerable <ComplexFriendRequest> requests =
                searchEntity == SearchEntity.IncomingFriendRequests ?
                requestService.GetIncomingRequests(searchRequest.SenderId) :
                requestService.GetOutgoingRequests(searchRequest.SenderId);

            IEnumerable <FriendRequest> clientModels = requests.Select(complexModel => complexModel.ToSimple());
            string serialized = new SerializeHelper().Serialize(clientModels);

            return(serialized);
        }
示例#18
0
        public VideoSearchEntity(SearchEntity _searchEntity) : base(_searchEntity.Type, _searchEntity.Text)
        {
            switch (Type)
            {
            case "Series":
                FontColor  = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#db3a34"));
                Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#e15d58"));
                break;

            case "Alt Series":
                FontColor  = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fca311"));
                Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fdc467"));
                break;

            case "Tag":
                FontColor  = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#084c61"));
                Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#618d9a"));
                break;

            default:
                FontColor  = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#323031"));
                Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7c7b7b"));
                break;
            }
        }
示例#19
0
        /// <summary>
        /// Manage the root folder case, depending on the scope.
        /// </summary>
        /// <param name="searchEntity"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        private bool ManageRootFolderCase(SearchEntity searchEntity, SearchFolderScope scope)
        {
            if (scope == SearchFolderScope.Defined)
            {
                // nothing to do, the user should define source folder
                return(true);
            }

            // get the root folder
            Folder rootFolder = _reposit.Finder.GetRootFolder();

            // go inside sub-folders
            if (scope == SearchFolderScope.All)
            {
                // add it to search object
                searchEntity.AddSourceFolder(rootFolder, true);
                return(true);
            }

            // doesn't go inside sub-folders
            if (scope == SearchFolderScope.RootOnly)
            {
                // add it to search object
                searchEntity.AddSourceFolder(rootFolder, false);
                return(true);
            }

            // error?
            return(false);
        }
示例#20
0
        // This might be best moved into a different class later on.
        public static List <Comment> GetCommentsForProduct(int productId)
        {
            List <Comment> result = new List <Comment>();

            SearchEntity search = new SearchEntity();

            search.ColumnsToReturn = new List <string>();
            search.ColumnsToReturn.Add("CommentId");

            search.ConnectionString = Constants.CONNECTION_STRING;

            LacesRepo.Condition userIdCond = new LacesRepo.Condition();
            userIdCond.Column   = "ProductId";
            userIdCond.Operator = LacesRepo.Condition.Operators.EqualTo;
            userIdCond.Value    = Convert.ToString(productId);

            search.Conditions.Add(userIdCond);

            search.SchemaName = Constants.SCHEMA_DEFAULT;
            search.TableName  = Constants.TABLE_IMAGES;

            result = new GenericRepository <Comment>().Read(search);

            return(result);
        }
示例#21
0
        /// <summary>
        /// Deal with any arguments and possible output filename.
        /// If a output filename is specified, create a string 'format' based
        /// on that and string out the arg.
        /// </summary>
        private void ParseExecutableArgs(SearchSpecification searchSpec, SearchEntity searchEntity)
        {
            var outputFormat   = "output-{0}.xml";
            var executableArgs = searchSpec.ExecutableArgs;

            if (!string.IsNullOrEmpty(executableArgs))
            {
                var tokens = executableArgs.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();

                if (tokens.Any(token => token == "-out"))
                {
                    var indexOfOutArg      = tokens.IndexOf("-out");
                    var indexOfOutFilename = indexOfOutArg + 1;
                    if (indexOfOutFilename > tokens.Count - 1)
                    {
                        throw new Exception("No filename specified for -out argument");
                    }
                    var outputFilename = tokens[indexOfOutArg + 1];
                    var name           = Path.GetFileNameWithoutExtension(outputFilename);
                    var extension      = Path.GetExtension(outputFilename);
                    outputFormat = name + "-{0}" + extension;

                    // Strip out the -out filename args as we already set it later
                    executableArgs = executableArgs.Replace(" -out " + outputFilename, " ");
                }
            }

            searchEntity.ExecutableArgsSanitised = executableArgs;
            searchEntity.OutputfileFormat        = outputFormat;
        }
示例#22
0
        public CM_UserListEntity GetUserInfoByCardNo(string cardNo)
        {
            CM_UserListEntity userListModel = new CM_UserListEntity();
            userListModel.UserKahao = cardNo;
            Dictionary<string, object> args = new Dictionary<string, object>();

            List<CM_UserListEntity> listUser = null;
            using (ICM_UserListService userlist = new CM_UserListService(new DataAccess("defaultRead")))
            {
                listUser = userlist.GetCM_UserListCollection(args);
            }

            using (ICM_UserListService userlist = new CM_UserListService())
            {
                userListModel = listUser[10];
                userListModel.UserKahao = "01020102";
                var list = userlist.InsertCM_UserListEntity(userListModel);
            }

            SearchEntity entity = new SearchEntity("GetCM_UserListEntityByKahao", System.Data.CommandType.StoredProcedure);
            entity["UserKahao"] = cardNo;
            using (IDbExecuter service = new ExCommonService())
            {
                var uList = service.ExecuteSelect<CM_UserListEntity>(entity).ToList();
                userListModel = uList.Count > 0 ? uList[0] : null;
            }

            return userListModel;
        }
示例#23
0
        /// <summary>
        /// Add a property criterion to a search unit.
        /// set to the left or to the right operand of the expression.
        /// </summary>
        /// <param name="criteria"></param>
        /// <param name="keyText"></param>
        /// <returns></returns>
        public SearchPropCriterionKeyText AddCritPropKeyText(SearchEntity searchEntity, SearchPropBoolExpr boolExprParent, BoolExprOperand leftOrRight, string keyText)
        {
            if (searchEntity == null)
            {
                return(null);
            }
            if (boolExprParent == null)
            {
                return(null);
            }

            // check the text
            if (string.IsNullOrWhiteSpace(keyText))
            {
                return(null);
            }

            // check that the criterion does not already exists
            if (boolExprParent.GetLeftOrRight(leftOrRight) != null)
            {
                return(null);
            }

            SearchPropCriterionKeyText criterionPropKeyText = CreateSearchPropCriterionPropKeyText(keyText);

            // set the prop operand to the left or to the right
            boolExprParent.SetLeftOrRight(leftOrRight, criterionPropKeyText);
            return(criterionPropKeyText);
        }
示例#24
0
        public DataResultArgs <List <PaymentEntity> > Get_Payment(SearchEntity entity)
        {
            DataProcess.ControlAdminAuthorization();

            DataResultArgs <List <PaymentEntity> > resultSet = new DataResultArgs <List <PaymentEntity> >();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@id", entity.Id);
            cmd.Parameters.AddWithValue("@isActive", entity.IsActive);
            cmd.Parameters.AddWithValue("@isDeleted", entity.IsDeleted);
            using (SqlConnection con = Connection.Conn)
            {
                con.Open();
                DataResultArgs <SqlDataReader> result = DataProcess.ExecuteProcDataReader(con, cmd, "get_Payment");
                if (result.HasError)
                {
                    resultSet.HasError         = result.HasError;
                    resultSet.ErrorDescription = result.ErrorDescription;
                    resultSet.ErrorCode        = result.ErrorCode;
                }
                else
                {
                    List <PaymentEntity> lst = GetList(result);
                    resultSet.Result = lst;
                }

                con.Close();
            }

            return(resultSet);
        }
示例#25
0
        public JsonResult LoadAllRoom(SearchEntity filter, int page, int pageSize = 20)
        {
            JsonResult jsonResult = new JsonResult();

            try
            {
                HttpRequestBase request = this.HttpContext.Request;
                if (ValidateRequestHeader(request))
                {
                    int totalRow      = 0;
                    var data          = _roomService.GetAllPaging(filter, page, pageSize, out totalRow);
                    var paginationSet = new PaginationSet <RoomEntity>()
                    {
                        Items      = data,
                        TotalCount = totalRow,
                        Success    = true
                    };
                    jsonResult = Json(new { lstData = paginationSet }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    jsonResult = Json(new { success = false }, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception ex)
            {
                jsonResult = Json(new { success = false }, JsonRequestBehavior.AllowGet);
                throw ex;
            }
            return(jsonResult);
        }
示例#26
0
        private IEnumerable <CloudTask> GetTasks(SearchEntity searchEntity, IEnumerable <SearchQueryEntity> queries)
        {
            var taskId = 0;

            foreach (var query in queries)
            {
                var cmd = string.Format("/bin/bash -c '{0}; result=$?; {1}; exit $result'",
                                        GetBlastCommandLine(searchEntity.DatabaseId, searchEntity.Executable, searchEntity.ExecutableArgsSanitised, query.QueryFilename, query.QueryOutputFilename, query.LogOutputFilename),
                                        GetUploadCommandLine(searchEntity.OutputContainer));

                var task = new CloudTask(taskId.ToString(), cmd);
                task.DisplayName   = query.QueryFilename;
                task.UserIdentity  = new UserIdentity(new AutoUserSpecification(elevationLevel: ElevationLevel.Admin));
                task.ResourceFiles = new List <ResourceFile>
                {
                    new ResourceFile(_blobStorageProvider.GetBlobSAS(searchEntity.InputContainer, query.QueryFilename), query.QueryFilename)
                };

                task.EnvironmentSettings = new[]
                {
                    new EnvironmentSetting("BLOBXFER_STORAGEACCOUNTKEY", _storageCredentials.Key),
                };

                yield return(task);

                taskId++;
            }
        }
示例#27
0
        private void SubmitBatchJob(SearchEntity searchEntity, IEnumerable <SearchQueryEntity> queries, List <ResourceFile> resourceFiles)
        {
            PoolInformation poolInfo;

            if (!string.IsNullOrEmpty(searchEntity.PoolId))
            {
                poolInfo = new PoolInformation
                {
                    PoolId = searchEntity.PoolId,
                };
            }
            else
            {
                var maxTasksPerNode = _configuration.GetCoresForVirtualMachineSize(searchEntity.VirtualMachineSize);

                if (searchEntity.TargetDedicated == 1 && maxTasksPerNode == 1)
                {
                    // Need to always ensure a JM can run
                    maxTasksPerNode = 2;
                }

                poolInfo = new PoolInformation
                {
                    AutoPoolSpecification = new AutoPoolSpecification
                    {
                        PoolSpecification = new PoolSpecification
                        {
                            TargetDedicated             = searchEntity.TargetDedicated,
                            MaxTasksPerComputeNode      = maxTasksPerNode,
                            VirtualMachineSize          = searchEntity.VirtualMachineSize,
                            VirtualMachineConfiguration = _configuration.GetVirtualMachineConfiguration(),
                        },
                        PoolLifetimeOption = PoolLifetimeOption.Job,
                        KeepAlive          = false,
                    }
                };
            }

            var job = _batchClient.JobOperations.CreateJob(searchEntity.JobId, poolInfo);

            job.DisplayName        = searchEntity.DatabaseId;
            job.JobPreparationTask = GetJobPreparationTask(
                searchEntity.DatabaseId,
                searchEntity.DatabaseContainer,
                resourceFiles);
            job.JobManagerTask = GetJobManagerTask(
                searchEntity.Id.ToString(),
                resourceFiles);
            job.Commit();

            var tasks = GetTasks(searchEntity, queries);

            job.Refresh();
            job.AddTask(tasks);

//            job.Refresh();
//            job.OnAllTasksComplete = OnAllTasksComplete.TerminateJob;
        }
示例#28
0
 public async Task <ActionResult> test(SearchEntity searchEntity)
 {
     //int rows2 = await orderMonitorService.Insert(new System.Collections.ArrayList
     //{
     //    new test1(){批次号="1",运单号="11",创建时间=DateTime.Now },
     //    new test1(){批次号="2",运单号="22",创建时间=DateTime.Now },
     //    new test1(){批次号="3",运单号="33",创建时间=DateTime.Now },
     //});
     return(Json(new { rows = ConfigHelper.GetWebConfigString("MySqlConnectionString1"), Msg = AppDomain.CurrentDomain.BaseDirectory, Status = 0, total = "1111" }, JsonSettings));
 }
示例#29
0
        /// <summary>
        ///  Search entities by the key property.
        ///  Create 3 entities, select entities having a property key equals to 'Name'.
        ///
        ///     computers\
        ///         Ent: Name=Toshiba   Ok, selected
        ///         Ent: Name=Dell      Ok, selected
        ///         Ent: Company=HP     --NOT selected
        ///
        /// -------output:
        /// Db initialized with success.
        /// -Search result: nb= 2
        /// Ent, id: 5c6822abdd125603e885d8d4
        /// Ent, id: 5c6822c1dd125603e885d8d6
        /// </summary>
        public void CreateThreeEntitiesSearchPropKeyName()
        {
            EtagairEngine engine = CreateEngine();

            //---- create a folder, under the root
            Folder foldComputers = engine.Editor.CreateFolder(null, "computers");

            //==== creates entities, with prop

            //----create entity
            Entity toshibaCoreI7 = engine.Editor.CreateEntity(foldComputers);

            engine.Editor.CreateProperty(toshibaCoreI7, "Name", "Toshiba Satellite Core I7");
            engine.Editor.CreateProperty(toshibaCoreI7, "TradeMark", "Toshiba");

            //----create entity
            Entity dellCoreI7 = engine.Editor.CreateEntity(foldComputers);

            engine.Editor.CreateProperty(dellCoreI7, "Name", "Dell Inspiron 15-5570-sku6");
            engine.Editor.CreateProperty(dellCoreI7, "TradeMark", "Dell");

            //----create entity
            Entity HPCoreI7 = engine.Editor.CreateEntity(foldComputers);

            engine.Editor.CreateProperty(HPCoreI7, "Company", "HP Core i7");
            engine.Editor.CreateProperty(HPCoreI7, "TradeMark", "HP");

            //==== define the search: from the root folder, select all entities having a key prop called 'Name'
            SearchEntity searchEntities = engine.Searcher.CreateSearchEntity("EntitiesHavingPropName", SearchFolderScope.Defined);

            //--Add sources folders, set option: go inside folders childs
            // (only one for now is managed!!)
            engine.Searcher.AddSourceFolder(searchEntities, foldComputers, true);

            //--Add criteria: (a boolean expression)
            SearchPropCriterionKeyText criterion = engine.Searcher.AddCritPropKeyText(searchEntities, "Name");

            criterion.TextMatch       = CritOptionTextMatch.TextMatchExact;
            criterion.PropKeyTextType = CritOptionPropKeyTextType.AllKeyType;

            //==== execute the search, get the result: list of found entities
            SearchEntityResult result = engine.Searcher.ExecSearchEntity(searchEntities);

            // displays found entities
            Console.WriteLine("-Search result: nb=" + result.ListEntityId.Count);
            foreach (string entityId in result.ListEntityId)
            {
                // displays the id of the entity
                Console.WriteLine("Ent, id: " + entityId);

                // load the entity and display it
                Entity entity = engine.Searcher.FindEntityById(entityId);
                // display the properties of the entity....
            }
        }
示例#30
0
        // TODO: gérer trad finale absente -> selectionne la mainLang
        // exp: pas de texte en fr_FR mais existe en fr, prend ce dernier.

        /// <summary>
        ///  select entities having a property key='Name'
        ///
        ///     computers\
        ///         Ent: Name=Toshiba   Ok, selected
        ///         Ent: Name=Dell      Ok, selected
        ///         Ent: Company=HP     --NOT selected
        ///
        /// </summary>
        /// <param name="core"></param>
        static void TestSearchEntity(EtagairCore core)
        {
            Console.WriteLine("====>TestSearchEntity: ");

            //---- create a folder, under the root
            Folder foldComputers = core.Editor.CreateFolder(null, "computers");

            //==== creates entities, with prop

            //----create entity
            Entity toshibaCoreI7 = core.Editor.CreateEntity(foldComputers);

            core.Editor.CreateProperty(toshibaCoreI7, "Name", "Toshiba Satellite Core I7");
            core.Editor.CreateProperty(toshibaCoreI7, "TradeMark", "Toshiba");

            //----create entity
            Entity dellCoreI7 = core.Editor.CreateEntity(foldComputers);

            core.Editor.CreateProperty(dellCoreI7, "Name", "Dell Inspiron 15-5570-sku6");
            core.Editor.CreateProperty(dellCoreI7, "TradeMark", "Dell");

            //----create entity
            Entity HPCoreI7 = core.Editor.CreateEntity(foldComputers);

            core.Editor.CreateProperty(HPCoreI7, "Company", "HP Core i7");
            core.Editor.CreateProperty(HPCoreI7, "TradeMark", "HP");

            //==== define the search: from the root folder, select all entities having a key prop called 'Name'
            SearchEntity searchEntities = core.Searcher.CreateSearchEntity(SearchFolderScope.Defined);

            //--Add sources folders, set option: go inside folders childs
            core.Searcher.AddSourceFolder(searchEntities, foldComputers, true);

            //--Add criteria: (a boolean expression)
            SearchPropCriterionKeyText criterion = core.Searcher.AddCritPropKeyText(searchEntities, "Name");

            criterion.PropKeyTextType = CritOptionPropKeyTextType.AllKeyType;
            criterion.TextMatch       = CritOptionTextMatch.TextMatchExact;

            //--set options
            // TODO: lesquelles?

            //==== execute the search, get the result: list of found entities
            SearchEntityResult result = core.Searcher.ExecSearchEntity(searchEntities);

            // displays found entities
            Console.WriteLine("-Search result: nb=" + result.ListEntityId.Count);
            foreach (string entityId in result.ListEntityId)
            {
                // load the entity

                Console.WriteLine("Ent, id: " + entityId);
            }
        }
示例#31
0
        public DataResultArgs <List <PaymentTypeEntity> > Get_PaymentType(SearchEntity entity)
        {
            DataProcess.ControlAdminAuthorization();

            if (staticPaymentTypeList == null)
            {
                DataResultArgs <List <PaymentTypeEntity> > resultSet = new DataResultArgs <List <PaymentTypeEntity> >();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@id", entity.Id);
                cmd.Parameters.AddWithValue("@isActive", entity.IsActive);
                cmd.Parameters.AddWithValue("@isDeleted", entity.IsDeleted);
                using (SqlConnection con = Connection.Conn)
                {
                    con.Open();
                    DataResultArgs <SqlDataReader> result =
                        DataProcess.ExecuteProcDataReader(con, cmd, "get_PaymentType");
                    if (result.HasError)
                    {
                        resultSet.HasError         = result.HasError;
                        resultSet.ErrorDescription = result.ErrorDescription;
                        resultSet.ErrorCode        = result.ErrorCode;
                    }
                    else
                    {
                        SqlDataReader            dr  = result.Result;
                        List <PaymentTypeEntity> lst = new List <PaymentTypeEntity>();
                        PaymentTypeEntity        elist;
                        while (dr.Read())
                        {
                            elist           = new PaymentTypeEntity();
                            elist.Id        = GeneralFunctions.GetData <Int32>(dr["id"]);
                            elist.Name      = GeneralFunctions.GetData <String>(dr["name"]);
                            elist.Amount    = GeneralFunctions.GetData <Decimal?>(dr["amount"]);
                            elist.IsActive  = GeneralFunctions.GetData <Boolean?>(dr["isActive"]);
                            elist.UpdatedOn = GeneralFunctions.GetData <DateTime>(dr["updatedOn"]);
                            lst.Add(elist);
                        }


                        dr.Close();

                        resultSet.Result = lst;
                    }
                    con.Close();
                }

                staticPaymentTypeList = resultSet;
            }

            return(staticPaymentTypeList);
        }
示例#32
0
        /// <summary>
        /// 查询SMS记录
        /// </summary>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        public static Response <List <SearchResponse> > Search(SearchEntity searchModel)
        {
            var request = new RestRequest("sms/_search", Method.POST)
            {
                RequestFormat = DataFormat.Json
            };

            request.AddBody(searchModel);

            var response = _client.Execute <List <SearchResponse> >(request);

            return(ToResponse(response));
        }
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            SearchEntity masha = new SearchEntity(Int32.Parse(textBox.Text));
            while (!masha.isReady)
                System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.01)).Wait();
            // now user is ready
            // user has also additional fields (if it is not hidden)
            UserDescription profile = masha.getDescription();

            // loading user's friend
            FriendsList mashas_friends = masha.getFriends();
            this.listBox1.Visibility = System.Windows.Visibility.Hidden;
            this.listBox2.Visibility = System.Windows.Visibility.Visible;
            this.listBox2.ItemsSource = mashas_friends.friends;
        }
 private void button3_Click(object sender, RoutedEventArgs e)
 {
     Search town = new Search(Int32.Parse(textBox2.Text));
     while (!town.isReady)
         System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.01)).Wait();
     Random random = new Random();
     int randomNumber = random.Next(0, 500);
     Search search = town;
     int id = search.search[randomNumber].id;
     SearchEntity masha = new SearchEntity(id);
     while (!masha.isReady)
         System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.01)).Wait();
     List<UserDescription> mashas_friends = masha.getFriends().friends;
     List<Levels> levelsList = new List<Levels>();
     Levels levels = friendsList(masha, 0);
     XmlDocument doc = new XmlDocument();
     string str = SerializeObject(levels);
     File.WriteAllText("MyFile.xml", str);
 }
 /// <summary>
 /// 根据提供的条件获取数据
 /// </summary>
 /// <param name="searchEntity">查询的条件清单</param>
 /// <returns></returns>
 public JsonResult GetData(SearchEntity searchEntity)
 {
     int iTotal;
     var rows = this.GetArrayData(searchEntity, out iTotal);
     return base.Json(new
     {
         success = true,
         total = iTotal,
         rows = rows
     }, JsonRequestBehavior.AllowGet);
 }
 private List<v_delivery_bill_join_order> GetArrayData(SearchEntity searchEntity, out int iTotal)
 {
     using (var entities = new ydERPGJEntities())
     {
         string str;
         object[] objArray;
         var q = entities.v_delivery_bill_join_order.AsQueryable<v_delivery_bill_join_order>();
         var row = q.FirstOrDefault<v_delivery_bill_join_order>();
         var dicSearchEntity = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(searchEntity.searchjson);
         var list = new List<Search2FieldInfo> {
             new Search2FieldInfo("bill_date_start", ">=", "bill_date", FieldType.Date),
             new Search2FieldInfo("bill_date_end", "<=", "bill_date", FieldType.Date)
         };
         var dicKey2OperateName = new Dictionary<string, string>();
         var dicKey2FieldName = new Dictionary<string, string>();
         var dicColTypes = new Dictionary<string, FieldType>();
         list.ForEach(delegate(Search2FieldInfo rr)
         {
             dicKey2OperateName.Add(rr.SearchName, rr.OperateName);
             dicKey2FieldName.Add(rr.SearchName, rr.FieldName);
             dicColTypes.Add(rr.SearchName, rr.FieldType);
         });
         ydAnalysisInputLinq.GetSqlParameter(
             dicSearchEntity,
             dicKey2OperateName,
             row,
             dicKey2FieldName,
             dicColTypes,
             out str,
             out objArray
         );
         //加入筛选条件
         if ((!string.IsNullOrWhiteSpace(str) && (objArray != null)) && (objArray.Length > 0))
         {
             q = q.Where<v_delivery_bill_join_order>(str, objArray);
         }
         //总行数
         iTotal = q.Count<v_delivery_bill_join_order>();
         //是否有执行排序
         bool isOrdered;
         //执行排序
         q = ydHelperLinq.DataSort<v_delivery_bill_join_order>(
             q,
             out isOrdered,
             Request.Params["sort"],
             Request.Params["order"]
         );
         //未排序则按照日期降序排序
         if (!isOrdered)
         {
             q = ydHelperLinq.DataSort<v_delivery_bill_join_order>(q, out isOrdered, "LastChangeDateTime", "desc");
         }
         //分页
         return ydHelperLinq.DataPagination<v_delivery_bill_join_order>(
             q,
             int.Parse(Request.Params["offset"]),
             int.Parse(Request.Params["limit"])
         ).ToList();
     }
 }
 public FileResult ToExcel(SearchEntity searchEntity)
 {
     int iTotal;
     var rows = this.GetArrayData(searchEntity, out iTotal);
     var dicColInfo = new Dictionary<string, Tuple<int, string>>();
     var colIndex = 0;
     dicColInfo.Add("bill_month", Tuple.Create<int, string>(colIndex++, "单据月份"));
     dicColInfo.Add("bill_date", Tuple.Create<int, string>(colIndex++, "单据日期"));
     dicColInfo.Add("cust_name", Tuple.Create<int, string>(colIndex++, "客户名称"));
     dicColInfo.Add("bill_num", Tuple.Create<int, string>(colIndex++, "送货单号"));
     dicColInfo.Add("row_id", Tuple.Create<int, string>(colIndex++, "行号"));
     dicColInfo.Add("order_id", Tuple.Create<int, string>(colIndex++, "订单序号"));
     dicColInfo.Add("market_dept", Tuple.Create<int, string>(colIndex++, "事业部"));
     dicColInfo.Add("product_num", Tuple.Create<int, string>(colIndex++, "生产编号"));
     dicColInfo.Add("cust_num", Tuple.Create<int, string>(colIndex++, "客户编号"));
     dicColInfo.Add("order_num", Tuple.Create<int, string>(colIndex++, "订单编号"));
     dicColInfo.Add("specification", Tuple.Create<int, string>(colIndex++, "规格"));
     dicColInfo.Add("batch_num", Tuple.Create<int, string>(colIndex++, "批号"));
     dicColInfo.Add("pcs_qty", Tuple.Create<int, string>(colIndex++, "交货数量"));
     dicColInfo.Add("foc_pcs_qty", Tuple.Create<int, string>(colIndex++, "备品数量"));
     dicColInfo.Add("product_date", Tuple.Create<int, string>(colIndex++, "生产日期"));
     dicColInfo.Add("remark", Tuple.Create<int, string>(colIndex++, "备注"));
     dicColInfo.Add("remark_head", Tuple.Create<int, string>(colIndex++, "单据备注"));
     dicColInfo.Add("lot_id_list", Tuple.Create<int, string>(colIndex++, "流程卡清单"));
     dicColInfo.Add("add_person", Tuple.Create<int, string>(colIndex++, "录入员"));
     dicColInfo.Add("add_time", Tuple.Create<int, string>(colIndex++, "录入时间"));
     dicColInfo.Add("last_change_time", Tuple.Create<int, string>(colIndex++, "最后修改时间"));
     dicColInfo.Add("cust_id", Tuple.Create<int, string>(colIndex++, "客户序号"));
     dicColInfo.Add("cust_long_name", Tuple.Create<int, string>(colIndex++, "客户全名"));
     dicColInfo.Add("cust_contact", Tuple.Create<int, string>(colIndex++, "客户联系人"));
     dicColInfo.Add("cust_telephone", Tuple.Create<int, string>(colIndex++, "客户电话"));
     dicColInfo.Add("cust_fax", Tuple.Create<int, string>(colIndex++, "客户传真号"));
     dicColInfo.Add("cust_address", Tuple.Create<int, string>(colIndex++, "客户地址"));
     dicColInfo.Add("pnl_length", Tuple.Create<int, string>(colIndex++, "开料长"));
     dicColInfo.Add("pnl_width", Tuple.Create<int, string>(colIndex++, "开料宽"));
     dicColInfo.Add("pnl_area", Tuple.Create<int, string>(colIndex++, "开料pnl面积"));
     dicColInfo.Add("order_pcs_qty", Tuple.Create<int, string>(colIndex++, "订单pcs数"));
     dicColInfo.Add("order_pcs_area", Tuple.Create<int, string>(colIndex++, "订单pcs面积"));
     dicColInfo.Add("unit_price_fpc", Tuple.Create<int, string>(colIndex++, "fpc单价"));
     dicColInfo.Add("unit_price_smt", Tuple.Create<int, string>(colIndex++, "smt单价"));
     dicColInfo.Add("fpc_smt_total_amount", Tuple.Create<int, string>(colIndex++, "fpc与smt总价"));
     dicColInfo.Add("tool_amount", Tuple.Create<int, string>(colIndex++, "工具费"));
     dicColInfo.Add("order_date", Tuple.Create<int, string>(colIndex++, "落单日期"));
     dicColInfo.Add("need_date", Tuple.Create<int, string>(colIndex++, "需求日期"));
     dicColInfo.Add("unit_price", Tuple.Create<int, string>(colIndex++, "含税单价"));
     dicColInfo.Add("subtotal_amount", Tuple.Create<int, string>(colIndex++, "含税金额"));
     var str = "对账单";
     var fileName = string.Format("{0}{1:yyMMddHHmmss}.xls", str, DateTime.Now);
     ydExtendNPIO.List2Excel<v_delivery_bill_join_order>(rows, dicColInfo, ref fileName, str);
     return this.File(string.Format("/Temp/{0}", fileName), "application/vnd.ms-excel", fileName);
 }
 private Levels friendsList(SearchEntity masha, int i)
 {
     if (i <= 3)
     {
         Levels levels1 = new Levels(masha.getDescription(), new List<Levels>());
         foreach (UserDescription user in masha.getFriends())
         {
             SearchEntity tmp = new SearchEntity(user.id);
             while (!tmp.isReady)
                 System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.01)).Wait();
             levels1.friends.Add(friendsList(tmp, i + 1));
         }
         return levels1;
     }
     else
         return new Levels(masha.getDescription(), new List<Levels>());
 }
 private void profile(int id)
 {
     SearchEntity masha = new SearchEntity(id);
     while (!masha.isReady)
         System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.01)).Wait();
     UserDescription profile = masha.getDescription();
     FriendsList mashas_friends = masha.getFriends();
     List<UserDescription> descriptions = new List<UserDescription>();
     descriptions.Add(profile);
     List<string> strings = new List<string>();
     strings.Add(profile.firstName);
     this.listBox1.ItemsSource = descriptions;
     this.listBox1.Visibility = System.Windows.Visibility.Visible;
     this.listBox2.Visibility = System.Windows.Visibility.Hidden;
 }
        private void htmlDocCompleteSearch(object sender, HtmlDocumentLoadCompleted e)
        {

            if (e.Error == null)
            {
                HtmlDocument htmlDoc = e.Document;
                if (htmlDoc != null)
                {
                    List<SearchEntity> searchList = new List<SearchEntity>();

                    HtmlNode node = htmlDoc.GetElementbyId("searchResult");

                    HtmlNodeCollection noC = node.SelectNodes("//*[@class=\"searchItem\"]");

                    foreach (HtmlNode h in noC)
                    {
                        HtmlNode hn1 = HtmlNode.CreateNode(h.OuterHtml);
                        SearchEntity search = new SearchEntity();

                        foreach (HtmlNode child in hn1.ChildNodes)
                        {

                            if (child.Attributes["class"] != null && child.Attributes["class"].Value == "searchItemTitle")
                            {
                                HtmlNode hsn = HtmlNode.CreateNode(child.OuterHtml);

                                string searchTitleValue = hsn.SelectSingleNode("//*[@class=\"searchItemTitle\"]").InnerText.Trim();
                                search.searchTitle = searchTitleValue;
                                //MessageBox.Show("searchTitle--------------" + searchTitleValue);
                            }

                            else if (child.Attributes["class"] != null && child.Attributes["class"].Value == "searchCon")
                            {
                                HtmlNode hsn = HtmlNode.CreateNode(child.OuterHtml);


                                string searchConValue = hsn.SelectSingleNode("//*[@class=\"searchCon\"]").InnerText.Trim();
                                search.searchCon = searchConValue;

                                //MessageBox.Show("searchCon--------------" + searchConValue);
                            }

                            else if (child.Attributes["class"] != null && child.Attributes["class"].Value == "searchItemInfo")
                            {


                                HtmlNode hsn = HtmlNode.CreateNode(child.OuterHtml);
                                foreach (HtmlNode searchItemInfoChild in hsn.ChildNodes)
                                {
                                    if (searchItemInfoChild.Attributes["class"] != null && searchItemInfoChild.Attributes["class"].Value == "searchItemInfo")
                                    {
                                        string userName = searchItemInfoChild.SelectSingleNode("//*[@class=\"searchItemInfo-userName\"]").InnerText.Trim();
                                        string publishDate = searchItemInfoChild.SelectSingleNode("//*[@class=\"searchItemInfo-publishDate\"]").InnerText.Trim();
                                        string good = searchItemInfoChild.SelectSingleNode("//*[@class=\"searchItemInfo-good\"]").InnerText.Trim();
                                        string comments = searchItemInfoChild.SelectSingleNode("//*[@class=\"searchItemInfo-comments\"]").InnerText.Trim();
                                        string views = searchItemInfoChild.SelectSingleNode("//*[@class=\"searchItemInfo-views\"]").InnerText.Trim();
                                        string searchInfoValue = userName + publishDate + good + comments + views;
                                        search.searchInfo = searchInfoValue;
                                        //MessageBox.Show("searchInfo--------------" + userName+publishDate+good+comments+views);
                                    }

                                    if (searchItemInfoChild.Attributes["class"] != null && searchItemInfoChild.Attributes["class"].Value == "searchURL")
                                    {
                                        string searchURLValue = searchItemInfoChild.SelectSingleNode("//*[@class=\"searchURL\"]").InnerText.Trim();
                                        search.searchURL = searchURLValue;
                                        //MessageBox.Show("searchInfo--------------" + searchURLValue);
                                    }
                                }



                                //string searchInfo = child.SelectSingleNode("//*[@class=\"searchItemInfo\"]").InnerText;
                                //MessageBox.Show("searchInfo--------------" + searchInfo);
                            }


                        }

                        searchList.Add(search);
                    }


                    this.listBox1.ItemsSource = searchList;

                }

            }

        }