Beispiel #1
0
        internal static void AugmentQuickInfoWorker(IQuickInfoSession session, ITextBuffer subjectBuffer, IVsTextView viewAdapter, ExpressionAnalysis exprAnalysis, System.Collections.Generic.IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = exprAnalysis.Span;
            if (applicableToSpan == null || String.IsNullOrWhiteSpace(exprAnalysis.Expression))
            {
                return;
            }

            bool            first  = true;
            var             result = new StringBuilder();
            int             count  = 0;
            IAnalysisResult val    = exprAnalysis.Value;

            if (val != null)
            {
                DTE dte = (DTE)VSGeneroPackage.Instance.GetPackageService(typeof(DTE));
                if (dte.Debugger.CurrentMode != dbgDebugMode.dbgBreakMode ||
                    !val.CanGetValueFromDebugger)
                {
                    quickInfoContent.Add(val.Documentation);
                }
                else
                {
                    string qiText;
                    if (TryGetQuickInfoFromDebugger(session, applicableToSpan.GetSpan(subjectBuffer.CurrentSnapshot), viewAdapter, out qiText))
                    {
                        quickInfoContent.Add(qiText);
                    }
                }
            }
        }
Beispiel #2
0
        public static void EnQueue(int productId)
        {
            System.Collections.Generic.IList <int> list = BrowsedProductQueue.GetBrowedProductList();
            int num = 0;

            foreach (int current in list)
            {
                if (productId == current)
                {
                    list.RemoveAt(num);
                    break;
                }
                num++;
            }
            if (list.Count <= 20)
            {
                list.Add(productId);
            }
            else
            {
                list.RemoveAt(0);
                list.Add(productId);
            }
            BrowsedProductQueue.SaveCookie(list);
        }
        public void WriteToSendBuffer(byte[] cmdBytes)
        {
            if (CouldAddToCurrentBuffer(cmdBytes))
            {
                return;
            }

            PushCurrentBuffer();

            if (CouldAddToCurrentBuffer(cmdBytes))
            {
                return;
            }

            var bytesCopied = 0;

            while (bytesCopied < cmdBytes.Length)
            {
                var copyOfBytes = BufferPool.GetBuffer();
                var bytesToCopy = Math.Min(cmdBytes.Length - bytesCopied, copyOfBytes.Length);
                Buffer.BlockCopy(cmdBytes, bytesCopied, copyOfBytes, 0, bytesToCopy);
                cmdBuffer.Add(new ArraySegment <byte>(copyOfBytes, 0, bytesToCopy));
                bytesCopied += bytesToCopy;
            }
        }
Beispiel #4
0
 public virtual void LoadData()
 {
     System.Collections.Generic.IList <ICompletionData> data = completionWindow.CompletionList.CompletionData;
     data.Add(new MyCompletionData("Item1", "Reserved Word"));
     data.Add(new MyCompletionData("Item2", "Reserved Word"));
     data.Add(new MyCompletionData("Item3", "Reserved Word"));
     data.Add(new MyCompletionData("Another Item", "Reserved Word"));
 }
Beispiel #5
0
        public void RefreshDataDirectories(System.Collections.Specialized.StringCollection recentDataDirectories)
        {
            if (Properties.Settings.Default.RecentFiles?.Count > 0)
            {
                Instance.NoRecentFiles.Visibility = Visibility.Collapsed;
                CleanUpRecentList();

                var startRecentItems = Instance.MenuFileOpenRecently.Items.IndexOf(Instance.NoRecentFiles);

                foreach (var dataDirectory in recentDataDirectories)
                {
                    RecentItems.Add(CreateDataDirectoryMenuLink(dataDirectory));
                }



                foreach (MenuItem menuItem in RecentItems.Reverse())
                {
                    Instance.MenuFileOpenRecently.Items.Insert(startRecentItems, menuItem);
                }
            }
            else
            {
                Instance.NoRecentFiles.Visibility = Visibility.Visible;
            }
        }
        /** Erases all edges of the given loop and marks them as unused. */

        private void RejectLoop(System.Collections.Generic.IList <S2Point> v, int n, System.Collections.Generic.IList <S2Edge> unusedEdges)
        {
            for (int i = n - 1, j = 0; j < n; i = j++)
            {
                unusedEdges.Add(new S2Edge(v[i], v[j]));
            }
        }
        /** Erases all edges of the given loop and marks them as unused. */

        private void RejectLoop(S2Loop v, int n, System.Collections.Generic.IList <S2Edge> unusedEdges)
        {
            for (int i = n - 1, j = 0; j < n; i = j++)
            {
                unusedEdges.Add(new S2Edge(v.Vertex(i), v.Vertex(j)));
            }
        }
