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


C# Gender.ToString方法代码示例

本文整理汇总了C#中Gender.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Gender.ToString方法的具体用法?C# Gender.ToString怎么用?C# Gender.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gender的用法示例。


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

示例1: QueryEmployeesByGender

 public static void QueryEmployeesByGender(Gender gender)
 {
     string uriTemplate = _baseAddress + "/odata/Employees?$filter=Gender eq {0}'{1}'";
     string requestUri = string.Format(uriTemplate, typeof(Gender).FullName, gender.ToString());
     using (HttpResponseMessage response = _httpClient.GetAsync(requestUri).Result)
     {
         response.EnsureSuccessStatusCode();
         JObject result = response.Content.ReadAsAsync<JObject>().Result;
         Console.WriteLine("\nEmployees whose gender is '{0}' are:", gender.ToString());
         Console.WriteLine(result);
     }
 }
开发者ID:andreychizhov,项目名称:microsoft-aspnet-samples,代码行数:12,代码来源:Program.cs

示例2: ConvertTest

 public void ConvertTest(Gender value, bool expectedResult)
 {
     string argument = expectedResult ? value.ToString() : "";
     var converter = new EnumToBooleanConverter();
     bool converted = (bool)converter.Convert(value, typeof(bool), argument, CultureInfo.CurrentCulture);
     Assert.AreEqual(expectedResult, converted);
 }
开发者ID:snyang,项目名称:AppGene,代码行数:7,代码来源:EnumToBooleanConverterTest.cs

示例3: ProfilePicture

        public static string ProfilePicture(this UrlHelper url, string photoId, string resize, Gender gender)
        {
            string defaultUrl = string.Format("~/Content/images/{0}/{1}.jpg", resize, gender.ToString());

            var photoUrl = GetPhotoUrl(url, photoId, resize, defaultUrl);
            var img = new TagBuilder("img");
            img.MergeAttribute("src", photoUrl);
            img.MergeAttribute("class", "img-polaroid");
            return img.ToString(TagRenderMode.SelfClosing);
        }
开发者ID:vcardins,项目名称:CoolApp,代码行数:10,代码来源:UrlExtensions.ProfilePicture.cs

示例4: CreateUser

        public User CreateUser(string emailAddress, string userName, string password, Gender gender, out UserCreateStatus status)
        {
            var currentUser = _userRepo.Find().WithEmail(emailAddress).SingleOrDefault();
            if (currentUser != null)
            {
                status = UserCreateStatus.DuplicateEmail;
                return null;
            }

            currentUser = _userRepo.Find().WithUserName(userName).SingleOrDefault();
            if (currentUser != null)
            {
                status = UserCreateStatus.DuplicateUserName;
                return null;
            }

            var now = DateTime.UtcNow;

            // Generate Hashed Password and Salt
            string hashedPassword;
            string salt;
            _saltedHash.GetHashAndSaltString(password, out hashedPassword, out salt);

            var user = new User
                           {
                               EmailAddress = emailAddress,
                               UserName = userName,
                               Salt = salt,
                               Password = hashedPassword,
                               Gender = gender.ToString(),
                               AccountStatusId = (int) AccountStatus.InActive,
                               LastLoggedIn = now,
                               CreatedOn = now,
                               UpdatedOn = now,
                               RegistrationStep = 2
                           };

            _userRepo.Insert(user);
            status = UserCreateStatus.Success;
            return user;
        }
开发者ID:sursani,项目名称:Sirius,代码行数:41,代码来源:AuthenticationService.cs

示例5: AdminAddStudentPage

        public AdminAddStudentPage(string name, Gender gender, string matric, string password, string school)
        {
            // FUNCTION: intialise for edditing student
            // PRE-CONDITIONS:
            // POST-CONDITIONS:

            InitializeComponent();
            this.matricTextbox.Enabled = false;
            this.matric = matric;
            this.gender = gender;
            this.name = name;
            this.password = password;
            this.school = school;
            this.nameTextbox.Text = name;
            this.matricTextbox.Text = matric;
            this.passwordTextbox.Text = password;
            this.schoolCombobox.Text = school;
            this.genderComboBox.Text = gender.ToString();
            checkSaved = false;
            this.Text = "Edit Student Particulars";
        }
