public JsonResult DragProperty(string schemaCode, string currentItemName, string targetItemName, string parentItemName, string changeType) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); this.SchemaCode = schemaCode; if (!this.ParseParam()) { result.Success = false; result.Message = "EditBizObjectSchema.Msg0"; return Json(result, JsonRequestBehavior.AllowGet); } BizObjectSchema currentSchema = string.IsNullOrWhiteSpace(parentItemName) ? this.Schema : this.Schema.GetProperty(parentItemName).ChildSchema; List <PropertySchema> propertys = currentSchema.Properties.Where(p => !DataModel.BizObjectSchema.IsReservedProperty(p.Name)).ToList(); int targetIndex = propertys.FindIndex(p => p.Name.Equals(targetItemName, StringComparison.InvariantCultureIgnoreCase)); propertys.Remove(currentSchema.GetProperty(currentItemName)); propertys.Insert(targetIndex, currentSchema.GetProperty(currentItemName)); //foreach (PropertySchema p in propertys) //{ // currentSchema.RemoveProperty(p.Name); //} foreach (PropertySchema p in propertys) { currentSchema.SetPropertyIndex(p); } result.Success = this.Engine.BizObjectManager.UpdateDraftSchema(this.Schema); return Json(result, JsonRequestBehavior.AllowGet); })); }
public bool SetInstanceData(string InstanceID, string WorkitemID, string bizObjectSchemaCode, string childSchemaCode, string detObjectID, DataTable dt, ref decimal amt) { BizObjectSchema schema = Engine.BizObjectManager.GetPublishedSchema(bizObjectSchemaCode); BizObject bo = new BizObject(Engine, schema, ""); //BizObjectID bo.ObjectID = detObjectID; bo.Load(); // Load 是装载数据 //设置主表字段的值 int i = 0; if (bo[childSchemaCode] != null) { foreach (var v in (OThinker.H3.DataModel.BizObject[])bo[childSchemaCode]) { i++; } } BizObjectSchema childSchema = schema.GetProperty(childSchemaCode).ChildSchema; BizObject[] bizObjects = new BizObject[i + dt.Rows.Count]; int j = 0; if (bo[childSchemaCode] != null) { foreach (var v in (OThinker.H3.DataModel.BizObject[])bo[childSchemaCode]) { bizObjects[j] = new BizObject(this.Engine, childSchema, this.UserValidator.UserID); bizObjects[j] = v; j++; } } foreach (DataRow dr in dt.Rows) { bizObjects[i] = new BizObject(this.Engine, childSchema, this.UserValidator.UserID); foreach (string item in childSchema.GetPropertyNames()) { if (dt.Columns.Contains(item)) { if ("DKJE" == item) { amt = amt + Convert.ToDecimal(dr["DKJE"].ToString()); } if ("LXJE" == item) { amt = amt + Convert.ToDecimal(dr["LXJE"].ToString()); } bizObjects[i][item] = dr[item].ToString(); } } i++; } bo[childSchemaCode] = bizObjects; return(bo.Update()); }
public bool SetInstanceData(string InstanceID, string WorkitemID, string bizObjectSchemaCode, string childSchemaCode, string detObjectID, List <string> strList) { BizObjectSchema schema = Engine.BizObjectManager.GetPublishedSchema(bizObjectSchemaCode); BizObject bo = new BizObject(Engine, schema, ""); //BizObjectID bo.ObjectID = detObjectID; bo.Load(); // Load 是装载数据 bo["TotalHKJE"] = strList[4]; bo["TotalLXJE"] = strList[5]; bo["TotalDZJE"] = strList[6]; //bo["XZQSBJ"] = strList[4]; //bo["SFBJ"] = strList[4]; //bo["SSLX"] = strList[5]; //bo["QSLX"] = strList[5]; //设置主表字段的值 if (!string.IsNullOrEmpty(childSchemaCode)) { int i = 0; if (bo[childSchemaCode] != null) { foreach (var v in (OThinker.H3.DataModel.BizObject[])bo[childSchemaCode]) { i++; } } BizObjectSchema childSchema = schema.GetProperty(childSchemaCode).ChildSchema; BizObject[] bizObjects = new BizObject[i + 1]; int j = 0; if (bo[childSchemaCode] != null) { foreach (var v in (OThinker.H3.DataModel.BizObject[])bo[childSchemaCode]) { bizObjects[j] = new BizObject(this.Engine, childSchema, this.UserValidator.UserID); bizObjects[j] = v; j++; } } // 第一行 bizObjects[i] = new BizObject(this.Engine, childSchema, this.UserValidator.UserID); bizObjects[i]["DZJEBH"] = strList[0]; bizObjects[i]["DZJE"] = strList[1]; bizObjects[i]["JEDZSJ"] = strList[2]; bizObjects[i]["CWDZBZ"] = strList[3]; bizObjects[i]["CJJEDZSJ"] = DateTime.Now; bo[childSchemaCode] = bizObjects; } return(bo.Update()); }
/// <summary> /// 获取子表结构 /// </summary> /// <param name="Schema"></param> /// <param name="Field"></param> /// <returns></returns> private BizObjectSchema GetChildSchema(BizObjectSchema schema, FieldSchema field) { PropertySchema property = schema.GetProperty(field.Name); if (property != null && property.ChildSchema != null) { return(property.ChildSchema); } return(this.Engine.BizObjectManager.GetPublishedSchema(field.ChildSchemaCode)); }
/// <summary> /// 加载数据,返回类型及显示名称 /// </summary> /// <param name="WorkflowCode"></param> /// <param name="ActivityCode"></param> /// <param name="ItemName"></param> /// <param name="Value"></param> /// <returns></returns> public JsonResult Load(string WorkflowCode, string ActivityCode, string ItemName, string Value) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(false); BizObjectSchema Schema = null; OThinker.H3.WorkflowTemplate.WorkflowClause Clause = this.Engine.WorkflowManager.GetClause(WorkflowCode); if (Clause != null) { Schema = this.Engine.BizObjectManager.GetPublishedSchema(Clause.BizSchemaCode); } else { result.Message = "Simulation.EditSimulation_Mssg3"; return Json(result, JsonRequestBehavior.AllowGet); } PropertySchema PropertySchema = null; if (Schema != null) { PropertySchema = Schema.GetProperty(ItemName); } else { result.Message = "Simulation.EditSimulation_Mssg3"; return Json(result, JsonRequestBehavior.AllowGet); } //string[] values = null; //try //{ // values = (string[])JsonConvert.DeserializeObject(Value, typeof(string[])); //} //catch { } var DisplayName = ""; var LogicTypeDisplay = ""; var LogicType = ""; if (PropertySchema != null) { DisplayName = PropertySchema.DisplayName; LogicTypeDisplay = OThinker.H3.Data.DataLogicTypeConvertor.ToLogicTypeName(PropertySchema.LogicType); LogicType = PropertySchema.LogicType.ToString(); //前端处理 ////选择参与者 //if (PropertySchema.LogicType == OThinker.H3.Data.DataLogicType.SingleParticipant || this.PropertySchema.LogicType == OThinker.H3.Data.DataLogicType.MultiParticipant) //{ // usParticipants.Visible = true; // usParticipants.SelectedUsers = values; //} //逻辑型 //else if (this.PropertySchema.LogicType == OThinker.H3.Data.DataLogicType.Bool) //{ // chk.Visible = true; // if (values != null && values.Length > 0 && (values[0] + string.Empty).ToLower() == "true") // { // chk.Checked = true; // } //} //逻辑型 //else if (this.PropertySchema.LogicType == OThinker.H3.Data.DataLogicType.DateTime) //{ // st.Visible = true; // DateTime time = DateTime.Now; // if (values != null && values.Length > 0 && DateTime.TryParse(values[0], out time)) // { // st.TimeValue = time; // } //} //else //{ // txtValues.Visible = true; // if (values != null && values.Length > 0) // { // txtValues.Text = string.Join(";", values); // } //} } else if (!string.IsNullOrEmpty(ActivityCode)) { OThinker.H3.WorkflowTemplate.WorkflowDocument document = this.Engine.WorkflowManager.GetPublishedTemplate(WorkflowCode, this.Engine.WorkflowManager.GetWorkflowDefaultVersion(WorkflowCode)); foreach (OThinker.H3.WorkflowTemplate.Activity activity in document.Activities) { if (activity.ActivityCode == ActivityCode) { DisplayName = activity.DisplayName; LogicType = string.Empty; } } } else { result.Message = "Simulation.EditSimulationData_Mssg1"; return Json(result, JsonRequestBehavior.AllowGet); } result.Success = true; result.Extend = new { DisplayName = DisplayName, LogicTypeDisplay = LogicTypeDisplay, LogicType = LogicType }; return Json(result, JsonRequestBehavior.AllowGet); })); }