本文整理汇总了C#中Results类的典型用法代码示例。如果您正苦于以下问题:C# Results类的具体用法?C# Results怎么用?C# Results使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Results类属于命名空间,在下文中一共展示了Results类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: searchUserEmail
public object searchUserEmail(string user, string Email)
{
Results<string> result = new Results<string>();
HelperData h = new HelperData();
try
{
result.Value = h.searchUserEmail(user, Email);
if (result.Value != "0" && result.Value != "-1")
{
result.IsSuccessfull = true;
result.Message = "";
}
else
{
result.IsSuccessfull = false;
result.Message = "نام کاربری یا آدرس ایمیل وارد شده اشتباه میباشد";
}
return result;
}
catch
{
result.IsSuccessfull = false;
result.Message = "ارتباط با پایگاه داده برقرار نشد. خطای شماره 190";
return result;
}
}
示例2: sendEmail
public object sendEmail(string user, string email)
{
Results<string> result = new Results<string>();
try
{
SmtpClient smtp = new SmtpClient("smtp.mail.yahoo.com");
smtp.EnableSsl = true;
smtp.Credentials = new NetworkCredential("[email protected]", "sally_bam66");
MailMessage m = new MailMessage();
m.SubjectEncoding = System.Text.Encoding.UTF8;
m.BodyEncoding = System.Text.Encoding.UTF8;
m.From = new MailAddress("[email protected]");
m.To.Add(email);
m.Subject = "تغییر رمز عبور سامانه ";
m.Body = "با سلام.رمز عبور جدید شما برای ورود به سامانه ثبت شناسنامه ی نرم افزارها عبارت : "+user+" میباشد. ";
smtp.Send(m);
result.IsSuccessfull = true;
return result;
}
catch (Exception error)
{
result.IsSuccessfull = false;
result.Message = "امکان ارسال ایمیل نمیباشد. خطای شماره 192" + Environment.NewLine + error.Message;
return result;
}
}
示例3: changPass
public object changPass(string userName)
{
Results<string> result = new Results<string>();
HelperData h = new HelperData();
try
{
string newPass = new CustomMembershipProvider().EncryptPassword(userName);
result.Value = h.changPass(userName, newPass);
if (result.Value != "0")
{
result.IsSuccessfull = true;
result.Message = "";
}
else
{
result.IsSuccessfull = false;
}
return result;
}
catch
{
result.IsSuccessfull = false;
result.Message = "ارتباط با پایگاه داده برقرار نشد. خطای شماره 190";
return result;
}
}
示例4: VisibleAppliedFilters_Should_Return_Only_Visible_Filters
public void VisibleAppliedFilters_Should_Return_Only_Visible_Filters()
{
var visibleFilter1 = new Slice
{
Name = "Filtro 1",
Visible = true
};
var visibleFilter2 = new Slice
{
Name = "Filtro 2",
Visible = true
};
var invisibleFilter = new Slice
{
Name = "Filtro Invisible",
Visible = false
};
var results = new Results<Publication>(1, 10);
results.AddAppliedFilter(visibleFilter1);
results.AddAppliedFilter(visibleFilter2);
results.AddAppliedFilter(invisibleFilter);
Assert.Contains(visibleFilter1, results.VisibleAppliedFilters);
Assert.Contains(visibleFilter2, results.VisibleAppliedFilters);
Assert.IsFalse(results.VisibleAppliedFilters.Contains(invisibleFilter));
}
示例5: creatReq
public object creatReq(fieldInfo rn, List<tendencyInfo> rgr)
{
Results<string> result = new Results<string>();
try
{
HelperData h = new HelperData();
// db.Connection.Open();
// using (db.Transaction = db.Connection.BeginTransaction())
rn.deleted = false;
int t = h.AddFieldInfo(rn);
if (t != 0)
{
bool s = h.AddTendency(rgr, t);
if (s)
{
// db.Transaction.Commit();
result.IsSuccessfull = true;
}
}
else
{
result.Message = "خطا!نام رشته وارد شده قبلا در سیستم ثبت شده است";
}
}
catch (Exception error)
{
// db.Transaction.Rollback();
result.IsSuccessfull = false;
result.Message = error.Message;
}
return result;
}
示例6: NewResult_WithEmptyPoiList_ContainsZeroPoisInResult
public void NewResult_WithEmptyPoiList_ContainsZeroPoisInResult()
{
var pois = new List<Poi>();
var result = new Results(pois);
result.Value.Should().NotBeNull();
result.Value.Should().HaveCount(0);
}
示例7: checkUserName
public object checkUserName(string userName)
{
Results<DataTable> result = new Results<DataTable>();
try
{
HelperSearch h = new HelperSearch();
int list = h.checkUniqUser(userName);
if (list == 1)
{
result.Message = "";
result.IsSuccessfull = true;
}
else if (list == 2)
{
result.Message = "نام کاربری تکراری است.";
result.IsSuccessfull = false;
}
return result;
}
catch
{
return result;
}
}
示例8: SecondPass
private static void SecondPass(VersionHandler handler, int[] maxCharacters, List<DeviceResult> initialResults, Results results)
{
int lowestScore = int.MaxValue;
foreach (DeviceResult current in initialResults)
{
// Calculate the score for this device.
int deviceScore = 0;
for (int segment = 0; segment < handler.VersionRegexes.Length; segment++)
{
deviceScore += (maxCharacters[segment] - current.Scores[segment].CharactersMatched + 1)*
(current.Scores[segment].Difference + maxCharacters[segment] -
current.Scores[segment].CharactersMatched);
}
// If the score is lower than the lowest so far then reset the list
// of best matching devices.
if (deviceScore < lowestScore)
{
results.Clear();
lowestScore = deviceScore;
}
// If the device score is the same as the lowest score so far then add this
// device to the list.
if (deviceScore == lowestScore)
{
results.Add(current.Device);
}
}
}
示例9: Run
public async override Task<Results> Run ()
{
var location = Location;
if (location == null)
return null;
var container = CKContainer.DefaultContainer;
var publicDB = container.PublicCloudDatabase;
var query = new CKQuery ("Items", NSPredicate.FromValue (true)) {
SortDescriptors = new NSSortDescriptor [] {
new CKLocationSortDescriptor ("location", location)
}
};
var defaultZoneId = new CKRecordZoneID (CKRecordZone.DefaultName, CKContainer.OwnerDefaultName);
CKRecord [] recordArray = await publicDB.PerformQueryAsync (query, defaultZoneId);
var results = new Results (alwaysShowAsList: true);
var len = recordArray.Length;
if(len == 0)
ListHeading = "No matching items";
else if (len == 1)
ListHeading = "Found 1 matching item:";
else
ListHeading = $"Found {recordArray.Length} matching items:";
results.Items.AddRange (recordArray.Select (r => new CKRecordWrapper (r)));
return results;
}
示例10: deleteVahed
public object deleteVahed(short vahedCode)
{
Results<DataTable> result = new Results<DataTable>();
try
{
HelperData sHelper = new HelperData();
int list = sHelper.DeleteVahedInfo(vahedCode);
if (list == 1)
{
result.Message = "";
result.IsSuccessfull = true;
}
else
{
result.IsSuccessfull = false;
}
return result;
}
catch
{
return result;
}
}
示例11: ReportCardFacade
public ReportCardFacade(Student aStudent)
{
student = aStudent;
studentResult = new Results(aStudent);
studentBehavior = new Behavior(aStudent);
studentAttendance = new Attendance(aStudent);
}
示例12: GetFunctionalRatio
/// <summary>
/// Returns the coefficient to be used in order to display the results according to the preferences of the IResult
/// object used to create the instance of this object. Returns the prefered functional unit divided by the functional unit.
///
/// In case of the FunctionalUnit is null or the PreferedUnit is null, this method returns a ratio of 1. This is usefull to
/// display the Inputs results and the TransportationSteps results which are accounted for all outputs and not a specific one.
/// In these cases instead of defining a PreferedUnit for each output we prefer to define none to make things simpler (see InputResult.GetResults)
///
/// Before display all results must be multiplied by this coefficient
///
/// May return a NullReferenceExeption if the IResult object does not define FunctinoalUnit, PreferedDisplayedUnit or PreferedDisplayedAmount
/// </summary>
/// <param name="results"></param>
/// <returns></returns>
internal static double GetFunctionalRatio(GData data, Results results, int producedResourceId)
{
if (results != null && results.CustomFunctionalUnitPreference != null && results.CustomFunctionalUnitPreference.PreferredUnitExpression != null)
{
LightValue functionalUnit = new LightValue(1.0, results.BottomDim);
LightValue preferedFunctionalUnit = GetPreferedVisualizationFunctionalUnit(data, results, producedResourceId);
switch (preferedFunctionalUnit.Dim)
{
case DimensionUtils.MASS: // HARDCODED
{
functionalUnit = data.ResourcesData[producedResourceId].ConvertToMass(functionalUnit);
} break;
case DimensionUtils.ENERGY: // HARDCODED
{
functionalUnit = data.ResourcesData[producedResourceId].ConvertToEnergy(functionalUnit);
} break;
case DimensionUtils.VOLUME: // HARDCODED
{
functionalUnit = data.ResourcesData[producedResourceId].ConvertToVolume(functionalUnit);
} break;
}
return preferedFunctionalUnit.Value / functionalUnit.Value;
}
else
return 1;
}
示例13: SearchInTable
public object SearchInTable(string Name, int firstRow)
{
DataTable list = new DataTable();
Results<DataTable> result = new Results<DataTable>();
try
{
helperSearch sHelper = new helperSearch();
list = sHelper.searchVahed(Name, firstRow, firstRow +6 -1);
if (list.Rows.Count == 0)
{
result.Message = "";
result.IsSuccessfull = false;
}
else
{
result.Value = list;
result.IsSuccessfull = true;
}
return result;
}
catch
{
return result;
}
}
示例14: changePass
public object changePass(string oldPass, string newPass)
{
Results<string> result = new Results<string>();
HelperData h = new HelperData();
try
{
newPass = new CustomMembershipProvider().EncryptPassword(newPass);
oldPass = new CustomMembershipProvider().EncryptPassword(oldPass);
result.Value = h.changePass(oldPass, newPass, Convert.ToInt32(System.Web.HttpContext.Current.Session["userCode"]));
if (result.Value == "1")
{
result.IsSuccessfull = true;
}
else if (result.Value == "0")
{
result.IsSuccessfull = false;
result.Message = "رمز عبور فعلی، اشتباه وارد شده است";
}
else
{
result.IsSuccessfull = false;
result.Message = "امکان ویرایش اطلاعات نمیباشد/ خطای شماره 100";
}
return result;
}
catch (Exception error)
{
result.Message = error.Message;
result.IsSuccessfull = false;
return result;
}
}
示例15: displayQuestionResults
/**
* Tells the GUI what the current question's results are and to display them on the screen.
* The results will contain each player's question, answer, and correctness of the answer.
* The GUI will first display each player's answer along with the correct answeyth vhur.
* A dramatic pause between the player's answer and correct answer can be added.
* The GUI should signify which questions are correct and which ones aren't.
*
* The GUI should then enable a button to let the player continue to the next question.
* When the button is pressed, the GUI will report to the Core.
* Once all players are ready to move on, the Core will call nextQuestion for the GUI to ask the next question.
* If there are no more questions, the Core will call displayFinalResults instead
*
* Just a note: This uses the viewNextButton, which currently has pretty bad ways of hiding
* the button. We may need to refactor this code in the future to efficiently and more elegantly
* hide and make the button appear.
*/
public void displayQuestionResults(Results theResults)
{
// Audio to play on question load
GameObject myViewGradeResult = GameObject.Find ("viewGradeResult");
// Gives feedback on correctness
GameObject myViewGradeText = GameObject.Find ("viewGradeText");
// Moves on to next question ("Onwards!")
GameObject myViewNextButton = GameObject.Find ("viewNextButton");
//Image myViewGradeResultImage = myViewGradeResult.GetComponents<Image> ();
Text myViewGradeTextComponent = myViewGradeText.GetComponent<Text> ();
// Update the contents depending on whether you got it right or not
if (theResults.isCorrect [0]) {
myViewGradeTextComponent.text = "Hey, " + theResults.players [0].playerName + " got this correct!";
myViewGradeTextComponent.color = Color.green;
// Change the graphic to HAPPY
//(GameObject.Find ("playerReaction")).GetComponent<Image>().sprite = Resources.Load("Cerulean_Happy") as Sprite;
} else {
myViewGradeTextComponent.text = theResults.players [0].playerName + " got this wrong. You suck.";
myViewGradeTextComponent.color = Color.red;
// Change the graphic to SAD
//(GameObject.Find ("playerReaction")).GetComponent<Image>().sprite = Resources.Load ("Cerulean_Sad") as Sprite;
}
// Make things appear.
// TODO: REFACTORING, I CALL DIBS, HANDS OFF NICK -- Watson
myViewGradeTextComponent.enabled = true;
(myViewNextButton.GetComponent<Image> ()).enabled = true;
((GameObject.Find ("viewNextButtonText")).GetComponent<Text>()).enabled = true;
}