本文整理汇总了C#中ReturnValue类的典型用法代码示例。如果您正苦于以下问题:C# ReturnValue类的具体用法?C# ReturnValue怎么用?C# ReturnValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReturnValue类属于命名空间,在下文中一共展示了ReturnValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddOrEdit
public ReturnValue AddOrEdit(LoginUser entity)
{
ReturnValue retValue = new ReturnValue();
using (LoginUserDal dal = new LoginUserDal())
{
if (entity.ID < 1)//添加
{
if (dal.Add(entity))
{
retValue.IsExists = true;
retValue.Message = "添加用户成功";
}
else
{
retValue.IsExists = false;
retValue.Message = "添加用户失败";
}
}
else//修改
{
if (dal.Modify(entity))
{
retValue.IsExists = true;
retValue.Message = "修改用户成功";
}
else
{
retValue.IsExists = false;
retValue.Message = "修改用户失败";
}
}
}
return retValue;
}
示例2: Login
public ReturnValue Login(string userNameOrEmail, string password, string ip)
{
ReturnValue retValue = new ReturnValue();
using (LoginUserDal dal = new LoginUserDal())
{
LoginUser user = dal.Get(userNameOrEmail);
//加密比较
if (user != null)
{
if (user.PassWord != password)
{
retValue.IsExists = false;
retValue.Message = "密码输入错误";
return retValue;
}
retValue.IsExists = true;
retValue.Message = "登录成功";
retValue.RetObjec = user;
//修改用登陆信息
user.LastLoginDate = DateTime.Now;
user.LastLoginIP = ip;
dal.Modify(user);
}
else
{
retValue.IsExists = false;
retValue.Message = "此用户不存在";
return retValue;
}
}
return retValue;
}
示例3: VisitReturnValue
public override Expression VisitReturnValue(ReturnValue returnValue)
{
// return a default value of the same type as the return value
TypeNode returnType = returnValue.Type;
ITypeParameter itp = returnType as ITypeParameter;
if (itp != null)
{
Local loc = new Local(returnType);
UnaryExpression loca = new UnaryExpression(loc, NodeType.AddressOf, loc.Type.GetReferenceType());
StatementList statements = new StatementList(2);
statements.Add(new AssignmentStatement(new AddressDereference(loca, returnType, false, 0),
new Literal(null, SystemTypes.Object)));
statements.Add(new ExpressionStatement(loc));
return new BlockExpression(new Block(statements), returnType);
}
if (returnType.IsValueType)
return new Literal(0, returnType);
return new Literal(null, returnType);
}
示例4: AddOrEdit
public ActionResult AddOrEdit()
{
ReturnValue retValue = new ReturnValue();
Article entity = new Article();
entity.ID = CodeNote.Common.ConvertWrap.ToInt(Request["articleid"]);
entity.Subject = Request["subject"];
entity.Body = CodeNote.Common.StringFilter.ClearHtml(Request["body"],true);
entity.CategoryID = Request["category"];
entity.Tag = Request["artitag"];
entity.CreateID = CurUser.ID;
entity.CreateDate = DateTime.Now;
entity.ModDate = entity.CreateDate;
retValue = ArtMg.AddOrEdit(entity);
if (retValue.IsExists)
{//添加标签或修改标签
TagInfoManager tagMg = new TagInfoManager();
Models.Constans.TagType tagType = Constans.TagType.UserTag;
if (CurUser != null && CurUser.Type == (int)Constans.UserType.Administrators)
{
tagType = Constans.TagType.SysTag;
}
tagMg.AddTag(entity.Tag, (int)tagType);
CodeNote.Luc.ArtilceLuc artLuc = new Luc.ArtilceLuc();
artLuc.ModifyIndex(retValue.Get<VwArticle>("vw"));
}
return View("Result", new ReturnMessage(Request, "提示消息", retValue));
}
示例5: UpdateItemRequest
/// <summary>
/// Instantiates UpdateItemRequest with the parameterized properties
/// </summary>
/// <param name="tableName">The name of the table containing the item to update.</param>
/// <param name="key">The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute. For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.</param>
/// <param name="attributeUpdates"><important> This is a legacy parameter, for backward compatibility. New applications should use <i>UpdateExpression</i> instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a <i>ValidationException</i> exception. This parameter can be used for modifying top-level attributes; however, it does not support individual list or map elements. </important> The names of attributes to be modified, the action to perform on each, and the new value for each. If you are updating an attribute that is an index key attribute for any indexes on that table, the attribute type must match the index key type defined in the <i>AttributesDefinition</i> of the table description. You can use <i>UpdateItem</i> to update any non-key attributes. Attribute values cannot be null. String and Binary type attributes must have lengths greater than zero. Set type attributes must not be empty. Requests with empty values will be rejected with a <i>ValidationException</i> exception. Each <i>AttributeUpdates</i> element consists of an attribute name to modify, along with the following: <ul> <li> <i>Value</i> - The new value, if applicable, for this attribute. </li> <li> <i>Action</i> - A value that specifies how to perform the update. This action is only valid for an existing attribute whose data type is Number or is a set; do not use <code>ADD</code> for other data types. If an item with the specified primary key is found in the table, the following values perform the following actions: <ul> <li> <code>PUT</code> - Adds the specified attribute to the item. If the attribute already exists, it is replaced by the new value. </li> <li> <code>DELETE</code> - Removes the attribute and its value, if no value is specified for <code>DELETE</code>. The data type of the specified value must match the existing value's data type. If a set of values is specified, then those values are subtracted from the old set. For example, if the attribute value was the set <code>[a,b,c]</code> and the <code>DELETE</code> action specifies <code>[a,c]</code>, then the final attribute value is <code>[b]</code>. Specifying an empty set is an error. </li> <li> <code>ADD</code> - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of <code>ADD</code> depends on the data type of the attribute: <ul> <li> If the existing attribute is a number, and if <i>Value</i> is also a number, then <i>Value</i> is mathematically added to the existing attribute. If <i>Value</i> is a negative number, then it is subtracted from the existing attribute. <note> If you use <code>ADD</code> to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses 0 as the initial value. Similarly, if you use <code>ADD</code> for an existing item to increment or decrement an attribute value that doesn't exist before the update, DynamoDB uses <code>0</code> as the initial value. For example, suppose that the item you want to update doesn't have an attribute named <i>itemcount</i>, but you decide to <code>ADD</code> the number <code>3</code> to this attribute anyway. DynamoDB will create the <i>itemcount</i> attribute, set its initial value to <code>0</code>, and finally add <code>3</code> to it. The result will be a new <i>itemcount</i> attribute, with a value of <code>3</code>. </note> </li> <li> If the existing data type is a set, and if <i>Value</i> is also a set, then <i>Value</i> is appended to the existing set. For example, if the attribute value is the set <code>[1,2]</code>, and the <code>ADD</code> action specified <code>[3]</code>, then the final attribute value is <code>[1,2,3]</code>. An error occurs if an <code>ADD</code> action is specified for a set attribute and the attribute type specified does not match the existing set type. Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, <i>Value</i> must also be a set of strings. </li> </ul> </li> </ul> If no item with the specified key is found in the table, the following values perform the following actions: <ul> <li> <code>PUT</code> - Causes DynamoDB to create a new item with the specified primary key, and then adds the attribute. </li> <li> <code>DELETE</code> - Nothing happens, because attributes cannot be deleted from a nonexistent item. The operation succeeds, but DynamoDB does not create a new item. </li> <li> <code>ADD</code> - Causes DynamoDB to create an item with the supplied primary key and number (or set of numbers) for the attribute value. The only data types allowed are Number and Number Set. </li> </ul> </li> </ul> If you provide any attributes that are part of an index key, then the data types for those attributes must match those of the schema in the table's attribute definition.</param>
/// <param name="returnValues">Use <i>ReturnValues</i> if you want to get the item attributes as they appeared either before or after they were updated. For <i>UpdateItem</i>, the valid values are: <ul> <li> <code>NONE</code> - If <i>ReturnValues</i> is not specified, or if its value is <code>NONE</code>, then nothing is returned. (This setting is the default for <i>ReturnValues</i>.) </li> <li> <code>ALL_OLD</code> - If <i>UpdateItem</i> overwrote an attribute name-value pair, then the content of the old item is returned. </li> <li> <code>UPDATED_OLD</code> - The old versions of only the updated attributes are returned. </li> <li> <code>ALL_NEW</code> - All of the attributes of the new version of the item are returned. </li> <li> <code>UPDATED_NEW</code> - The new versions of only the updated attributes are returned. </li> </ul> There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No Read Capacity Units are consumed. Values returned are strongly consistent</param>
public UpdateItemRequest(string tableName, Dictionary<string, AttributeValue> key, Dictionary<string, AttributeValueUpdate> attributeUpdates, ReturnValue returnValues)
{
_tableName = tableName;
_key = key;
_attributeUpdates = attributeUpdates;
_returnValues = returnValues;
}
示例6: Merge
public void Merge(ReturnValue returnObject)
{
if (returnObject != null && returnObject.Type != null)
{
ReturnItems.Add(returnObject.Type, returnObject.Value);
}
}
示例7: deletelab
public ActionResult deletelab(string sn)
{
ReturnValue r;
if (sn != null && sn.ToString() != "")
{
var guid = WebRequest.GetString("guid", true);
Guid g = Guid.Parse(guid);
try
{
var b = diagnosticService.DeleteTestAnalysisReport(g, sn);
if (b != "")
{
LogHelper.Info(Masterpage.CurrUser.alias, "501027:客户," + Masterpage.CurrUser.client_code + ",删除诊断的实验分析报告,报告编号为:" + sn);
string path = ConfigurationManager.AppSettings["CustomerRes"] + Masterpage.CurrUser.client_code + "/files/diagnostic/" + b;
FileHelper.DeleteFile(path);
r = new ReturnValue { message = "", status = "ok" };
}
else r = new ReturnValue { message = "删除失败", status = "error" };
}
catch
{
LogHelper.Info(Masterpage.CurrUser.alias, "501027:客户," + Masterpage.CurrUser.client_code + ",删除诊断的实验分析报告失败,缺少参数,报告编号为:" + sn);
r = new ReturnValue { message = "参数错误", status = "error" };
}
}
else
{
LogHelper.Info(Masterpage.CurrUser.alias, "501027:客户," + Masterpage.CurrUser.client_code + ",删除诊断的实验分析报告失败,缺少参数,报告编号为:" + sn);
r = new ReturnValue { message = "缺少参数", status = "error" };
}
return Json(r, JsonRequestBehavior.AllowGet);
}
示例8: ReturnAdorner
public ReturnAdorner(TextBox adornedElement, ReturnValue operation)
: base(adornedElement)
{
this.text.FontSize = adornedElement.FontSize * 0.80;
this.text.Text = "return " + operation.Value;
this.border.Child = this.text;
}
示例9: Main
static void Main()
{
ReturnValue val = new ReturnValue(GetInteger);
Console.WriteLine(val());
AddString addstr = null;
parDel(addstr, "khan");
Console.WriteLine(parDel(addstr, "Khan"));
}
示例10: autopost
public ActionResult autopost()
{
ReturnValue r = new ReturnValue();
r.status = "ok";
r.message = SessionHelper.SessionId;
Session["autopostsession"] = r.message;
return Json(r, JsonRequestBehavior.AllowGet);
}
示例11: Can_set_value
public void Can_set_value()
{
var expected = DateTime.Now;
var value = new ReturnValue();
value.SetValue(expected);
Assert.AreEqual(typeof (DateTime), value.Type);
Assert.AreEqual(expected, value.Value);
}
示例12: delemployee
public ActionResult delemployee()
{
Employee one = new Employee();
string guid = WebRequest.GetString("guid", true);
ReturnValue r = new ReturnValue { status = "ok" };
Guid g = Guid.Empty;
g = Guid.Parse(guid);
_employeeservice.DeleteEmployee(g);
LogHelper.BackInfo("4-3", Masterpage.AdminCurrUser.userid, "删除员工:" + g);
return Json(r, JsonRequestBehavior.AllowGet);
}
示例13: SaveVariableToMemorySpace
public void SaveVariableToMemorySpace()
{
MemorySpaceNodeListCache cache = new MemorySpaceNodeListCache();
AST root = new AST();
MemorySpace memorySpace = new MemorySpace("globals", root, new Scope(Scope.ScopeType.MAIN_SCOPE, "blah"), cache);
ReturnValue val = new ReturnValue(5.9f);
memorySpace.setValue("x", val);
Assert.AreEqual(ReturnValueType.NUMBER, memorySpace.getValue("x").getReturnValueType());
Assert.AreEqual(5.9f, memorySpace.getValue("x").NumberValue);
}
示例14: HandleFunctionReturnValue
/// <summary>
/// Handles the function return value.
/// May throw Exception if the result is not Ok
/// </summary>
/// <param name="functionReturnValue">EDSDK function return value.</param>
/// <exception cref="EDSDKException">if the functionReturnValue is not "Ok".</exception>
/// <remarks></remarks>
public static void HandleFunctionReturnValue(ReturnValue functionReturnValue)
{
// This is a good return value
if (functionReturnValue == ReturnValue.Ok)
{
// Return and proceed
return;
}
// If we end up with this section, the return value represents one of the Failure Return values.
throw new EDSDKException(functionReturnValue);
}
示例15: HandleFunctionReturnValue
/// <summary>
/// Handles the function return value.
/// May throw Exception if the result is not Ok
/// </summary>
/// <param name="functionReturnValue">EDSDK function return value.</param>
/// <exception cref="EDSDKException">if the functionReturnValue is not "Ok".</exception>
/// <remarks></remarks>
public void HandleFunctionReturnValue(ReturnValue functionReturnValue)
{
// This is a good return value
if (functionReturnValue == ReturnValue.Ok || functionReturnValue == ReturnValue.DeviceBusy)
{
// Return and proceed
return;
}
_onError(functionReturnValue);
// If we end up with this section, the return value represents one of the Failure Return values.
//throw new EDSDKException(functionReturnValue); //todo maybe later
}