public IActionResult ShareProductByEmail(long id, ShareInfo info) { var config = new ConfigurationBuilder().AddJsonFile("appsettings.Development.Json").Build(); var product = _context.Products.SingleOrDefault(x => x.Id == id); if (product != null) { var emailBuilder = new EmailBuilder(product, info.TargetEmail); try { emailBuilder.SendEmail(); TempData["OperationStatus"] = "Success"; } catch { TempData["OperationStatus"] = "Fail"; } } else { TempData["OperationStatus"] = "Fail"; } return(RedirectToAction("Index", "Shop")); }
/// <summary> /// Gets the fundamental data for the share with the supplied symbol. /// </summary> /// <param name="symbol">The share symbol.</param> /// <returns>The share's fundamental data.</returns> public ShareFundamentals GetShareFundamentals(string symbol) { if (string.IsNullOrWhiteSpace(symbol)) { throw new ArgumentException($"Argument '{nameof(symbol)}' is required."); } // Get the share information. ShareInfo info = _shareInfoProvider.GetShareInfo(symbol); if (info == null) { return(null); } var fundamentals = new ShareFundamentals(info.Symbol, info.Name, info.Industry); Task[] tasks = new[] { GetKeyStatistics(symbol, fundamentals), GetPriceHistory(symbol, fundamentals) }; Task.WaitAll(tasks); // PE Ratio not provided by Yahoo. We have to calculate it manually. if (fundamentals.PreviousClose.HasValue && fundamentals.EarningsShare.HasValue) { fundamentals.PERatio = Math.Round(fundamentals.PreviousClose.Value / fundamentals.EarningsShare.Value, 2); } return(fundamentals); }
public async Task <IEnumerable <ShareInfo> > GetOwnerShareInfoAsync(int buildingId, DateTime from, DateTime to) { var result = new List <ShareInfo>(); using (var connection = new SqlConnection(_connectionString)) { using (var cmd = new SqlCommand()) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "[dbo].[SpOwnershipGetShareInfo]"; cmd.Parameters.AddWithValue("@buildingId", buildingId); cmd.Parameters.AddWithValue("@from", from); cmd.Parameters.AddWithValue("@to", to); cmd.Connection = connection; cmd.Connection.Open(); using (var dataReader = await cmd.ExecuteReaderAsync()) { while (await dataReader.ReadAsync()) { var shareInfo = new ShareInfo(); shareInfo.BuildingId = Convert.ToInt32(dataReader["BuildingID"]); shareInfo.UnitId = Convert.ToInt32(dataReader["UnitID"]); shareInfo.PersonId = Convert.ToInt32(dataReader["PersonID"]); shareInfo.Days = Convert.ToInt32(dataReader["Days"]); shareInfo.Area = Convert.ToDecimal(dataReader["Area"]); shareInfo.NumberOfPeopel = 0; result.Add(shareInfo); } } } } return(result); }
public void ShouldAddNewShare() { // Arrange var shareService = new ShareService( this.shareRepository, this.shareTypeRepository, this.stockRepository, this.traderRepository); ShareInfo shareInfo = new ShareInfo { Amount = 2, StockId = 1, ShareTypeId = 1, OwnerId = 1 }; this.shareTypeRepository.GetById(1) .Returns(new ShareTypeEntity { }); this.stockRepository.GetById(1) .Returns(new StockEntity { }); this.traderRepository.GetById(1) .Returns(new TraderEntity { }); // Act shareService.AddNewShare(shareInfo); // Assert this.shareRepository.Received(1).Add(Arg.Any <ShareEntity>()); this.shareRepository.Received(1).SaveChanges(); }
internal static IAbsoluteDirectoryPath[] GetExistingUNCShares() { try { var list = new List <IAbsoluteDirectoryPath>(); foreach (var item in GetNetServers("WORKGROUP", Win32MethodsNetwork.SV_101_TYPES.SV_TYPE_ALL)) { var serverInfo = ServerInfo.FromNetApi32(item); foreach (var itemShare in GetNetShares(serverInfo.Name)) { var shareInfo = new ShareInfo(itemShare); if (shareInfo.IsHidden || shareInfo.IsPrinter) { continue; } list.Add((@"\\" + serverInfo.Name + @"\" + shareInfo.Name).ToAbsoluteDirectoryPath()); } } return(list.ToArray()); } catch { // 20Jan2014: so far didn't happen, but don't trust too much this code return(new IAbsoluteDirectoryPath[0]); } }
public void ShouldNotAddNewShareIfShareTypeDoesntExist() { // Arrange var shareService = new ShareService( this.shareRepository, this.shareTypeRepository, this.stockRepository, this.traderRepository); ShareInfo shareInfo = new ShareInfo { Amount = 2, StockId = 1, ShareTypeId = 1, OwnerId = 1 }; this.stockRepository.GetById(1) .Returns(new StockEntity { }); this.traderRepository.GetById(1) .ReturnsNull(); this.shareTypeRepository.GetById(1) .ReturnsNull(); // Act shareService.AddNewShare(shareInfo); }
/// <summary> /// 微信分享网页 /// </summary> /// <param name="url">网址</param> /// <param name="title">标题</param> /// <param name="desc">描述</param> /// <param name="thumb">缩略图在asset中的名称,如:thumb.png</param> /// <param name="scene">发送的场景</param> public static void ShareWebpage(string url, string title, string desc, string thumb, Scene scene) { Log("ShareWebpage,url = " + url); int sceneInt = (int)scene; LastShareInfo = new ShareInfo { Scene = scene, Type = ShareType.ShareWeb }; try { #if UNITY_ANDROID using (AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject activity = cls_UnityPlayer.GetStatic <AndroidJavaObject>("currentActivity")) { AndroidJavaClass cls = new AndroidJavaClass("com.morln.game.plugin.wechat.UnityWechat"); cls.CallStatic("shareWebpage", activity, url, title, desc, thumb, sceneInt); } } #elif UNITY_IPHONE _wxShareWebpage(url, title, desc, thumb, sceneInt); #endif } catch (Exception exception) { Debug.LogError(exception.Message); } }
protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs p_args) { var info = new ShareInfo(); await info.Init(p_args.ShareOperation); await Startup.Launch <Stub>(null, info); }
public ActionResult GetShareinfos() { //don't 处理 //using (MyDatabaseEntities dc = new MyDatabaseEntities()) //{ // var shareinfos = dc.ShareInfoes.OrderBy(a => a.Title).ToList(); // return Json(new { data = shareinfos }, JsonRequestBehavior.AllowGet); //} List <ShareInfo> shareinfolist = new List <ShareInfo>(); //需要改变值,所有用循环 WechatEntities dc = new WechatEntities(); for (int i = 0; i < dc.ShareInfoes.ToList().Count; i++) { ShareInfo myshareinfo = new ShareInfo(); myshareinfo.Id = dc.ShareInfoes.Local[i].Id; myshareinfo.Title = dc.ShareInfoes.Local[i].Title; myshareinfo.Description = dc.ShareInfoes.Local[i].Description; myshareinfo.Image = string.Format(@"<img src='{0}' alt='' border=3 height=30 width=40>", dc.ShareInfoes.Local[i].Image); var pageinfo = dc.Pageinexinfoes.Where(a => a.shareinfoID == myshareinfo.Id).FirstOrDefault(); myshareinfo.ShareURL = pageinfo != null ? "http://www.bbpdt.cn/pages/index" + pageinfo.shareinfoID.ToString() + ".html" : ""; myshareinfo.AuthorID = dc.ShareInfoes.Local[i].AuthorID; myshareinfo.InputDate = dc.ShareInfoes.Local[i].InputDate; shareinfolist.Add(myshareinfo); } //return Json(shareinfolist); return(Json(new { data = shareinfolist }, JsonRequestBehavior.AllowGet)); }
public List <ShareInfo> EnumNetShares(string Server) { List <ShareInfo> ShareInfos = new List <ShareInfo>(); int entriesread = 0; int totalentries = 0; int resume_handle = 0; int nStructSize = Marshal.SizeOf(typeof(ShareInfo)); IntPtr bufPtr = IntPtr.Zero; StringBuilder server = new StringBuilder(Server); int ret = NetShareEnum(server, 2, ref bufPtr, MAX_PREFERRED_LENGTH, ref entriesread, ref totalentries, ref resume_handle); if (ret == SuccessCode) { IntPtr currentPtr = bufPtr; for (int i = 0; i < entriesread; i++) { ShareInfo shi1 = (ShareInfo)Marshal.PtrToStructure(currentPtr, typeof(ShareInfo)); ShareInfos.Add(shi1); currentPtr = new IntPtr(currentPtr.ToInt32() + nStructSize); } NetApiBufferFree(bufPtr); return(ShareInfos); } else { return(new List <ShareInfo>()); } }
public static ShareInfo GetPayInfo(string prepayid) { var shareInfo = new ShareInfo(); //检查是否已经注册jssdk if (!JsApiTicketContainer.CheckRegistered(ConfigHelper.WeChatAppId)) { JsApiTicketContainer.Register(ConfigHelper.WeChatAppId, ConfigHelper.WeChatSecret); } JsApiTicketResult jsApiTicket = JsApiTicketContainer.GetJsApiTicketResult(ConfigHelper.WeChatAppId); JSSDKHelper jssdkHelper = new JSSDKHelper(); shareInfo.Ticket = jsApiTicket.ticket; shareInfo.CorpId = ConfigHelper.WeChatAppId.ToLower(); shareInfo.Noncestr = JSSDKHelper.GetNoncestr().ToLower(); shareInfo.Timestamp = JSSDKHelper.GetTimestamp().ToLower(); shareInfo.Package = "prepay_id=" + prepayid.ToLower(); RequestHandler requestHandler = new RequestHandler(HttpContext.Current); requestHandler.SetParameter("appId", shareInfo.CorpId); requestHandler.SetParameter("timeStamp", shareInfo.Timestamp); requestHandler.SetParameter("nonceStr", shareInfo.Noncestr); requestHandler.SetParameter("package", shareInfo.Package); requestHandler.SetParameter("signType", "MD5"); requestHandler.SetKey(tenPayV3Info.Key); requestHandler.CreateMd5Sign(); requestHandler.GetRequestURL(); requestHandler.CreateSHA1Sign(); shareInfo.PaySign = (requestHandler.GetAllParameters()["sign"]).ToString(); return(shareInfo); }
public void Test_PopulateShareStatFromYahoo() { ShareInfoBLL sibll = new ShareInfoBLL(_unit); ShareInfo info = new ShareInfo(); sibll.GetShareStatFromYahoo("ORG.AX", info); }
public static ShareInfo GetItem(int?Id) { if (Id == null) { return(null); } if (itemCacheTimeout <= 0) { return(dal.GetItem(Id)); } string key = string.Concat("DC2016_BLL_Share_", Id); string value = RedisHelper.Get(key); if (!string.IsNullOrEmpty(value)) { try { return(new ShareInfo(value)); } catch { } } ShareInfo item = dal.GetItem(Id); if (item == null) { return(null); } RedisHelper.Set(key, item.Stringify(), itemCacheTimeout); return(item); }
public void ShouldNotUpdateShareIfStockDoesntExist() { // Arrange var shareService = new ShareService( this.shareRepository, this.shareTypeRepository, this.stockRepository, this.traderRepository); ShareInfo shareInfo = new ShareInfo { Id = 1, Amount = 2, StockId = 1, ShareTypeId = 1, OwnerId = 1 }; ShareEntity shareToUpdate = new ShareEntity { Id = 1 }; this.shareRepository.GetById(1) .Returns(shareToUpdate); this.stockRepository.GetById(1) .ReturnsNull(); // Act shareService.UpdateShare(shareInfo); }
public void OnShareSimpleText(ShareInfo shI) { #if UNITY_ANDROID StartCoroutine (ShareAndroidText ()); #elif UNITY_IPHONE || UNITY_IPAD GeneralSharingiOSBridge.ShareSimpleText ("Hello !!!"); #endif }
public static DC2016.DAL.Share.SqlUpdateBuild UpdateDiy(ShareInfo item, int?Id) { if (itemCacheTimeout > 0) { RemoveCache(item != null ? item : GetItem(Id)); } return(new DC2016.DAL.Share.SqlUpdateBuild(item, Id)); }
private static void RemoveCache(ShareInfo item) { if (item == null) { return; } RedisHelper.Remove(string.Concat("DC2016_BLL_Share_", item.Id)); }
public void Update(int id, ShareInfo args) { ShareEntity share = repo.GetShareById(id); share.Name = args.Name ?? share.Name; share.CompanyName = args.CompanyName ?? share.CompanyName; repo.SaveChanges(); }
public static int Update(ShareInfo item) { if (itemCacheTimeout > 0) { RemoveCache(item); } return(dal.Update(item)); }
public void initUI(int _type, ShareInfo _info) { info = _info; tapType = _type; showType = info.type; showItem.fatherWindow = fatherWindow; showUI(); }
public static ShareInfo Insert(ShareInfo item) { item = dal.Insert(item); if (itemCacheTimeout > 0) { RemoveCache(item); } return(item); }
private void appbar_button_Share_Click(object sender, EventArgs e) { ShareLinkTask shareLinkTask = new ShareLinkTask(); ShareInfo appInfo = new ShareInfo(); shareLinkTask.Title = PhoneHelper.GetAppAttribute("Title"); shareLinkTask.LinkUri = new Uri(appInfo.LinkUri, UriKind.Absolute); shareLinkTask.Message = appInfo.LinkMessage; shareLinkTask.Show(); }
public ShareInfo Insert(ShareInfo item) { int loc1; if (int.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1)) { item.Id = loc1; } return(item); }
public void LoadIsMyPraised(ShareInfo shareInfo) { if (CurrentPrincipal == null) { return; } var userId = CurrentPrincipal.UserId; shareInfo.IsMyPraised = CurrentDB.PraiseUsers.Any(o => o.UserId == userId && o.ShareId == shareInfo.Id); }
public IHttpActionResult Post(ShareInfo shareInfo) { ShareInfo output = null; if (shareInfo.Id > 0) { output = new ShareInfoBLL(_unit).UpdateShareInfo(shareInfo); } return(Ok(output)); }
/// <summary> /// Share the screenshot with a windows app /// </summary> /// <param name="manuallyInitiated"></param> /// <param name="surface"></param> /// <param name="captureDetails"></param> /// <returns>ExportInformation</returns> protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); try { var triggerWindow = new Window { WindowState = WindowState.Normal, WindowStartupLocation = WindowStartupLocation.CenterScreen, Width = 400, Height = 400 }; triggerWindow.Show(); var shareInfo = new ShareInfo(); // This is a bad trick, but don't know how else to do it. // Wait for the focus to return, and depending on the state close the window! triggerWindow.WindowMessages() .Where(m => m.Message == WindowsMessages.WM_SETFOCUS).Delay(TimeSpan.FromSeconds(1)) .Subscribe(info => { if (shareInfo.ApplicationName != null) { return; } shareInfo.ShareTask.TrySetResult(false); }); var windowHandle = new WindowInteropHelper(triggerWindow).Handle; Share(shareInfo, windowHandle, surface, captureDetails).Wait(); Log.Debug().WriteLine("Sharing finished, closing window."); triggerWindow.Close(); if (string.IsNullOrWhiteSpace(shareInfo.ApplicationName)) { exportInformation.ExportMade = false; } else { exportInformation.ExportMade = true; exportInformation.DestinationDescription = shareInfo.ApplicationName; } } catch (Exception ex) { exportInformation.ExportMade = false; exportInformation.ErrorMessage = ex.Message; } ProcessExport(exportInformation, surface); return(exportInformation); }
public void Inits(ShareInfo info) { gameTypeLb.text = info.gameType; allJsLb.text = "共对局:" + info.allJs.ToString(); timeLb.text = string.Format("{0}月{1}日 {2}:{3}", info.gameTime.Month.ToString("D2"), info.gameTime.Day.ToString("D2"), info.gameTime.Hour.ToString("D2"), info.gameTime.Minute.ToString("D2")); UIUtils.DestroyChildren(parent); for (int i = 0; i < info.playerInfos.Count; i++) { Instantiate(prefab, parent).GetComponent <ShareItem>().Inits(info.playerInfos[i]); } }
/// <summary> /// 获取微信分享数据 /// </summary> /// <param name="info"></param> private void SendWechatShare(ShareInfo info) { var wechatApi = Facade.Instance <WeChatApi>(); wechatApi.InitWechat(); if (!wechatApi.CheckWechatValidity()) { return; } _curShareInfo = info; wechatApi.ShareContent(info, OnShareSuccess, null, OnShareFailed); }
public void Update(int id, ShareInfo args) { try { this.shareServices.Update(id, args); Logger.Log.Info($"Акция с id {id} изменена"); } catch (Exception ex) { Logger.Log.Error(ex.Message); } }
private void SendWechatShare(ShareInfo info) { var wechatApi = Facade.Instance <WeChatApi>(); string appId = App.Config.WxAppId; if (string.IsNullOrEmpty(appId)) { return; } wechatApi.InitWechat(appId); wechatApi.ShareContent(info, OnShareSuccess, null, OnShareFailed); }
public void Insert(ShareInfo entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } using (var db = new BaseDatabaseContext()) { db.ShareInfos.Add(entity); db.SaveChanges(); } }
public void OnShareTextWithImage(ShareInfo shI) { //Debug.Log ("Media Share"); #if UNITY_ANDROID StartCoroutine (SaveAndShare (shI.text)); #elif UNITY_IPHONE || UNITY_IPAD byte[] bytes = MyImage.EncodeToPNG (); string path = Application.persistentDataPath + "/MyImage.png"; File.WriteAllBytes (path, bytes); string path_ = "MyImage.png"; StartCoroutine (ScreenshotHandler.Save (path_, "Media Share", true)); #endif }
internal static IAbsoluteDirectoryPath[] GetExistingUNCShares() { try { var list = new List<IAbsoluteDirectoryPath>(); foreach (var item in GetNetServers("WORKGROUP", Win32MethodsNetwork.SV_101_TYPES.SV_TYPE_ALL)) { var serverInfo = ServerInfo.FromNetApi32(item); foreach (var itemShare in GetNetShares(serverInfo.Name)) { var shareInfo = new ShareInfo(itemShare); if (shareInfo.IsHidden || shareInfo.IsPrinter) { continue; } list.Add((@"\\" + serverInfo.Name + @"\" + shareInfo.Name).ToAbsoluteDirectoryPath()); } } return list.ToArray(); } catch { // 20Jan2014: so far didn't happen, but don't trust too much this code return new IAbsoluteDirectoryPath[0]; } }
/// <summary> /// Internal ctor, GettShares class creates new instance for this class /// </summary> /// <param name="gettUser">GettUser class</param> /// <param name="gettShareInfo">Information for this share</param> internal GettShare(GettUser gettUser, ShareInfo gettShareInfo) { _gettUser = gettUser; GettShareInfo = gettShareInfo; }
/// <summary> /// Refresh share information and all files. /// </summary> public bool Refresh() { // Build Uri. var baseUri = new UriBuilder(BaseUri); baseUri.Path = baseUri.Path + string.Format(ShareList, GettShareInfo.ShareName); baseUri.Query = string.Format("accesstoken={0}", _gettUser.Token.AccessToken); // GET request. var gett = new WebClient { Encoding = Encoding.UTF8 }; byte[] response = gett.DownloadData(baseUri.Uri); // Response. var shareInfo = JsonConvert.DeserializeObject<ShareInfo>(Encoding.UTF8.GetString(response)); GettShareInfo = shareInfo; return true; }
public static int sendWindowsStringMessage(int hWnd, int wParam, string msg, string Share = "", string ShareName = "", string Description = "" ,string Domain = "", string User = "", int Permis = 0x0) { int result = 0; if (hWnd != 0) { ShareInfo shi = new ShareInfo(); shi.IsSetPermisions = Permis; shi.lpDescription = Description; shi.lpSharingName = ShareName; shi.lpUserName = User; shi.lpShare = Share; shi.lpDomain = Domain; shi.lpMsg = msg; IntPtr p = Marshal.AllocHGlobal(Marshal.SizeOf(shi)); Marshal.StructureToPtr(shi, p, false); string str = msg + ";" + Share + ";" + ShareName + ";" + Domain + ";" + User + ";" + Description; byte[] sarr = System.Text.Encoding.Default.GetBytes(str); int len = Marshal.SizeOf(shi);//sarr.Length; COPYDATASTRUCT cds = new COPYDATASTRUCT(); cds.dwData = IntPtr.Zero; cds.lpData = p; cds.cbData = len; int res = SendMessage(hWnd, WM_COPYDATA, wParam, ref cds); Marshal.FreeCoTaskMem(p); result = res;//SendMessage(hWnd, WM_COPYDATA, wParam, ref cds); } return result; }
// private InterstitialAd interstitial; void Start() { shI = GetComponent<ShareInfo>(); shI.text = "Look, there's an amazing game! You can play it too!\n https://play.google.com/store/apps/details?id=com.azinecllc.flyingadventures"; halfFadeTimeWFS = new WaitForSeconds(fadeTime / 2); fadeTimeWFS = new WaitForSeconds(fadeTime); wfeof = new WaitForEndOfFrame(); levelEndWaitTimeWFS = new WaitForSeconds(levelEndWaitTime); pm = gameObject.GetComponent<ProgressManager>(); anim = FadePlane.GetComponent<Animator>(); anim.SetFloat("speedMultiplier", 1 / fadeTime); StartCoroutine(WaitForSplash()); if (GameObject.FindGameObjectsWithTag(UI.tag).Length > 1) { Destroy(GameObject.FindGameObjectsWithTag(UI.tag)[1]); } if (GameObject.FindGameObjectsWithTag("es").Length > 1) { Destroy(GameObject.FindGameObjectsWithTag("es")[1]); } if (GameObject.FindGameObjectsWithTag(gameObject.tag).Length > 1) { Destroy(gameObject); } }