通过插件更新工期字段 [英] Updating a Duration Field by Plugin

查看:50
本文介绍了通过插件更新工期字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人需要从插件中更新 Duraton 字段吗?

Has anyone had to update a Duraton field from within a plugin?

在用户界面上,它相当聪明,您可以输入

On the UI it is fairly intelligent, you can type


  • 5分钟

  • 7 //默认为分钟

  • 3小时

  • 5 minutes
  • 7 //defaults to minutes
  • 3 hours

它将锻炼您需要的东西。

And it will workout what you need.

假定该字段称为 new_foo ,我应该分配什么值?真的吗

Assuming the field is called new_foo, what value should I assign? Int?

var e = new Entity("new_bar");
e.Attributes("new_foo", 5);//5 minutes?

Double?

var e = new Entity("new_bar");
e.Attributes("new_foo", 5.00);//5 minutes?

其他想法?

推荐答案

持续时间整数类型的格式,因此需要通过代码设置 Int32 的值(在这种情况下为非负数,否则将引发异常)

Duration is a format for the Whole Number type, so by code you need to set an Int32 value (in this case not negative or it will throw an exception)

分钟,因此如果要放置3小时,则需要将字段值设置为180(60分钟x 3小时),1天是1440(60分钟x 24小时),依此类推。

The value is always considered in minutes, so if you want to put 3 hours you need to set the field value to 180 (60 minutes x 3 hours), 1 day is 1440 (60 minutes x 24 hours) and so on.

您可以使用小数点设置界面,但是它始终是整数值的表示形式(例如1.5小时等于90分钟)

By interface you can set using decimals, but it's always a representation of an integer value (for example 1.5 hours equals 90 minutes)

这篇关于通过插件更新工期字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