/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write(DateTime.Now.ToString() + ":驳回" + this.MvcPost.Command); // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); try { if (this.ActionContext.IsOriginateMode) { var ContractNo = this.ActionContext.InstanceData["ContractNo"].Value; // var ContractNo2 = ActionContext.BizObject.GetValue("ContractNo"); var ContractName = this.ActionContext.InstanceData["ContractName"].Value; System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable( " insert into I_ContractStatus " + " (ContractNo, ContractName, UpdateNoFlg, ApproveFlg, OperateFlg, CompleteFlg) " + " VALUES('" + ContractNo + "', '" + ContractName + "', '0', '', '', '') " ); DataRowCollection dr = dt.Rows; this.ActionContext.InstanceData.Submit(); } } catch (Exception exp) { } }
public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { //wangxg 19.8 string val = ""; foreach (var item in MvcPost.BizObject.DataItems) { val += item.Value.V; } string msg = ""; bool isInject = new DongZheng.H3.WebApi.Controllers.XssAttribute().IsContainXSSCharacter(val, out msg); if (isInject) { result.Successful = false; result.Errors.Add("检测到SQL敏感字符"); return; } isInject = new DongZheng.H3.WebApi.Controllers.SqlInjectAttribute().IsSqlInjectCharacter(val, out msg); if (isInject) { result.Successful = false; result.Errors.Add("检测到XSS敏感字符"); return; } // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { if (this.ActionContext.ActivityCode == "submit") { if (MvcPost.Command == "Submit") { string projectNum = (string)ActionContext.BizObject.GetValue("ProjectNum"); string taskId = (string)ActionContext.BizObject.GetValue("ObjectID"); //获取负责部门 id string RDepartment = (string)ActionContext.BizObject.GetValue("RDepartment"); //参与部门 id string[] JDepartment = (string[])ActionContext.BizObject.GetValue("JDepartment"); //获取部门主管 string RDManageId = OThinker.H3.Controllers.AppUtility.Engine.Organization.GetOUManager(RDepartment); List <string> JDManage = OThinker.H3.Controllers.AppUtility.Engine.Organization.GetOUManagers(JDepartment); OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("INSERT INTO ProjectDepart(ProjectNum,ProjectTaskId" + " ,DepartManager) VALUES( '" + projectNum + "','" + taskId + "','" + RDManageId + "')"); for (int i = 0; i < JDManage.Count; i++) { var manageId = JDManage[i]; OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("INSERT INTO ProjectDepart(ProjectNum,ProjectTaskId" + ", DepartManager) VALUES( '" + projectNum + "','" + taskId + "','" + manageId + "')"); } } } //保存后执行操作, base.SaveDataFields(MvcPost, result); }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { // 以下函数可改变数据项的值 MvcPost.BizObject.DataItems.SetValue("mvcName", "Save值"); // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { MvcPost.BizObject.DataItems.SetValue("Updator", this.ActionContext.User.UserName); MvcPost.BizObject.DataItems.SetValue("UpdateTime", DateTime.Now.ToString()); // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { var BHFlg = this.ActionContext.InstanceData["BHFlg"].Value; System.Data.DataTable dt1 = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable( " update I_BH set BHFlg = '" + BHFlg + "' where ObjectID = '" + this.ActionContext.BizObjectID + "' "); // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); if (this.MvcPost.Command == "Submit") { new WorkFlowFunction().AddMyUnit(this.ActionContext.BizObjectID, this.ActionContext.User.UserID); } }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { // 以下函数可改变数据项的值 //MvcPost.BizObject.DataItems.SetValue("CJH", MvcPost.InstanceId); //if (this.MvcPost.Command == "Submit" || this.MvcPost.Command == "Save" || this.MvcPost.Command == "Reject") //{ // this.ActionContext.InstanceData["instanceid"].Value = MvcPost.InstanceId; //} // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { //OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable( // " delete from I_HYContractSet" // ); //OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable( // " delete from I_SalerTblOfHY" // ); // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write(DateTime.Now.ToString() + ":驳回" + this.MvcPost.Command); // 以下函数可改变数据项的值 //MvcPost.BizObject.DataItems.SetValue("CJH", MvcPost.InstanceId); if (this.MvcPost.Command == "Submit" || this.MvcPost.Command == "Save" || this.MvcPost.Command == "Reject") { OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write(DateTime.Now.ToString() + ":驳回成功赋值" + this.MvcPost.Command); this.ActionContext.InstanceData["instanceid"].Value = MvcPost.InstanceId; } // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
public override void Submit(MvcPostValue MvcPostValue, MvcResult MvcResult) { if (this.ActionContext.ActivityCode == "submit") { var smid = ActionContext.BizObject.GetValue("SMId"); String sql = "SELECT sd.Type, sd.MaterialName, sd.Model, sd.Note, sd.Num, sd.Price, sd.Cost FROM I_SpecialMaterials sm " + "LEFT JOIN I_SpMaterialDetails sd ON sm.ObjectID = sd.ParentObjectID " + "WHERE sm.ObjectID = " + "'" + smid + "'"; System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sql); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { var name = dt.Rows[i]["MaterialName"].ToString(); var model = dt.Rows[i]["Model"].ToString(); var num = dt.Rows[i]["Num"].ToString(); System.Data.DataTable dt1 = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("SELECT * FROM I_Consumables WHERE" + " Model=" + "'" + model + "'" + " AND SName=" + "'" + name + "'"); if (dt1.Rows.Count > 0) { //存在则数量相加 System.Data.DataTable dt2 = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("UPDATE I_Consumables " + "SET Num =Num" + "+'" + num + "'" + " WHERE Model=" + "'" + model + "'" + "AND SName=" + "'" + name + "'"); } else { //不存在,添加到易耗品库 var id = DateTime.Now.ToString("yyyyMMddHHmmssfff"); var price = dt.Rows[i]["Price"].ToString(); var cost = dt.Rows[i]["Cost"].ToString(); var type = dt.Rows[i]["Type"].ToString(); var note = dt.Rows[i]["Note"].ToString(); System.Data.DataTable dt3 = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("INSERT INTO I_Consumables " + "( ObjectID,Type,SName,Model,Note,Price,Num)" + "VALUES" + "( " + "'" + id + "','" + type + "','" + name + "','" + model + "','" + note + "','" + price + "','" + num + "'" + ")"); } } } } base.Submit(MvcPostValue, MvcResult); }
public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { if (this.ActionContext.ActivityCode == "Activity9") { if (MvcPost.Command == "Submit") { var projectNum = ActionContext.BizObject.GetValue("ProjectNum"); var projectId = ActionContext.BizObject.GetValue("ProjectId"); var projectMember = (BizObject[])ActionContext.BizObject.GetValue("ProjectChangeMember"); if (projectMember != null) { System.Data.DataTable deleteDt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("DELETE FROM ProjectMember WHERE ProjectId='" + projectId + "'"); for (int i = 0; i < projectMember.Length; i++) { var fullName = projectMember[i]["FullName"].ToString(); var userRole = projectMember[i]["UserRole"].ToString(); var department = projectMember[i]["Department"].ToString(); var profession = projectMember[i]["Profession"].ToString(); var jobTitle = projectMember[i]["JobTitle"].ToString(); var qualification = projectMember[i]["Qualification"].ToString(); var userId = projectMember[i]["UserId"].ToString(); System.Data.DataTable resultDt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("INSERT INTO ProjectMember(ProjectNum," + " ProjectId, FullName, UserRole, Department, Profession, JobTitle, Qualification, UserId)" + "VALUES( '" + projectNum + "','" + projectId + "','" + fullName + "','" + userRole + "','" + department + "','" + profession + "','" + jobTitle + "','" + qualification + "','" + userId + "')"); } } } } //保存后执行操作, base.SaveDataFields(MvcPost, result); }
public override void Submit(MvcPostValue MvcPostValue, MvcResult MvcResult) { if (this.ActionContext.ActivityCode == "submit") { var smid = ActionContext.BizObject.GetValue("SMId"); String sql = "SELECT sd.Type, sd.MaterialName, sd.Model, sd.Note, sd.Num, sd.Price, sd.Cost FROM I_SpecialMaterials sm " + "LEFT JOIN I_SpMaterialDetails sd ON sm.ObjectID = sd.ParentObjectID " + "WHERE sm.ObjectID = " + "'" + smid + "'"; System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sql); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { var name = dt.Rows[i]["MaterialName"].ToString(); var model = dt.Rows[i]["Model"].ToString(); var num = dt.Rows[i]["Num"].ToString(); //库存减去领用数量 System.Data.DataTable dt2 = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("UPDATE I_Consumables " + "SET Num =Num" + "-'" + num + "'" + " WHERE Model=" + "'" + model + "'" + "AND SName=" + "'" + name + "'"); } } } base.Submit(MvcPostValue, MvcResult); }
public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { if (MvcPost.Command == "Submit") { base.SaveDataFields(MvcPost, result); BizObject[] list = this.ActionContext.InstanceData["ProjectMembers"].Value as BizObject[]; if (list != null || !"".Equals(list)) { for (int i = 0; i < list.Length; i++) { String UserId = list[i].GetValue("UserId"); String Name = list[i].GetValue("FullName"); String PersonRole = list[i].GetValue("PersonRole"); String Department = list[i].GetValue("Department"); String Profession = list[i].GetValue("Profession"); String JobTitle = list[i].GetValue("JobTitle"); String GNVQ = list[i].GetValue("GNVQ"); String AppointmentDate = list[i].GetValue("AppointmentDate"); String ResidentDate = list[i].GetValue("ResidentDate"); } } // var i = list.Length(); } }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); }
public string DataTrack(MvcPostValue MvcPost, FieldSchema[] fields, SheetDataType sheetDataType, ClientActivity clientActivity) { var dics = new Dictionary <string, object>(); // 数据项存在2个情况,1.数据项名称 2.数据项.子数据项 foreach (FieldSchema field in fields) { // 如果数据项设置不允许保存,那么不会被保存进去 if (sheetDataType == SheetDataType.Workflow && !clientActivity.GetItemEditable(field.Name)) { continue; } if (!MvcPost.BizObject.DataItems.ContainsKey(field.Name)) { continue; } if (field.LogicType == DataLogicType.BizObject || field.LogicType == DataLogicType.BizObjectArray) { continue; } if (field.LogicType == DataLogicType.Comment && int.Equals(MvcPost.WorkItemType, (int)WorkItemType.WorkItemAssist)) { // 协办处理审核意见和审批结果逻辑 //SaveCommentData(MvcPost.BizObject, field.Name, MvcResult, MvcPost); } else if (field.LogicType == DataLogicType.Comment) { // 处理审核意见和审批结果逻辑 //SaveCommentData(MvcPost.BizObject, field.Name, MvcResult, null); } else if (field.LogicType == DataLogicType.Attachment) { // 处理附件逻辑 } else if (field.LogicType == DataLogicType.MultiParticipant) { // 处理多人参与者逻辑 } else { // 处理普通数据项 //this.ActionContext.InstanceData[field.Name].Value = MvcPost.BizObject.DataItems[field.Name].V; dics.Add(field.Name, MvcPost.BizObject.DataItems[field.Name].V); } } // 最后保存子表,因为关联关系的子表主键有可能在主表中,所以先保存主表 foreach (FieldSchema field in fields) { // 如果数据项设置不允许保存,那么不会被保存进去 if (sheetDataType == SheetDataType.Workflow && !clientActivity.GetItemEditable(field.Name)) { continue; } if (!MvcPost.BizObject.DataItems.ContainsKey(field.Name)) { continue; } if (field.LogicType != DataLogicType.BizObject && field.LogicType != DataLogicType.BizObjectArray) { continue; } if (field.LogicType == DataLogicType.BizObject) { // 业务对象可以使用普通控件显示,例如:业务对象A.Code,可以使用文本框绑定数据项显示 A.Code } else if (field.LogicType == DataLogicType.BizObjectArray) { if (field.Name == "APPLICANT_TYPE") { continue; } // 记录字表变动数据 List <Dictionary <string, object> > result = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(MvcPost.BizObject.DataItems[field.Name].V.ToString()); if (result != null && result.Any()) { var dicItems = new List <Dictionary <string, object> >(); foreach (var item in result) { var dicItem = new Dictionary <string, object>(); foreach (var dicKey in item.Keys) { if (dicKey.ToLower() == "objectid") { continue; } var itemField = field.Schema.Fields.Where(p => p.Name == dicKey).FirstOrDefault(); if (itemField != null) { dicItem.Add(dicKey, item[dicKey]); } } dicItems.Add(dicItem); } dics.Add(field.Name, dicItems); } } } var dataTrack = JsonConvert.SerializeObject(dics, Formatting.Indented); return(dataTrack); }
public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { MvcPost.BizObject.DataItems.SetValue("aaaaaa", "21"); base.SaveDataFields(MvcPost, result); }
/// <summary> /// 保存表单数据到引擎中 /// </summary> /// <param name="Args"></param> public override void SaveDataFields(MvcPostValue MvcPost, MvcResult result) { try { MvcDataItem type = new MvcDataItem(); MvcPost.BizObject.DataItems.TryGetValue("APPLICANT_TYPE", out type); var dataJson = JsonConvert.SerializeObject(MvcPost.BizObject.DataItems); var r = JsonConvert.DeserializeObject <List <System.Collections.Generic.Dictionary <object, object> > >(JsonConvert.SerializeObject(type.V)); if (r.Count() > 0) { var name = r[0]["NAME1"] + string.Empty; string msg = ""; bool isInject = new DongZheng.H3.WebApi.Controllers.XssAttribute().IsContainXSSCharacter(name, out msg); if (isInject) { result.Successful = false; result.Errors.Add("检测到SQL敏感字符"); return; } isInject = new DongZheng.H3.WebApi.Controllers.SqlInjectAttribute().IsSqlInjectCharacter(name, out msg); if (isInject) { result.Successful = false; result.Errors.Add("检测到XSS敏感字符"); return; } } } catch (Exception ex) { } // 保存后,后台执行事件 base.SaveDataFields(MvcPost, result); string Command = Request["Command"] + string.Empty; //1.判断是否成功保存 if (result.Successful && Command.ToLower() == MvcController.Button_Submit) { var version = 1; var tokenId = 1; var fields = this.ActionContext.Schema.Fields; var sheetDataType = this.ActionContext.SheetDataType; var clientActivity = (H3.WorkflowTemplate.ClientActivity) this.ActionContext.ActivityTemplate; var context = this.ActionContext.Engine.InstanceManager.GetInstanceContext(this.ActionContext.InstanceId); if (context != null) { var tokens = context.GetTokens("Activity2", Instance.TokenState.Unspecified).OrderByDescending(p => p.CreatedTime); version = tokens.Count() == 0 ? 1 : tokens.Count(); tokenId = tokens.Count() == 0 ? 1 : tokens.FirstOrDefault().TokenId; } var instanceId = this.ActionContext.InstanceId; //2.记录数据变动日志 Task.Run(() => { var trackResult = new DataLogger().DataTrack(MvcPost, fields, sheetDataType, clientActivity); string sql = "insert into H3.c_fidatatrack(objectid,instanceid,verson,activitycode,datatrack,tokenid,createdtime) values('" + Guid.NewGuid().ToString() + "','" + instanceId + "','" + version + "','Activity2',:content,'" + tokenId + "',to_date('" + DateTime.Now + "','yyyy/mm/dd HH24:MI:SS'))"; try { var i = 0; string connectionCode = "Engine"; var dbObject = AppUtility.Engine.SettingManager.GetBizDbConnectionConfig(connectionCode); OracleConnection connection = new OracleConnection(dbObject.DbConnectionString); connection.Open(); OracleCommand Cmd = new OracleCommand(sql, connection); OracleParameter Temp = new OracleParameter("content", OracleType.NClob); Temp.Direction = ParameterDirection.Input; Temp.Value = trackResult; Cmd.Parameters.Add(Temp); i = Cmd.ExecuteNonQuery(); connection.Close(); } catch (Exception ex) { AppUtility.Engine.LogWriter.Write("保存风控报告数据异常:" + ex.ToString()); } }).GetAwaiter(); } }