本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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";
}
示例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;
}
}
示例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);
}
示例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>);
}
}
示例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);
}
示例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
});
}
}
示例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);
}
示例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;
}
示例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_ไม่สามารถคำนวณเบี้ยประกันภัยได้ เนื่องจากอายุ หรือเพศ หรือจำนวนเงินเอาประกันภัยที่ท่านระบุไม่อยู่ในเงื่อนไขการรับประกัน";
//.........这里部分代码省略.........
示例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();
}
}
示例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);
}