Beispiel #8
0
 protected void rptypelist_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem)
     {
         System.Web.UI.WebControls.Repeater repeater = e.Item.FindControl("ListShipper") as System.Web.UI.WebControls.Repeater;
         FreightTemplate freightTemplate             = (FreightTemplate)e.Item.DataItem;
         int             templateId = System.Convert.ToInt32(freightTemplate.TemplateId);
         System.Collections.Generic.IList <SpecifyRegionGroup> specifyRegionGroups = SettingsHelper.GetSpecifyRegionGroups(templateId);
         if (specifyRegionGroups.Count < 1)
         {
             specifyRegionGroups.Add(new SpecifyRegionGroup
             {
                 RegionIds   = "",
                 ModeId      = 1,
                 FristNumber = 1m,
                 FristPrice  = 0m,
                 AddNumber   = 1m,
                 AddPrice    = 0m,
                 IsDefault   = true
             });
         }
         repeater.DataSource = specifyRegionGroups;
         repeater.DataBind();
     }
 }
        public void RefreshDataDirectories()
        {
            List <AnimationEditor.Classes.Settings.Instance.RecentFile> recentDataDirectories = AnimationEditor.Classes.Settings.Default.RecentFiles;

            if (AnimationEditor.Classes.Settings.Default.RecentFiles?.Count > 0)
            {
                Instance.NoRecentFiles.Visibility = Visibility.Collapsed;
                CleanUpRecentList();

                var startRecentItems = Instance.MenuFileOpenRecently.Items.IndexOf(Instance.NoRecentFiles);

                foreach (var dataDirectory in recentDataDirectories)
                {
                    RecentItems.Add(CreateDataDirectoryMenuLink(dataDirectory));
                }



                foreach (MenuItem menuItem in RecentItems.Reverse())
                {
                    Instance.MenuFileOpenRecently.Items.Insert(startRecentItems, menuItem);
                }
            }
            else
            {
                Instance.NoRecentFiles.Visibility = Visibility.Visible;
            }
        }
Beispiel #10
0
        public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList <ISignature> signatures)
        {
            var span = session.GetApplicableSpan(_textBuffer);

            if (_provider._PublicFunctionProvider != null)
            {
                _provider._PublicFunctionProvider.SetFilename(_textBuffer.GetFilePath());
            }
            var sigs = _textBuffer.CurrentSnapshot.GetSignatures(span, _provider._PublicFunctionProvider);

            ISignature curSig = null;

            foreach (var sig in sigs.Signatures)
            {
                if (sigs.ParameterIndex == 0 || sig.Parameters.Count > sigs.ParameterIndex)
                {
                    curSig = sig;
                    break;
                }
            }

            foreach (var sig in sigs.Signatures)
            {
                signatures.Add(sig);
            }

            if (curSig != null)
            {
                // save the current sig so we don't need to recalculate it (we can't set it until
                // the signatures are added by our caller).
                session.Properties.AddProperty(typeof(Genero4glFunctionSignature), curSig);
            }
        }
        public void Reportar(int id_usuario, int id_gym, int id_reto, string motivo)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CEN.Whatever_Reporte_Reportar) ENABLED START*/

            // Write here your custom code...

            ReporteEN  repor    = new ReporteEN();
            ReporteCEN reporcen = new ReporteCEN();
            AdminCEN   admincen = new AdminCEN();

            System.Collections.Generic.IList <AdminEN>   admin     = null;
            System.Collections.Generic.IList <int>       numadmins = null;
            System.Collections.Generic.IList <ReporteEN> listareporte;
            listareporte = reporcen.GetAll(0, 0);
            int aux = 0;

            foreach (AdminEN element in admin)
            {
                numadmins.Add(element.ID);
            }
            aux = listareporte [listareporte.Count - 1].ID;

            admin = admincen.GetAll(0, 0);

            reporcen.New_(motivo, aux + 1, id_usuario, numadmins, id_reto, id_gym);

            /*PROTECTED REGION END*/
        }
        public void RefreshWorkspaces()
        {
            List <Workspace> recentDataDirectories = AnimationEditor.Classes.Settings.Default.Workspaces;

            if (AnimationEditor.Classes.Settings.Default.Workspaces?.Count > 0)
            {
                Instance.NoRecentFiles2.Visibility = Visibility.Collapsed;
                CleanUpWorkspaceList();

                var startRecentItems = Instance.MenuFileOpenFromWorkspace.Items.IndexOf(Instance.NoRecentFiles2);

                foreach (var dataDirectory in recentDataDirectories)
                {
                    WorkspaceItems.Add(CreateWorkSpaceMenuLink(dataDirectory));
                }



                foreach (MenuItem menuItem in WorkspaceItems.Reverse())
                {
                    Instance.MenuFileOpenFromWorkspace.Items.Insert(startRecentItems, menuItem);
                }
            }
            else
            {
                Instance.NoRecentFiles2.Visibility = Visibility.Visible;
            }
        }
