public async Task <List <VideoChannel> > GetChannels(bool onlyEditable) { var query = onlyEditable ? await SpHelper.GetVideoPortalRootUrl() + "/_api/VideoService/CanEditChannels" : await SpHelper.GetVideoPortalRootUrl() + "/_api/VideoService/Channels"; // create request for channels HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, query); // issue request & get response var response = await _client.SendAsync(request); string responseString = await response.Content.ReadAsStringAsync(); // convert response to object var jsonResponse = JsonConvert.DeserializeObject <JsonHelpers.VideoChannelCollection>(responseString); // convert to model object var channels = new List <VideoChannel>(); foreach (var videoChannel in jsonResponse.Data.Results) { var channel = new VideoChannel { Id = videoChannel.Id, HtmlColor = videoChannel.TileHtmlColor, Title = videoChannel.Title, Description = videoChannel.Description, ServerRelativeUrl = videoChannel.ServerRelativeUrl }; channels.Add(channel); } return(channels.OrderBy(vc => vc.Title).ToList()); }
public async Task <Video> GetVideo(string channelId, string videoId) { // create request for video var query = string.Format("{0}/_api/VideoService/Channels('{1}')/Videos('{2}')", await SpHelper.GetVideoPortalRootUrl(), channelId, videoId); // issue request & get response var response = await _client.GetAsync(query); string responseString = await response.Content.ReadAsStringAsync(); // convert response to object var jsonResponse = JsonConvert.DeserializeObject <JsonHelpers.ChannelVideosSingle>(responseString); var channelVideo = jsonResponse.Data; var video = new Video { ChannelId = channelId, VideoId = channelVideo.ID, Title = channelVideo.Title, DisplayFormUrl = channelVideo.DisplayFormUrl, DurationInSeconds = channelVideo.VideoDurationInSeconds, ThumbnailUrl = channelVideo.ThumbnailUrl }; return(video); }
public async Task <List <Video> > GetChannelVideos(string channelId) { // create request for videos var query = string.Format("{0}/_api/VideoService/Channels('{1}')/Videos", await SpHelper.GetVideoPortalRootUrl(), channelId); // issue request & get response var response = await _client.GetAsync(query); string responseString = await response.Content.ReadAsStringAsync(); // convert response to object var jsonResponse = JsonConvert.DeserializeObject <JsonHelpers.ChannelVideosCollection>(responseString); // convert to model object var videos = new List <Video>(); foreach (var channelVideo in jsonResponse.Data.Results) { var video = new Video { ChannelId = channelId, VideoId = channelVideo.ID, Title = channelVideo.Title, DisplayFormUrl = channelVideo.DisplayFormUrl, DurationInSeconds = channelVideo.VideoDurationInSeconds, ViewCount = channelVideo.ViewCount, ThumbnailUrl = channelVideo.ThumbnailUrl, Description = channelVideo.Description }; videos.Add(video); } return(videos.OrderBy(v => v.Title).ToList()); }
private void DrawAtlas(SpAtlas atlas) { EditorGUILayout.LabelField("Atlas", EditorStyles.boldLabel); var rect = SpHelper.Reserve(14.0f); var width = rect.width / 3.0f; var rect0 = rect; rect0.width = width; rect0.x = rect.x + width * 0; rect0.xMax -= 2; var rect1 = rect; rect1.width = width; rect1.x = rect.x + width * 1; rect1.xMin += 1; rect1.xMax -= 1; var rect2 = rect; rect2.width = width; rect2.x = rect.x + width * 2; rect2.xMin += 2; if (GUI.Button(rect0, "Update", EditorStyles.miniButton) == true) { atlas.Update(); } EditorGUI.BeginDisabledGroup(atlas.Texture == null); { if (GUI.Button(rect1, "Select", EditorStyles.miniButton) == true) { Selection.activeObject = atlas.Texture; } if (GUI.Button(rect2, "Link", EditorStyles.miniButton) == true) { SpLink_Wizard.Open(atlas); } } EditorGUI.EndDisabledGroup(); }
public IEnumerable <StateModel> ListOfState(int CountryId) { List <StateModel> stateModel = new List <StateModel>(); stateModel = SpHelper <StateModel> .GetListWithRawSql("usp_StateList").ToList(); return(stateModel); }
public IEnumerable <University_CollegeModel> ListOfUniversity_college() { List <University_CollegeModel> University_CollegeModel = new List <University_CollegeModel>(); University_CollegeModel = SpHelper <University_CollegeModel> .GetListWithRawSql("usp_University_CollegeList").ToList(); return(University_CollegeModel); }
public IEnumerable <CompanyModel> ListOfCompany() { List <CompanyModel> CompanyModel = new List <CompanyModel>(); CompanyModel = SpHelper <CompanyModel> .GetListWithRawSql("usp_CompanyList").ToList(); return(CompanyModel); }
public IEnumerable <DesignationModel> ListOfDesigation() { List <DesignationModel> DesignationModel = new List <DesignationModel>(); DesignationModel = SpHelper <DesignationModel> .GetListWithRawSql("usp_DesignationList").ToList(); return(DesignationModel); }
public IEnumerable <CityModel> ListofCity(int State) { List <CityModel> cityModel = new List <CityModel>(); cityModel = SpHelper <CityModel> .GetListWithRawSql("usp_CityList").ToList(); return(cityModel); }
public IEnumerable <CountryModel> ListOfCountry() { List <CountryModel> countryModels = new List <CountryModel>(); countryModels = SpHelper <CountryModel> .GetListWithRawSql("usp_CountryList").ToList(); return(countryModels); }
private static List <SpRect> CompileSources(List <SpSource> sources) { var rects = new List <SpRect>(); for (var i = sources.Count - 1; i >= 0; i--) { var source = sources[i]; var sourceTexture = source.Texture; if (sourceTexture != null) { var sourcePath = source.Path; var sourcePixels = default(SpPixels); var sourceSprites = source.Sprites; var sourceImporter = SpHelper.GetAssetImporter <TextureImporter>(sourcePath); if (sourceImporter != null) { // Make the texture temporarily readable, or directly read pixels if (sourceImporter.isReadable == false) { sourceImporter.isReadable = true; SpHelper.ReimportAsset(sourcePath); { sourcePixels = new SpPixels(sourceTexture); } sourceImporter.isReadable = false; SpHelper.ReimportAsset(sourcePath); } else { sourcePixels = new SpPixels(sourceTexture); } // Add sprites or whole texture if (sourceSprites.Count > 0) { for (var j = 0; j < sourceSprites.Count; j++) { var sourceSprite = sourceSprites[j]; CompileRect(rects, source, sourcePixels.GetSubset(sourceSprite.rect), sourceSprite.name, sourceSprite); } } else { CompileRect(rects, source, sourcePixels, sourceTexture.name); } continue; } } sources.RemoveAt(i); } rects.Sort((a, b) => Mathf.Max(b.W, b.H) - Mathf.Max(a.W, a.H)); return(rects); }
public IEnumerable <OtherMasterModel> ListOfOtherMaster() { List <OtherMasterModel> otherMasterModel = new List <OtherMasterModel>(); otherMasterModel = SpHelper <OtherMasterModel> .GetListWithRawSql("usp_otherMasterList").ToList(); return(otherMasterModel); }
public bool Delete(IList <int> entities) { if (entities.Count == 0) { return(false); } var list = String.Join(",", entities); var sp = new SpHelper().Add("ids", list, 1000); var a = db.SqlQuery <int>(sp.ToSpString("DeleteNhanViens"), sp.GetObject()).ToList().FirstOrDefault(); return(a == 1); }
/// <summary> /// Gets stored procedure result. /// </summary> /// <typeparam name="TEntity">Type of entity.</typeparam> /// <typeparam name="TResult">Type of result.</typeparam> /// <param name="name">name of stored procedure</param> /// <param name="parameters">parameters of stored procedure</param> /// <param name="storedProcedureReturnData">stored procedure return data type</param> /// <returns>result</returns> private async Task <TResult> GetSpResult <TEntity, TResult>( string name, IEnumerable <KeyValuePair <string, object> > parameters, StoredProcedureReturnData storedProcedureReturnData) where TEntity : class { var sp = SpHelper.CreateSp(name, parameters, storedProcedureReturnData); var dbResult = await this.ExecuteAsync <TEntity>(sp); var result = SpHelper.GetResult <TResult>(dbResult); return(result); }
private void DrawPivot(SpSource source) { var rect = SpHelper.Reserve(); var rect1 = rect; rect1.xMax = EditorGUIUtility.labelWidth + 32.0f; var rect2 = rect; rect2.xMin += EditorGUIUtility.labelWidth + 16.0f; source.UseCustomPivot = EditorGUI.Toggle(rect1, "Custom Pivot", source.UseCustomPivot); if (source.UseCustomPivot == true) { source.CustomPivot = EditorGUI.Vector2Field(rect2, "", source.CustomPivot); } }
public async Task DeleteChannelVideo(string channelId, string videoId) { var videoServiceUrl = await SpHelper.GetVideoPortalRootUrl(); // create request for videos var query = string.Format("{0}/_api/VideoService/Channels('{1}')/Videos('{2}')", await SpHelper.GetVideoPortalRootUrl(), channelId, videoId); // set request header method _client.DefaultRequestHeaders.Add("X-HTTP-Method", "DELETE"); // issue request await _client.PostAsync(query, null); }
private void DrawBorder(SpSource source) { var rect = SpHelper.Reserve(); var rect1 = rect; rect1.xMax = EditorGUIUtility.labelWidth + 32.0f; var rect2 = rect; rect2.xMin += EditorGUIUtility.labelWidth + 16.0f; rect2.y -= 16.0f; source.UseCustomBorder = EditorGUI.Toggle(rect1, "Custom Border", source.UseCustomBorder); if (source.UseCustomBorder == true) { source.CustomBorder = EditorGUI.Vector4Field(rect2, default(string), source.CustomBorder); } }
public void OnGUI() { if (atlas != null) { EditorGUILayout.HelpBox("This tool will replace all your non-atlas sprites with these atlas sprites (e.g. in your prefabs & scripts)", MessageType.Info); EditorGUILayout.Separator(); inScenes = (SpLink_Scene)EditorGUILayout.EnumPopup("In Scenes", inScenes); inPrefabs = EditorGUILayout.Toggle("In Prefabs", inPrefabs); inScriptableObjects = EditorGUILayout.Toggle("In Scriptable Objects", inScriptableObjects); inAnimationClips = EditorGUILayout.Toggle("In Animation Clips", inAnimationClips); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Replace", EditorStyles.boldLabel); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); { for (var i = 0; i < sourceSprites.Length; i++) { var rect = SpHelper.Reserve(); var rect0 = rect; rect0.xMax = rect0.center.x - 20; var rect1 = rect; rect1.xMin = rect1.center.x + 20; var rect2 = rect; rect2.xMin = rect2.center.x - 20; rect2.xMax = rect2.center.x + 20; if (sourceSprites[i] == null) { GUI.Box(rect0, "", SpHelper.RedBox); } sourceSprites[i] = (Sprite)EditorGUI.ObjectField(rect0, sourceSprites[i], typeof(Sprite), true); packedSprites[i] = (Sprite)EditorGUI.ObjectField(rect1, packedSprites[i], typeof(Sprite), true); EditorGUI.LabelField(rect2, "With"); } } EditorGUILayout.EndScrollView(); EditorGUILayout.Separator(); DrawButtons(); } else { Close(); } }
private static void consumer_Listener(IMessage message) { string projectId = string.Empty; try { ITextMessage msg = (ITextMessage)message; Dictionary <string, object> param = MqConsumerBase.ReadMapFromJson(msg.Text); AgentApiAp apBll = ApFactory.GetAp(param["deviceModel"].ToString()); projectId = param["projectId"].ToString(); log.Info(msg.NMSMessageId, projectId); if (msg.NMSType == "PostWebRequest") { string param1 = param["dns2"].ToString(); log.Info("执行命令,参数是" + param1, projectId); Thread.Sleep(1000 * 3); string url = "http://192.168.0.1/goform/NetWorkSetupSave"; string param11 = string.Format("Go=index.htm&con-type=0&adsl-user=302000230640&adsl-pwd=36663381&ssid=sss&ssid-pwd=lizc580231&ipval=192.168.163.82&submask=255.255.255.0&gateway=192.168.163.1&dns1=114.114.114.114&dns2={0}", param1); string ret = HttpHelper.PostWebRequest(url, param11); log.Info("回复消息,执行成功", projectId); MqAgentProducer.SendResponse(msg.NMSMessageId, StepTestStatus.测试通过, "我已经成功执行了"); } else if (msg.NMSType == "ModifySp") { string param1 = param["p1"].ToString(); SpHelper sp = new SpHelper(); sp.ModifySp(param1); log.Info("执行命令,参数是" + param1, projectId); Thread.Sleep(1000 * 3); WriteLogAndSendResponse(msg.NMSMessageId, "回复消息,我已经完成任务!", StepTestStatus.测试通过, "", projectId, param["caseId"].ToString(), param["stepId"].ToString()); } else if (msg.NMSType == "InitApConfig") { string ip = param["ip"].ToString(); string user = param["user"].ToString(); string pwd = param["password"].ToString(); List <string> commandList = ((Newtonsoft.Json.Linq.JArray)param["cfgCommand"]).Select(s => s.ToString()).ToList(); apBll.InitApConfig(ip, user, pwd, commandList); Thread.Sleep(1000 * 3); Dictionary <string, string> response = new Dictionary <string, string>(); WriteLogAndSendResponse(msg.NMSMessageId, "回复消息,我已经完成任务!", StepTestStatus.测试通过, "", projectId, param["caseId"].ToString(), param["stepId"].ToString()); } } catch (Exception ex) { log.Info(ex.Message, projectId); } }
public IEnumerable <NhanVien> GetListByPaging(string value, string index, int page, int size, string sort, out int total) { var sp = new SpHelper() .Add("value", value) .Add("index", index) .Add("page", page) .Add("size", size) .Add("sort", sort, 50) .Add("totalrow", 0, -1, true); var list = db.SqlQuery <NhanVien>(sp.ToSpString("GetNhanVienByPagingFilter"), sp.GetObject()).ToList <NhanVien>(); total = (int)sp.GetParam("totalrow").Value; return(list); }
void ProcessDecisionsIntoDgv(SeasonPlannerDecision[] spDecisions, int _initialRaceId, SeasonPlannerFullLine spFull) { dtSeasonPlanner.Clear(); int initialRaceId = _initialRaceId; spDecisions = spDecisions.Where(x => x != null).ToArray(); for (int raceIndex = initialRaceId; raceIndex < 17; raceIndex++) { spFull.spDecisions = spDecisions[raceIndex - initialRaceId]; //spDecisions[j - initialRaceId]; spFull.spTable.SeasonRaceNumber = raceIndex; spFull = SpHelper.ProcessSeasonPlanner(spFull); WriteSpFullToDgv(spFull); } }
public AccountModel UserLogin(string EmailID, string Password) { try { string DecrPassword = Common.Common.Encryptdata(Password); var objUserRes = SpHelper <AccountModel> .GetListWithRawSql("Sp_LoginCheck @Emaild,@passWord", new SqlParameter { ParameterName = "@Emaild", DbType = DbType.String, Value = EmailID }, new SqlParameter { ParameterName = "@passWord", DbType = DbType.String, Value = DecrPassword }).FirstOrDefault(); return(objUserRes); } catch (Exception ex) { } return(null); }
private void DrawDragAndDrop(SpAtlas atlas) { var dropRect = SpHelper.Reserve(48.0f); // Open drag and drop window? if (GUI.Button(dropRect, "Add Textures\n(Drag And Drop)") == true) { var drop = SpDrop_Window.Open(); drop.CurrentAtlas = atlas; drop.Repaint(); } SpHelper.DrawDragAndDropZone(dropRect); SpHelper.HandleDradAndDrop(atlas, dropRect); }
public void Trim() { if (Source.Trim == true && Source.PadStyle == SpPadStyle.Transparent) { var sourceRect = new Rect(0.0f, 0.0f, Pixels.Width, Pixels.Height); var trimmedRect = default(Rect); var pivotX = Pivot.x * sourceRect.width; var pivotY = Pivot.y * sourceRect.height; Pixels = Pixels.GetTrimmed(ref trimmedRect, ref Border); pivotX = SpHelper.Divide(pivotX - trimmedRect.xMin, trimmedRect.width); pivotY = SpHelper.Divide(pivotY - trimmedRect.yMin, trimmedRect.height); Pivot = new Vector2(pivotX, pivotY); } W = Pixels.Width + Source.PadSize * 2; H = Pixels.Height + Source.PadSize * 2; }
public async Task <byte[]> GetVideoThumbnail(string channelid, string videoid, string preferredwidth) { HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken); var url = await SpHelper.GetVideoPortalRootUrl() + $"/_api/VideoService/Channels('{channelid}')/Videos('{videoid}')/ThumbnailStream('{preferredwidth}')"; var response = await client.GetAsync(url); // https://techcommunity.microsoft.com/t5/Office-365-Video/Video-thumbnail-URL-broken-when-using-OAuth/td-p/7956 if (response.StatusCode == HttpStatusCode.OK) { //var resultString = response.Content.ReadAsStringAsync().Result; Stream imageStream = await response.Content.ReadAsStreamAsync(); byte[] bytes = new byte[imageStream.Length]; imageStream.Read(bytes, 0, (int)imageStream.Length); return(bytes); } return(null); }
public async Task <VideoChannel> GetChannel(string channelId) { var query = string.Format("{0}/_api/VideoService/Channels('{1}')", await SpHelper.GetVideoPortalRootUrl(), channelId); // issue request & get response var response = await _client.GetAsync(query); string responseString = await response.Content.ReadAsStringAsync(); // convert response to object var jsonResponse = JsonConvert.DeserializeObject <JsonHelpers.VideoChannelSingle>(responseString); var channel = new VideoChannel { Id = jsonResponse.Data.Id, HtmlColor = jsonResponse.Data.TileHtmlColor, Title = jsonResponse.Data.Title, Description = jsonResponse.Data.Description, ServerRelativeUrl = jsonResponse.Data.ServerRelativeUrl }; return(channel); }
private static void CompileRect(List <SpRect> rects, SpSource source, SpPixels pixels, string name, Sprite sprite = null) { var newRect = new SpRect(); newRect.Name = name; newRect.Source = source; newRect.Pixels = pixels; // Read pivot and border from sprite if (sprite != null) { newRect.Pivot = SpHelper.GetSpritePivot(sprite); newRect.Border = sprite.border; } // Use default pivot and border settings else { newRect.Pivot = new Vector2(0.5f, 0.5f); newRect.Border = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); } // Override the pivot? if (source.UseCustomPivot == true) { newRect.Pivot = source.CustomPivot; } // Override the border? if (source.UseCustomBorder == true) { newRect.Border = source.CustomBorder; } newRect.Trim(); rects.Add(newRect); }
SeasonPlannerResult GetBestDecisionThread3(int initialRaceId, SeasonPlannerFullLine spFull, Random random) { SeasonPlannerDecision[] spDecisions = new SeasonPlannerDecision[17]; SeasonPlannerDecision[] bestSpDecisions = new SeasonPlannerDecision[17]; //Generate and test spDecision for (int j = initialRaceId; j < 17; j++) { spDecisions[j - initialRaceId] = SpHelper.GenerateRandomDecisionValues(random); spFull.spDecisions = spDecisions[j - initialRaceId]; spFull.spTable.SeasonRaceNumber = j; spFull = SpHelper.ProcessSeasonPlanner(spFull); } SeasonPlannerResult spDecBal = new SeasonPlannerResult(); spDecBal.spDecisions = (SeasonPlannerDecision[])spDecisions.Clone(); spDecBal.random = random; spDecBal.finalPoints = spFull.spTab.CurrentPoints; spDecBal.finalBalanceM = spFull.spTable.BalanceAfterRaceM; return(spDecBal); }
public void OnGUI() { var dropRect = SpHelper.Reserve(position.height - 2.0f); if (CurrentAtlas != null) { if (GUI.Button(dropRect, "Add To " + CurrentAtlas.name + "\n(Drag And Drop)") == true) { Selection.activeObject = CurrentAtlas; } SpHelper.DrawDragAndDropZone(dropRect); SpHelper.HandleDradAndDrop(CurrentAtlas, dropRect); } else { EditorGUI.BeginDisabledGroup(true); { GUI.Button(dropRect, "No Atlas Selected"); } EditorGUI.EndDisabledGroup(); } }
private void DrawButtons() { var rect = SpHelper.Reserve(); var rect0 = rect; rect0.xMax = rect0.center.x - 1; var rect1 = rect; rect1.xMin = rect1.center.x + 1; if (GUI.Button(rect0, "Link Sprites") == true) { switch (inScenes) { case SpLink_Scene.This: { LinkInScene(); } break; case SpLink_Scene.All: { #if OLD_SCENE_MANAGEMENT if (EditorApplication.SaveCurrentSceneIfUserWantsTo() == true) { var currentScene = EditorApplication.currentScene; var sceneGuids = AssetDatabase.FindAssets("t:scene"); foreach (var sceneGuid in sceneGuids) { var scenePath = AssetDatabase.GUIDToAssetPath(sceneGuid); if (EditorApplication.OpenScene(scenePath) == true) { LinkInScene(); EditorApplication.SaveScene(); } } EditorApplication.OpenScene(currentScene); } #else if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo() == true) { var setup = EditorSceneManager.GetSceneManagerSetup(); var sceneGuids = AssetDatabase.FindAssets("t:scene"); foreach (var sceneGuid in sceneGuids) { var scenePath = AssetDatabase.GUIDToAssetPath(sceneGuid); var scene = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single); if (scene.isLoaded == true) { LinkInScene(); EditorSceneManager.SaveScene(scene); } } EditorSceneManager.RestoreSceneManagerSetup(setup); } #endif } break; } if (inPrefabs == true) { LinkInPrefabs(); } if (inScriptableObjects == true) { LinkInScriptableObjects(); } if (inAnimationClips == true) { LinkInAnimationClips(); } #if OLD_SCENE_MANAGEMENT EditorApplication.MarkSceneDirty(); #else EditorSceneManager.MarkAllScenesDirty(); #endif } if (GUI.Button(rect1, "Cancel") == true) { Close(); } }