Esempio n. 1
0
        public PackageItemContainer(XmlElement element) : base(element)
        {
            Children   = new SetCollection();
            Operations = new OperationCollection();

            foreach (XmlElement e in element.ChildNodes)
            {
                switch (e.Name)
                {
                case "set":

                    Set set = new Set(e);
                    Children.Add(set);

                    break;

                case "patch":

                    PatchOperation patch = new PatchOperation(e);
                    Operations.Add(patch);
                    break;

                case "file":
                case "filetype":
                    break;
                }
            }
        }
Esempio n. 2
0
        public static string GetJobCancellationMailBody(long JobId, string timeDifference, string ContactNumber, string userName)
        {
            SetCollection setcollection      = new SetCollection();
            Dictionary <string, string> args = new Dictionary <string, string>
            {
                { "JobId", JobId.ToString() },
                { "Username", userName },
                { "TimeDifference", timeDifference },
                { "ContactNumber", ContactNumber },
                { "JobURL", string.Format("{0}?jobId={1}", ConfigurationManager.AppSettings["M4PLApplicationURL"], JobId) },
            };

            Stream        stream        = GenerateHtmlFile(setcollection, "JobDS", AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"bin\StyleSheets\JobCancel.xslt", args);
            StringBuilder stringBuilder = new StringBuilder();

            using (StreamReader reader = new StreamReader(stream))
            {
                string line = string.Empty;
                while ((line = reader.ReadLine()) != null)
                {
                    stringBuilder.Append(line);
                }
            }

            return(stringBuilder.ToString());
        }
Esempio n. 3
0
        public static string GetCargoExceptionMailBody(ActiveUser activeUser, string exceptionCode, long jobId, string contractNo, DateTime createdDate, string comment, string cgoPartNumCode, string cgoitle, string cgoSerialNumber, string currentGateway)
        {
            SetCollection setcollection      = new SetCollection();
            Dictionary <string, string> args = new Dictionary <string, string>
            {
                { "ExceptionCode", exceptionCode },
                { "JobId", jobId.ToString() },
                { "ContractNo", contractNo },
                { "CreatedDate", createdDate.ToString() },
                { "Username", activeUser.UserName },
                { "JobURL", string.Format("{0}?jobId={1}", ConfigurationManager.AppSettings["M4PLApplicationURL"], jobId) },
                { "Comment", string.IsNullOrEmpty(comment) ? string.Empty : comment },
                { "IsCommentPresent", string.IsNullOrEmpty(comment) ? "0" : "1" },
                { "IsCargoDetailsPresent", string.IsNullOrEmpty(cgoPartNumCode) && string.IsNullOrEmpty(cgoitle) && string.IsNullOrEmpty(cgoSerialNumber) && string.IsNullOrEmpty(currentGateway)? "0" : "1" },
                { "CgoPartNumCode", cgoPartNumCode ?? " " },
                { "CgoTitle", cgoitle ?? " " },
                { "CgoSerialNumber", cgoSerialNumber ?? " " },
                { "CurrentGateway", currentGateway ?? " " },
            };

            Stream        stream        = GenerateHtmlFile(setcollection, "JobDS", AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"bin\StyleSheets\CargoException.xslt", args);
            StringBuilder stringBuilder = new StringBuilder();

            using (StreamReader reader = new StreamReader(stream))
            {
                string line = string.Empty;
                while ((line = reader.ReadLine()) != null)
                {
                    stringBuilder.Append(line);
                }
            }

            return(stringBuilder.ToString());
        }
