TransferWorkItems.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:4k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Collections;
- using System.Configuration;
- using System.Data;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.HtmlControls;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- namespace OThinker.H3.Portal
- {
- public partial class TransferWorkItems : PortalPage
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.IsPostBack)
- {
- // 验证是否具有管理员权限
- if (!this.UserValidator.ValidateAdministrator())
- {
- this.NotifyMessage(LackOfAuth);
- }
- }
- }
- protected void lnkQuery_Click(object sender, EventArgs e)
- {
- if (this.txtSource.SelectedUser == null || this.txtSource.SelectedUser == "")
- {
- this.NotifyMessage("没有选中转移谁的工作项");
- }
- // 查询可转移的工作项
- OThinker.Data.Database.CommandFactory factory = new OThinker.Data.Database.CommandFactory(
- OThinker.H3.Configs.Config.Current.DataBase.DBType,
- OThinker.H3.Configs.Config.Current.DataBase.DBConnString);
- OThinker.Data.Database.ICommand command = factory.CreateCommand();
- System.Data.DataTable table = command.ExecuteDataTable(
- "SELECT * FROM " + OThinker.H3.WorkItem.WorkItem.TableName + " " +
- "WHERE " +
- OThinker.H3.WorkItem.WorkItem.PropertyName_Receiptor + "='" + this.txtSource.SelectedUser + "' OR " +
- "(" + OThinker.H3.WorkItem.WorkItem.PropertyName_Participant + "='" + this.txtSource.SelectedUser + "' AND " + WorkItem.WorkItem.PropertyName_Receiptor + " IS NULL)");
- this.WorkItemGrid.BindDataGrid(table);
- }
- protected void lnkOk_Click(object sender, EventArgs e)
- {
- string source = this.txtSource.SelectedUser;
- if (source == null || source == "")
- {
- this.NotifyMessage("没有选中转移谁的工作项");
- }
- string receiptor = this.txtReceiptor.SelectedUser;
- if (receiptor == null || receiptor == "")
- {
- this.NotifyMessage("没有选中转移的接收人");
- }
- // 查询可转移的工作项
- OThinker.Data.Database.CommandFactory factory = new OThinker.Data.Database.CommandFactory(
- OThinker.H3.Configs.Config.Current.DataBase.DBType,
- OThinker.H3.Configs.Config.Current.DataBase.DBConnString);
- OThinker.Data.Database.ICommand command = factory.CreateCommand();
- System.Data.DataTable table = command.ExecuteDataTable(
- "SELECT [" + WorkItem.WorkItem.PropertyName_ObjectID + "] FROM " + OThinker.H3.WorkItem.WorkItem.TableName + " " +
- "WHERE " +
- OThinker.H3.WorkItem.WorkItem.PropertyName_Receiptor + "='" + source + "' OR " +
- "(" + OThinker.H3.WorkItem.WorkItem.PropertyName_Participant + "='" + source + "' AND " + WorkItem.WorkItem.PropertyName_Receiptor + " IS NULL)");
- // 转移工作项
- int successCount = 0;
- foreach (System.Data.DataRow row in table.Rows)
- {
- string itemId = (string)row[0];
- long result = OThinker.H3.Server.Engine.WorkItemManager.Transfer(itemId, this.txtReceiptor.SelectedUser);
- if (result == ErrorCode.SUCCESS)
- {
- successCount++;
- }
- }
- this.NotifyMessage("成功转移" + successCount + "项工作项,总共需要转移" + table.Rows.Count + "项工作项。从用户" + OThinker.H3.Server.Engine.Organization.GetFullName(source) + "到用户" + OThinker.H3.Server.Engine.Organization.GetFullName(receiptor));
- }
- }
- }