using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace LQKJ.K3.MES.AppServicePlugin
{
	[Description("记录同步数据服务插件")]
	public class SyncdataServerPlugin : AbstractOperationServicePlugIn
	{
		public override void BeginOperationTransaction(BeginOperationTransactionArgs e)
		{
			List<string> list = new List<string>();
			string id = base.BusinessInfo.GetForm().Id;
			string text = base.Context.UserId.ToString();
			string text2 = base.FormOperation.OperationName.ToString();
			string operation = base.FormOperation.Operation;
			DynamicObject[] dataEntitys = e.DataEntitys;
			for (int i = 0; i < dataEntitys.Length; i++)
			{
				DynamicObject dynamicObject = dataEntitys[i];
				string text3 = dynamicObject["Id"].ToString();
				string item = string.Format("insert into LQKJ_t_IMSSync(FID,F_LQKJ_SYNCDATAID,F_LQKJ_SYNCBILL,F_LQKJ_SYNDDATETIME,FCREATORID,FMODIFIERID,FCREATEDATE,FMODIFYDATE,F_LQKJ_SYNCCHECK,F_LQKJ_Operationname,F_LQKJ_operationinnercode)\r\n              values(NEWID(),'{0}','{1}',null,'{2}','0',GETDATE(),GETDATE(),'0','{3}','{4}')", new object[]
				{
					text3,
					id,
					text,
					text2,
					operation
				});
				list.Add(item);
			}
			DBUtils.ExecuteBatch(base.Context, list, list.Count);
			base.BeginOperationTransaction(e);
		}
	}
}
