EditInstanceData.aspx.cs
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:4k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. namespace OThinker.H3.Portal
  12. {
  13.     public partial class EditInstanceData : PortalPage
  14.     {
  15.         #region 参数
  16.         public string InstanceId
  17.         {
  18.             get
  19.             {
  20.                 return this.Request.QueryString[Param_InstanceId];
  21.             }
  22.         }
  23.         private string _WorkflowPackage = null;
  24.         public string WorkflowPackage
  25.         {
  26.             get
  27.             {
  28.                 if (this._WorkflowPackage == null)
  29.                 {
  30.                     this._WorkflowPackage = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowPackage(this.InstanceId);
  31.                 }
  32.                 return this._WorkflowPackage;
  33.             }
  34.         }
  35.         private string _WorkflowName = null;
  36.         public string WorkflowName
  37.         {
  38.             get
  39.             {
  40.                 if (this._WorkflowName == null)
  41.                 {
  42.                     this._WorkflowName = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowName(this.InstanceId);
  43.                 }
  44.                 return this._WorkflowName;
  45.             }
  46.         }
  47.         private int _WorkflowVersion = H3.WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion;
  48.         public int WorkflowVersion
  49.         {
  50.             get
  51.             {
  52.                 if (this._WorkflowVersion == H3.WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion)
  53.                 {
  54.                     this._WorkflowVersion = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowVersion(this.InstanceId);
  55.                 }
  56.                 return this._WorkflowVersion;
  57.             }
  58.         }
  59.         private H3.WorkflowTemplate.WorkflowTemplate _Workflow = null;
  60.         public H3.WorkflowTemplate.WorkflowTemplate Workflow
  61.         {
  62.             get
  63.             {
  64.                 if (this._Workflow == null)
  65.                 {
  66.                     this._Workflow = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflow(this.WorkflowPackage, this.WorkflowName, this.WorkflowVersion);
  67.                 }
  68.                 return this._Workflow;
  69.             }
  70.         }
  71.         private string _ItemName = null;
  72.         public string ItemName
  73.         {
  74.             get
  75.             {
  76.                 if (this._ItemName == null)
  77.                 {
  78.                     this._ItemName = HttpUtility.UrlDecode(this.Request.QueryString[Param_ItemName]);
  79.                 }
  80.                 return this._ItemName;
  81.             }
  82.         }
  83.         public H3.Data.WorkflowDataItem WorkflowDataItem
  84.         {
  85.             get
  86.             {
  87.                 return this.Workflow.GetDataItem(this.ItemName);
  88.             }
  89.         }
  90.         #endregion
  91.         protected void Page_Load(object sender, EventArgs e)
  92.         {
  93.             if (!this.IsPostBack)
  94.             {
  95.                 // 验证是否具有管理员权限
  96.                 if (!this.UserValidator.ValidateAdministrator())
  97.                 {
  98.                     this.NotifyMessage(LackOfAuth);
  99.                 }
  100.                 // 获得当前值
  101.                 object currentValue = OThinker.H3.Server.Engine.InstanceDataManager.GetItemValue(this.InstanceId, Instance.Token.UnspecifiedID, this.ItemName);
  102.                 if (currentValue == null)
  103.                 {
  104.                     this.txtItemValue.Text = "";
  105.                 }
  106.                 else
  107.                 {
  108.                     this.txtItemValue.Text = currentValue.ToString();
  109.                 }
  110.             }
  111.         }
  112.         protected void btnSubmit_Click(object sender, EventArgs e)
  113.         {
  114.             object newValue = OThinker.Data.Convertor.Convert(this.txtItemValue.Text, this.WorkflowDataItem.RealType);
  115.             OThinker.H3.Server.Engine.InstanceDataManager.SetItemValue(this.InstanceId, Instance.Token.UnspecifiedID, this.ItemName, null, this.UserValidator.UserID, newValue);
  116.             this.NotifyMessage("值修改成功");
  117.         }
  118.     }
  119. }