开发者ID:garygsw,项目名称:Camphor,代码行数:21,代码来源:AdminAddStudentPage.cs

示例6: SythesizeAsync

        public async Task<Stream> SythesizeAsync(string ssmlFragment, string language = "en-US", Gender gender = Gender.Female)
        {
            if (language == null) throw new ArgumentNullException(nameof(language));

            var voice = SpeechSynthesizer.AllVoices
                        .Where(v => v.Language == language && v.Gender == (VoiceGender)Enum.Parse(typeof(VoiceGender), gender.ToString(), true))
                        .FirstOrDefault();
            if (voice == null || ssmlFragment == null)
                return null;

            try
            {
                using (var synth = new SpeechSynthesizer())
                {
                    synth.Voice = voice;
                    var ssml = String.Format(SsmlTemplate, language, ssmlFragment);
                    return (await synth.SynthesizeSsmlToStreamAsync(ssml)).AsStream();
                }
            }
            catch (Exception e)
            {
                return null;
            }
        }
开发者ID:evgri243,项目名称:pubic-demos,代码行数:24,代码来源:LocalSpeechSythesizer.cs

示例7: UpdateAthleteSex

        /// <summary>
        /// Updates the sex of the currently authenticated athlete.
        /// </summary>
        /// <param name="gender">The gender to update to.</param>
        /// <returns>The currently authenticated athlete.</returns>
        public async Task<Athlete> UpdateAthleteSex(Gender gender)
        {
            string putUrl = string.Format("{0}?sex={1}&access_token={2}", Endpoints.Athlete, gender.ToString().Substring(0, 1), Authentication.AccessToken);
            string json = await WebRequest.SendPutAsync(new Uri(putUrl));

            return Unmarshaller<Athlete>.Unmarshal(json);
        }
开发者ID:wolfpackt99,项目名称:stravadotnet,代码行数:12,代码来源:AthleteClient.cs

示例8: FindAsync

     /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
     /// <exception cref="PersonsClientException">A server side error occurred.</exception>
     public async System.Threading.Tasks.Task<System.Collections.ObjectModel.ObservableCollection<Person>> FindAsync(Gender gender, System.Threading.CancellationToken cancellationToken)
     {
         var url_ = string.Format("{0}/{1}", BaseUrl, "api/Persons/find/{gender}");
 
         if (gender == null)
             throw new System.ArgumentNullException("gender");
         url_ = url_.Replace("{gender}", System.Uri.EscapeDataString(gender.ToString()));
 
         using (var client_ = await CreateHttpClientAsync(cancellationToken).ConfigureAwait(false))
 		{
 			var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false);
 			PrepareRequest(client_, ref url_);
 			var content_ = new System.Net.Http.StringContent(string.Empty);
 			request_.Content = content_;
 			request_.Method = new System.Net.Http.HttpMethod("POST");
 			request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
 			var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false);
 			ProcessResponse(client_, response_);
 
 			var responseData_ = await response_.Content.ReadAsByteArrayAsync().ConfigureAwait(false); 
 			var status_ = ((int)response_.StatusCode).ToString();
 
 			if (status_ == "200") 
 			{
 				var result_ = default(System.Collections.ObjectModel.ObservableCollection<Person>); 
 				try
 				{
 					if (responseData_.Length > 0)
 						result_ = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.ObjectModel.ObservableCollection<Person>>(System.Text.Encoding.UTF8.GetString(responseData_, 0, responseData_.Length), new Newtonsoft.Json.JsonConverter[] { new Newtonsoft.Json.Converters.StringEnumConverter(), new JsonExceptionConverter() });                                
 					return result_; 
 				} 
 				catch (System.Exception exception) 
 				{
 					throw new PersonsClientException("Could not deserialize the response body.", status_, responseData_, exception);
 				}
 			}
 			else
 			if (status_ != "200" && status_ != "204")
 				throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", status_, responseData_, null);
 		
 			return default(System.Collections.ObjectModel.ObservableCollection<Person>);
 		}
 	}
