Beispiel #1
0
 void Add(dictionary d)
 {
     foreach(var pair in d)
     {
         Add(pair.Key, pair.Value);
     }
 }
Beispiel #2
0
        public override string ToString()
        {
            var d = new dictionary();

            Each(d.Add);
            return(serializer.Serialize(d));
        }
Beispiel #3
0
 void Add(dictionary d)
 {
     foreach (var pair in d)
     {
         Add(pair.Key, pair.Value);
     }
 }
Beispiel #4
0
        public void Generate(String prefix, XDocument document, TextWriter writer)
        {
            XElement root = document.Element("dictionary");

            if (root == null)
            {
                return;
            }

            dictionary dictionary = new dictionary(root);

            IEnumerable <@class>         classes         = dictionary.suite.SelectMany(suite => suite.@class);
            IEnumerable <classextension> classExtensions = dictionary.suite.SelectMany(suite => suite.classextension);
            IEnumerable <command>        commands        = dictionary.suite.SelectMany(suite => suite.command);
            IEnumerable <enumeration>    enumerations    = dictionary.suite.SelectMany(suite => suite.enumeration);
            GenerationContext            context         = new GenerationContext(prefix, classes, classExtensions, commands, enumerations);

            context.Merge();

            // Create the compilation unit
            CodeCompileUnit compileUnit = this.Generate(context);

            // Write the result
            using (IndentedTextWriter tw = new IndentedTextWriter(writer))
            {
                CodeGeneratorOptions options = new CodeGeneratorOptions();
                options.BlankLinesBetweenMembers = true;
                options.BracingStyle             = "C";
                options.IndentString             = " ";
                options.VerbatimOrder            = true;
                this.provider.GenerateCodeFromCompileUnit(compileUnit, tw, new CodeGeneratorOptions());
            }
        }
Beispiel #5
0
        static void Load(String inputFile)
        {
            Console.WriteLine("Probing " + Path.GetFileName(inputFile));
            String outputFile = Path.ChangeExtension(inputFile, ".xml");

            using (XIncludingReader reader = new XIncludingReader(inputFile)) {
                using (StreamWriter writer = new StreamWriter(outputFile)) {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(reader);

                    // Remove "xml:base attribute"
                    RemoveXmlBase(doc.DocumentElement);

                    doc.Save(writer);

                    XDocument doc2 = ToXDocument(doc);
                    Console.WriteLine(doc2.Elements().Count());

                    //dictionary dictionary = new dictionary(doc2.Root);
                    //Console.WriteLine (dictionary.title);
                }
            }

            using (StreamReader reader = new StreamReader(outputFile)) {
                XmlSerializer serializer = new XmlSerializer(typeof(dictionary));
                dictionary    dict       = (dictionary)serializer.Deserialize(reader);
                Console.WriteLine(dict.title);
            }
        }
Beispiel #6
0
        public ActionResult Save(string dict)
        {
            dictionary _dict = new dictionary();

            _dict = JsonConvert.DeserializeObject <dictionary>(dict);
            if (dict != null && _dict.id > 0)
            {
                Uof.IdictionaryService.UpdateEntity(_dict);
                AddLog("修改配置信息ID:" + _dict.id.ToString(), " 修改配置信息", "成功");

                return(Json(new {
                    result = true,
                    id = _dict.id
                }));
            }
            else
            {
                AddLog("添加配置信息ID:" + _dict.id.ToString(), " 添加配置信息", "成功");
                _dict = Uof.IdictionaryService.AddEntity(_dict);
                return(Json(new
                {
                    result = true,
                    id = _dict.id
                }));
            }
            return(Json(new { result = false }));
        }