Esempio n. 4
0
 /// <summary>
 /// 根据用户ID查询收藏商品数量
 /// <para>Service Url: http://devbtp.sv.iuoooo.com/Jinher.AMP.BTP.SV.SetCollectionSV.svc/GetCollectionComsCount
 /// </para>
 /// </summary>
 /// <param name="search"></param>
 /// <returns></returns>
 public int GetCollectionComsCountExt(Jinher.AMP.BTP.Deploy.CustomDTO.SetCollectionSearchDTO search)
 {
     try
     {
         if (search == null || search.UserId == Guid.Empty || search.ChannelId == Guid.Empty)
         {
             LogHelper.Debug("SetCollectionSV.GetCollectionComsCountExt,获取收藏商品数量参数不完整");
             return(0);
         }
         var commodityCount = (from setCollection in SetCollection.ObjectSet()
                               join commodity in Commodity.ObjectSet() on setCollection.ColKey equals commodity.Id
                               where setCollection.ColType == 1 && setCollection.UserId == search.UserId && commodity.IsDel == false && commodity.State == 0 && commodity.CommodityType == 0 && setCollection.ChannelId == search.ChannelId
                               select new CommodityListCDTO
         {
             Id = commodity.Id,
             Pic = commodity.PicturesPath,
             Price = commodity.Price,
             State = commodity.State,
             Stock = commodity.Stock,
             Name = commodity.Name,
             MarketPrice = commodity.MarketPrice,
             AppId = commodity.AppId,
             ComAttrType = (commodity.ComAttribute == "[]" || commodity.ComAttribute == null) ? 1 : 3
         }).Count();
         return(commodityCount);
     }
     catch (Exception e)
     {
         LogHelper.Error("SetCollectionSV.GetCollectionComsCountExt,获取收藏商品数量异常" + e);
         return(0);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 根据用户ID查询收藏店铺数量
 /// <para>Service Url: http://devbtp.sv.iuoooo.com/Jinher.AMP.BTP.SV.SetCollectionSV.svc/GetCollectionAppsCount
 /// </para>
 /// </summary>
 /// <param name="search"></param>
 /// <returns></returns>
 public int GetCollectionAppsCountExt(Jinher.AMP.BTP.Deploy.CustomDTO.SetCollectionSearchDTO search)
 {
     if (search == null || search.UserId == Guid.Empty || search.ChannelId == Guid.Empty)
     {
         LogHelper.Debug(string.Format("SetCollectionSV.GetCollectionAppsCountExt,获取收藏店铺数量参数不全,search:{0},", JsonHelper.JsonSerializer(search)));
         return(0);
     }
     try
     {
         var appIds =
             SetCollection.ObjectSet()
             .Where(c => c.ColType == 2 && c.UserId == search.UserId && c.ChannelId == search.ChannelId).OrderByDescending(c => c.SubTime)
             .Select(c => c.ColKey)
             .ToList();
         if (appIds.Any())
         {
             var applist = APPSV.GetAppListByIds(appIds);
             if (applist != null && applist.Any())
             {
                 return(applist.Count);
             }
         }
         LogHelper.Debug(string.Format("SetCollectionSV.GetCollectionAppsCountExt,获取收藏店铺数量位未查到appids,search:{0},", JsonHelper.JsonSerializer(search)));
         return(0);
     }
     catch (Exception ex)
     {
         LogHelper.Error(string.Format("SetCollectionSV.GetCollectionAppsCountExt,获取收藏店铺数量异常,search:{0},", JsonHelper.JsonSerializer(search)), ex);
         return(0);
     }
 }
Esempio n. 6
0
        public void Ejecutar(Entorno e)
        {
            if (ids == null)
            {
                Console.WriteLine("Error, no existen identificadores validos para crear la collection Set");
                return;
            }
            SetCollection set = null;

            //Creo la lista
            foreach (string id in ids)
            {
                if (e.Obtener(id) != null)
                {
                    Console.WriteLine("No se puede declarar el Set con id " + id + " porque ya existe una variable con ese nombre en este entorno");
                    continue;
                }
                //Si traen un tipo
                if (!tipo.Equals(Tipos.NULL))
                {
                    set = new SetCollection(id, tipo);
                    e.InsertarSet(id, set);
                }
                //Si no se trae el tipo
                else
                {
                    if (valores != null)
                    {
                        tipo = valores.First.Value.GetTipo(e);
                        set  = new SetCollection(id, tipo);
                        e.InsertarSet(id, set);
                    }
                }
            }
            if (valores == null)
            {
                return;
            }
            //Si trae los valores
            foreach (IExpresion expresion in valores)
            {
                object valor = expresion.GetValor(e);
                Tipos  t     = expresion.GetTipo(e);
                if (!t.Equals(tipo))
                {
                    Console.WriteLine("No se puede insertar un tipo " + t + " en una collection Set tipo " + tipo);
                    continue;
                }
                //Si es un objeto
                if (valor is Entorno atributos && t.Equals(Tipos.OBJETO))
                {
                    //Solo lo inserto si no esta en la lista
                    if (set.Contains(atributos))
                    {
                        Console.WriteLine("No se pueden insertar elementos duplicados en el set " + set.identificador);
                        return;
                    }
                    set.Insert(new Objeto("", atributos));
                }
        public void CheckSetSetEquals2()
        {
            q = new SetCollection <int>();
            var testSet1 = new int[] { 1, 2, 3, 4, 5 };

            q.AddRange(testSet1);
            Assert.AreEqual(false, q.SetEquals(new int[] { 1, 2, 666, 3, 4, 5 }));
        }
        public void CheckSetSetEquals1()
        {
            q = new SetCollection <int>();
            var testSet1 = new int[] { 1, 2, 3, 4, 5 };

            q.AddRange(testSet1);
            Assert.AreEqual(true, q.SetEquals(new int[] { 1, 2, 3, 4, 5, 4, 3, 2, 1 }));
        }
        public void CheckSetOverlaps()
        {
            q = new SetCollection <int>();
            var testSet1 = new int[] { 1, 2, 3, 4, 5 };

            q.AddRange(testSet1);
            Assert.AreEqual(true, q.Overlaps(new int[] { 9, 5, 7, 8 }));
        }
        public void CheckSetSunsetOf()
        {
            q = new SetCollection <int>();
            var testSet1 = new int[] { 1, 2, 3, 4, 5 };

            q.AddRange(testSet1);
            Assert.AreEqual(true, q.IsProperSubsetOf(new int[] { 5, 2, 3, 1, 4, 6, 5, 3, 1 }));
        }
Esempio n. 11
0
        public static List enum_certificates(string store_name)
        {
            X509Store store = null;

            try {
                store = new X509Store(store_name, StoreLocation.LocalMachine);
                store.Open(OpenFlags.ReadOnly);
                var result = new List();

                foreach (var cert in store.Certificates)
                {
                    string format = cert.GetFormat();

                    switch (format)
                    {
                    case "X509":
                        format = "x509_asn";
                        break;

                    default:
                        format = "unknown";
                        break;
                    }

                    var  set   = new SetCollection();
                    bool found = false;
                    foreach (var ext in cert.Extensions)
                    {
                        var keyUsage = ext as X509EnhancedKeyUsageExtension;
                        if (keyUsage != null)
                        {
                            foreach (var oid in keyUsage.EnhancedKeyUsages)
                            {
                                set.add(oid.Value);
                            }
                            found = true;
                            break;
                        }
                    }

                    result.Add(PythonTuple.MakeTuple(new Bytes(cert.RawData.ToList()), format, found ? set : ScriptingRuntimeHelpers.True));
                }

                return(result);
            } catch {
            } finally {
                if (store != null)
                {
#if NETSTANDARD
                    store.Dispose();
#else
                    store.Close();
#endif
                }
            }
            return(new List());
        }
Esempio n. 12
0
        /// <summary>
        /// 删除正品会收藏
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO DeleteCollectionsExt(SetCollectionSearchDTO search)
        {
            if (search == null || search.UserId == Guid.Empty || search.ColKeyList == null || !search.ColKeyList.Any())
            {
                return new ResultDTO {
                           ResultCode = -1, Message = "参数非法"
                }
            }
            ;
            try
            {
                ContextSession contextSession = ContextFactory.CurrentThreadContext;

                List <Commodity> needRefreshCacheCommodityList = new List <Commodity>();

                var cols = SetCollection.ObjectSet()
                           .Where(c => c.UserId == search.UserId && c.ColType == search.ColType && search.ColKeyList.Contains(c.ColKey) && c.ChannelId == search.ChannelId)
                           .Distinct();
                if (cols.Any())
                {
                    foreach (var collection in cols)
                    {
                        //删除收藏
                        collection.EntityState = System.Data.EntityState.Deleted;
                    }

                    //商品收藏,回退商品收藏数量
                    if (search.ColType == 1)
                    {
                        var comIds = cols.Select(c => c.ColKey).ToList();
                        var coms   = Commodity.ObjectSet().Where(n => comIds.Contains(n.Id) && n.CommodityType == 0).ToList();
                        foreach (var commodity in coms)
                        {
                            commodity.TotalCollection -= 1;
                            commodity.EntityState      = EntityState.Modified;
                            needRefreshCacheCommodityList.Add(commodity);
                        }
                    }
                    contextSession.SaveChanges();
                    if (needRefreshCacheCommodityList.Any())
                    {
                        needRefreshCacheCommodityList.ForEach(c => c.RefreshCache(EntityState.Modified));
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("删除收藏服务异常。search:{0},", JsonHelper.JsonSerializer(search)), ex);
                return(new ResultDTO {
                    ResultCode = 1, Message = "Error"
                });
            }
            return(new ResultDTO {
                ResultCode = 0, Message = "Success"
            });
        }
        public void CheckSetSymmetricExceptWith()
        {
            q = new SetCollection <int>();
            var testSet1 = new int[] { 1, 2, 3, 4, 5 };

            q.AddRange(testSet1);
            q.SymmetricExceptWith(new int[] { 1, 3, 5 });
            var expected = new int[] { 2, 4 };

            CollectionAssert.AreEqual(expected, q);
        }
        public void CheckSetUnionWith()
        {
            q = new SetCollection <int>();
            var testSet1 = new int[] { 1, 2, 3, 4, 5 };

            q.AddRange(testSet1);
            q.UnionWith(new int[] { 4, 5, 6, 7, 8 });
            var expected = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };

            CollectionAssert.AreEqual(expected, q);
        }
Esempio n. 15
0
            private void WriteSet(object set)
            {
                SetCollection s = set as SetCollection;

                _bytes.Add((byte)'<');
                WriteInt32(s.__len__());
                foreach (object o in s)
                {
                    WriteObject(o);
                }
            }
        public void CheckSetIntersectWith()
        {
            q = new SetCollection <int>();
            var testSet1 = new int[] { 1, 2, 3, 4, 5 };

            q.AddRange(testSet1);
            q.IntersectWith(new int[] { 1, 5 });
            var expected = new int[] { 1, 5 };

            CollectionAssert.AreEqual(expected, q);
        }
Esempio n. 17
0
        /// <summary>
        /// 添加商品收藏
        /// </summary>
        /// <param name="commodityId">商品ID</param>
        /// <param name="userId">用户ID</param>
        /// <param name="channelId">渠道Id</param>
        /// <returns></returns>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO SaveCommodityCollectionExt(System.Guid commodityId, System.Guid userId, System.Guid channelId)
        {
            ResultDTO result = new ResultDTO {
                ResultCode = 0, Message = "Success"
            };
            ContextSession contextSession = ContextFactory.CurrentThreadContext;

            try
            {
                List <Commodity> needRefreshCacheCommodityList = new List <Commodity>();
                int collections = SetCollection.ObjectSet().Count(n => n.ColType == 1 && n.UserId == userId && n.ColKey == commodityId && n.ChannelId == channelId);
                if (collections == 0)
                {
                    SetCollection collection = SetCollection.CreateSetCollection();
                    collection.ChannelId = channelId;
                    collection.ColKey    = commodityId;
                    collection.SubId     = userId;
                    collection.ColType   = 1;
                    collection.UserId    = userId;
                    contextSession.SaveObject(collection);
                    Commodity com = Commodity.ObjectSet().FirstOrDefault(n => n.Id == commodityId);
                    if (com != null)
                    {
                        com.EntityState      = System.Data.EntityState.Modified;
                        com.TotalCollection += 1;
                        contextSession.SaveObject(com);
                        needRefreshCacheCommodityList.Add(com);
                    }
                    contextSession.SaveChanges();

                    if (needRefreshCacheCommodityList.Any())
                    {
                        needRefreshCacheCommodityList.ForEach(c => c.RefreshCache(EntityState.Modified));
                    }
                }
                else
                {
                    result = new ResultDTO {
                        ResultCode = 0, Message = "已有收藏"
                    };
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("添加收藏服务异常。commodityId:{0},userId:{1},channelId:{2},", commodityId, userId, channelId), ex);
                return(new ResultDTO {
                    ResultCode = 1, Message = "Error"
                });
            }
            return(result);
        }
Esempio n. 18
0
        public void Insert(LinkedList <Celda> celdas)
        {
            DataRow myDataRow = data.NewRow();
            string  registro  = "";

            foreach (Celda celda in celdas)
            {
                //Si es un map viene en un objeto
                Type tipoColumna = myDataRow.Table.Columns[celda.id].DataType;
                if (tipoColumna.Equals(typeof(MapCollection)) && celda.valor is Objeto objeto)
                {
                    //Aqui debo generar el MapCollection
                    MapCollection map = new MapCollection("")
                    {
                        valores = objeto.atributos
                    };
                    myDataRow[celda.id] = map;
                }
                //Si es una lista el valor es una List<object>
                else if (tipoColumna.Equals(typeof(ListCollection)) && celda.valor is List <object> valores)
                {
                    ListCollection list = new ListCollection("")
                    {
                        valores = valores
                    };
                    myDataRow[celda.id] = list;
                }
                //Si es un set el valor es una List<object>
                else if (tipoColumna.Equals(typeof(SetCollection)) && celda.valor is List <object> vals)
                {
                    SetCollection set = new SetCollection("")
                    {
                        valores = vals
                    };
                    myDataRow[celda.id] = set;
                }
                else
                {
                    myDataRow[celda.id] = celda.valor;
                    registro           += celda.valor + " ";
                }
            }
            try
            {
                data.Rows.Add(myDataRow);
            }
            catch (Exception e)
            {
                Console.WriteLine("No se puede insertar el registro: " + registro + " posible llave primaria duplicada");
            }
        }
        /************************************************************************************/
        protected Actor GetNestedCombatAssistTarget(string strPlayerName)
        {
            Actor AssistedPlayerActor = GetPlayerActor(strPlayerName);

            if (AssistedPlayerActor == null)
            {
                Program.Log("No player actor was found with the name {0}.", strPlayerName);
                return(null);
            }

            string strAssistDescription = string.Empty;
            Actor  FinalTargetActor     = null;

            SetCollection <int> TraversedActorIDSet = new SetCollection <int>();

            /// Nested assist targetting. Go through assist targets until either a recursive loop or a killable NPC is found.
            /// This is more advanced than even the normal UI allows.
            for (Actor ThisActor = AssistedPlayerActor; ThisActor.IsValid; ThisActor = ThisActor.Target())
            {
                if (TraversedActorIDSet.Count > 0)
                {
                    strAssistDescription += " --> ";
                }
                strAssistDescription += string.Format("{0} ({1})", ThisActor.Name, ThisActor.ID);

                if (ThisActor.Type == "NPC" || ThisActor.Type == STR_NAMED_NPC)
                {
                    FinalTargetActor = ThisActor;
                    break;
                }

                /// Infinite recursion = FAIL
                if (TraversedActorIDSet.Contains(ThisActor.ID))
                {
                    Program.Log("Circular player assist chain detected! No enemy was found.");
                    break;
                }

                TraversedActorIDSet.Add(ThisActor.ID);
            }

            Program.Log("Assist chain: {0}", strAssistDescription);
            return(FinalTargetActor);
        }
Esempio n. 20
0
        public DocumentData GetTrackingDocumentByJobId(long jobId)
        {
            DocumentData  documentData  = null;
            SetCollection setcollection = _commands.GetTrackingDocumentByJobId(ActiveUser, jobId);

            if (setcollection != null)
            {
                documentData = new DocumentData();
                Dictionary <string, string> args = new Dictionary <string, string> {
                    { "ImagePath", ConfigurationManager.AppSettings["M4PLApplicationLocalURL"] + "Content/Images/M4plLogo.png" }
                };
                Stream        stream        = GenerateHtmlFile(setcollection, "JobTrackingDS", AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"bin\StyleSheets\JobTracking.xslt", args);
                StringBuilder stringBuilder = new StringBuilder();
                using (StreamReader reader = new StreamReader(stream))
                {
                    string line = string.Empty;
                    while ((line = reader.ReadLine()) != null)
                    {
                        stringBuilder.Append(line);
                    }
                }

                if (!string.IsNullOrEmpty(stringBuilder.ToString()))
                {
                    using (MemoryStream memorystream = new System.IO.MemoryStream())
                    {
                        StringReader sr     = new StringReader(stringBuilder.ToString());
                        Document     pdfDoc = new Document();
                        PdfWriter    writer = PdfWriter.GetInstance(pdfDoc, memorystream);
                        pdfDoc.Open();
                        XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr);
                        pdfDoc.Close();
                        documentData.DocumentContent = memorystream.ToArray();
                    }
                }

                documentData.DocumentHtml = stringBuilder.ToString();
                documentData.DocumentName = string.Format("Tracking_{0}.pdf", jobId);
                documentData.ContentType  = "application/pdf";
            }

            return(documentData);
        }
Esempio n. 21
0
        /// <summary>
        /// 根据用户ID查询收藏商品
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public System.Collections.Generic.List <Jinher.AMP.BTP.Deploy.CustomDTO.AppSetAppDTO> GetCollectionAppsExt(SetCollectionSearchDTO search)
        {
            DateTime            now    = DateTime.Now;
            List <AppSetAppDTO> result = new List <AppSetAppDTO>();

            if (search == null || search.UserId == Guid.Empty || search.ChannelId == Guid.Empty || search.PageIndex < 1 || search.PageSize < 1)
            {
                return(result);
            }
            try
            {
                var appIds =
                    SetCollection.ObjectSet()
                    .Where(c => c.ColType == 2 && c.UserId == search.UserId && c.ChannelId == search.ChannelId).OrderByDescending(c => c.SubTime)
                    .Select(c => c.ColKey).Skip((search.PageIndex - 1) * search.PageSize)
                    .Take(search.PageSize)
                    .ToList();
                if (appIds.Any())
                {
                    var applist = APPSV.GetAppListByIds(appIds);
                    if (applist != null && applist.Any())
                    {
                        foreach (var appIdNameIconDTO in applist)
                        {
                            result.Add(new AppSetAppDTO
                            {
                                AppId       = appIdNameIconDTO.AppId,
                                AppIcon     = appIdNameIconDTO.AppIcon,
                                AppName     = appIdNameIconDTO.AppName,
                                AppCreateOn = appIdNameIconDTO.CreateDate > DateTime.MinValue ? appIdNameIconDTO.CreateDate : new DateTime(1970, 1, 1)
                            });
                        }
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("SetCollectionSV.GetCollectionAppsExt,获取收藏商品列表查询错误search:{0},", JsonHelper.JsonSerializer(search)), ex);
                return(new List <AppSetAppDTO>());
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Builds the bot set.
        /// </summary>
        /// <returns></returns>
        static SetCollection <int> BuildBotSet()
        {
            SetCollection <int> result = new SetCollection <int>();
            string fileName            = BotsDataBaseFile;

            if (File.Exists(fileName))
            {
                using (Stream xmlFile = new FileStream(fileName, FileMode.Open, FileAccess.Read))
                {
                    XPathNavigator      xml = new XPathDocument(xmlFile).CreateNavigator();
                    XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xml.NameTable);
                    namespaceManager.AddNamespace("bugx", "http://www.wavenet.be/bugx/web/bots.xsd");
                    foreach (XPathNavigator node in xml.Select("/bugx:bots/bugx:bot", namespaceManager))
                    {
                        result.Add(node.Value.GetHashCode());
                    }
                }
            }
            return(result);
        }
Esempio n. 23
0
        public static void GetAllSets(this SetCollection sets)
        {
            WowDatabase wowDatabase = Engine.Instance.WowDatabase;

            uint setCount = wowDatabase.SetCount;

            sets.Clear();

            for (uint i = 0; i < setCount; ++i)
            {
                SEntry?r = wowDatabase.GetSet(i);
                if (r != null)
                {
                    sets.Add(new Set()
                    {
                        Name = r.Value.name, Id = r.Value.id
                    });
                }
            }
        }
Esempio n. 24
0
        /// <summary>
        /// Function to get all columns to display to select & unselect for grid.
        /// </summary>
        /// <param name="PageName"></param>
        /// <returns></returns>
        public static disChooseColumns GetAllColumns(string PageName, bool IsRestoreDefault = false)
        {
            disChooseColumns obj = new disChooseColumns();

            var set = new SetCollection();

            set.AddSet <Columns>("LstColumnName");
            set.AddSet <Columns>("LstDisplayColumnName");

            var parameters = new Parameter[]
            {
                new Parameter("@PageName", PageName),
                new Parameter("@IsRestoreDefault", IsRestoreDefault)
            };

            SqlSerializer.Default.DeserializeMultiSets(set, StoredProcedureNames.GetAllColumns, parameters, storedProcedure: true);
            obj.LstColumnName        = set.GetSet <Columns>("LstColumnName") ?? new List <Columns>();
            obj.LstDisplayColumnName = set.GetSet <Columns>("LstDisplayColumnName") ?? new List <Columns>();

            return(obj);
        }
Esempio n. 25
0
        /// <summary>
        /// 店铺收藏
        /// </summary>
        /// <param name="appId">appId</param>
        /// <param name="userId">用户ID</param>
        /// <param name="channelId"></param>
        /// <returns></returns>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO SaveAppCollectionExt(System.Guid appId, System.Guid userId, System.Guid channelId)
        {
            ResultDTO result = new ResultDTO {
                ResultCode = 0, Message = "Success"
            };
            ContextSession contextSession = ContextFactory.CurrentThreadContext;

            try
            {
                int collections = SetCollection.ObjectSet().Count(n => n.ColType == 2 && n.UserId == userId && n.ColKey == appId && n.ChannelId == channelId);
                if (collections == 0)
                {
                    SetCollection collection = SetCollection.CreateSetCollection();
                    collection.ChannelId = channelId;
                    collection.ColKey    = appId;
                    collection.SubTime   = DateTime.Now;
                    collection.SubId     = userId;
                    collection.ColType   = 2;
                    collection.UserId    = userId;
                    contextSession.SaveObject(collection);

                    contextSession.SaveChanges();
                }
                else
                {
                    result = new ResultDTO {
                        ResultCode = 0, Message = "已有收藏"
                    };
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("添加收藏服务异常。appId:{0},userId:{1},channelId:{2},", appId, userId, channelId), ex);
                return(new ResultDTO {
                    ResultCode = 1, Message = "Error"
                });
            }
            return(result);
        }
Esempio n. 26
0
        private static Stream GenerateHtmlFile(SetCollection data, string rootName, string xsltFilePath, Dictionary <string, string> xsltArgumentsDictionary)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            using (DataSet ds = new DataSet(rootName))
            {
                ds.Locale = System.Globalization.CultureInfo.InvariantCulture;

                foreach (DictionaryEntry set in data)
                {
                    var table = ds.Tables.Add(set.Key.ToString());

                    foreach (IDictionary <string, object> item in (IList <dynamic>)set.Value)
                    {
                        if (table.Columns.Count == 0)
                        {
                            foreach (var prop in item)
                            {
                                table.Columns.Add(prop.Key, prop.Value.GetType() == typeof(DBNull) ? typeof(object) : prop.Value.GetType());
                            }
                        }

                        DataRow row = table.NewRow();

                        foreach (var prop in item)
                        {
                            row[prop.Key] = HtmlGenerator.CleanInvalidXmlChars(prop.Value.ToString());
                        }

                        table.Rows.Add(row);
                    }
                }

                return(HtmlGenerator.GenerateHtmlFile(ds, xsltFilePath, xsltArgumentsDictionary));
            }
        }
Esempio n. 27
0
 /// <summary>
 /// 校验是否收藏店铺
 /// </summary>
 /// <param name="channelId"></param>
 /// <param name="userId"></param>
 /// <param name="appId"></param>
 /// <returns></returns>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO CheckAppCollectedExt(Guid channelId, Guid userId, Guid appId)
 {
     try
     {
         var cnt = SetCollection.ObjectSet().Count(c => c.UserId == userId && c.ColType == 2 && c.ColKey == appId && c.ChannelId == channelId);
         if (cnt <= 0)
         {
             return(new ResultDTO {
                 ResultCode = 1, Message = "false"
             });
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(string.Format("SetCollectionSV.CheckAppCollectedExt服务异常。channelId:{0},userId:{1},appId:{2},", channelId, userId, appId), ex);
         return(new ResultDTO {
             ResultCode = -1, Message = "false"
         });
     }
     return(new ResultDTO {
         ResultCode = 0, Message = "true"
     });
 }
Esempio n. 28
0
 /// <summary>
 /// Builds the bot set.
 /// </summary>
 /// <returns></returns>
 static SetCollection<int> BuildBotSet()
 {
     SetCollection<int> result = new SetCollection<int>();
     string fileName = BotsDataBaseFile;
     if (File.Exists(fileName))
     {
         using (Stream xmlFile = new FileStream(fileName, FileMode.Open, FileAccess.Read))
         {
             XPathNavigator xml = new XPathDocument(xmlFile).CreateNavigator();
             XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xml.NameTable);
             namespaceManager.AddNamespace("bugx", "http://www.wavenet.be/bugx/web/bots.xsd");
             foreach (XPathNavigator node in xml.Select("/bugx:bots/bugx:bot", namespaceManager))
             {
                 result.Add(node.Value.GetHashCode());
             }
         }
     }
     return result;
 }
Esempio n. 29
0
            private object UpdateStack(object res)
            {
                ProcStack curStack = _stack.Peek();

                switch (curStack.StackType)
                {
                case StackType.Dict:
                    PythonDictionary od = curStack.StackObj as PythonDictionary;
                    if (curStack.HaveKey)
                    {
                        od[curStack.Key] = res;
                        curStack.HaveKey = false;
                    }
                    else
                    {
                        curStack.HaveKey = true;
                        curStack.Key     = res;
                    }
                    break;

                case StackType.Tuple:
                    List <object> objs = curStack.StackObj as List <object>;
                    objs.Add(res);
                    curStack.StackCount--;
                    if (curStack.StackCount == 0)
                    {
                        _stack.Pop();
                        object tuple = PythonTuple.Make(objs);
                        if (_stack.Count == 0)
                        {
                            _result = tuple;
                        }
                        return(tuple);
                    }
                    break;

                case StackType.List:
                    PythonList ol = curStack.StackObj as PythonList;
                    ol.AddNoLock(res);
                    curStack.StackCount--;
                    if (curStack.StackCount == 0)
                    {
                        _stack.Pop();
                        if (_stack.Count == 0)
                        {
                            _result = ol;
                        }
                        return(ol);
                    }
                    break;

                case StackType.Set:
                    SetCollection os = curStack.StackObj as SetCollection;
                    os.add(res);
                    curStack.StackCount--;
                    if (curStack.StackCount == 0)
                    {
                        _stack.Pop();
                        if (_stack.Count == 0)
                        {
                            _result = os;
                        }
                        return(os);
                    }
                    break;

                case StackType.FrozenSet:
                    List <object> ofs = curStack.StackObj as List <object>;
                    ofs.Add(res);
                    curStack.StackCount--;
                    if (curStack.StackCount == 0)
                    {
                        _stack.Pop();
                        object frozenSet = FrozenSetCollection.Make(TypeCache.FrozenSet, ofs);
                        if (_stack.Count == 0)
                        {
                            _result = frozenSet;
                        }
                        return(frozenSet);
                    }
                    break;
                }
                return(null);
            }
Esempio n. 30
0
        /// <summary>
        /// 获取正品会“我的”,各栏目数量
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public UserInfoCountDTO GetUserInfoCountExt(Guid userId, Guid esAppId)
        {
            try
            {
                UserInfoCountDTO result = new UserInfoCountDTO()
                {
                    UserId = userId, EsAppId = esAppId
                };

                #region 订单
                CommodityOrderSV commodityOrderSV = new CommodityOrderSV();

                var orderCount = commodityOrderSV.GetOrderCountExt(userId, esAppId);
                if (orderCount != null)
                {
                    result.OrderTotalState0   = orderCount.OrderTotalState0;
                    result.OrderTotalState1   = orderCount.OrderTotalState1;
                    result.OrderTotalState2   = orderCount.OrderTotalState2;
                    result.OrderTotalState3   = orderCount.OrderTotalState3;
                    result.OrderTotalStateTui = orderCount.OrderTotalStateTui;
                }
                #endregion

                #region 收藏


                result.ColCommodityCnt = (from com in Commodity.ObjectSet()
                                          join col in SetCollection.ObjectSet() on com.Id equals col.ColKey
                                          where col.UserId == userId && col.ColType == 1 && com.State == 0 && !com.IsDel && com.CommodityType == 0 && col.ChannelId == esAppId
                                          select com.Id).Count();

                result.ColAppCnt = SetCollection.ObjectSet().Count(c => c.UserId == userId && c.ColType == 2 && c.ChannelId == esAppId);
                #endregion

                #region 预约

                try
                {
                    result.ForespeakCnt = Jinher.AMP.BTP.TPS.ZPHSV.Instance.GetMyPresellComdtyNum(userId, esAppId);
                }
                catch (Exception ex)
                {
                    LogHelper.Error(string.Format("AppSetSV.GetUserInfoCountExt。获取我的预约数量异常。 userId:{0}", userId), ex);
                }
                #endregion

                #region 金币
                result.Gold = FSPSV.Instance.GetBalance(userId);
                #endregion

                #region 浏览记录

                try
                {
                    string sql = "select count(distinct CommodityId) from UserBrowseList where appid='" + esAppId.ToString() + "' and UserId='" + userId.ToString() + "'";

                    int BrowseCount = Convert.ToInt32(Jinher.AMP.BTP.Common.SQLHelper.ExecuteScalar(SQLHelper.UserBrowse, CommandType.Text, sql, null).ToString());
                    result.BrowseCount = BrowseCount;
                }
                catch (Exception ex)
                {
                    LogHelper.Error(string.Format("AppSetSV.GetUserInfoCountExt。获取浏览记录失败。 userId:{0},esAppId:{1}", userId, esAppId), ex);
                    result.BrowseCount = 0;
                    throw;
                }

                #endregion

                return(result);
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("AppSetSV.GetUserInfoCountExt异常:userId:{0}", userId), ex);
                return(new UserInfoCountDTO {
                    UserId = userId, BrowseCount = -1
                });
            }
        }
Esempio n. 31
0
 private void removeBtnClick(object sender, RoutedEventArgs e)
 {
     SubsetCollection.RemoveAll(x => SetCollection.Contains(x));
 }