当前位置: 首页>>代码示例>>C#>>正文


C# Globalization.CultureInfo类代码示例

本文整理汇总了C#中System.Globalization.CultureInfo的典型用法代码示例。如果您正苦于以下问题:C# System.Globalization.CultureInfo类的具体用法?C# System.Globalization.CultureInfo怎么用?C# System.Globalization.CultureInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.Globalization.CultureInfo类属于命名空间,在下文中一共展示了System.Globalization.CultureInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExportTxt

        /// <summary>
        /// 导出文件为txt
        /// </summary>
        /// <param name="isdelete">是否删除数据</param>
        protected void ExportTxt(bool isdelete)
        {

            Page.Response.Clear();
            Page.Response.Buffer = true;
            Page.Response.Charset = "GB2312";
            Page.Response.AppendHeader("Content-Disposition", string.Format("attachment;filename=sys_EventLog{0}.csv",DateTime.Now.ToShortDateString()));
            Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
            Response.ContentType = "text/plain";//设置输出文件类型为txt文件。 
            this.EnableViewState = false;
            System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);
            System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("EventID,E_U_LoginName,E_UserID,E_DateTime,E_ApplicationID,E_A_AppName,E_M_Name,E_M_PageCode,E_From,E_Type,E_IP,E_Record");
            sb.Append("\n");
            int rCount = 0;
            ArrayList lst = BusinessFacade.sys_EventList(new QueryParam(1, int.MaxValue),out rCount);
            foreach (sys_EventTable var in lst)
            {
                sb.AppendFormat("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},\"{11}\"\n", var.EventID,
                var.E_U_LoginName,var.E_UserID,var.E_DateTime,var.E_ApplicationID,
                var.E_A_AppName,var.E_M_Name,var.E_M_PageCode,var.E_From,
                var.E_Type,var.E_IP,var.E_Record
                );
            }

            Page.Response.Write(sb.ToString());
            if (isdelete)
            {
                ClearData();
            }
            EventMessage.EventWriteDB(2, "导出操作日志!");
            Page.Response.End();
        }
开发者ID:zhanfuzhi,项目名称:shanligitproject,代码行数:38,代码来源:default.aspx.cs

示例2: ReturnDayOfWeekOnBulgarian

        public string ReturnDayOfWeekOnBulgarian(DateTime date)
        {
            var culture = new System.Globalization.CultureInfo("bg-BG");
            var day = culture.DateTimeFormat.GetDayName(date.DayOfWeek);

            return day;
        }
开发者ID:juvemar,项目名称:WebApi-Cloud-Wcf,代码行数:7,代码来源:DayOfWeekService.svc.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("es-ES");

            spanFecha.InnerText = "Garage Nadia - " + DateTime.Now.ToString("dd/MM/yyyy hh:mm");

            string tipo = Request.QueryString["tipo"];

            if (tipo == "mensual")
            {
                string mes = Request.QueryString["mes"];
                string ano = Request.QueryString["ano"];
                string texto = Request.QueryString["texto"];
                string detalle = Request.QueryString["detalle"];

                spanFiltros.InnerText = "Mes: "+texto+" - Año: "+ano;

                divCode.InnerHtml = CONTROLADORA.ControladoraReporteHTML.ReporteGananciasMensual(mes, ano, detalle);
            }

            if (tipo == "periodo")
            {
                string desde = Request.QueryString["desde"];
                string hasta = Request.QueryString["hasta"];
                string detalle = Request.QueryString["detalle"];

                spanFiltros.InnerText = "Reporte Desde: " + desde + " - Hasta: " + hasta;


                divCode.InnerHtml = CONTROLADORA.ControladoraReporteHTML.ReporteGananciasPeriodo(desde, hasta, detalle);
            }


        }
开发者ID:guicejas,项目名称:GNAPP2016,代码行数:34,代码来源:reportegananciasHTML.aspx.cs

示例4: Import

        public static Person Import(String input)
        {
            var parameters = new Dictionary<string, string>();
            var data = input.Split(';');
            foreach (string item in data)
            {
                var specyficData = item.Split(':');
                parameters[specyficData[0]] = specyficData[1];
            }

            var person = new Person();
            person.NameSurname = parameters["NS"];

            IFormatProvider culture = new System.Globalization.CultureInfo("pl-PL", true);
            if (parameters.ContainsKey("BD"))
            {
                person.Birthdate = DateTime.Parse(parameters["BD"], culture);
            }

            if (parameters.ContainsKey("DD"))
            {
                person.Deathdate = DateTime.Parse(parameters["DD"], culture);
            }

            if (parameters.ContainsKey("S"))
            {
                switch (parameters["S"])
                {
                    case "M": person.Sex = PersonSex.Male; break;
                    case "F": person.Sex = PersonSex.Female; break;
                }
            }

            return person;
        }
开发者ID:mic22,项目名称:NancyDb4o,代码行数:35,代码来源:Program.cs

