Exemplo n.º 1
0
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection parameters)
        {
            if (string.IsNullOrEmpty((string)parameters["connectionName"]))
            {
                parameters.Remove("connectionName");
                parameters.Add("connectionName", "PermissionsCenter");

            }

            if (string.IsNullOrEmpty((string)parameters["sourceName"]))
            {
                parameters.Remove("sourceName");
                parameters.Add("sourceName", "DefaultSource");
            }

            this.connectionName = parameters["connectionName"];
            this.sourceName = parameters["sourceName"];

            base.Initialize(name, parameters);

            parameters.Remove("connectionName");
            parameters.Remove("sourceName");

            if (parameters.Count > 0)
            {
                string key = parameters.GetKey(0);
                if (!string.IsNullOrEmpty(key))
                    throw new ProviderException(string.Format("不识别的属性: {0} ", key));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// クッキーコンテナにクッキーを追加する
        /// domainが.hal.fscs.jpなどだと http://hal.fscs.jp でクッキーが有効にならないので.ありとなし両方指定する
        /// </summary>
        /// <param name="container"></param>
        /// <param name="cookie"></param>
        public static void AddCookieToContainer(System.Net.CookieContainer container, System.Net.Cookie cookie)
        {
            if(container == null) {
                throw new ArgumentNullException("container");
            }

            if(cookie == null) {
                throw new ArgumentNullException("cookie");
            }

            container.Add(cookie);
            if(cookie.Domain.StartsWith(".")) {
                container.Add(new System.Net.Cookie() {
                    Comment = cookie.Comment,
                    CommentUri = cookie.CommentUri,
                    Discard = cookie.Discard,
                    Domain = cookie.Domain.Substring(1),
                    Expired = cookie.Expired,
                    Expires = cookie.Expires,
                    HttpOnly = cookie.HttpOnly,
                    Name = cookie.Name,
                    Path = cookie.Path,
                    Port = cookie.Port,
                    Secure = cookie.Secure,
                    Value = cookie.Value,
                    Version = cookie.Version,
                });
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates the pachube embeddable graph. 
        /// </summary>
        /// <seealso cref="http://pachube.github.com/pachube_graph_library/"/>
        /// <param name="alContent">The Embeddable HTML content.</param>
        public static void GenerateHTML(System.Collections.ArrayList alContent)
        {
            string update = GraphFunctionality.AutoUpdate.ToString().ToLower();
            string rolling = GraphFunctionality.Rolling.ToString().ToLower();
            try
            {
                alContent.Clear();
                foreach (string ID in PachubeData.TOTAL_DATASTREAM_ID)
                {
                    string EmbeddableHTML =
                        "<div id=\"graph\" class=\"pachube-graph\" pachube-resource=\"feeds/" + AlarmByZones.Alarm.UserData.Pachube.feedId + "/datastreams/" + ID +
                        "\" pachube-key=\"" +
                        AlarmByZones.Alarm.UserData.Pachube.apiKey + "\" pachube-options=\"timespan:" +
                        Pachube.EmbeddableGraphGenerator.GraphFunctionality.DEFAULT_TIMESPAN[0] +
                        ";update:"+update+";rolling:"+rolling+";background-color:#FFFFFF;line-color:#FF0066;grid-color:#EFEFEF;" +
                        "border-color:#9D9D9D;text-color:#555555;\" style=\"width:" +
                        Pachube.EmbeddableGraphGenerator.GraphAppearance.WIDTH +
                        ";height:" + Pachube.EmbeddableGraphGenerator.GraphAppearance.HEIGHT +
                        ";background:#F0F0F0;\">Graph: Feed " + AlarmByZones.Alarm.UserData.Pachube.feedId +
                        ", Datastream 1</div><script type=\"text/javascript\" " +
                        "src=\"http://beta.apps.pachube.com/embeddable_graphs/lib/PachubeLoader.js\"></script>";

                    alContent.Add(EmbeddableHTML);
                    alContent.Add("<br/>");
                }
                alContent.Add("<br/>");
                alContent.Add("Reference material from: <a href=\"http://pachube.github.com/pachube_graph_library/ \">Pachube graphic library.</a>" + "");
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
Exemplo n.º 4
0
 protected override void FillStyleAttributes(System.Web.UI.CssStyleCollection attributes, System.Web.UI.IUrlResolutionService urlResolver)
 {
     base.FillStyleAttributes (attributes, urlResolver);
     attributes.Add ("opacity", "0.40");
     attributes.Add ("filter", "alpha(opacity=40)");
     attributes.Add ("-moz-opacity", ".40");
 }
        public static void FindAllCameraControllers(System.Collections.Generic.ICollection<ICamera> coll, System.Func<ICamera, bool> predicate = null)
        {
            if (coll == null) throw new System.ArgumentNullException("coll");

            if(predicate == null)
            {
                var e = CameraManager.Instance._cameras.GetEnumerator();
                while (e.MoveNext())
                {
                    coll.Add(e.Current);
                }

                var ucams = Camera.allCameras;
                foreach (var c in ucams)
                {
                    coll.Add(c.AddOrGetComponent<UnityCamera>());
                }
            }
            else
            {
                var e = CameraManager.Instance._cameras.GetEnumerator();
                while (e.MoveNext())
                {
                    if (predicate(e.Current)) coll.Add(e.Current);
                }

                var ucams = Camera.allCameras;
                foreach (var c in ucams)
                {
                    var uc = c.AddOrGetComponent<UnityCamera>();
                    if (predicate(uc)) coll.Add(uc);
                }
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            var list = new[]
            {
                new
                {
                    Name = "Erik",
                    Age = 35,
                    FullName = new Func<string>(() => "Erik")
                }
            }.ToList();

            list.Add(new { Name = "Bråhammar", Age = 30, FullName = new Func<string>(() => "Bråhammar") });
            list.Add(new { Name = "Bråhammar", Age = 30, FullName = new Func<string>(() => "Erik Bråhammar") });

            var query =
                (from p in list
                 where p.Name.Contains("Erik")
                 select new { FN= p.FullName.Invoke(), p.Age });


            list.Add(new { Name = "Bråhammar", Age = 30, FullName = new Func<string>(() => "Erik Bråhammar") });

            Console.WriteLine(list.Count);


            //foreach (var item in query)
            //{
            //    Console.WriteLine(item);
            //}
}
 protected override void InitializeRequiresDictionary(string directiveName, System.Collections.Generic.IDictionary<string, string> requiresDictionary)
 {
     base.InitializeRequiresDictionary(directiveName, requiresDictionary);
     requiresDictionary.Add("GeneratedCodeFolder", "GeneratedCode");
     requiresDictionary.Add("GeneratedResourceFile", "DomainModelResx");
     requiresDictionary.Add("ProjectDefaultNamespace", System.String.Empty);
 }
Exemplo n.º 8
0
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install(stateSaver);

            string targetDirectory = Context.Parameters["DP_TargetDirectory"].ToString();
            stateSaver.Add("targetDirectory", targetDirectory);

            string tileDirectory = Context.Parameters["DP_TileDirectory"].ToString();
            stateSaver.Add("TileDirectory", tileDirectory);

            string outputDirectory = Context.Parameters["DP_OutputDirectory"].ToString();
            stateSaver.Add("OutputDirectory", outputDirectory);

            string configuration = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<configuration>\n  <appSettings>\n    <add key=\"TileDirectory\" value=\"{0}\"/>\n    <add key=\"OutputDirectory\" value=\"{1}\"/>\n    <add key=\"DeleteTiles\" value=\"true\"/>\n  </appSettings>\n</configuration>", tileDirectory, outputDirectory);

            // Save the config file using the Tile Directory and Output Directory
            StreamWriter sw = new StreamWriter(targetDirectory + "DeltaDrawing.UI.exe.config", false);

            // Move the Sample Drawing to the output folder
            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }
            string sampleDrawingFileName = "SampleDrawing.xml";
            File.Move(targetDirectory + sampleDrawingFileName, outputDirectory + "\\" + sampleDrawingFileName);

            sw.Write(configuration);
            sw.Flush();
            sw.Close();
        }
Exemplo n.º 9
0
 public void Problem11()
 {
     string text = Console.ReadLine();
     var list = new []{new {C = text[0], Val = 0}}.ToList();
     for (int i = 1; i < text.Length; i++)
     {
         if (text[i] > text[i - 1])
         {
             list.Add(new { C = text[i], Val = list[i - 1].Val + 1 });
         }
         else if (text[i] < text[i - 1])
         {
             list.Add(new { C = text[i], Val = list[i - 1].Val - 1 });
         }
         else list.Add(new { C = text[i], Val = list[i - 1].Val });
     }
     int min = list.Select(x => x.Val).Min();
     int max = list.Select(x => x.Val).Max();
     for (int i = max; i >= min; i--)
     {
         foreach (var item in list)
         {
             if (item.Val == i) Console.Write(item.C);
             else Console.Write(' ');
         }
         Console.WriteLine();
     }
 }
        /// <summary>
        /// Called during install
        /// </summary>
        /// <param name="stateSaver"></param>
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install(stateSaver);

            string curPath = GetPath();

            //using (StreamWriter log = File.CreateText(curPath + "install.log"))
            {
                //log.WriteLine("started = {0}", DateTime.Now.ToString());
                //log.WriteLine("curPath = {0}", curPath);

                stateSaver.Add("previousPath", curPath);
                string newPath = AddPath(curPath, MyPath());

                //log.WriteLine("newPath = {0}", newPath);

                if (curPath != newPath)
                {
                    //log.WriteLine("Adding new path");

                    stateSaver.Add("changedPath", true);
                    SetPath(newPath);
                }
                else
                {
                    //log.WriteLine("Not adding");

                    stateSaver.Add("changedPath", false);
                }

                //log.WriteLine("completed = {0}", DateTime.Now.ToString());
                //log.Close();
            }
        }
Exemplo n.º 11
0
        public JsonResult DMenus()
        {
            var menus = new[] { new { Text = "Home", Url = "/Home/Index" } }.ToList();
            menus.Add(new { Text = "Test1", Url = "/Home/Left1" });
            menus.Add(new { Text = "Test2", Url = "/Home/Left2" });

            return Json(menus, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 12
0
        public override void SaveAllProperties(System.Collections.Generic.IList<System.Collections.Generic.KeyValuePair<string, object>> output)
        {
            if (this.NumberOfColumns != 0)
                output.Add(new KeyValuePair<string, object>("cols", this.NumberOfColumns));

            if (this.NumberOfRows != 0)
                output.Add(new KeyValuePair<string, object>("rows", this.NumberOfRows));

            base.SaveAllProperties(output);
        }
Exemplo n.º 13
0
        public override void SaveAllProperties(System.Collections.Generic.IList<System.Collections.Generic.KeyValuePair<string, object>> output)
        {
            if (NRols != 0)
            {
                output.Add(new KeyValuePair<string, object>("rows", this.NRols));
            }

            if (NCols != 0)
            {
                output.Add(new KeyValuePair<string, object>("cols", this.NCols));
            }

            base.SaveAllProperties(output);
        }
Exemplo n.º 14
0
 public override void Install(System.Collections.IDictionary stateSaver)
 {
     base.Install(stateSaver);
     string curPath = GetPath();
     stateSaver.Add("pPath", curPath);
     string newPath = AddPath(curPath, MyPath());
     if (curPath != newPath)
     {
         stateSaver.Add("cPath", true);
         SetPath(newPath);
     }
     else
         stateSaver.Add("cPath", false);
 }
Exemplo n.º 15
0
 public static string ProcessParams(string sql, object[] args_src, System.Collections.Generic.List<object> args_dest)
 {
     return ParametersHelper.rxParams.Replace(sql, delegate(Match m)
     {
         string text = m.Value.Substring(1);
         int num;
         object obj;
         if (int.TryParse(text, out num))
         {
             if (num < 0 || num >= args_src.Length)
             {
                 throw new System.ArgumentOutOfRangeException(string.Format("Parameter '@{0}' specified but only {1} parameters supplied (in `{2}`)", num, args_src.Length, sql));
             }
             obj = args_src[num];
         }
         else
         {
             bool flag = false;
             obj = null;
             object[] args_src2 = args_src;
             for (int i = 0; i < args_src2.Length; i++)
             {
                 object obj2 = args_src2[i];
                 System.Reflection.PropertyInfo property = obj2.GetType().GetProperty(text);
                 if (property != null)
                 {
                     obj = property.GetValue(obj2, null);
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 throw new System.ArgumentException(string.Format("Parameter '@{0}' specified but none of the passed arguments have a property with this name (in '{1}')", text, sql));
             }
         }
         if (obj is System.Collections.IEnumerable && !(obj is string) && !(obj is byte[]))
         {
             System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
             foreach (object current in obj as System.Collections.IEnumerable)
             {
                 stringBuilder.Append(((stringBuilder.Length == 0) ? "@" : ",@") + args_dest.Count.ToString());
                 args_dest.Add(current);
             }
             return stringBuilder.ToString();
         }
         args_dest.Add(obj);
         return "@" + (args_dest.Count - 1).ToString();
     });
 }
Exemplo n.º 16
0
        /// <summary>
        /// クッキーコンテナにクッキーを追加する
        /// domainが.hal.fscs.jpなどだと http://hal.fscs.jp でクッキーが有効にならないので.ありとなし両方指定する
        /// </summary>
        /// <param name="container"></param>
        /// <param name="cookie"></param>
        public static void AddCookieToContainer(System.Net.CookieContainer container, System.Net.Cookie cookie)
        {
            if (container == null) {
                throw new ArgumentNullException("container");
            }

            if (cookie == null) {
                throw new ArgumentNullException("cookie");
            }

            container.Add(cookie);
            if (cookie.Domain.StartsWith(".")) {
                container.Add(new System.Net.Cookie(cookie.Name, cookie.Value, cookie.Path, cookie.Domain.Substring(1)));
            }
        }
Exemplo n.º 17
0
 protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, System.Collections.Generic.IList<object> tileImageLayerSources)
 {
     string basepath = Path.GetDirectoryName(HtmlPage.Document.DocumentUri.OriginalString).Replace("\\", "/").Replace("http:/", "http://");
     int zoom = tileLevel - 8;
     if (zoom > 0)
     {
         string QuadKey = TileXYToQuadKey(tilePositionX, tilePositionY, zoom);
         string VEUrl = Protocol + Prefix + QuadKey[QuadKey.Length - 1] + TilePath + Prefix + QuadKey + Suffix;
         tileImageLayerSources.Add(new Uri(VEUrl));
     } else {
         string localPath = string.Format(basepath + "/VE_files/{0}/{1}_{2}.jpg", tileLevel, tilePositionX, tilePositionY);
         Uri localUri = new Uri(localPath);
         tileImageLayerSources.Add(localUri);
     }
 }
Exemplo n.º 18
0
 static void Main(string[] args)
 {
     var item = new { Field1 = "The Value", Field2 = 5 };
     List<object> theList = new List<object>(); // also: object = dynamic
     theList.Add(item);
     var item2 = new { Field2 = 5, Field3 = "Value" };
     theList.Add(item2);
     // or
     var list = new[] { item }.ToList();
     var item3 = new { Field1 = "Valueee", Field2 = 3 };
     list.Add(item);
     list.Add(item3);
     Console.WriteLine(list[0].Field1);
     Console.WriteLine(list[1].Field2);
 }
Exemplo n.º 19
0
        /// <summary>
        /// init
        /// </summary>
        /// <param name="name"></param>
        /// <param name="config"></param>
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (String.IsNullOrEmpty(name))
            {
                name = "UNCBlogProvider";
            }
            base.Initialize(name, config);
            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Generic UNC File Path Blog Provider");
            }

            if (config["storageVariable"] == null)
            {
                // default to BlogEngine XML provider paths
                config["storageVariable"] = HostingEnvironment.MapPath(Blog.CurrentInstance.StorageLocation);
            }
            else
            {
                if(config["storageVariable"].EndsWith(@"\"))
                    config["storageVariable"] =  config["storageVariable"].Substring(0,  config["storageVariable"].Length - 1);
                if(!System.IO.Directory.Exists(config["storageVariable"]))
                    throw new ArgumentException("storageVariable (as unc path) does not exist. or does not have read\\write permissions");
            }

            this.uncPath = config["storageVariable"];
            config.Remove("storageVariable");
        }
 public override void ExtractTerms(System.Collections.Hashtable terms)
 {
     if (terms.Contains(term) == false)
     {
         terms.Add(term, term);
     }
 }
Exemplo n.º 21
0
        public override void OnAdded()
        {
            base.OnAdded();

            // make the popup panel belong to the root
            System.Add(PopupPanel);
        }
Exemplo n.º 22
0
        private void AddToCategory(string category, string field, string label, NameValueCollection value)
        {
            var labelValue = Tuple.Create(label, value.Cast <string>()
                                          .Select(key => new KeyValuePair <string, string>(key, value[key]))
                                          );

            switch (category)
            {
            case "form":
                Form.Add(field, labelValue);
                break;

            case "support.metrics.system":
                System.Add(field, labelValue);
                break;

            case "support.metrics.environment":
                Environment.Add(field, labelValue);
                break;

            case "support.metrics.counters":
                Counters.Add(field, labelValue);
                break;

            case "support.metrics.tasks":
                Tasks.Add(field, labelValue);
                break;

            case "support.metrics.eventlog":
                EventLog.Add(field, labelValue);
                break;
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Initializes a new instance of the <seealso cref="Panel"/> class.
        /// </summary>
        /// <param name="container">The host container.</param>
        public DockPanel(System.ComponentModel.IContainer container)
        {
            container.Add(this);
            InitializeComponent();

            Init();
        }
Exemplo n.º 24
0
    public override IEnumerable<string> Process()
    {
      var counts = new MappedCountItemList();

      var features = counts.Parse(options, m => SmallRNAUtils.SortNames(m));

      var featureCounts = (from feature in features
                           let count = MathNet.Numerics.Statistics.Statistics.Median(from c in counts
                                                                                     select c.DisplayNameGroupMap.ContainsKey(feature) ? c.DisplayNameGroupMap[feature].GetEstimatedCount() : 0)
                           select new { Feature = feature, Count = count }).OrderByDescending(m => m.Count).ToList();

      using (StreamWriter sw = new StreamWriter(options.OutputFile))
      {
        sw.Write("Feature\tLocation");

        var hassequence = !string.IsNullOrEmpty(counts.First().DisplayNameGroupMap.First().Value.First().Sequence);

        if (hassequence)
        {
          sw.Write("\tSequence");
        }

        sw.WriteLine("\t" + (from c in counts select c.ItemName).Merge("\t"));

        foreach (var fc in featureCounts)
        {
          var feature = fc.Feature;
          var first = counts.FirstOrDefault(m => m.DisplayNameGroupMap.ContainsKey(feature));
          var item = first.DisplayNameGroupMap[feature];
          sw.Write(feature + "\t" + item.DisplayLocations);
          if (hassequence)
          {
            sw.Write("\t" + item.DisplaySequence);
          }
          for (int i = 0; i < counts.Count; i++)
          {
            if (counts[i].DisplayNameGroupMap.ContainsKey(feature))
            {
              sw.Write("\t{0:0.##}", counts[i].DisplayNameGroupMap[feature].GetEstimatedCount());
            }
            else
            {
              sw.Write("\t0");
            }

          }
          sw.WriteLine();
        }
      }

      var result = new[] { Path.GetFullPath(options.OutputFile) }.ToList();

      var infofile = Path.ChangeExtension(options.OutputFile, ".info");
      if (CountUtils.WriteInfoSummaryFile(infofile, options.GetCountFiles().ToDictionary(m => m.Name, m => m.File)))
      {
        result.Add(infofile);
      }

      return new string[] { Path.GetFullPath(options.OutputFile) };
    }
Exemplo n.º 25
0
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");
            if (String.IsNullOrEmpty(name))
                name = "TalkCallLogsProvider";
            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Talk Call Logs Provider");
            }
            base.Initialize(name, config);
            _applicationName = config["applicationName"];

            if (String.IsNullOrEmpty(_applicationName))
                _applicationName = "/";
            config.Remove("applicationName");

            if (config.Count > 0)
            {
                string attr = config.Get(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new ProviderException("Unrecognized atrtibute: " + attr);
            }
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (name == null || name.Length == 0)
            {
                name = "MyCacheStore";
            }

            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Redis as a session data store");
            }
            base.Initialize(name, config);

            // If configuration exists then use it otherwise read from config file and create one
            if (configuration == null)
            {
                lock (configurationCreationLock)
                {
                    if (configuration == null)
                    {
                        configuration = ProviderConfiguration.ProviderConfigurationForOutputCache(config);
                    }
                }
            }
        }
Exemplo n.º 27
0
			[System.Diagnostics.DebuggerNonUserCode()]public WebSecurityProvider(System.ComponentModel.IContainer Container) : this()
			{
				
				//Required for Windows.Forms Class Composition Designer support
				Container.Add(this);
				
			}
Exemplo n.º 28
0
 public void CopyTo(System.Collections.ArrayList list, int listIndex)
 {
     for (int i = listIndex; i < _Table.Rows.Count; i++)
     {
         list.Add(_Table.Rows[i][_ColIndex]);
     }
 }
        /// <summary>
        /// 保存上传文件到磁盘目录(此方法在http_service_handler的Upload中在文件类型校验合法后被调用)
        /// </summary>
        /// <param name="param">上传参数配置</param>
        /// <param name="fileHash">上传文件的物理路径Hashtable</param>
        internal static void SaveToDisk(UploadParameter param, System.Collections.Hashtable fileHash)
        {
            int cur_build = 0;      // 创建文件保存路径次数            
            string _filePath = string.Empty;

            if (!Directory.Exists(param.SaveToDir))
            {
                if (!param.AutoMKDir)
                    throw new APIFW_ArgumentException(" 上传目录不存在,请手动创建目录或将AutoMKDir参数设置为True ");
                fileHash.Add(-1, Directory.CreateDirectory(param.SaveToDir).FullName);
            }

            int size = 0;
            long completed = 0;
            byte[] buffer = new byte[param.BufferSize];

            for (int i = 0; i < param.FileUploads.Length; i++)
            {
                cur_build = 0;      // 上传文件名称重命名计数
                completed = 0;      // 当前上传文件已保存大小

                AdjustUploadItemFileName(param, ref param.FileUploads[i], ref cur_build, ref _filePath);

                if (param.FileUploads[i].IsValid && param.FileUploads[i].FileName != null &&
                    param.FileUploads[i].ContentLength > 0 && param.FileUploads[i].FileName.Length > 0)
                {
                    try
                    {
                        // 开始上传
                        param.ExcuteOnUploadItemStart(param.FileUploads[i]);

                        // request.Files.Get(param.FileUploads[i].ClientKey).SaveAs(_filePath);
                        using (FileStream fs = new FileStream(_filePath, FileMode.Create, FileAccess.ReadWrite))
                        {
                            using (BinaryWriter bw = new BinaryWriter(fs))
                            {
                                using (BinaryReader br = new BinaryReader(param.FileUploads[i].InputStream))
                                {
                                    while ((size = br.Read(buffer, 0, buffer.Length)) > 0)
                                    {
                                        completed += size;
                                        bw.Write(buffer, 0, size);

                                        // 进度变化
                                        param.ExcuteOnUploadItemProgressChange(param.FileUploads[i], completed);
                                    }
                                }
                            }
                        }
                        // 上传完成
                        param.ExcuteOnUploadItemCompleted(param.FileUploads[i]);
                    }
                    catch (Exception ex)
                    {
                        // 上传出错
                        if (!param.ExcuteOnUploadItemFailedHandler(param.FileUploads[i], ex)) { throw ex; }
                    }
                }
            }
        }
Exemplo n.º 30
0
        public static void GetFundRedemptionsStep(IContact contact, out System.Collections.Generic.IList<Sage.Entity.Interfaces.IContactFundRedemptions> result)
        {
            //Get a list of all fund redemptions for this contact
               Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IContactFundRedemptions> f = Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IContactFundRedemptions>();
               Sage.Platform.Repository.ICriteria crit = f.CreateCriteria();

               crit.Add(f.EF.Eq("ContactId", contact.Id.ToString()));

               result = crit.List<Sage.Entity.Interfaces.IContactFundRedemptions>();

               //Calculate the total values
               double totalRedemptions = (Double)(from h in result
                                           select h.TotalRedemptions).Distinct().Sum();
               int totalAccounts = (Int32)(from h in result
                                       select h.TotalNumberOfAccounts).Distinct().Sum();
               double totalYTDRedemptions = (Double)(from h in result
                                                select h.TotalYTDRedemptions).Distinct().Sum();

               //Add the totals to the the result set
               Sage.Entity.Interfaces.IContactFundRedemptions totalItem = Sage.Platform.EntityFactory.Create<Sage.Entity.Interfaces.IContactFundRedemptions>();
               totalItem.RepCode = "-";
               totalItem.FundName = "All";
               totalItem.FundCode = "-";
               totalItem.Redemptions = totalRedemptions;
               totalItem.NumberOfAccounts = totalAccounts;
               totalItem.YTDRedemptions = totalYTDRedemptions;

               result.Add(totalItem);
        }
			[System.Diagnostics.DebuggerNonUserCode()]public SPPrintSettings(System.ComponentModel.IContainer Container) : this()
			{
				
				//Required for Windows.Forms Class Composition Designer support
				Container.Add(this);
				
			}
Exemplo n.º 32
0
        public async System.Threading.Tasks.Task LoadKML(System.Collections.Generic.List<Windows.Devices.Geolocation.BasicGeoposition> mapdata)
        {
            Windows.Data.Xml.Dom.XmlLoadSettings loadSettings = new Windows.Data.Xml.Dom.XmlLoadSettings();
            loadSettings.ElementContentWhiteSpace = false;
            Windows.Data.Xml.Dom.XmlDocument kml = new Windows.Data.Xml.Dom.XmlDocument();
            FileOpenPicker openPicker = new FileOpenPicker();
            openPicker.ViewMode = PickerViewMode.List;
            openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            openPicker.FileTypeFilter.Add(".kml");
            Windows.Storage.IStorageFile file = await openPicker.PickSingleFileAsync();
            if (file != null)
            {
                string[] stringSeparators = new string[] { ",17" };
                kml = await Windows.Data.Xml.Dom.XmlDocument.LoadFromFileAsync(file);
                var element = kml.GetElementsByTagName("coordinates").Item(0);
                string ats  = element.FirstChild.GetXml();

                string[] atsa = ats.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
                int size = atsa.Length-1;
                for (int i = 0; i < size; i++)
                {
                    string[] coord = atsa[i].Split(',');
                    double longi = Convert.ToDouble(coord[0]);
                    double lati = Convert.ToDouble(coord[1]);
                    mapdata.Add(new Windows.Devices.Geolocation.BasicGeoposition() { Latitude = lati, Longitude = longi });
                }
            }
        }