Beispiel #13
0
        private void confirmar_Lugar_Click(object sender, RoutedEventArgs e)
        {
            if (this.tipo.Text != null && this.tipo.Text != "")
            {
                if (this.poblacion.Text != null && this.poblacion.Text != "")
                {
                    if (this.coordenadas.Text != null && this.coordenadas.Text != "")
                    {
                        if (this.descripcion.Text != null && this.descripcion.Text != "")
                        {
                            if (imagen != "")
                            {
                                if (!System.IO.File.Exists(ruta + nombreLugar))
                                {
                                    System.IO.File.Copy(de, ruta + nombreLugar);
                                    //almacenamos en la lista la ruta de la imagen y como nombre el nombre del lugar + el de la foto original

                                    list_fotos.Add(ruta + nombreLugar);

                                    /*for(int x=0;x<list_fotos.Count && x < 1; x++) {
                                     *      this.ea.Text = (list_fotos[x]);
                                     *
                                     * }*/
                                    //this.ea.Text = list_fotos.ToString();
                                }
                                presenter.crearLugarNuevo(this.nombre.Text, this.tipo.Text, this.coordenadas.Text, this.descripcion.Text, this.poblacion.Text, list_fotos);
                                System.Windows.MessageBox.Show(String.Concat("Lugar creado con éxito!!"));
                            }
                        }
                    }
                }
            }
        }
Beispiel #14
0
        public void AddTask(Uri subject, string initialNode,
                            System.Collections.Generic.IEnumerable <string> preferredNodes)
        {
            _configurations.Add(node => node.AddTask(subject, preferredNodes));

            if (!initialNode.EqualsIgnoreCase("none"))
            {
                _nodes[initialNode].AddInitialTask(subject);
            }
        }
Beispiel #15
0
 public void Add(string nome, string valor)
 {
     if (!string.IsNullOrEmpty(nome) && !string.IsNullOrEmpty(valor))
     {
         var filtro = new Filtro()
         {
             Nome = nome, Valor = valor
         };
         list.Add(filtro);
     }
 }
Beispiel #16
0
 /*******************************/
 /// <summary>
 /// Sets the capacity for the specified List
 /// </summary>
 /// <param name="vector">The List which capacity will be set</param>
 /// <param name="newCapacity">The new capacity value</param>
 public static void SetCapacity <T>(System.Collections.Generic.IList <T> vector, int newCapacity) where T : new()
 {
     while (newCapacity > vector.Count)
     {
         vector.Add(new T());
     }
     while (newCapacity < vector.Count)
     {
         vector.RemoveAt(vector.Count - 1);
     }
 }
        /**
         * Release ownership of the loops of this polygon by appending them to the
         * given list. Resets the polygon to be empty.
         */

        public void Release(System.Collections.Generic.IList <S2Loop> loops)
        {
            foreach (var item in _loops)
            {
                loops.Add(item);
            }

            _loops.Clear();
            _bound       = S2LatLngRect.Empty;
            _hasHoles    = false;
            _numVertices = 0;
        }