示例5: cleanUpPhotos

 /// <summary>
 /// Remove all photos not referenced by any album
 /// David
 /// </summary>
 /// <returns>Number of photos removed</returns>
 public static int cleanUpPhotos()
 {
     int totalRemoved = 0;
     System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
     List<AllImagesInfo> _allImageInfo = getAllImageInfo();
     foreach(string photoPath in Directory.GetFiles(Directory.GetCurrentDirectory() + "\\Photos","*.*",SearchOption.AllDirectories).Where(s=>s.EndsWith(".jpg",true,ci) || s.EndsWith(".png",true,ci) || s.EndsWith(".jpeg",true,ci) || s.EndsWith(".gif",true,ci) || s.EndsWith(".bmp",true,ci)))
     {
         if (!_allImageInfo.Exists(x => x.path == photoPath))
         {
             try
             {
                 if (File.Exists(photoPath))
                 {
                     File.Delete(photoPath);
                     totalRemoved++;
                 }
                 else
                 {
                     throw new Exception("File path does not exist!!");
                 }
             }catch(Exception e){
                 System.Windows.Forms.MessageBox.Show("An error has occurred trying to remove photos. " + e.Message,"Error",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Error);
             }
         }
     }
     return totalRemoved;
 }
开发者ID:sylvesterink,项目名称:Album-Viewer,代码行数:32,代码来源:Utilities.cs

示例6: GetDayOfTheWeek

        // funktions som kontrolerar om väder prognonsernas dag
        public string GetDayOfTheWeek(DateTime dateTime, int period)
        {
            var culture = new System.Globalization.CultureInfo("sv-SE");

            if (dateTime.DayOfWeek == DateTime.Now.DayOfWeek && counter != 1)
            {
                //counter = 1; test
                /*
                 if (dateTime.DayOfWeek == DateTime.Now.AddDays(1).DayOfWeek && period == 0)
            {
                return "Imorgon";
            }*/
                counter = 1;
                return "Idag";

            }
            if (dateTime.DayOfWeek == DateTime.Now.AddDays(1).DayOfWeek && period == 0)
            {
                return "Imorgon";
            }
            if (period == 0)
            {

                return culture.DateTimeFormat.GetDayName(dateTime.DayOfWeek).ToString();
            }
            else
            {
                return null;
            }
        }
开发者ID:Marco30,项目名称:Mv222fp-1DV449-Webbteknik-II,代码行数:31,代码来源:WeatherViewModel.cs

示例7: Create

 public ActionResult Create(Customer cs, FormCollection collection)
 {
     IFormatProvider iFP = new System.Globalization.CultureInfo("vi-VN", true);
     cs.CreateDate = DateTime.Parse(collection["CreateDate"], iFP);
     var result = CustomerBusiness.Insert(cs);
     return PartialView(cs);
 }
开发者ID:thuyenvinh,项目名称:qlvx,代码行数:7,代码来源:CustomerController.cs

示例8: NifParser

 public NifParser()
 {
     // Language settings
     System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
     System.Threading.Thread.CurrentThread.CurrentCulture = ci;
     System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
 }
开发者ID:Merec,项目名称:DAoC-MapCreator,代码行数:7,代码来源:NifParser.cs

示例9: RunBare

		// @Override
		public override void  RunBare()
		{
			// Do the test with the default Locale (default)
			try
			{
				locale = defaultLocale;
				base.RunBare();
			}
			catch (System.Exception e)
			{
                System.Console.Out.WriteLine("Test failure of '" + Lucene.Net.TestCase.GetName() + "' occurred with the default Locale " + locale); 
				throw e;
			}

            if (testWithDifferentLocales == null || testWithDifferentLocales.Contains(Lucene.Net.TestCase.GetName())) 
			{
				// Do the test again under different Locales
				System.Globalization.CultureInfo[] systemLocales = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.InstalledWin32Cultures);
				for (int i = 0; i < systemLocales.Length; i++)
				{
					try
					{
						locale = systemLocales[i];
						base.RunBare();
					}
					catch (System.Exception e)
					{
                        System.Console.Out.WriteLine("Test failure of '" + Lucene.Net.TestCase.GetName() + "' occurred under a different Locale " + locale); // {{Aroush-2.9}} String junit.framework.TestCase.getName()
						throw e;
					}
				}
			}
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:34,代码来源:LocalizedTestCase.cs

示例10: MainPage

        // Constructor
        public MainPage()
        {
            InitializeComponent();
            dat = new DataHandler();
            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;

            GoogleAnalytics.EasyTracker.GetTracker().SendView("MainPanaroma");

            App.ViewModel.Items.Clear();
            txt_REG.Text = (string) dat.getReg();
            if (txt_REG.Text == "" || dat.getDob().Equals(""))
            {
                newUser = true;
            }
            else {
                DateTime dater;
                IFormatProvider culture = new System.Globalization.CultureInfo("fr-FR");
                String date = (dat.getDob().Insert(2, "/")).Insert(5,"/");
                dater = DateTime.Parse(date, culture);
                datePicker.Value = dater;
                if (dat.isVellore())
                    chk_Vellore.IsChecked = true;
                else
                    chk_Chennai.IsChecked = true;
                //App.ViewModel.isCache = true;
                //App.ViewModel.LoadData();
            }
            
        }