Beispiel #7
0
        /// <summary>
        /// 返回对应角色数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public dictionary GetSingleRole(int id)
        {
            using (IDbContext dbContext = DbContextFactory.CreateDbContext())
            {
                var single = dbContext.Query <dictionary>().Where(p => p.id == id).FirstOrDefault();
                if (single == null)
                {
                    dictionary dictionary = new dictionary();
                    return(dictionary);
                }

                return(single);
            }
        }
        public ActionResult addkey(dictionary dic)
        {
            try
            {
                dictionary d = new dictionary();

                d.key = dic.key;
                d.val = dic.val;
                DictionaryService divserv = new DictionaryService();
                divserv.Add(d);
                divserv.Commit();
                return(RedirectToAction("addkey"));
            }
            catch
            {
                return(View());
            }
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="theData">保存的数据</param>
        public ActionResult SaveData(dictionary theData)
        {
            if (theData.Id.IsNullOrEmpty())
            {
                theData.Id = Guid.NewGuid().ToSequentialGuid();
                if (theData.code == "citypartne")
                {
                    theData.value = RandomHelper.GenRandom(6);
                }
                _dictionaryBusiness.AddData(theData);
            }
            else
            {
                _dictionaryBusiness.UpdateData(theData);
            }

            return(Success());
        }
        public ActionResult AddNewLabel(string label)
        {
            using (UnitOfWork work = new UnitOfWork())
            {
                work.LabelTypesRepository.insert(new LabelTypes
                {
                    Key = label
                });
                work.Save();

                dictionary dic = new dictionary
                {
                    key   = label,
                    value = work.LabelTypesRepository.listByWhere(ok => ok.Key == label).FirstOrDefault().ID,
                    check = false
                };

                return(Json(dic, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult PostsGet()
        {
            using (var db = new DBContext())
            {
                PostsGet PostsGet = new PostsGet
                {
                    Posts = db.Posts.OrderByDescending(ok => ok.ID).ToList(),
                    Enums = new List <dictionary>()
                };

                foreach (var item in db.LabelTypes.ToList())
                {
                    dictionary dic = new dictionary
                    {
                        key   = item.Key,
                        value = item.ID,
                        check = false
                    };
                    PostsGet.Enums.Add(dic);
                }

                return(Json(PostsGet, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult PostsGet()
        {
            using (UnitOfWork work = new UnitOfWork())
            {
                PostsGet PostsGet = new PostsGet
                {
                    Posts = work.PostsRepository.list().OrderByDescending(ok => ok.ID).ToList(),
                    Enums = new List <dictionary>()
                };

                foreach (var item in work.LabelTypesRepository.list())
                {
                    dictionary dic = new dictionary
                    {
                        key   = item.Key,
                        value = item.ID,
                        check = false
                    };
                    PostsGet.Enums.Add(dic);
                }

                return(Json(PostsGet, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #13
0
 public override string ToString()
 {
     var d = new dictionary();
     Each(d.Add);
     return serializer.Serialize(d);
 }
Beispiel #14
0
            internal static bool RemoteTestCase()
            {
                typeof(fastCSharp.config.pub).GetProperty("IsDebug", BindingFlags.Instance | BindingFlags.Public).SetValue(fastCSharp.config.pub.Default, true, null);
                using (fastCSharp.memoryDatabase.physicalServer.tcpServer server = new fastCSharp.memoryDatabase.physicalServer.tcpServer(tcpServer))
                {
                    if (server.Start())
                    {
                        using (memoryDatabaseModelTable <primaryKey3, primaryKey> .remote table = new memoryDatabaseModelTable <primaryKey3, primaryKey> .remote(new fastCSharp.memoryDatabase.physicalServer.tcpClient(tcpServer), cache = new dictionary <primaryKey3, primaryKey>(), memoryDatabaseTable.serializeType.Json))
                        {
                            updateMember = table.CreateMemberMap().Append(value => value.Int);
                            cache.WaitLoad();
                            if (cache.Count == 0)
                            {
                                primaryKey3 int1 = table.Insert(new primaryKey3 {
                                    Key1 = 1, Key2 = "1", Key3 = Guid.NewGuid(), Int = 1, String = "A大A"
                                }, false);
                                primaryKey3 intOld2 = new primaryKey3 {
                                    Key1 = 2, Key2 = "2", Key3 = Guid.NewGuid(), Int = 2
                                };
                                primaryKey3 int2 = table.Insert(intOld2);
                                primaryKey3 int4 = table.Insert(new primaryKey3 {
                                    Key1 = 2, Key2 = "2", Key3 = Guid.NewGuid(), Int = 4
                                });
                                if (int1 == null)
                                {
                                    return(false);
                                }
                                if (int2 == null)
                                {
                                    return(false);
                                }
                                if (int4 == null)
                                {
                                    return(false);
                                }

                                intOld2.Int = 3;
                                primaryKey3 int3 = table.Update(intOld2, updateMember);
                                if (int3 == null)
                                {
                                    return(false);
                                }
                                primaryKey3 delete = table.Delete(int4);
                                if (delete == null)
                                {
                                    return(false);
                                }

                                return(check(table, false));
                            }
                            return(check(table, true));
                        }
                    }
                }
                return(false);
            }
Beispiel #15
0
    static void Main()
    {
        mkDoctor.mkDoctors();
        strings.printString1();

        var c1 = int.Parse(Console.ReadLine());

        while (c1 > 2 || c1 < 1)
        {
            Console.WriteLine("\nWrong choice ... Please chose again!");
            Console.Write("Your Choice is:");
            c1 = int.Parse(Console.ReadLine());
        }
        if (c1 == 1)
        {
            Console.Clear();
            strings.printString2();

            Console.Write("\nPlease choose the clinic department you want:");

            int c2 = int.Parse(Console.ReadLine());
            while (c2 <= 0 || c2 > 5)
            {
                Console.WriteLine("\nIncorrect Choice ... Please Choose again!");
                Console.Write("\nChoose the clinic department you want:");
                c2 = int.Parse(Console.ReadLine());
            }

            Console.Clear();

            Doctor.printDoctor(mkDoctor.DoctorList, c2);

            Console.WriteLine("\nWhich doctor would you like to make appointment with?");
            Console.Write("Your choice is:");

            int c3 = int.Parse(Console.ReadLine());

            Doctor.chooseDoctor(mkDoctor.DoctorList, c3);

            Console.WriteLine("\nWhich time would you like to make appointment at?");
            Console.Write("Your choice is:");

            int c4 = int.Parse(Console.ReadLine());

            Doctor.chooseTime(mkDoctor.DoctorList, c4);

            profCreate.createFile();
        }
        else if (c1 == 2)
        {
            List <string> arraydictionary = new List <string> {
                "1. C.B.C", "2. R.B.C", "3. L.C.D", "4. W.B.C", "5. Hgb",
                "6. E.S.R", "7. APTT", "8. G6PD", "9. TSH", "10. C.B.R"
            };

            Dictionary <int, dictionary> analyzingdictionary = new Dictionary <int, dictionary>();

            dictionary analyzing1 = new dictionary()
            {
                analyzingName  = "C.B.C",
                id             = 1,
                analyzingPrice = 300
            };
            dictionary analyzing2 = new dictionary()
            {
                analyzingName  = "R.B.C",
                id             = 2,
                analyzingPrice = 400
            };
            dictionary analyzing3 = new dictionary()
            {
                analyzingName  = "L.C.D",
                id             = 3,
                analyzingPrice = 500
            };
            dictionary analyzing4 = new dictionary()
            {
                analyzingName  = "W.B.C",
                id             = 4,
                analyzingPrice = 600
            };
            dictionary analyzing5 = new dictionary()
            {
                analyzingName  = "Hgb",
                id             = 5,
                analyzingPrice = 700
            };
            dictionary analyzing6 = new dictionary()
            {
                analyzingName  = "E.S.R",
                id             = 6,
                analyzingPrice = 800
            };
            dictionary analyzing7 = new dictionary()
            {
                analyzingName  = "APTT",
                id             = 7,
                analyzingPrice = 350
            };
            dictionary analyzing8 = new dictionary()
            {
                analyzingName  = "G6PD",
                id             = 8,
                analyzingPrice = 550
            };
            dictionary analyzing9 = new dictionary()
            {
                analyzingName  = "TSH",
                id             = 9,
                analyzingPrice = 650
            };
            dictionary analyzing10 = new dictionary()
            {
                analyzingName  = "C.B.R",
                id             = 10,
                analyzingPrice = 750
            };
            analyzingdictionary.Add(analyzing1.id, analyzing1);
            analyzingdictionary.Add(analyzing2.id, analyzing2);
            analyzingdictionary.Add(analyzing3.id, analyzing3);
            analyzingdictionary.Add(analyzing4.id, analyzing4);
            analyzingdictionary.Add(analyzing5.id, analyzing5);
            analyzingdictionary.Add(analyzing6.id, analyzing6);
            analyzingdictionary.Add(analyzing7.id, analyzing7);
            analyzingdictionary.Add(analyzing8.id, analyzing8);
            analyzingdictionary.Add(analyzing9.id, analyzing9);
            analyzingdictionary.Add(analyzing10.id, analyzing10);

            printarray.printlabels(arraydictionary);
            printtotalprice.print(analyzingdictionary);
        }
    }
Beispiel #16
0
 get => externalGetter(dictionary[key]);
Beispiel #17
0
            internal static bool TestCase()
            {
                using (memoryDatabaseModelTable <primaryKey3, primaryKey> table = new memoryDatabaseModelTable <primaryKey3, primaryKey>(cache = new dictionary <primaryKey3, primaryKey>(), memoryDatabaseTable.serializeType.Json, "localPrimaryKey3"))
                {
                    updateMember = table.CreateMemberMap().Append(value => value.Int);
                    cache.WaitLoad();
                    if (cache.Count == 0)
                    {
                        primaryKey3 int1 = table.Insert(new primaryKey3 {
                            Key1 = 1, Key2 = "1", Key3 = Guid.NewGuid(), Int = 1, String = "A大A"
                        }, false);
                        primaryKey3 intOld2 = new primaryKey3 {
                            Key1 = 2, Key2 = "2", Key3 = Guid.NewGuid(), Int = 2
                        };
                        primaryKey3 int2 = table.Insert(intOld2);
                        primaryKey3 int4 = table.Insert(new primaryKey3 {
                            Key1 = 2, Key2 = "2", Key3 = Guid.NewGuid(), Int = 4
                        });
                        if (int1 == null)
                        {
                            return(false);
                        }
                        if (int2 == null)
                        {
                            return(false);
                        }
                        if (int4 == null)
                        {
                            return(false);
                        }

                        intOld2.Int = 3;
                        primaryKey3 int3 = table.Update(intOld2, updateMember);
                        if (int3 == null)
                        {
                            return(false);
                        }
                        primaryKey3 delete = table.Delete(int4);
                        if (delete == null)
                        {
                            return(false);
                        }

                        return(check(table, false));
                    }
                    return(check(table, true));
                }
            }
 dataBase.GetReference(PlayerData.Instance.userID).Child(reference).SetValueAsync(dictionary[i]);
Beispiel #19
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="theData">保存的数据</param>
        public ActionResult SaveData(product theData, List <product_date> listProductDate, List <product_Introduction> datalistIntroduction)
        {
            //校验价格是否亏本
            if (!_productBusiness.PaymentAmount(theData))
            {
                return(Error("价格异常!请检查产品价格及营销价格"));
            }

            var supplier = _dictionaryBusiness.GetTheData(theData.supplier);

            if (supplier == null)//创建供应商
            {
                var su = new dictionary()
                {
                    Id          = Guid.NewGuid().ToSequentialGuid(),
                    code        = "supplier",
                    name        = theData.supplier,
                    sort        = 0,
                    enable_flag = "1"
                };
                _dictionaryBusiness.AddData(su);
                theData.supplier = su.Id;
            }
            if (theData.Id == 0)
            {
                theData.enable_flag    = "1";
                theData.special_status = 0;
                theData.create_by      = Operator.UserId;
                theData.create_time    = DateTime.Now.ToCstTime();
                _productBusiness.AddData(theData);
            }
            else
            {
                theData.update_by   = Operator.UserId;
                theData.update_time = DateTime.Now.ToCstTime();
                _productBusiness.UpdateData(theData);
            }

            var addIntroductions = new List <product_Introduction>();

            foreach (var item in datalistIntroduction)
            {
                if (item.Id.IsNullOrEmpty())
                {
                    addIntroductions.Add(new product_Introduction()
                    {
                        Id          = Guid.NewGuid().ToSequentialGuid(),
                        productId   = theData.Id,
                        days        = item.days,
                        title       = item.title,
                        scheduling  = item.scheduling,
                        stay        = item.stay,
                        food        = item.food,
                        create_by   = Operator.UserId,
                        create_time = DateTime.Now.ToCstTime()
                    });
                }
                else
                {
                    var introduction = new product_Introduction()
                    {
                        Id          = item.Id,
                        days        = item.days,
                        title       = item.title,
                        scheduling  = item.scheduling,
                        stay        = item.stay,
                        food        = item.food,
                        update_by   = Operator.UserId,
                        update_time = DateTime.Now.ToCstTime()
                    };
                    _product_IntroductionBusiness.UpdateAny(introduction, new List <string>()
                    {
                        "days", "title", "scheduling", "stay", "food", "update_by", "update_time"
                    });
                }
            }
            _product_IntroductionBusiness.Insert(addIntroductions);

            var addProductDate    = new List <product_date>();
            var updateProductDate = new List <product_date>();
            var teamlist          = new List <team>();

            //保存或更新开团日期

            foreach (var item in listProductDate)
            {
                item.product_id = theData.Id;
                if (item.product_date_id == 0)
                {
                    addProductDate.Add(item);
                    teamlist.Add(new team()
                    {
                        product_id = theData.Id, start_time = item.open_date, status = 1
                    });
                }
                else
                {
                    updateProductDate.Add(item);
                }
            }
            _product_dateBusiness.Insert(addProductDate);
            _product_dateBusiness.Update(updateProductDate);
            _teamBusiness.Insert(teamlist);
            return(Success());
        }
Beispiel #20
0
 Remove(dictionary[key]);
 var(dictionary, queries, expected) = scenarios;
 get => AddSymmetricKeyIfNotExist(dictionary[key]);