Beispiel #18
0
        private void CmdProperty_PropertyTableSelectionChangedEvent(DataRow dr)
        {
            try
            {
                if (regexDataList != null)
                {
                    regexDataList.Clear();
                }
                colName = "";
                fids    = null;
                if (dr == null)
                {
                    return;
                }

                colName = (dr["F"] as IFieldInfo).Name;
                DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer;
                if (dffc == null)
                {
                    return;
                }
                HashMap hm = SelectCollection.Instance().GetSelectGeometrys();
                if (hm != null && hm.Count == 1)
                {
                    IRowBufferCollection rowBufferCollection = hm[dffc] as IRowBufferCollection;
                    if (rowBufferCollection != null)
                    {
                        List <int> listFids = SelectCollection.Instance().GetOIDList(rowBufferCollection);
                        if (listFids != null)
                        {
                            fids = listFids.ToArray <int>();
                            if (dr["FV"] == null)
                            {
                                regexDataList = null;
                            }
                            {
                                if (regexDataList == null)
                                {
                                    regexDataList = new List <RegexDataStruct>();
                                }
                                RegexDataStruct rds = new RegexDataStruct(dr["FV"].ToString(), CharactorType.ConstKey);
                                regexDataList.Add(rds);
                            }
                            UpdateDatabase();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #19
0
 private bool LoadNext()
 {
     if (!end)
     {
         if (@base.MoveNext())
         {
             loaded.Add(@base.Current);
             actualSize++;
             return(true);
         }
         Close();
     }
     return(false);
 }
        public NearSpansUnordered(SpanNearQuery query, IndexReader reader)
        {
            this.query = query;
            this.slop  = query.Slop;

            SpanQuery[] clauses = query.GetClauses();
            queue    = new CellQueue(this, clauses.Length);
            subSpans = new Spans[clauses.Length];
            for (int i = 0; i < clauses.Length; i++)
            {
                SpansCell cell = new SpansCell(this, clauses[i].GetSpans(reader), i);
                ordered.Add(cell);
                subSpans[i] = cell.spans;
            }
        }
Beispiel #21
0
 public override void collect_variable_names(System.Collections.Generic.IList <string> l,
                                             System.Collections.Generic.IDictionary <string, string> types)
 {
     if (this.param_names != null)
     {
         for (int i = 0; i < this.param_names.Length; i++)
         {
             l.Add(this.param_names[i]);
         }
     }
     if (this.Successor != null)
     {
         this.Successor.collect_variable_names(l, types);
     }
 }
        /**
         * Assembles the given edges into as many non-crossing loops as possible. When
         * there is a choice about how to assemble the loops, then CCW loops are
         * preferred. Returns true if all edges were assembled. If "unused_edges" is
         * not NULL, it is initialized to the set of edges that could not be assembled
         * into loops.
         *
         *  Note that if xor_edges() is false and duplicate edge pairs may be present,
         * then undirected_edges() should be specified unless all loops can be
         * assembled in a counter-clockwise direction. Otherwise this method may not
         * be able to assemble all loops due to its preference for CCW loops.
         *
         * This method resets the S2PolygonBuilder state so that it can be reused.
         */

        public bool AssembleLoops(System.Collections.Generic.IList <S2Loop> loops, System.Collections.Generic.IList <S2Edge> unusedEdges)
        {
            if (_options.MergeDistance.Radians > 0)
            {
                MergeVertices();
            }

            var dummyUnusedEdges = new List <S2Edge>();

            if (unusedEdges == null)
            {
                unusedEdges = dummyUnusedEdges;
            }

            // We repeatedly choose an arbitrary edge and attempt to assemble a loop
            // starting from that edge. (This is always possible unless the input
            // includes extra edges that are not part of any loop.)

            unusedEdges.Clear();
            while (_edges.Any())
            {
                //Map.Entry<S2Point, Multiset<S2Point>> edge = edges.entrySet().iterator().next();
                var edge = _edges.First();

                var v0 = edge.Key;
                var v1 = edge.Value.First();

                var loop = AssembleLoop(v0, v1, unusedEdges);
                if (loop == null)
                {
                    continue;
                }

                // In the case of undirected edges, we may have assembled a clockwise
                // loop while trying to assemble a CCW loop. To fix this, we assemble
                // a new loop starting with an arbitrary edge in the reverse direction.
                // This is guaranteed to assemble a loop that is interior to the previous
                // one and will therefore eventually terminate.

                while (_options.UndirectedEdges && !loop.IsNormalized)
                {
                    loop = AssembleLoop(loop.Vertex(1), loop.Vertex(0), unusedEdges);
                }
                loops.Add(loop);
                EraseLoop(loop, loop.NumVertices);
            }
            return(unusedEdges.Count == 0);
        }
Beispiel #23
0
        public System.Collections.Generic.IList <WhateverGenNHibernate.EN.Whatever.MapaEN> FiltrarMapa(string latitud, string longitud, int radio)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CEN.Whatever_Mapa_filtrarMapa) ENABLED START*/

            // Write here your custom code...
            System.Collections.Generic.IList <MapaEN> listaM       = this.GetAll(0, 0);
            System.Collections.Generic.IList <MapaEN> listaMDentro = null;

            foreach (MapaEN map in listaM)
            {
                if (map.Evento.ID != 0)
                {
                    double lati  = double.Parse(latitud);
                    double longi = double.Parse(longitud);
                    double lat   = double.Parse(map.Latitud);
                    double lon   = double.Parse(map.Longitud);

                    double EarthRadius = 6371;

                    double distance = 0;
                    double Lat      = (lat - lati) * (Math.PI / 180);
                    double Lon      = (lon - longi) * (Math.PI / 180);
                    double a        = Math.Sin(Lat / 2) * Math.Sin(Lat / 2) + Math.Cos(lati * (Math.PI / 180)) * Math.Cos(lat * (Math.PI / 180)) * Math.Sin(Lon / 2) * Math.Sin(Lon / 2);
                    double c        = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
                    distance = EarthRadius * c;


                    if (distance < radio)
                    {
                        listaMDentro.Add(map);
                    }
                }
            }
            return(listaMDentro);

            /*PROTECTED REGION END*/
        }
Beispiel #24
0
 public void Add(T item)
 {
     list.Add(item);
     System.ComponentModel.ListChangedEventArgs e = new System.ComponentModel.ListChangedEventArgs(System.ComponentModel.ListChangedType.ItemAdded, -1);
     OnListChanged(e);
 }
Beispiel #25
0
 public override bool Autoload(ref string name, ref string texture, System.Collections.Generic.IList <EquipType> equips)
 {
     equips.Add(EquipType.Neck);
     return(true);
 }
        /**
         * We start at the given edge and assemble a loop taking left turns whenever
         * possible. We stop the loop as soon as we encounter any vertex that we have
         * seen before *except* for the first vertex (v0). This ensures that only CCW
         * loops are constructed when possible.
         */

        private S2Loop AssembleLoop(S2Point v0, S2Point v1, System.Collections.Generic.IList <S2Edge> unusedEdges)
        {
            // The path so far.
            var path = new List <S2Point>();

            // Maps a vertex to its index in "path".
            var index = new Dictionary <S2Point, int>();

            path.Add(v0);
            path.Add(v1);

            index.Add(v1, 1);

            while (path.Count >= 2)
            {
                // Note that "v0" and "v1" become invalid if "path" is modified.
                v0 = path[path.Count - 2];
                v1 = path[path.Count - 1];

                var v2      = default(S2Point);
                var v2Found = false;
                HashBag <S2Point> vset;
                _edges.TryGetValue(v1, out vset);
                if (vset != null)
                {
                    foreach (var v in vset)
                    {
                        // We prefer the leftmost outgoing edge, ignoring any reverse edges.
                        if (v.Equals(v0))
                        {
                            continue;
                        }
                        if (!v2Found || S2.OrderedCcw(v0, v2, v, v1))
                        {
                            v2 = v;
                        }
                        v2Found = true;
                    }
                }
                if (!v2Found)
                {
                    // We've hit a dead end. Remove this edge and backtrack.
                    unusedEdges.Add(new S2Edge(v0, v1));
                    EraseEdge(v0, v1);
                    index.Remove(v1);
                    path.RemoveAt(path.Count - 1);
                }
                else if (!index.ContainsKey(v2))
                {
                    // This is the first time we've visited this vertex.
                    index.Add(v2, path.Count);
                    path.Add(v2);
                }
                else
                {
                    // We've completed a loop. Throw away any initial vertices that
                    // are not part of the loop.
                    var start = index[v2];
                    path = path.GetRange(start, path.Count - start);

                    if (_options.Validate && !S2Loop.IsValidLoop(path))
                    {
                        // We've constructed a loop that crosses itself, which can only happen
                        // if there is bad input data. Throw away the whole loop.
                        RejectLoop(path, path.Count, unusedEdges);
                        EraseLoop(path, path.Count);
                        return(null);
                    }
                    return(new S2Loop(path));
                }
            }
            return(null);
        }
Beispiel #27
0
 public void Accumulate(T obj)
 {
     list.Add(obj);
 }
Beispiel #28
0
        private void btnImport_Click(object sender, System.EventArgs e)
        {
            string text = this.dropFiles.SelectedValue;

            text = System.IO.Path.Combine(this._dataPath, text);
            if (!System.IO.File.Exists(text))
            {
                this.ShowMsg("选择的数据包文件有问题!", false);
                return;
            }
            int num  = 0;
            int num2 = 0;

            this.PrepareDataFiles(new object[]
            {
                text
            });
            System.Collections.Generic.List <System.Collections.Generic.List <string> > list = this.ReadCsv(this.csvPath, true, '\t', System.Text.Encoding.GetEncoding("GB2312"));
            int i     = 0;
            int count = list.Count;

            while (i < count)
            {
                ProductInfo productInfo = new ProductInfo();
                try
                {
                    System.Collections.Generic.List <string> list2 = list[i];
                    if (list2[18] != "")
                    {
                        System.Data.DataTable brandCategories = CatalogHelper.GetBrandCategories(list2[18]);
                        if (brandCategories.Rows.Count > 0)
                        {
                            productInfo.BrandId = new int?(System.Convert.ToInt32(brandCategories.Rows[0]["BrandId"]));
                        }
                    }
                    if (list2[1] != "")
                    {
                        System.Data.DataTable categoryes = CatalogHelper.GetCategoryes(list2[1]);
                        if (categoryes.Rows.Count > 0)
                        {
                            productInfo.CategoryId = System.Convert.ToInt32(categoryes.Rows[0]["CategoryId"]);
                        }
                        else
                        {
                            productInfo.CategoryId = 0;
                        }
                    }
                    else
                    {
                        productInfo.CategoryId = 0;
                    }
                    if (list2[7] != "")
                    {
                        string path = System.IO.Path.Combine(this.csvPath.Replace(".csv", ""), list2[7]);
                        using (System.IO.StreamReader streamReader = new System.IO.StreamReader(path, System.Text.Encoding.GetEncoding("gb2312")))
                        {
                            productInfo.Description = streamReader.ReadToEnd();
                        }
                    }
                    if (productInfo.CategoryId > 0)
                    {
                        productInfo.MainCategoryPath = CatalogHelper.GetCategory(productInfo.CategoryId).Path + "|";
                    }
                    productInfo.HasSKU    = (int.Parse(list2[19]) == 1);
                    productInfo.ImageUrl1 = "";
                    productInfo.ImageUrl2 = "";
                    productInfo.ImageUrl3 = "";
                    productInfo.ImageUrl4 = "";
                    productInfo.ImageUrl5 = "";
                    if (list2[12] != "")
                    {
                        System.IO.FileInfo fileInfo = new System.IO.FileInfo(System.IO.Path.Combine(this.csvPath.Replace(".csv", ""), list2[12]));
                        if (fileInfo.Exists)
                        {
                            this.GetImg(fileInfo.FullName, ref productInfo, 1);
                        }
                    }
                    if (list2[13] != "")
                    {
                        System.IO.FileInfo fileInfo2 = new System.IO.FileInfo(System.IO.Path.Combine(this.csvPath.Replace(".csv", ""), list2[13]));
                        if (fileInfo2.Exists)
                        {
                            this.GetImg(fileInfo2.FullName, ref productInfo, 2);
                        }
                    }
                    if (list2[14] != "")
                    {
                        System.IO.FileInfo fileInfo3 = new System.IO.FileInfo(System.IO.Path.Combine(this.csvPath.Replace(".csv", ""), list2[14]));
                        if (fileInfo3.Exists)
                        {
                            this.GetImg(fileInfo3.FullName, ref productInfo, 3);
                        }
                    }
                    if (list2[15] != "")
                    {
                        System.IO.FileInfo fileInfo4 = new System.IO.FileInfo(System.IO.Path.Combine(this.csvPath.Replace(".csv", ""), list2[15]));
                        if (fileInfo4.Exists)
                        {
                            this.GetImg(fileInfo4.FullName, ref productInfo, 4);
                        }
                    }
                    if (list2[16] != "")
                    {
                        System.IO.FileInfo fileInfo5 = new System.IO.FileInfo(System.IO.Path.Combine(this.csvPath.Replace(".csv", ""), list2[16]));
                        if (fileInfo5.Exists)
                        {
                            this.GetImg(fileInfo5.FullName, ref productInfo, 5);
                        }
                    }
                    if (list2[17] != "")
                    {
                        productInfo.MarketPrice = new decimal?(decimal.Parse(list2[17]));
                    }
                    if (list2[9] != "")
                    {
                        productInfo.MetaDescription = list2[9];
                    }
                    if (list2[10] != "")
                    {
                        productInfo.MetaKeywords = list2[10];
                    }
                    if (list2[4] != "")
                    {
                        productInfo.ProductCode = list2[4];
                    }
                    productInfo.ProductName = list2[3];
                    string text2 = list2[11];
                    string a;
                    if ((a = text2) != null)
                    {
                        if (!(a == "出售中"))
                        {
                            if (!(a == "下架区"))
                            {
                                if (a == "仓库中")
                                {
                                    productInfo.SaleStatus = ProductSaleStatus.OnStock;
                                }
                            }
                            else
                            {
                                productInfo.SaleStatus = ProductSaleStatus.UnSale;
                            }
                        }
                        else
                        {
                            productInfo.SaleStatus = ProductSaleStatus.OnSale;
                        }
                    }
                    if (list2[5] != "")
                    {
                        productInfo.ShortDescription = list2[5];
                    }
                    if (list2[8] != "")
                    {
                        productInfo.Title = list2[8];
                    }
                    if (list2[2] != "")
                    {
                        int typeId = ProductTypeHelper.GetTypeId(list2[2]);
                        if (typeId > 0)
                        {
                            productInfo.TypeId = new int?(typeId);
                        }
                    }
                    if (!productInfo.TypeId.HasValue)
                    {
                        productInfo.HasSKU = false;
                    }
                    if (list2[6] != "")
                    {
                        productInfo.Unit = list2[6];
                    }
                    System.Collections.Generic.Dictionary <string, SKUItem> dictionary = null;
                    System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > dictionary2 = null;
                    System.Collections.Generic.IList <int> list3 = new System.Collections.Generic.List <int>();
                    if (list2[20] == "")
                    {
                        dictionary = new System.Collections.Generic.Dictionary <string, SKUItem>();
                        SKUItem sKUItem = new SKUItem();
                        sKUItem.SkuId     = "0";
                        sKUItem.CostPrice = decimal.Parse(list2[24].Split(new char[]
                        {
                            ';'
                        })[0]);
                        sKUItem.SalePrice = decimal.Parse(list2[25].Split(new char[]
                        {
                            ';'
                        })[0]);
                        sKUItem.SKU = list2[21].Split(new char[]
                        {
                            ';'
                        })[0];
                        sKUItem.Stock = int.Parse(list2[23].Split(new char[]
                        {
                            ';'
                        })[0]);
                        sKUItem.Weight = decimal.Parse(list2[22].Split(new char[]
                        {
                            ';'
                        })[0]);
                        dictionary.Add(sKUItem.SKU, sKUItem);
                    }
                    else
                    {
                        if (productInfo.TypeId.HasValue)
                        {
                            dictionary = new System.Collections.Generic.Dictionary <string, SKUItem>();
                            int value = productInfo.TypeId.Value;
                            if (productInfo.HasSKU)
                            {
                                ProductTypeHelper.GetAttributes(value, AttributeUseageMode.Choose);
                                string[] array = list2[20].Split(new char[]
                                {
                                    ';'
                                });
                                int num3 = array.Length;
                                for (int j = 0; j < num3; j++)
                                {
                                    SKUItem sKUItem2 = new SKUItem();
                                    sKUItem2.CostPrice = decimal.Parse(list2[24].Split(new char[]
                                    {
                                        ';'
                                    })[j]);
                                    sKUItem2.SalePrice = decimal.Parse(list2[25].Split(new char[]
                                    {
                                        ';'
                                    })[j]);
                                    sKUItem2.SKU = list2[21].Split(new char[]
                                    {
                                        ';'
                                    })[j];
                                    sKUItem2.Stock = int.Parse(list2[23].Split(new char[]
                                    {
                                        ';'
                                    })[j]);
                                    sKUItem2.Weight = decimal.Parse(list2[22].Split(new char[]
                                    {
                                        ';'
                                    })[j]);
                                    string text3 = array[j];
                                    System.Collections.Generic.Dictionary <int, int> dictionary3 = new System.Collections.Generic.Dictionary <int, int>();
                                    string[] array2 = text3.Split(new char[]
                                    {
                                        ','
                                    });
                                    for (int k = 0; k < array2.Length; k++)
                                    {
                                        string text4             = array2[k];
                                        string specificationName = text4.Split(new char[]
                                        {
                                            ':'
                                        })[0];
                                        string valueStr = text4.Split(new char[]
                                        {
                                            ':'
                                        })[1];
                                        int specificationId = ProductTypeHelper.GetSpecificationId(value, specificationName);
                                        if (specificationId <= 0)
                                        {
                                            productInfo.HasSKU = false;
                                            break;
                                        }
                                        int specificationValueId = ProductTypeHelper.GetSpecificationValueId(specificationId, valueStr);
                                        if (specificationValueId <= 0)
                                        {
                                            productInfo.HasSKU = false;
                                            break;
                                        }
                                        dictionary3.Add(specificationId, specificationValueId);
                                    }
                                    if (productInfo.HasSKU && dictionary3.Count > 0)
                                    {
                                        string text5 = "";
                                        foreach (System.Collections.Generic.KeyValuePair <int, int> current in dictionary3)
                                        {
                                            sKUItem2.SkuItems.Add(current.Key, current.Value);
                                            text5 = text5 + current.Value + "_";
                                        }
                                        sKUItem2.SkuId = text5.Substring(0, text5.Length - 1);
                                        dictionary.Add(sKUItem2.SKU, sKUItem2);
                                    }
                                }
                                if (dictionary.Count > 0)
                                {
                                    productInfo.HasSKU = true;
                                }
                            }
                            else
                            {
                                SKUItem sKUItem3 = new SKUItem();
                                sKUItem3.SkuId     = "0";
                                sKUItem3.CostPrice = decimal.Parse(list2[24].Split(new char[]
                                {
                                    ';'
                                })[0]);
                                sKUItem3.SalePrice = decimal.Parse(list2[25].Split(new char[]
                                {
                                    ';'
                                })[0]);
                                sKUItem3.SKU = list2[21].Split(new char[]
                                {
                                    ';'
                                })[0];
                                sKUItem3.Stock = int.Parse(list2[23].Split(new char[]
                                {
                                    ';'
                                })[0]);
                                sKUItem3.Weight = int.Parse(list2[22].Split(new char[]
                                {
                                    ';'
                                })[0]);
                                dictionary.Add(sKUItem3.SKU, sKUItem3);
                            }
                        }
                    }
                    if (list2[26] != "" && productInfo.TypeId.HasValue)
                    {
                        int value2 = productInfo.TypeId.Value;
                        dictionary2 = new System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> >();
                        System.Collections.Generic.IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(value2, AttributeUseageMode.View);
                        foreach (AttributeInfo current2 in ProductTypeHelper.GetAttributes(value2, AttributeUseageMode.MultiView))
                        {
                            attributes.Add(current2);
                        }
                        string[] array2 = list2[26].Split(new char[]
                        {
                            ','
                        });
                        for (int k = 0; k < array2.Length; k++)
                        {
                            string text6  = array2[k];
                            string value3 = text6.Split(new char[]
                            {
                                ':'
                            })[0];
                            string valueStr2 = text6.Split(new char[]
                            {
                                ':'
                            })[1];
                            bool flag = false;
                            int  num4 = 0;
                            foreach (AttributeInfo current3 in attributes)
                            {
                                if (current3.AttributeName.Equals(value3))
                                {
                                    num4 = current3.AttributeId;
                                    flag = true;
                                    break;
                                }
                            }
                            if (flag)
                            {
                                int specificationValueId2 = ProductTypeHelper.GetSpecificationValueId(num4, valueStr2);
                                if (specificationValueId2 > 0)
                                {
                                    if (dictionary2.ContainsKey(num4))
                                    {
                                        dictionary2[num4].Add(specificationValueId2);
                                    }
                                    else
                                    {
                                        dictionary2.Add(num4, new System.Collections.Generic.List <int>
                                        {
                                            specificationValueId2
                                        });
                                    }
                                }
                            }
                        }
                    }
                    if (list2[27] != "")
                    {
                        list3 = new System.Collections.Generic.List <int>();
                        System.Data.DataTable tags = CatalogHelper.GetTags();
                        string[] array2            = list2[27].Split(new char[]
                        {
                            ','
                        });
                        for (int k = 0; k < array2.Length; k++)
                        {
                            string obj = array2[k];
                            foreach (System.Data.DataRow dataRow in tags.Rows)
                            {
                                if (dataRow["TagName"].Equals(obj))
                                {
                                    list3.Add(System.Convert.ToInt32(dataRow["TagId"]));
                                    break;
                                }
                            }
                        }
                    }
                    productInfo.AddedDate = System.DateTime.Now;
                    ProductActionStatus productActionStatus = ProductHelper.AddProduct(productInfo, dictionary, dictionary2, list3);
                    if (productActionStatus == ProductActionStatus.Success)
                    {
                        num++;
                    }
                    else
                    {
                        if (productActionStatus == ProductActionStatus.AttributeError)
                        {
                            num2++;
                        }
                        else
                        {
                            if (productActionStatus == ProductActionStatus.DuplicateName)
                            {
                                num2++;
                            }
                            else
                            {
                                if (productActionStatus == ProductActionStatus.DuplicateSKU)
                                {
                                    num2++;
                                }
                                else
                                {
                                    if (productActionStatus == ProductActionStatus.SKUError)
                                    {
                                        num2++;
                                    }
                                    else
                                    {
                                        num2++;
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                    num2++;
                }
                i++;
            }
            System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(this.csvPath.Replace(".csv", ""));
            directoryInfo.Delete(true);
            System.IO.File.Delete(this.csvPath);
            System.IO.File.Delete(text);
            this.BindFiles();
            if (num2 == 0)
            {
                this.ShowMsg("此次商品批量导入操作已成功!", true);
                return;
            }
            this.ShowMsg("此次商品批量导入操作," + num2 + "件商品导入失败!", false);
        }
Beispiel #29
0
        internal static void AugmentQuickInfoWorker(ExpressionAnalysis vars, System.Collections.Generic.IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = vars.Span;
            if (applicableToSpan == null || String.IsNullOrWhiteSpace(vars.Expression))
            {
                return;
            }

            bool first  = true;
            var  result = new StringBuilder();
            int  count  = 0;
            List <AnalysisValue> listVars     = new List <AnalysisValue>(vars.Values);
            HashSet <string>     descriptions = new HashSet <string>();
            bool multiline = false;

            foreach (var v in listVars)
            {
                string description = null;
                if (listVars.Count == 1)
                {
                    if (!String.IsNullOrWhiteSpace(v.Description))
                    {
                        description = v.Description;
                    }
                }
                else
                {
                    if (!String.IsNullOrWhiteSpace(v.ShortDescription))
                    {
                        description = v.ShortDescription;
                    }
                }

                description = description.LimitLines();

                if (description != null && descriptions.Add(description))
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        if (result.Length == 0 || result[result.Length - 1] != '\n')
                        {
                            result.Append(", ");
                        }
                        else
                        {
                            multiline = true;
                        }
                    }
                    result.Append(description);
                    count++;
                }
            }

            string expr = vars.Expression;

            if (expr.Length > 4096)
            {
                expr = expr.Substring(0, 4093) + "...";
            }
            if (multiline)
            {
                result.Insert(0, expr + ": " + Environment.NewLine);
            }
            else if (result.Length > 0)
            {
                result.Insert(0, expr + ": ");
            }
            else
            {
                result.Append(expr);
                result.Append(": ");
                result.Append("<unknown type>");
            }

            quickInfoContent.Add(result.ToString());
        }
Beispiel #30
0
        public void AugmentQuickInfoSession(IQuickInfoSession session, System.Collections.Generic.IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            var vars = _textBuffer.CurrentSnapshot.AnalyzeExpression(
                session.CreateTrackingSpan(_textBuffer),
                false
                );

            applicableToSpan = vars.Span;
            if (applicableToSpan == null || String.IsNullOrWhiteSpace(vars.Expression))
            {
                return;
            }

            bool first  = true;
            var  result = new StringBuilder();
            int  count  = 0;
            List <IAnalysisValue> listVars     = new List <IAnalysisValue>(vars.Values);
            HashSet <string>      descriptions = new HashSet <string>();
            bool multiline = false;

            foreach (var v in listVars)
            {
                string description = null;
                if (listVars.Count == 1)
                {
                    if (v.Description != null)
                    {
                        description = v.Description;
                    }
                }
                else
                {
                    if (v.ShortDescription != null)
                    {
                        description = v.ShortDescription;
                    }
                }

                if (descriptions.Add(description))
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        if (result.Length == 0 || result[result.Length - 1] != '\n')
                        {
                            result.Append(", ");
                        }
                        else
                        {
                            multiline = true;
                        }
                    }
                    result.Append(description);
                    count++;
                }
            }

            if (multiline)
            {
                result.Insert(0, vars.Expression + ": " + Environment.NewLine);
            }
            else
            {
                result.Insert(0, vars.Expression + ": ");
            }

            quickInfoContent.Add(result.ToString());
        }