开发者ID:NSwag,项目名称:NSwag,代码行数:45,代码来源:ServiceClients.cs

示例9: GetSegmentLeaderboard

        /// <summary>
        /// Gets the gender-filtered and weight-class filtered leaderboard of a segment. This method requires the currently 
        /// authenticated  athlete to have a Strava premium account.
        /// </summary>
        /// <param name="segmentId">The Strava segment Id.</param>
        /// <param name="gender">The gender used to filter the leaderboard.</param>
        /// /// <param name="weight">The weight class used to filter the leaderboard.</param>
        /// <returns>The leaderboard filtered by gender and weight class.</returns>
        public Leaderboard GetSegmentLeaderboard(String segmentId, Gender gender, WeightClass weight)
        {
            String getUrl = String.Format("{0}/{1}/leaderboard?gender={2}&weight_class={3}&filter=weight_class&access_token={4}",
                Endpoints.Leaderboard,
                segmentId,
                gender.ToString().Substring(0, 1),
                UrlHelper.WeightClassToString(weight),
                Authentication.AccessToken
                );

            String json = WebRequest.SendGet(new Uri(getUrl));
            return Unmarshaller<Leaderboard>.Unmarshal(json);
        }
开发者ID:rnrbrste,项目名称:stravadotnet,代码行数:21,代码来源:SegmentClient.cs

示例10: SetGender

 public void SetGender(Gender type)
 {
     if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor && this.mAccount != null)
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.tendcloud.tenddata.TDGAAccount$Gender");
         AndroidJavaObject androidJavaObject = androidJavaClass.CallStatic<AndroidJavaObject>("valueOf", new object[]
         {
             type.ToString()
         });
         this.mAccount.Call("setGender", new object[]
         {
             androidJavaObject
         });
     }
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:15,代码来源:TDGAAccount.cs

示例11: GetSegmentLeaderboard

        /// <summary>
        /// Gets the gender-filtered and age-filtered leaderboard of a segment. This method requires the currently authenticated 
        /// athlete to have a Strava premium account.
        /// </summary>
        /// <param name="segmentId">The Strava segment Id.</param>
        /// <param name="gender">The gender used to filter the leaderboard.</param>
        /// /// <param name="age">The age range used to filter the leaderboard.</param>
        /// <returns>The leaderboard filtered by gender and age.</returns>
        public Leaderboard GetSegmentLeaderboard(String segmentId, Gender gender, AgeGroup age)
        {
            String ageFilter = String.Empty;

            switch (age)
            {
                case AgeGroup.One:
                    ageFilter = "0_24";
                    break;
                case AgeGroup.Two:
                    ageFilter = "25_34";
                    break;
                case AgeGroup.Three:
                    ageFilter = "35_44";
                    break;
                case AgeGroup.Four:
                    ageFilter = "45_54";
                    break;
                case AgeGroup.Five:
                    ageFilter = "55_64";
                    break;
                case AgeGroup.Six:
                    ageFilter = "65_plus";
                    break;
            }

            String getUrl = String.Format("{0}/{1}/leaderboard?gender={2}&age_group={3}&filter=age_group&access_token={4}",
                Endpoints.Leaderboard,
                segmentId,
                gender.ToString().Substring(0, 1),
                ageFilter,
                Authentication.AccessToken
                );

            String json = WebRequest.SendGet(new Uri(getUrl));

            return Unmarshaller<Leaderboard>.Unmarshal(json);
        }
开发者ID:TiBall,项目名称:stravadotnet,代码行数:46,代码来源:SegmentClient.cs

