Пример #1
0
        static void Main(string[] args)
        {
            //var entity = new RangeEntity();
            //var data = entity.GetRanges();

            //var data2 = new string[2][];
            //data2[0] = new String[] { "1", "2"};
            //data2[1] = new String[] { "3", "4"};

            //var entity2 = new RangeDataEntity();
            //entity2.UploadRange("Guest", "435test", "foobar", "$A1:$B2", data2);

            //var entity3 = new RangeDataEntity();
            //var result = entity2.DownLoadRange(4);

            var entity = new RangeEntity();
            var data = entity.GetMyRanges("tonyj.lei");

            var data2 = new string[2][];
            data2[0] = new String[] { "1", "2" };
            data2[1] = new String[] { "3", "4" };

            var entity2 = new RangeDataEntity();
            entity2.TargetedUploadRange("Guest", "435test", "foobar", "$A1:$B2", data2, new String[] { "saad.shaharyar,tony.lei"});
        }
Пример #2
0
        //public RangeModel[] GetRangeList()
        //{
        //    RangeEntity entity = new RangeEntity();
        //    List<RangeModel> ranges = entity.GetRanges();
        //    return ranges.ToArray();
        public string GetRangeList()
        {
            RangeEntity entity = new RangeEntity();
            List<RangeModel> result = entity.GetMyRanges(Environment.UserName);

            string fileName = GetTempName();

            using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
            {
                using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
                {
                    sw.WriteLine(result.Count.ToString());
                    sw.WriteLine();

                    for (int r = 0; r < result.Count; r++)
                    {
                        sw.WriteLine(result[r].Id.ToString());
                        sw.WriteLine(result[r].Name);
                        sw.WriteLine(result[r].Desc);
                        sw.WriteLine(result[r].UserName);
                    }

                    sw.Close();
                }
            }

            return fileName;
        }