开发者ID:saurabhsjoshi,项目名称:VITacademics-for-WindowsPhone,代码行数:31,代码来源:MainPage.xaml.cs

示例11: getSystemCultureInfo

		protected override System.Globalization.CultureInfo getSystemCultureInfo()
		{
			var netLanguage = "en";
			var prefLanguageOnly = "en";
			if (NSLocale.PreferredLanguages.Length > 0)
			{
				var pref = NSLocale.PreferredLanguages[0];
				prefLanguageOnly = pref.Substring(0, 2);
				if (prefLanguageOnly == "pt")
				{
					if (pref == "pt")
						pref = "pt-BR"; // get the correct Brazilian language strings from the PCL RESX (note the local iOS folder is still "pt")
					else
						pref = "pt-PT"; // Portugal
				}
				netLanguage = pref.Replace("_", "-");
				Console.WriteLine("preferred language:" + netLanguage);
			}
			System.Globalization.CultureInfo ci = null;
			try
			{
				ci = new System.Globalization.CultureInfo(netLanguage);
			}
			catch
			{
				// iOS locale not valid .NET culture (eg. "en-ES" : English in Spain)
				// fallback to first characters, in this case "en"
				ci = new System.Globalization.CultureInfo(prefLanguageOnly);
			}
			return ci;
		}
开发者ID:fadafido,项目名称:tojeero,代码行数:31,代码来源:LocalizationService.cs

示例12: GetSatelliteAssembly

        public Assembly GetSatelliteAssembly(CultureInfo culture)
        {
            if (culture == null)
            {
                throw new ArgumentNullException("culture");
            }

            Assembly assm = null;
            string baseName = this.FullName;
            string cultureName;

            while (assm == null && (cultureName = culture.Name) != "")
            {
                string assmName = baseName + "." + cultureName;

                assm = Assembly.Load(assmName, false);

                culture = culture.Parent;
            }

            if (assm == null)
            {
                throw new ArgumentException();
                // FIXME -- throw new FileNotFoundException();
            }

            return assm;
        }
开发者ID:elasota,项目名称:clarity,代码行数:28,代码来源:Assembly.cs

示例13: RoundFloatToString

 public static string RoundFloatToString(float floatToRound)
 {
     System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-US");
     cultureInfo.NumberFormat.CurrencyDecimalDigits = 2;
     cultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
     return floatToRound.ToString("F", cultureInfo);
 }
开发者ID:mumer92,项目名称:Design-Patterns,代码行数:7,代码来源:StatisticsDisplay.cs

示例14: GetDataValueRangeFilderString

        internal static string GetDataValueRangeFilderString(DataValueFilter dataValueFilter)
        {
            string WhereClause = " WHERE NOT (";
            string CurrentThreadDecimalChar = System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator;
            string InvariantCultureDecimalChar = new System.Globalization.CultureInfo("en-US").NumberFormat.NumberDecimalSeparator;
            switch (dataValueFilter.OpertorType)
            {
                case OpertorType.EqualTo:
                    WhereClause += " VAL([" + Data.DataValue + "]) = " + dataValueFilter.FromDataValue.ToString().Replace(CurrentThreadDecimalChar, InvariantCultureDecimalChar);
                    break;
                case OpertorType.Between:
                    //Inclusive of min & max values as per ANSI SQL
                    WhereClause += "(VAL([" + Data.DataValue + "]) >= " + dataValueFilter.FromDataValue.ToString().Replace(CurrentThreadDecimalChar, InvariantCultureDecimalChar) + " AND VAL([" + Data.DataValue + "]) <= " + dataValueFilter.ToDataValue.ToString().Replace(CurrentThreadDecimalChar, InvariantCultureDecimalChar) + ")";
                    break;
                case OpertorType.GreaterThan:
                    WhereClause += "(VAL([" + Data.DataValue + "]) > " + dataValueFilter.FromDataValue.ToString().Replace(CurrentThreadDecimalChar, InvariantCultureDecimalChar) + ")";
                    break;
                case OpertorType.LessThan:
                    WhereClause += "(VAL([" + Data.DataValue + "]) < " + dataValueFilter.ToDataValue.ToString().Replace(CurrentThreadDecimalChar, InvariantCultureDecimalChar) + ")";
                    break;
            }

            WhereClause += " )";

            return WhereClause;
        }
开发者ID:SDRC-India,项目名称:sdrcdevinfo,代码行数:26,代码来源:Utility.cs

示例15: GetJQueryDateFormatFor

        static string GetJQueryDateFormatFor(string language)
        {
            var culture = new System.Globalization.CultureInfo(language);
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;

            return DateFormatter.CurrentJQuery;
        }
开发者ID:sharparchitecture,项目名称:Sharp-Architecture,代码行数:7,代码来源:DateFomatterTests.cs


注:本文中的System.Globalization.CultureInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。