示例12: FindSerchResults

        public List<Dictionary<string, string>> FindSerchResults(string serchableName, TablesNames tableName, Gender gender)
        {
            TableInform table;
            DbConnection connection;
            List<Dictionary<string, string>> result;

            result = new List<Dictionary<string, string>>();
            connection = TableInform.Connection;
            table = new TableInform(tableName.ToString());

            var rowList = table.Table.AsEnumerable().Where(r => r.Field<string>("Name").Contains(serchableName.ToUpper())).ToList();

            if (rowList.Count > 0)
            {
                foreach (var row in rowList)
                {
                    if (row.Field<string>("League") == gender.ToString())
                    {
                        result.Add(table.ConvertRowToDict(row));
                    }
                }
                return result;
            }
            return null;
        }
开发者ID:gaidanna,项目名称:Volleyball,代码行数:25,代码来源:VolleyballService.cs

示例13: CalculatePremium

    public CalculatePremium_Result CalculatePremium(string partnerUsername, string partnerPassword, string planCode, PaymentMethod paymentMethod, string age, Gender gender, string amount, string channel, string occupationGroup)
    {
        /*
        Call WS_SQM_CalculateService.CalculatePremium(Channel (int), SelectedPlanCode (string), PaymentMethod (int), CustomerAge (int), CustomerGender (char), MainInsured (decimal), CustomerOccupationGroup (strimg));
        ระบุ Channel เป็นรหัสช่องทางที่กำหนด เช่น 6,
        ระบุ PaymentMethod เป็น 12/06/03/01
        ระบุ CustomerGender เป็น F/M ,
        ระบุ CustomerOccupationGroup เป็น 001
        */

        CalculatePremium_Result obj = new CalculatePremium_Result();
        RefRunningTBBLL runningobj = new RefRunningTBBLL();
        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj = new WSLogBLL();
        string methodName = "CalculatePremium";

        int vChannel = 0;
        int vPaymentMethod = 0;
        int vAge = 0;
        char vGender = 'F';
        decimal vMainInsured = 0;
        string vOccupationGroup = "";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || planCode == "" || paymentMethod.ToString() == "" || age == "" || gender.ToString() == "" || amount == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + planCode + "|" + gender.ToString() + "|" + age + "|" + amount + "|" + paymentMethod.ToString() + "|" + channel + "|" + occupationGroup, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุข้อมูลให้ครบถ้วน";
            }
            else
            {
                // พิสูจน์ตัวตนของพันธมิตรก่อนที่จะให้ใช้งานจริง
                NETWS_ForPartnerAuthenticationChecking.CheckPartnerAuthentication_Result pacobj = CheckPartnerAuthenticationReturnDetail(partnerUsername, partnerPassword, this.ipaddress);
                if (pacobj.Result.Trim().ToLower() == "passed")
                {
                    //vChannel = 32;
                    // 20150325: แก้ให้ระบุช่องทางมาเลย ไม่ fix ให้
                    vChannel = Convert.ToInt32(channel);
                    //vPaymentMethod = Convert.ToInt32(paymentMethod);
                    vPaymentMethod = this.PaymentMethodValues[Convert.ToInt32(paymentMethod.ToString("D"))];
                    vAge = Convert.ToInt32(age);
                    //vGender = gender.ToString().ToUpper() == "FEMALE" ? 'F' : 'M';
                    vGender = this.GenderValues[Convert.ToInt32(gender.ToString("D"))];
                    vMainInsured = Convert.ToDecimal(amount);
                    //vOccupationGroup = "001";
                    // 20150325: แก้ให้ระบุช่องทางมาเลย ไม่ fix ให้
                    vOccupationGroup = occupationGroup;

                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + planCode + "|" + vGender.ToString() + "|" + vAge + "|" + vMainInsured + "|" + vPaymentMethod + "|" + vChannel + "|" + vOccupationGroup, this.refnum);

                    try
                    {
                        MTL.NETWS_ForSmartProposal.WS_SQM_CalculateService wsobj = new MTL.NETWS_ForSmartProposal.WS_SQM_CalculateService();
                        //string result = wsobj.CalculatePremium(vChannel, planCode, vPaymentMethod, vAge, vGender, vMainInsured, vOccupationGroup);
                        string result = wsobj.CompletePremium(vChannel, planCode, vPaymentMethod, vAge, vGender, vMainInsured, vOccupationGroup);
                        if (Convert.ToDecimal(result) >= 0)
                        {
                            // ช่องทาง 32 (For Online Sales) แบบประกัน EON08C ขาย + ส่วนควบ WP
                            if (channel.Trim() == "32" && planCode == "EON08C")
                            {
                                string resultWPRider = this.CalculateRiderWP(planCode, vPaymentMethod.ToString(), vAge.ToString(), gender.ToString() == "MALE" ? "M" : "F", vMainInsured.ToString(), result);

                                result = (Convert.ToDecimal(result) + Convert.ToDecimal(resultWPRider)).ToString("N2");

                                obj.Result = "completed";
                                obj.Premium = result;
                            }
                            else
                            {
                                obj.Result = "completed";
                                obj.Premium = result;
                            }
                        }
                        else
                        {
                            if (result.Trim().Contains("ไม่พบข้อมูลเบี้ยประกัน (Premium)"))
                            {
                                obj.Result = "notcomplete_ไม่สามารถคำนวณเบี้ยประกันภัยได้ เนื่องจากอายุ หรือเพศ หรือจำนวนเงินเอาประกันภัยที่ท่านระบุไม่อยู่ในเงื่อนไขการรับประกัน";
                            }
                            else if (result.Trim().Contains("ไม่พบแบบประกัน"))
                            {
                                obj.Result = "notcomplete_ไม่สามารถคำนวณเบี้ยประกันภัยได้ เนื่องจากไม่พบข้อมูลของแบบประกันที่ท่านระบุในระบบ";
                            }
                            else
                            {
                                obj.Result = "notcomplete_" + result;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message.ToString().Trim().Contains("ไม่พบข้อมูลเบี้ยประกัน (Premium)"))
                        {
                            obj.Result = "notcomplete_ไม่สามารถคำนวณเบี้ยประกันภัยได้ เนื่องจากอายุ หรือเพศ หรือจำนวนเงินเอาประกันภัยที่ท่านระบุไม่อยู่ในเงื่อนไขการรับประกัน";
//.........这里部分代码省略.........
开发者ID:nodamean,项目名称:Master_MTLNETWebServices,代码行数:101,代码来源:NETWS_ForMTLWebSite.cs

示例14: OnGenderChange

	private void OnGenderChange(Gender value)
	{
		try
		{
			GameObject obj = Utility.Load<GameObject>("Art/Character/" + value.ToString() + "/Body/Models/Body");
			GameObject instance = Instantiate(obj);
			bodyObject.sharedMesh = instance.GetComponentInChildren<SkinnedMeshRenderer>().sharedMesh;
			Destroy(instance);
			bodyObject.material.SetTexture("_MainTex", Utility.Load<Texture2D>("Art/Character/" + value.ToString() + "/Body/Textures/Body"));
			LoadBoneSetups();
		}
		finally
		{
			Resources.UnloadUnusedAssets();
		}
	}
开发者ID:dallinnguyen,项目名称:Pokemon,代码行数:16,代码来源:CharacterRenderer.cs

示例15: SearchResult

 public ActionResult SearchResult(string name,
                                  string last_name,
                                  Gender gender,
                                  DateTime? birth,
                                  string address,
                                  int? yearsExperience)
 {
     List<FanItem> list = db.Fans.Where(fan => fan.Name.Contains(name) &&
                                        fan.Last_name.Contains(last_name) &&
                                        ((gender.ToString() == "-1") || (fan.gender == gender)) &&
                                        ((birth == null) || (fan.Birth == birth)) &&
                                        fan.Address.Contains(address) &&
                                        ((yearsExperience == null) || (fan.Years_experience == yearsExperience))).ToList();
     ViewBag.SearchReuslt = list.Count;
     return PartialView("SearchFans", list);
 }
开发者ID:itays02,项目名称:ShauliProject,代码行数:16,代码来源:fansController.cs


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