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 override MvcViewContext LoadDataFields()
        {
            if (this.ActionContext.IsOriginateMode)
            {
                //初始化预算信息
                var bos = (BizObject[])ActionContext.BizObject.GetValue("WorkPlan");
                if (bos != null)
                {
                    //已存在不再初始化
                }
                else
                {
                    //不存在,初始化子表
                    System.Data.DataTable projectConclusionDt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable("SELECT Content FROM BudgetInfo where BudgetType='Conclusion'");
                    if (projectConclusionDt.Rows.Count > 0)
                    {
                        BizObject[]     bizObjects  = new BizObject[projectConclusionDt.Rows.Count];
                        BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("WorkPlan").ChildSchema;
                        for (int i = 0; i < projectConclusionDt.Rows.Count; i++)
                        {
                            bizObjects[i]             = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                            bizObjects[i]["WorkName"] = projectConclusionDt.Rows[i]["Content"].ToString();
                        }
                        this.ActionContext.InstanceData["WorkPlan"].Value = bizObjects;
                    }
                }
            }

            return(base.LoadDataFields());
        }
Esempio n. 3
0
        public override MvcViewContext LoadDataFields()
        {
            if (!this.ActionContext.IsOriginateMode)
            {
                String id = (String)ActionContext.BizObject.GetValue("ObjectID");
                System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                    "SELECT * FROM I_ChangeLogs  where FAObject = " + "'" + id + "'");
                if (dt.Rows.Count > 0)
                {
                    BizObject[]     bizObjects  = new BizObject[dt.Rows.Count];
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("AssetsChanges").ChildSchema;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["ChangeDate"]  = dt.Rows[i]["ChangeDate"].ToString();
                        bizObjects[i]["BDepartment"] = dt.Rows[i]["BDepart"].ToString();
                        bizObjects[i]["BUserName"]   = dt.Rows[i]["BUserName"].ToString();
                        bizObjects[i]["ADepartment"] = dt.Rows[i]["ADepart"].ToString();
                        bizObjects[i]["AUserName"]   = dt.Rows[i]["AUserName"].ToString();
                        bizObjects[i]["Resson"]      = dt.Rows[i]["Reason"].ToString();
                    }
                    this.ActionContext.InstanceData["AssetsChanges"].Value = bizObjects;

                    this.ActionContext.InstanceData.Submit();
                }
            }
            return(base.LoadDataFields());
        }
Esempio n. 4
0
        public override MvcViewContext LoadDataFields()
        {
            if (!this.ActionContext.IsOriginateMode)
            {
                String id = (String)ActionContext.BizObject.GetValue("ObjectID");
                System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                    "SELECT er.Zjgzlx,er.Xmmc,er.Gzmc,zp.kssj,zp.Jssj,zp.Gznr,zp.Pj FROM I_EvaluationResult er " +
                    "LEFT JOIN I_ZYjpj zp ON er.ObjectID = zp.ParentObjectID WHERE zp.ExpertId = " + "'" + id + "'");
                if (dt.Rows.Count > 0)
                {
                    BizObject[]     bizObjects  = new BizObject[dt.Rows.Count];
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("Gzyjpjxx").ChildSchema;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bizObjects[i]           = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["Zjgzlx"] = dt.Rows[i]["Zjgzlx"].ToString();
                        bizObjects[i]["Xmmc"]   = dt.Rows[i]["Xmmc"].ToString();
                        bizObjects[i]["Gzmc"]   = dt.Rows[i]["Gzmc"].ToString();
                        bizObjects[i]["kssj"]   = dt.Rows[i]["kssj"].ToString();
                        bizObjects[i]["Jssj"]   = dt.Rows[i]["Jssj"].ToString();
                        bizObjects[i]["Gznr"]   = dt.Rows[i]["Gznr"].ToString();
                        bizObjects[i]["Yjpj"]   = dt.Rows[i]["Pj"].ToString();
                    }
                    this.ActionContext.InstanceData["Gzyjpjxx"].Value = bizObjects;

                    this.ActionContext.InstanceData.Submit();
                }
            }
            return(base.LoadDataFields());
        }
        /// <summary>
        /// 获取数据模型对象基础信息
        /// </summary>
        /// <param name="parentId">父ID</param>
        /// <param name="IsBizObject">是否是数据模型</param>
        /// <returns>数据模型对象基础信息</returns>
        private BizObjectSchemaViewModel GetBizObjectSchema(string parentId, out bool IsBizObject)
        {
            var bizTreeNode = this.Engine.FunctionAclManager.GetFunctionNode(parentId);

            BizObjectSchema ownSchema = null;

            if (bizTreeNode.Code != this.Schema.SchemaCode)
            {
                ownSchema = this.Engine.BizObjectManager.GetDraftSchema(bizTreeNode.Code);
            }

            BizObjectSchemaViewModel model = new BizObjectSchemaViewModel()
            {
                Code          = this.Schema.SchemaCode,
                Description   = this.Schema.Description,
                DisplayName   = this.Schema.DisplayName,
                Type          = "WorkflowPackage." + this.Schema.StorageType.ToString(),
                ParentId      = parentId,
                IsQuotePacket = ownSchema == null?false:ownSchema.IsQuotePacket
                                //ObjectID=this.Schema.ObjectTypeId,
            };

            IsBizObject = false;
            //是否可以删除
            if (!string.IsNullOrEmpty(this.SchemaCode))
            {
                FunctionNode node = this.Engine.FunctionAclManager.GetFunctionNodeByCode(this.SchemaCode);
                if (node != null)
                {
                    model.SortKey = node.SortKey.ToString();
                    IsBizObject   = (node.NodeType == FunctionNodeType.BizObject);//TODO 感觉这里永远为False?
                }
            }
            return(model);
        }
        public override MvcViewContext LoadDataFields()
        {
            // 后台获取Url的参数(通过Request来获取)
            string url = Request.Url.ToString();

            string AgreeMent_number = Common.getUrlParam(url, "AgreeMent_number");
            string agency_type      = Common.getUrlParam(url, "agency_type");

            //var AgreeMent_number = this.ActionContext.InstanceData["AgreeMent_number"].Value;
            if (!AgreeMent_number.Equals(""))
            {
                String sqls = "";
                if ("USD".Equals(agency_type))
                {
                    sqls = "SELECT am.Project_head_A,am.Project_head_B,am.AgreeMent_number,am.AgreeMent_name,am.Agreement_client,am.Pay_conditions,am.CreatedBy,am.CreatedTime, " +
                           " ar.agency_money,ar.agency_type,e1.EnumValue agency_type_name,ar.up_limit,ar.lower_limit " +
                           " FROM I_AircraftOilAgreement am  " +
                           " inner JOIN I_agency_rates_hy ar on am.ObjectID = ar.ParentObjectID " +
                           " inner JOIN OT_EnumerableMetadata e1 on e1.Code = ar.agency_type and e1.Category = '代理费费率/金额' " +
                           "  where am.AgreeMent_number='" + AgreeMent_number + "'";
                }
                else
                {
                    sqls = "SELECT am.Project_head_A,am.Project_head_B,am.AgreeMent_number,am.AgreeMent_name,am.Agreement_client,am.Pay_conditions,am.CreatedBy,am.CreatedTime, " +
                           " ar.agency_money,ar.agency_type,e1.EnumValue agency_type_name,ar.up_limit,ar.lower_limit " +
                           " FROM I_Agreement_mains am  " +
                           " inner JOIN I_agency_rates ar on am.ObjectID = ar.ParentObjectID " +
                           " inner JOIN OT_EnumerableMetadata e1 on e1.Code = ar.agency_type and e1.Category = '代理费费率/金额' " +
                           "  where am.AgreeMent_number='" + AgreeMent_number + "'";
                }
                System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sqls);
                if (dt.Rows.Count > 0)
                {
                    BizObject[] bizObjects = new BizObject[dt.Rows.Count];
                    //BizObject[] bizObjects2 = new BizObject[dt.Rows.Count];
                    var i = 0;
                    foreach (DataRow dr in dt.Rows)
                    {
                        BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("agency_rates_gd").ChildSchema;
                        // BizObjectSchema childSchema2 = this.ActionContext.Schema.GetProperty("New_agency_rates").ChildSchema;
                        // 第一行
                        bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["agency_money"] = dr["agency_money"].ToString();
                        bizObjects[i]["agency_type"]  = dr["agency_type_name"].ToString();
                        bizObjects[i]["up_limit"]     = dr["up_limit"].ToString();
                        bizObjects[i]["lower_limit"]  = dr["lower_limit"].ToString();

                        //bizObjects2[i] = new BizObject(this.ActionContext.Engine, childSchema2, this.ActionContext.User.UserID);
                        //bizObjects2[i]["agency_money"] = dr["agency_money"].ToString();
                        //bizObjects2[i]["agency_type"] = dr["agency_type"].ToString();
                        //bizObjects2[i]["up_limit"] = dr["up_limit"].ToString();
                        //bizObjects2[i]["lower_limit"] = dr["lower_limit"].ToString();
                        i++;
                    }
                    this.ActionContext.InstanceData["agency_rates_gd"].Value = bizObjects;
                    //this.ActionContext.InstanceData["New_agency_rates"].Value = bizObjects2;
                }
            }
            return(base.LoadDataFields());
        }
        public override MvcViewContext LoadDataFields()
        {
            if (this.ActionContext.IsOriginateMode)
            {
                BizObject[]     bizObjects  = new BizObject[3];
                BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("BidBusiTbl").ChildSchema;
                // 第一行
                bizObjects[0]              = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                bizObjects[0]["IsCheck"]   = "";
                bizObjects[0]["Resources"] = "用车(辆)";
                bizObjects[0]["Num"]       = 0;
                bizObjects[0]["ApplyFY"]   = 0;
                bizObjects[0]["ConfirmFY"] = 0;
                // 第二行
                bizObjects[1]              = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                bizObjects[1]["IsCheck"]   = "";
                bizObjects[1]["Resources"] = "用餐(人)";
                bizObjects[1]["Num"]       = 0;
                bizObjects[1]["ApplyFY"]   = 0;
                bizObjects[1]["ConfirmFY"] = 0;
                // 第三行
                bizObjects[2]              = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                bizObjects[2]["IsCheck"]   = "";
                bizObjects[2]["Resources"] = "用工(人)";
                bizObjects[2]["Num"]       = 0;
                bizObjects[2]["ApplyFY"]   = 0;
                bizObjects[2]["ConfirmFY"] = 0;

                this.ActionContext.InstanceData["BidBusiTbl"].Value = bizObjects;
            }
            return(base.LoadDataFields());
        }
    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 void ExportBizMasterData(string bizMasterDataCode)
        {
            ExecuteFunctionRun(() =>
            {
                Acl.FunctionNode masterDataNode = this.Engine.FunctionAclManager.GetFunctionNodeByCode(bizMasterDataCode);

                //主数据根节点
                XmlElement bizMasterData = XmlDoc.CreateElement(FunctionNodeType.BizObject.ToString());
                //数据模型
                BizObjectSchema Schema = this.Engine.BizObjectManager.GetDraftSchema(bizMasterDataCode);
                if (Schema != null)
                {
                    bizMasterData.InnerXml += Convertor.ObjectToXml(Schema);
                }
                //监听实例
                BizListenerPolicy policy = this.Engine.BizObjectManager.GetListenerPolicy(bizMasterDataCode);
                if (policy != null)
                {
                    bizMasterData.InnerXml += Convertor.ObjectToXml(policy);
                }
                //定时作业
                ScheduleInvoker[] scheduleInvokers = this.Engine.BizObjectManager.GetScheduleInvokerList(bizMasterDataCode);
                if (scheduleInvokers != null && scheduleInvokers.Length > 0)
                {
                    XmlElement invokers = XmlDoc.CreateElement("ScheduleInvokers");
                    foreach (ScheduleInvoker item in scheduleInvokers)
                    {
                        invokers.InnerXml += Convertor.ObjectToXml(item);
                    }
                    bizMasterData.AppendChild(invokers);
                }
                //查询列表
                BizQuery[] queries = this.Engine.BizObjectManager.GetBizQueries(bizMasterDataCode);
                if (queries != null && queries.Length > 0)
                {
                    XmlElement bizQueries = XmlDoc.CreateElement("BizQueries");
                    foreach (BizQuery query in queries)
                    {
                        bizQueries.InnerXml += Convertor.ObjectToXml(query);
                    }
                    bizMasterData.AppendChild(bizQueries);
                }
                XmlDoc.AppendChild(bizMasterData);

                //导出文件
                string path     = Server.MapPath("~/TempImages/");
                string fileName = bizMasterDataCode + ".xml";

                XmlDoc.Save(path + fileName);
                this.Response.Clear();
                this.Response.ContentType = "text/xml";
                this.Response.AppendHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
                this.Response.TransmitFile(path + fileName);
                this.Response.End();
                System.IO.File.Delete(path + fileName);
                return(null);
            });
        }
    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());
    }
Esempio n. 11
0
        /// <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));
        }
Esempio n. 12
0
 public JsonResult GetWorkflowPackage(string id, string objectType, string parentId, string parentCode)
 {
     return(ExecuteFunctionRun(() =>
     {
         ActionResult result = new ActionResult();
         string bizTreeCode = string.Empty;
         if (!string.IsNullOrEmpty(id))
         {
             var bizTreeNode = this.Engine.FunctionAclManager.GetFunctionNode(id);
             bizTreeCode = bizTreeNode.Code;
             BizObjectSchema schema = this.Engine.BizObjectManager.GetDraftSchema(bizTreeNode.Code);
             if (schema == null)
             {
                 schema = this.Engine.BizObjectManager.GetPublishedSchema(bizTreeNode.Code);
             }
             WorkflowPackageViewModel model = new WorkflowPackageViewModel()
             {
                 ObjectID = bizTreeNode.ObjectID,
                 Code = bizTreeNode.Code,
                 DisplayName = bizTreeNode.DisplayName,
                 Folder = string.IsNullOrWhiteSpace(parentCode) ? this.Engine.FunctionAclManager.GetFunctionNode(parentId).Code : parentCode,
                 SortKey = bizTreeNode.SortKey.ToString(),
                 StorageType = ((int)schema.StorageType).ToString(),
                 CheckedUser = bizTreeNode.IsLocked ? this.Engine.Organization.GetName(bizTreeNode.LockedBy) : "WorkflowPackage.UnLocked",
                 ParentId = parentId,
                 ObjectType = objectType,
                 IsShared = schema.IsShared,
                 IsQuotePacket = schema.IsQuotePacket,
                 BindPacket = schema.BindPacket
             };
             result.Extend = new
             {
                 WorkflowPackage = model,
                 Folders = GetFloders(objectType, parentId),
                 CurrentUser = this.UserValidator.UserName
             };
         }
         else
         {
             result.Extend = new
             {
                 WorkflowPackage = new WorkflowPackageViewModel()
                 {
                     Folder = string.IsNullOrWhiteSpace(parentCode) ? this.Engine.FunctionAclManager.GetFunctionNode(parentId).Code : parentCode,
                     SortKey = "1",
                     StorageType = "0",
                     ParentId = parentId,
                     ObjectType = objectType
                 },
                 Folders = GetFloders(objectType, parentId)
             };
         }
         return Json(result.Extend, JsonRequestBehavior.AllowGet);
     }));
 }
Esempio n. 13
0
        public override MvcViewContext LoadDataFields()
        {
            // 后台获取Url的参数(通过Request来获取)
            string url        = Request.Url.ToString();
            string ContractNo = Common.getUrlParam(url, "ContractNo");

            if (!ContractNo.Equals(""))
            {
                ContractMain con = Common.getContractByBizId(ContractNo);
                this.ActionContext.InstanceData["Currency"].Value = con.Currency;
            }

            // 获取取回子流程的版本号
            int versionBack = OThinker.H3.Controllers.AppUtility.Engine.WorkflowManager.GetWorkflowDefaultVersion("GetBackContract");

            this.ActionContext.InstanceData["WorkflowVersion_Back"].Value = versionBack;
            // 获取回退记录
            System.Data.DataTable dt_back = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " SELECT ins.OriginatorName Approver,ins.StartTime ApproveDate,ins.State Status,ins.ObjectID, " +
                " gb.OldInstanceActivityName,gb.InstanceActivityName,c.[Text] Remark  " +
                " FROM I_GetBackContract gb, OT_InstanceContext ins, OT_Comment c " +
                " where gb.NeedInstanceId = '" + this.ActionContext.InstanceId + "' and gb.ObjectID = ins.BizObjectId and ins.ObjectID = c.InstanceId");
            if (dt_back.Rows.Count > 0)
            {
                BizObject[] bizObjects = new BizObject[dt_back.Rows.Count];
                var         i          = 0;
                foreach (DataRow dr in dt_back.Rows)
                {
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("GetBackPaymentSubTbl").ChildSchema;
                    // 第一行
                    bizObjects[i]                            = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                    bizObjects[i]["Approver"]                = dr["Approver"].ToString();
                    bizObjects[i]["ApproveDate"]             = dr["ApproveDate"].ToString();
                    bizObjects[i]["Remark"]                  = dr["Remark"].ToString();
                    bizObjects[i]["OldInstanceActivityName"] = dr["OldInstanceActivityName"].ToString();
                    bizObjects[i]["InstanceActivityName"]    = dr["InstanceActivityName"].ToString();

                    var st = dr["Status"].ToString();
                    Dictionary <string, string> workItemDic = Common.getWorkItemId(dr["ObjectID"].ToString(), st);
                    foreach (var item in workItemDic)
                    {
                        Console.WriteLine(item.Key + item.Value);
                        if (item.Key.Equals("workItemId"))
                        {
                            bizObjects[i]["WorkItemId"] = item.Value;
                        }
                    }
                    bizObjects[i]["Status"] = st == "2" ? "审批中" : (st == "4" ? "已回退" : "");
                    i++;
                }
                this.ActionContext.InstanceData["GetBackPaymentSubTbl"].Value = bizObjects;
            }

            return(base.LoadDataFields());
        }
Esempio n. 14
0
        public JsonResult SetWorkflowPackageShared(string schemaCode, bool isShared)
        {
            ActionResult    result          = new ActionResult(true);
            BizObjectSchema bizObjectSchema = this.Engine.BizObjectManager.GetDraftSchema(schemaCode);

            BizObjectSchema[] quoteBizObjectSchemas = this.Engine.BizObjectManager.GetQuoteDraftSchemas(schemaCode);
            //被其他流程包应用,禁止修改应用状态
            if (quoteBizObjectSchemas.Length > 0)
            {
                result.Success = false;
                result.Message = "WorkflowPackage.QuotePackagesExist";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            //数据模型不存在
            if (bizObjectSchema == null)
            {
                result.Success = false;
                result.Message = "EditBizObjectSchema.Msg0";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            try
            {
                //更新数据模型
                bizObjectSchema.IsShared = isShared;
                this.Engine.BizObjectManager.UpdateDraftSchema(bizObjectSchema);

                //更新表单
                OThinker.H3.Sheet.BizSheet[] bizSheets = this.Engine.BizSheetManager.GetBizSheetBySchemaCode(schemaCode);
                if (bizSheets != null)
                {
                    for (int i = 0; i < bizSheets.Length; i++)
                    {
                        bizSheets[i].IsShared = isShared;
                        this.Engine.BizSheetManager.UpdateBizSheet(bizSheets[i]);
                    }
                }
                //更新流程模板
                WorkflowTemplate.WorkflowClause[] workflowClauses = this.Engine.WorkflowManager.GetClausesBySchemaCode(schemaCode);
                if (workflowClauses != null)
                {
                    for (int i = 0; i < workflowClauses.Length; i++)
                    {
                        workflowClauses[i].IsShared = isShared;
                        this.Engine.WorkflowManager.UpdateClause(workflowClauses[i]);
                    }
                }
            }
            catch (Exception e)
            {
                result.Success = false;
                result.Message = e.Message;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 15
0
        public override MvcViewContext LoadDataFields()
        {
            if (!this.ActionContext.IsOriginateMode)
            {
                String zb = null;
                if (this.ActionContext.ActivityCode == "xmb")
                {
                    //初始化预算信息
                    var bos = (BizObject[])ActionContext.BizObject.GetValue("ProjectDepartment");
                    if (bos == null)
                    {
                        //已存在不再初始化
                        zb = "ProjectDepartment";
                    }
                }

                if (this.ActionContext.ActivityCode == "scb")
                {
                    //初始化预算信息
                    var bos = (BizObject[])ActionContext.BizObject.GetValue("MarketingDepartment");
                    if (bos == null)
                    {
                        zb = "MarketingDepartment";
                    }
                }

                if (this.ActionContext.ActivityCode == "zhb")
                {
                    //初始化预算信息
                    var bos = (BizObject[])ActionContext.BizObject.GetValue("IntegratedOffice");
                    if (bos == null)
                    {
                        zb = "IntegratedOffice";
                    }
                }

                if (zb != null)
                {
                    System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(" " +
                                                                                                                                                      "SELECT ProjectName,TaskNum FROM I_ProjectInfo where Status='1'");
                    BizObject[]     bizObjects  = new BizObject[dt.Rows.Count];
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty(zb).ChildSchema;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["ProjectName"] = dt.Rows[i]["ProjectName"].ToString();
                        bizObjects[i]["TaskNum"]     = dt.Rows[i]["TaskNum"].ToString();
                    }
                    this.ActionContext.InstanceData[zb].Value = bizObjects;
                }
            }
            return(base.LoadDataFields());
        }
Esempio n. 16
0
        public override MvcViewContext LoadDataFields()
        {
            try {
                // 解决缓存问题
                System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                    " SELECT * " +
                    " FROM I_DKTbl " +
                    " where ParentObjectID = '" + this.ActionContext.BizObjectID + "'" +
                    " order By ParentIndex ");
                if (dt.Rows.Count > 0)
                {
                    BizObject[] bizObjects = new BizObject[dt.Rows.Count];
                    var         i          = 0;
                    foreach (DataRow dr in dt.Rows)
                    {
                        BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("DKTbl").ChildSchema;
                        // 第一行
                        bizObjects[i]                    = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["QKSeq"]           = dr["QKSeq"].ToString();
                        bizObjects[i]["QKObjectID"]      = dr["QKObjectID"].ToString();
                        bizObjects[i]["QKSeqHidden"]     = dr["QKSeqHidden"].ToString();
                        bizObjects[i]["QKType"]          = dr["QKType"].ToString();
                        bizObjects[i]["QKTypeCode"]      = dr["QKTypeCode"].ToString();
                        bizObjects[i]["QKTarget"]        = dr["QKTarget"].ToString();
                        bizObjects[i]["QKTargetCode"]    = dr["QKTargetCode"].ToString();
                        bizObjects[i]["QKDate"]          = dr["QKDate"].ToString();
                        bizObjects[i]["ZJKX"]            = dr["ZJKX"].ToString();
                        bizObjects[i]["ZJMS"]            = dr["ZJMS"].ToString();
                        bizObjects[i]["QKAmount"]        = dr["QKAmount"].ToString();
                        bizObjects[i]["QKCurrency"]      = dr["QKCurrency"].ToString();
                        bizObjects[i]["QKCurrencyCode"]  = dr["QKCurrencyCode"].ToString();
                        bizObjects[i]["QKConvertAmount"] = dr["QKConvertAmount"].ToString();
                        bizObjects[i]["SeqCnt"]          = dr["SeqCnt"].ToString();
                        bizObjects[i]["LJDKAmount"]      = dr["LJDKAmount"].ToString();
                        bizObjects[i]["CurDKAmount"]     = dr["CurDKAmount"].ToString();
                        bizObjects[i]["CurDKCurrency"]   = dr["CurDKCurrency"].ToString();
                        bizObjects[i]["Status"]          = dr["Status"].ToString();
                        i++;
                    }
                    this.ActionContext.InstanceData["DKTbl"].Value = bizObjects;
                }
            }
            catch (Exception e)
            {
                ;
            }

            return(base.LoadDataFields());
        }
        public List <ComboxTree> GetPropertyTree(string schemaCode)
        {
            ComboxTree root = new ComboxTree()
            {
                text     = "PropertyTreeHandler.DataItem",
                children = new List <ComboxTree>()
            };

            // 系统数据项
            root.children.Add(new ComboxTree()
            {
                text     = "PropertyTreeHandler.SystemDataItem",
                children = new List <ComboxTree>()
            });

            TreeNode systemNode = this.GetInstanceDataTreeNode();

            AddSystemTreeNode(root.children[0], systemNode);

            // 流程数据项
            root.children.Add(new ComboxTree()
            {
                text     = "PropertyTreeHandler.WorkflowDataItem",
                children = new List <ComboxTree>()
            });
            BizObjectSchema schema = _controller.Engine.BizObjectManager.GetPublishedSchema(schemaCode);

            if (schema != null)
            {
                PropertySchema[] schemas = schema.Properties;
                if (schemas != null)
                {
                    foreach (PropertySchema field in schemas)
                    {
                        root.children[1].children.Add(new ComboxTree()
                        {
                            id   = field.Name,
                            text = field.FullName
                        });
                    }
                }
            }
            List <ComboxTree> results = new List <ComboxTree>();

            results.Add(root);
            return(results);
        }
Esempio n. 18
0
        private static MvcBizObject LoadBizObjectData(InstanceData Data, FieldSchema field)
        {
            BizObject    bo  = Data[field.Name].Value as BizObject;
            MvcBizObject mbo = new MvcBizObject();

            if (bo == null)
            {
                BizObjectSchema schema = field.Schema;
                if (schema == null)
                {
                    schema = AppUtility.Engine.BizObjectManager.GetPublishedSchema(field.ChildSchemaCode);
                }
                bo = new BizObject(AppUtility.Engine, schema, "");
            }
            foreach (PropertySchema p in bo.Schema.Properties)
            {
                mbo.DataItems.Add(field.Name + "." + p.Name, GetMvcDataFromProperty(field, p, bo));
            }
            return(mbo);
        }
        /// <summary>
        /// 加载表单数据
        /// </summary>
        /// <returns></returns>
        public override MvcViewContext LoadDataFields()
        {
            // 注意:这只是赋值,会显示到前端,但是如果前端的值不做变化,是不会存储到后台的
            this.ActionContext.InstanceData["mvcMobile"].Value = "系统赋值";

            /*
             * 子表设置初始化值,注:子表默认会有一行空数据,并且未填数据时,不会保存
             */
            if (this.ActionContext.IsOriginateMode)
            {
                BizObject[]     bizObjects  = new BizObject[2];
                BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("mvcDetail").ChildSchema;
                // 第一行
                bizObjects[0]         = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                bizObjects[0]["code"] = "aa";
                // 第二行
                bizObjects[1]         = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                bizObjects[1]["code"] = "bb";
                this.ActionContext.InstanceData["mvcDetail"].Value = bizObjects;
            }
            return(base.LoadDataFields());
        }
        public override MvcViewContext LoadDataFields()
        {
            String sql = "SELECT * FROM I_ProjectHouseRental ph LEFT JOIN I_ApplyerHouseInfo hi ON ph.ObjectID = hi.ParentObjectID  WHERE ph.Status='1'";

            System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sql);
            if (dt.Rows.Count > 0)
            {
                BizObject[]     bizObjects  = new BizObject[dt.Rows.Count];
                BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("ProjectHouseInfo").ChildSchema;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    bizObjects[i]              = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                    bizObjects[i]["Place"]     = dt.Rows[i]["Place"].ToString();
                    bizObjects[i]["Personnel"] = dt.Rows[i]["Accommodation"].ToString();
                    bizObjects[i]["Type"]      = dt.Rows[i]["Type"].ToString();
                }
                this.ActionContext.InstanceData["ProjectHouseInfo"].Value = bizObjects;

                //this.ActionContext.InstanceData.Submit();
            }


            return(base.LoadDataFields());
        }
        public override MvcViewContext LoadDataFields()
        {
            var AgreeMent_number = this.ActionContext.InstanceData["AgreeMent_number"].Value;
            //var AgreeMent_number = "17SPIAIE34-001US";
            //String sqls1 = "SELECT am.Project_head_A,am.Project_head_B,am.AgreeMent_number,am.AgreeMent_name,am.Agreement_client,am.Pay_conditions,am.CreatedBy,am.CreatedTime, " +
            //        " ar.agency_money,e1.EnumValue agency_type,ar.up_limit,ar.lower_limit " +
            //        " FROM I_Agreement_mains am  " +
            //        " inner JOIN I_agency_rates ar on am.ObjectID = ar.ParentObjectID " +
            //        " inner JOIN OT_EnumerableMetadata e1 on e1.Code = ar.agency_type and e1.Category = '代理费费率/金额' " +
            //        "  where am.AgreeMent_number='" + ContractNo + "'";
            //String sql = "SELECT cm.AgencyComputerNum agency_money,e1.EnumValue agency_type  " +
            //        " FROM I_ContractMain cm " +
            //        " inner JOIN OT_EnumerableMetadata e1 on e1.Code = cm.AgencyComputerType and e1.Category = '代理费费率/金额' " +
            //        "  where cm.ContractNo='" + AgreeMent_number + "'";
            //System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sql);
            //if (dt.Rows.Count > 0)
            //{

            //    BizObject[] bizObjects = new BizObject[dt.Rows.Count];
            //    var i = 0;
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("agency_rates_hy").ChildSchema;
            //        // 第一行
            //        bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
            //        bizObjects[i]["agency_money"] = dr["agency_money"].ToString();
            //        bizObjects[i]["agency_type"] = dr["agency_type"].ToString();
            //        bizObjects[i]["up_limit"] = "";
            //        bizObjects[i]["lower_limit"] = "";
            //        i++;
            //    }
            //    this.ActionContext.InstanceData["agency_rates_hy"].Value = bizObjects;
            //}
            ////协议号缓存
            var ReceiveAgencyFeeHidden = "0";

            System.Data.DataTable dt1 = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " SELECT a.AgreeMent_number,a.ReceiveAgencyFeeHidden FROM OT_InstanceContext ic INNER JOIN I_Agreement_mains a on ic.BizObjectId = a.ObjectID and ic.ObjectID = '" + this.ActionContext.InstanceId + "'");
            if (dt1.Rows.Count > 0)
            {
                AgreeMent_number       = dt1.Rows[0]["AgreeMent_number"].ToString();
                ReceiveAgencyFeeHidden = dt1.Rows[0]["ReceiveAgencyFeeHidden"].ToString();
            }
            this.ActionContext.InstanceData["AgreeMent_number"].Value       = AgreeMent_number;
            this.ActionContext.InstanceData["ReceiveAgencyFeeHidden"].Value = ReceiveAgencyFeeHidden;
            //协议号修改的版本号
            int versionBack = OThinker.H3.Controllers.AppUtility.Engine.WorkflowManager.GetWorkflowDefaultVersion("Update_agreement_number");

            this.ActionContext.InstanceData["Process_version"].Value = versionBack;
            //协议变更的版本号
            int Agreement_changeNumbers = OThinker.H3.Controllers.AppUtility.Engine.WorkflowManager.GetWorkflowDefaultVersion("Agreenment_change");

            this.ActionContext.InstanceData["Agreement_changeNumber"].Value = Agreement_changeNumbers;
            //协议归档版本号
            int Agreement_files = OThinker.H3.Controllers.AppUtility.Engine.WorkflowManager.GetWorkflowDefaultVersion("Agreement_file");

            this.ActionContext.InstanceData["AgreementGD_file"].Value = Agreement_files;
            //收退款版本号
            int st_moneys = OThinker.H3.Controllers.AppUtility.Engine.WorkflowManager.GetWorkflowDefaultVersion("Charge_back");

            this.ActionContext.InstanceData["st_money"].Value = st_moneys;

            // 获取取回协议子流程的版本号
            //int GetBackAgreement = OThinker.H3.Controllers.AppUtility.Engine.WorkflowManager.GetWorkflowDefaultVersion("GetBackAgreement");
            //this.ActionContext.InstanceData["WorkflowVersion_Back"].Value = GetBackAgreement;


            // 获取审签记录
            //System.Data.DataTable dt_approve = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
            //    "SELECT ins.OriginatorName Approver,CONVERT(varchar(12),ins.StartTime,111) ApproveDate,ins.State Status,ins.ObjectID " +
            //    " FROM I_Agreement_sign s, OT_InstanceContext ins " +
            //    " where s.AgreeMent_number = '"+ AgreeMent_number + "' and s.ObjectID = ins.BizObjectId");
            //if (dt_approve.Rows.Count > 0)
            //{
            //    BizObject[] bizObjects = new BizObject[1];
            //    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("Agreement_signTbl").ChildSchema;
            //    // 第一行
            //    bizObjects[0] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
            //    bizObjects[0]["Approver"] = dt_approve.Rows[0]["Approver"].ToString();
            //    bizObjects[0]["ApproveDate"] = dt_approve.Rows[0]["ApproveDate"].ToString();
            //    var st = dt_approve.Rows[0]["Status"].ToString();
            //    Dictionary<string, string> workItemDic = Common.getWorkItemId(dt_approve.Rows[0]["ObjectID"].ToString(), st);
            //    foreach (var item in workItemDic)
            //    {
            //        Console.WriteLine(item.Key + item.Value);
            //        if (item.Key.Equals("workItemId"))
            //        {
            //            bizObjects[0]["WorkItemId"] = item.Value;
            //        }

            //    }
            //    bizObjects[0]["Status"] = st == "2" ? "审批中" : (st == "4" ? "审批完了" : "");
            //    bizObjects[0]["Operate"] = "";

            //    this.ActionContext.InstanceData["Agreement_signTbl"].Value = bizObjects;
            //}

            // 获取协议归档文件名数据
            System.Data.DataTable dt_gdfn = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " select a.CreatedTime,a.DataField,a.FileName from I_Agreement_file g,OT_Attachment a  " +
                " where  g.ObjectID = a.BizObjectID" +
                " and g.Agreement_Number = '" + AgreeMent_number + "'" +
                " order by a.CreatedTime ");
            if (dt_gdfn.Rows.Count > 0)
            {
                var    i             = 0;
                string FileSignVer   = "";
                string BGFileSignVer = "";
                foreach (DataRow dr in dt_gdfn.Rows)
                {
                    if (dr["DataField"].ToString().Equals("Agency_original"))
                    {
                        FileSignVer += dr["FileName"].ToString() + ",";
                    }
                    else if (dr["DataField"].ToString().Equals("Agency_change"))
                    {
                        BGFileSignVer += dr["FileName"].ToString() + ",";
                    }
                    i++;
                }
                this.ActionContext.InstanceData["FileSignVersion"].Value   = FileSignVer;
                this.ActionContext.InstanceData["BGFileSignVersion"].Value = BGFileSignVer;
            }
            // 获取文件归档数据
            System.Data.DataTable dt_gd = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " SELECT " +
                " g.OwnerId," +
                " CONVERT(varchar(12),g.CreatedTime,111) CreatedTime," +
                " ic.State Status,  " +
                " case ic.State    " +
                "	when '2' then    "+
                "		'审批中'  "+
                "  when '4' then   " +
                "		'审批完了' "+
                " end DisplayName,   " +
                " g.CreatedTime,  " +
                " ic.ObjectID IcObjectId " +
                " FROM I_Agreement_file g" +
                " INNER JOIN OT_InstanceContext ic on g.ObjectID = ic.BizObjectId and g.AgreeMent_number = '" + AgreeMent_number + "'  " +
                " order by g.CreatedTime   ");

            if (dt_gd.Rows.Count > 0)
            {
                BizObject[] bizObjects = new BizObject[dt_gd.Rows.Count];
                var         i          = 0;
                foreach (DataRow dr in dt_gd.Rows)
                {
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("AgreementFileRecordhy").ChildSchema;
                    // 第一行
                    bizObjects[i]              = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                    bizObjects[i]["Applyer"]   = OThinker.H3.Controllers.AppUtility.Engine.Organization.GetName(dr["OwnerId"].ToString());
                    bizObjects[i]["ApplyDate"] = dr["CreatedTime"].ToString();
                    var st = dr["Status"].ToString();
                    bizObjects[i]["Status"] = dr["DisplayName"].ToString();
                    Dictionary <string, string> workItemDic = Common.getWorkItemId(dr["IcObjectId"].ToString(), st);
                    foreach (var item in workItemDic)
                    {
                        Console.WriteLine(item.Key + item.Value);
                        if (item.Key.Equals("workItemId"))
                        {
                            bizObjects[i]["WorkItemId"] = item.Value;
                        }
                    }
                    i++;
                }
                this.ActionContext.InstanceData["AgreementFileRecordhy"].Value = bizObjects;
            }

            // 获取变更数据
            System.Data.DataTable dt_bg = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " SELECT ac.PayConditionOld, ac.PayConditionNew, " +
                "  old.agency_money old_agency_money,old.agency_type old_agency_type, " +
                "  new.agency_money new_agency_money,new.agency_type new_agency_type, " +
                "  ins.State Status,ins.ObjectID IcObjectId " +
                "  FROM I_Agreenment_change ac,I_Old_agency_rates old, I_New_agency_rates new, OT_InstanceContext ins ,OT_EnumerableMetadata e " +
                "  where ac.AgreenMent_number = '" + AgreeMent_number + "' and ac.ObjectID = ins.BizObjectId  " +
                "  and old.ParentObjectID = ac.ObjectId and new.ParentObjectID = ac.ObjectId and new.agency_type = e.Code and e.Category = '代理费费率/金额' " +
                "  and e.EnumValue = old.agency_type " +
                "  ORDER BY ac.CreatedTime  ");
            List <Dictionary <string, string> > ls = new List <Dictionary <string, string> >();

            if (dt_bg.Rows.Count > 0)
            {
                var i               = 0;
                var IcObjectIdBak   = "";
                var PayConditionOld = "";
                var PayConditionNew = "";
                var old_agency      = "";
                var new_agency      = "";
                var Status          = "";
                var WorkItemId      = "";
                foreach (DataRow dr in dt_bg.Rows)
                {
                    if (dr["IcObjectId"].ToString() != IcObjectIdBak && IcObjectIdBak != "")
                    {
                        Dictionary <string, string> dic = new Dictionary <string, string>();
                        dic.Add("IcObjectId", IcObjectIdBak);
                        dic.Add("PayConditionOld", PayConditionOld);
                        dic.Add("PayConditionNew", PayConditionNew);
                        dic.Add("old_agency", old_agency);
                        dic.Add("new_agency", new_agency);
                        dic.Add("Status", Status);
                        dic.Add("WorkItemId", WorkItemId);
                        ls.Add(dic);
                        old_agency = "";
                        new_agency = "";
                    }
                    PayConditionOld = dr["PayConditionOld"].ToString();
                    PayConditionNew = dr["PayConditionNew"].ToString();
                    old_agency     += dr["old_agency_money"].ToString() + "(" + dr["old_agency_type"].ToString() + ")\n";
                    new_agency     += dr["new_agency_money"].ToString() + "(" + dr["old_agency_type"].ToString() + ")\n";

                    var st = dr["Status"].ToString();
                    Status = st == "2" ? "审批中" : (st == "4" ? "审批完了" : "");
                    Dictionary <string, string> workItemDic = Common.getWorkItemId(dr["IcObjectId"].ToString(), st);
                    foreach (var item in workItemDic)
                    {
                        Console.WriteLine(item.Key + item.Value);
                        if (item.Key.Equals("workItemId"))
                        {
                            WorkItemId = item.Value;
                        }
                    }
                    IcObjectIdBak = dr["IcObjectId"].ToString();
                    i++;
                }
                if (IcObjectIdBak != "")
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("IcObjectId", IcObjectIdBak);
                    dic.Add("PayConditionOld", PayConditionOld);
                    dic.Add("PayConditionNew", PayConditionNew);
                    dic.Add("old_agency", old_agency);
                    dic.Add("new_agency", new_agency);
                    dic.Add("Status", Status);
                    dic.Add("WorkItemId", WorkItemId);
                    ls.Add(dic);
                }
            }

            if (ls.Count > 0)
            {
                BizObject[] bizObjects = new BizObject[ls.Count];
                var         i          = 0;
                foreach (Dictionary <string, string> dic in ls)
                {
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("Agreement_bg_hy").ChildSchema;
                    // 第一行
                    bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);

                    foreach (var item in dic)
                    {
                        if (item.Key.Equals("PayConditionOld"))
                        {
                            bizObjects[i]["PayConditionOld"] = item.Value;
                        }
                        if (item.Key.Equals("PayConditionNew"))
                        {
                            bizObjects[i]["PayConditionNew"] = item.Value;
                        }
                        if (item.Key.Equals("old_agency"))
                        {
                            bizObjects[i]["old_agency"] = item.Value;
                        }
                        if (item.Key.Equals("new_agency"))
                        {
                            bizObjects[i]["new_agency"] = item.Value;
                        }
                        if (item.Key.Equals("Status"))
                        {
                            bizObjects[i]["Status"] = item.Value;
                        }
                        if (item.Key.Equals("WorkItemId"))
                        {
                            bizObjects[i]["WorkItemId"] = item.Value;
                        }
                    }
                    i++;
                }
                this.ActionContext.InstanceData["Agreement_bg_hy"].Value = bizObjects;
            }

            // 获取合同项目关联数据
            // 1、协议与项目的关联数据
            System.Data.DataTable dt_AgrAndProj = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " select ib.ObjectID,min(ib.projectName) projectName,min(ib.BiddingCode) BiddingCode " +
                " from I_AircraftOilAgreement am " +
                " INNER JOIN I_AgencyAgreements aa on am.AgreeMent_number = aa.AgreementCode " +
                " INNER JOIN I_InviteBids ib on aa.ParentObjectID = ib.ObjectID " +
                " and am.AgreeMent_number = '" + AgreeMent_number + "'  " +
                " group by ib.ObjectID ");
            // 2、协议与合同的关联数据
            System.Data.DataTable dt_AgrAndCont = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " select cm.ContractNo,cm.ContractName,e.EnumValue ContractType " +
                " from I_AircraftOilAgreement am " +
                " INNER JOIN I_ContractMain cm on cm.ContractNo = am.AgreeMent_number " +
                " INNER JOIN OT_EnumerableMetadata e on e.Code = cm.ContractType and e.Category = '合同类型' " +
                " and am.AgreeMent_number = '" + AgreeMent_number + "' ");
            // 3、项目与合同的关联数据
            string sql_ProjAndCont =
                " select cm.ContractNo " +
                " from I_InviteBids ib " +
                " INNER JOIN I_ContractMain cm on ib.BiddingCode = cm.BidNo " +
                " and ib.BiddingCode = 'BidCodeReplace' " +
                " GROUP BY cm.ContractNo ";
            List <Dictionary <string, string> > ls_AgrAndProj = new List <Dictionary <string, string> >();

            if (dt_AgrAndProj.Rows.Count > 0)
            {
                foreach (DataRow dr in dt_AgrAndProj.Rows)
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("projectName", dr["projectName"].ToString());
                    dic.Add("BiddingCode", dr["BiddingCode"].ToString());
                    ls_AgrAndProj.Add(dic);
                }
            }
            List <Dictionary <string, string> > ls_AgrAndCont = new List <Dictionary <string, string> >();

            if (dt_AgrAndCont.Rows.Count > 0)
            {
                foreach (DataRow dr in dt_AgrAndCont.Rows)
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("ContractNo", dr["ContractNo"].ToString());
                    dic.Add("ContractName", dr["ContractName"].ToString());
                    dic.Add("ContractType", dr["ContractType"].ToString());
                    ls_AgrAndCont.Add(dic);
                }
            }

            List <Dictionary <string, string> > ls_All = new List <Dictionary <string, string> >();
            List <int> indexs = new List <int>();

            if (ls_AgrAndProj.Count > 0)
            {
                foreach (Dictionary <string, string> item in ls_AgrAndProj)
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    int index = -1;
                    dic.Add("projectName", item["projectName"].ToString());
                    dic.Add("BiddingCode", item["BiddingCode"].ToString());
                    System.Data.DataTable dt_ProjAndCont =
                        OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sql_ProjAndCont.Replace("BidCodeReplace", item["BiddingCode"].ToString()));
                    if (dt_ProjAndCont.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt_ProjAndCont.Rows)
                        {
                            foreach (Dictionary <string, string> item_AgrAndCont in ls_AgrAndCont)
                            {
                                int i = 0;
                                if (dr["ContractNo"].ToString() == item_AgrAndCont["ContractNo"].ToString())
                                {
                                    index = i;
                                    break;
                                }
                                i++;
                            }
                            if (index >= 0)
                            {
                                break;
                            }
                        }
                    }
                    if (index >= 0)
                    {
                        dic.Add("ContractNo", ls_AgrAndCont[index]["ContractNo"].ToString());
                        dic.Add("ContractName", ls_AgrAndCont[index]["ContractName"].ToString());
                        dic.Add("ContractType", ls_AgrAndCont[index]["ContractType"].ToString());
                        indexs.Add(index);
                    }
                    else
                    {
                        dic.Add("ContractNo", "");
                        dic.Add("ContractName", "");
                        dic.Add("ContractType", "");
                    }
                    ls_All.Add(dic);
                }
            }

            if (ls_AgrAndCont.Count > 0)
            {
                int j = 0;
                foreach (Dictionary <string, string> item in ls_AgrAndCont)
                {
                    if (indexs.Contains(j++))
                    {
                        continue;
                    }
                    else
                    {
                        Dictionary <string, string> dic = new Dictionary <string, string>();
                        dic.Add("projectName", "");
                        dic.Add("BiddingCode", "");
                        dic.Add("ContractNo", item["ContractNo"].ToString());
                        dic.Add("ContractName", item["ContractName"].ToString());
                        dic.Add("ContractType", item["ContractType"].ToString());
                        ls_All.Add(dic);
                    }
                }
            }

            if (ls_All.Count > 0)
            {
                BizObject[] bizObjects = new BizObject[ls_All.Count];
                var         i          = 0;
                foreach (Dictionary <string, string> dic in ls_All)
                {
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("Project_contracts_hy").ChildSchema;
                    // 第一行
                    bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                    bizObjects[i]["project_names"] = dic["projectName"].ToString();
                    bizObjects[i]["tender_number"] = dic["BiddingCode"].ToString();
                    bizObjects[i]["contact_no"]    = dic["ContractNo"].ToString();
                    bizObjects[i]["contact_name"]  = dic["ContractName"].ToString();
                    bizObjects[i]["contract_type"] = dic["ContractType"].ToString();

                    i++;
                }
                this.ActionContext.InstanceData["Project_contracts_hy"].Value = bizObjects;
            }

            // 获取收款RMB记录
            System.Data.DataTable dt_skrmb = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " select CONVERT(varchar(12),c.CreatedTime,111) CreatedTime,CurrentSKTotalRMB,CONVERT(varchar(12),c.SKDate,111) SKDate " +
                " ,ic.State Status,ic.ObjectID IcObjectID " +
                " from I_Charge_back c" +
                " INNER JOIN OT_InstanceContext ic on c.ObjectID = ic.BizObjectId " +
                " where c.agency_type = 'RMB' and c.AgreeMent_number = '" + AgreeMent_number + "' ");
            if (dt_skrmb.Rows.Count > 0)
            {
                BizObject[] bizObjects = new BizObject[dt_skrmb.Rows.Count];
                var         i          = 0;
                foreach (DataRow dr in dt_skrmb.Rows)
                {
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("SKRecordsRMB").ChildSchema;
                    // 第一行
                    bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                    bizObjects[i]["ApplyDate"] = dr["CreatedTime"].ToString();
                    bizObjects[i]["SKAmount"]  = dr["CurrentSKTotalRMB"].ToString();
                    bizObjects[i]["DKDate"]    = dr["SKDate"].ToString() == "1753/01/01" ? "": dr["SKDate"].ToString();
                    var st = dr["Status"].ToString();
                    bizObjects[i]["Status"] = st == "2" ? "收款中" : (st == "4" ? "收款完了" : "");
                    Dictionary <string, string> workItemDic = Common.getWorkItemId(dr["IcObjectId"].ToString(), st);
                    foreach (var item in workItemDic)
                    {
                        Console.WriteLine(item.Key + item.Value);
                        if (item.Key.Equals("workItemId"))
                        {
                            bizObjects[i]["WorkItemId"] = item.Value;
                        }
                    }
                    i++;
                }
                this.ActionContext.InstanceData["SKRecordsRMB"].Value = bizObjects;
            }

            //// 获取收款USD记录
            //System.Data.DataTable dt_skusd = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
            //    " select CONVERT(varchar(12),c.CreatedTime,111) CreatedTime,CurrentSKTotalUSD,CONVERT(varchar(12),c.SKDate,111) SKDate " +
            //    " ,ic.State Status,ic.ObjectID IcObjectID " +
            //    " from I_Charge_back c" +
            //    " INNER JOIN OT_InstanceContext ic on c.ObjectID = ic.BizObjectId " +
            //    " where c.agency_type = 'USD' and c.AgreeMent_number = '" + AgreeMent_number + "' ");
            //if (dt_skusd.Rows.Count > 0)
            //{
            //    BizObject[] bizObjects = new BizObject[dt_skusd.Rows.Count];
            //    var i = 0;
            //    foreach (DataRow dr in dt_skrmb.Rows)
            //    {
            //        BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("SKRecordsUSD").ChildSchema;
            //        // 第一行
            //        bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
            //        bizObjects[i]["ApplyDate"] = dr["CreatedTime"].ToString();
            //        bizObjects[i]["SKAmount"] = dr["CurrentSKTotalUSD"].ToString();
            //        bizObjects[i]["DKDate"] = dr["SKDate"].ToString() == "1753/01/01" ? "" : dr["SKDate"].ToString();
            //        var st = dr["Status"].ToString();
            //        bizObjects[i]["Status"] = st == "2" ? "收款中" : (st == "4" ? "收款完了" : "");
            //        Dictionary<string, string> workItemDic = Common.getWorkItemId(dr["IcObjectId"].ToString(), st);
            //        foreach (var item in workItemDic)
            //        {
            //            Console.WriteLine(item.Key + item.Value);
            //            if (item.Key.Equals("workItemId"))
            //            {
            //                bizObjects[i]["WorkItemId"] = item.Value;
            //            }
            //        }
            //        i++;
            //    }
            //    this.ActionContext.InstanceData["SKRecordsUSD"].Value = bizObjects;
            //}
            // 获取收款Percent记录
            System.Data.DataTable dt_skpercent = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                " select CONVERT(varchar(12),c.CreatedTime,111) CreatedTime,CurrentSKTotalRMB,CONVERT(varchar(12),c.SKDate,111) SKDate " +
                " ,ic.State Status,ic.ObjectID IcObjectID " +
                " from I_Charge_back c" +
                " INNER JOIN OT_InstanceContext ic on c.ObjectID = ic.BizObjectId " +
                " where c.agency_type = 'Percent' and c.AgreeMent_number = '" + AgreeMent_number + "' ");
            if (dt_skpercent.Rows.Count > 0)
            {
                BizObject[] bizObjects = new BizObject[dt_skpercent.Rows.Count];
                var         i          = 0;
                foreach (DataRow dr in dt_skpercent.Rows)
                {
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("SKRecordsPercent").ChildSchema;
                    // 第一行
                    bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                    bizObjects[i]["ApplyDate"] = dr["CreatedTime"].ToString();
                    bizObjects[i]["SKAmount"]  = dr["CurrentSKTotalRMB"].ToString();
                    bizObjects[i]["DKDate"]    = dr["SKDate"].ToString() == "1753/01/01" ? "" : dr["SKDate"].ToString();
                    var st = dr["Status"].ToString();
                    bizObjects[i]["Status"] = st == "2" ? "收款中" : (st == "4" ? "收款完了" : "");
                    Dictionary <string, string> workItemDic = Common.getWorkItemId(dr["IcObjectId"].ToString(), st);
                    foreach (var item in workItemDic)
                    {
                        Console.WriteLine(item.Key + item.Value);
                        if (item.Key.Equals("workItemId"))
                        {
                            bizObjects[i]["WorkItemId"] = item.Value;
                        }
                    }
                    i++;
                }
                this.ActionContext.InstanceData["SKRecordsPercent"].Value = bizObjects;
            }



            return(base.LoadDataFields());
        }
Esempio n. 22
0
        /// <summary>
        /// 获取单元格控件
        /// </summary>
        /// <param name="schema"></param>
        /// <param name="field"></param>
        /// <param name="controlId"></param>
        /// <param name="parentFieldName"></param>
        /// <param name="parentControlId"></param>
        /// <param name="isCount"></param>
        /// <returns></returns>
        private HtmlGenericControl GetCellControl(BizObjectSchema schema,
                                                  FieldSchema field,
                                                  string controlId,
                                                  string parentFieldName,
                                                  string parentControlId,
                                                  bool isCount)
        {
            HtmlGenericControl cellControl = null;
            string             datafield   = field.Name;

            if (!string.IsNullOrEmpty(parentFieldName))
            {
                datafield = parentFieldName + "." + field.Name;
            }
            if (!isCount)
            {
                switch (field.LogicType)
                {
                    #region 生成控件 ---------------------------
                case OThinker.H3.Data.DataLogicType.Comment:
                    if (!IsEditInstanceData)
                    {
                        cellControl = new HtmlGenericControl("div");
                        cellControl.Attributes.Add("data-datafield", datafield);
                    }
                    break;

                case OThinker.H3.Data.DataLogicType.Attachment:
                    cellControl = new HtmlGenericControl("div");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                case OThinker.H3.Data.DataLogicType.String:
                case Data.DataLogicType.Xml:
                    cellControl    = new HtmlGenericControl("textarea");
                    cellControl.ID = Guid.NewGuid().ToString();
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                case OThinker.H3.Data.DataLogicType.Html:
                    cellControl    = new HtmlGenericControl("textarea");
                    cellControl.ID = Guid.NewGuid().ToString();
                    cellControl.Attributes.Add("data-datafield", datafield);
                    cellControl.Attributes.Add("data-RichTextBox", "true");
                    break;

                case OThinker.H3.Data.DataLogicType.Bool:
                    cellControl = new HtmlGenericControl("input");
                    cellControl.Attributes.Add("type", "checkbox");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                case OThinker.H3.Data.DataLogicType.DateTime:
                    cellControl = new HtmlGenericControl("input");
                    cellControl.Attributes.Add("type", "text");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                case OThinker.H3.Data.DataLogicType.TimeSpan:
                    cellControl = new HtmlGenericControl("div");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                case OThinker.H3.Data.DataLogicType.Double:
                case Data.DataLogicType.Decimal:
                case OThinker.H3.Data.DataLogicType.Int:
                case OThinker.H3.Data.DataLogicType.Long:
                case OThinker.H3.Data.DataLogicType.ShortString:
                case Data.DataLogicType.Guid:
                    cellControl = new HtmlGenericControl("input");
                    cellControl.Attributes.Add("type", "text");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                case OThinker.H3.Data.DataLogicType.HyperLink:      // 链接控件
                    cellControl = new HtmlGenericControl("a");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                case OThinker.H3.Data.DataLogicType.SingleParticipant:      // 选人控件 单选
                case OThinker.H3.Data.DataLogicType.MultiParticipant:       // 选人控件 多选
                    cellControl = new HtmlGenericControl("div");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                case Data.DataLogicType.BizObject:
                case Data.DataLogicType.BizObjectArray:
                    cellControl = new HtmlGenericControl("table");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    cellControl.Attributes.Add("class", "SheetGridView");
                    BizObjectSchema childSchema = this.GetChildSchema(schema, field);
                    if (childSchema == null)
                    {
                        break;
                    }
                    HtmlGenericControl titleRow = new HtmlGenericControl("tr");
                    titleRow.Attributes.Add("class", "header");
                    cellControl.Controls.Add(titleRow);

                    HtmlGenericControl templateRow = new HtmlGenericControl("tr");
                    templateRow.Attributes.Add("class", "template");
                    cellControl.Controls.Add(templateRow);

                    HtmlGenericControl countRow = new HtmlGenericControl("tr");
                    countRow.Attributes.Add("class", "footer");
                    cellControl.Controls.Add(countRow);

                    if (field.LogicType == Data.DataLogicType.BizObjectArray)
                    {
                        // 序号列
                        HtmlGenericControl serialTitleTd = new HtmlGenericControl("td");
                        serialTitleTd.InnerText = "序号";
                        serialTitleTd.Attributes.Add("class", "rowSerialNo");
                        titleRow.Controls.Add(serialTitleTd);

                        HtmlGenericControl serialControlTd = new HtmlGenericControl("td");
                        serialControlTd.Attributes.Add("class", "rowOption");
                        templateRow.Controls.Add(serialControlTd);

                        HtmlGenericControl countTd = new HtmlGenericControl("td");
                        countTd.Attributes.Add("class", "rowOption");
                        countRow.Controls.Add(countTd);
                    }

                    // 数据列
                    int index = 0;
                    foreach (PropertySchema property in childSchema.Properties)
                    {
                        if (BizObjectSchema.IsReservedProperty(property.Name))
                        {
                            continue;
                        }
                        index++;

                        FieldSchema fieldschema     = new FieldSchema(property);
                        string      detailDatafiled = fieldschema.Name;
                        if (!string.IsNullOrEmpty(field.Name))
                        {
                            detailDatafiled = field.Name + "." + fieldschema.Name;
                        }

                        HtmlGenericControl headerTd = new HtmlGenericControl("td");
                        headerTd.InnerText = property.DisplayName;
                        headerTd.Attributes.Add("data-datafield", detailDatafiled);
                        titleRow.Controls.Add(headerTd);

                        HtmlGenericControl controlTd        = new HtmlGenericControl("td");
                        HtmlGenericControl childCellControl = GetCellControl(schema, fieldschema, "cell" + index, field.Name, controlId, false);
                        if (childCellControl != null)
                        {
                            controlTd.Controls.Add(childCellControl);
                        }
                        controlTd.Attributes.Add("data-datafield", detailDatafiled);
                        templateRow.Controls.Add(controlTd);

                        HtmlGenericControl countTd          = new HtmlGenericControl("td");
                        HtmlGenericControl countCellControl = GetCellControl(schema, fieldschema, "cell" + index, field.Name, controlId, true);
                        if (countCellControl != null)
                        {
                            countTd.Controls.Add(countCellControl);
                        }
                        countTd.Attributes.Add("data-datafield", detailDatafiled);
                        countRow.Controls.Add(countTd);
                    }

                    if (field.LogicType == Data.DataLogicType.BizObjectArray)
                    {    // 删除列
                        HtmlGenericControl deleteTitleTd = new HtmlGenericControl("td");
                        deleteTitleTd.InnerText = "删除";
                        deleteTitleTd.Attributes.Add("class", "rowOption");
                        titleRow.Controls.Add(deleteTitleTd);

                        HtmlGenericControl deleteControlTd = new HtmlGenericControl("td");
                        deleteControlTd.InnerHtml = "<a class=\"delete\"><div class=\"fa fa-minus\"></div></a><a class=\"insert\"><div class=\"fa fa-arrow-down\"></div></a>";
                        deleteControlTd.Attributes.Add("class", "rowOption");
                        templateRow.Controls.Add(deleteControlTd);

                        HtmlGenericControl countTd = new HtmlGenericControl("td");
                        countTd.Attributes.Add("class", "rowOption");
                        countRow.Controls.Add(countTd);
                    }
                    break;

                case OThinker.H3.Data.DataLogicType.ByteArray:
                case OThinker.H3.Data.DataLogicType.Object:
                default:
                    cellControl = new HtmlGenericControl("div");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                    #endregion
                }
            }
            else
            {
                switch (field.LogicType)
                {
                case OThinker.H3.Data.DataLogicType.Double:
                case Data.DataLogicType.Decimal:
                case OThinker.H3.Data.DataLogicType.Int:
                case OThinker.H3.Data.DataLogicType.Long:
                    cellControl = new HtmlGenericControl("label");
                    cellControl.Attributes.Add("data-datafield", datafield);
                    break;

                default:
                    break;
                }
            }
            if (cellControl != null)
            {
                if (!string.IsNullOrEmpty(parentControlId))
                {
                    cellControl.ID = controlId;
                }
                else
                {
                    cellControl.ID = parentControlId + "_" + controlId;
                }
            }
            return(cellControl);
        }
Esempio n. 23
0
        /// <summary>
        /// PC时填充表格控件
        /// </summary>
        /// <param name="schemaCode"></param>
        private void FillTableControlOnPC(string schemaCode)
        {
            // 控件的索引号
            int    controlIndex = 0;
            string labelId, controlId;
            // 当前控件是否单独行
            bool currentRowIsLarg = false;
            // 下一控件是否单独行
            bool            nextRowIsLarg = false;
            BizObjectSchema schema        = AppUtility.Engine.BizObjectManager.GetPublishedSchema(schemaCode);

            if (schema == null)
            {
                schema = AppUtility.Engine.BizObjectManager.GetDraftSchema(schemaCode);
            }
            if (schema.Fields == null || schema.Fields.Length == 0)
            {
                return;
            }
            int cellIndex             = 0;
            HtmlGenericControl row    = null;
            string             colCss = string.Empty;

            foreach (FieldSchema field in schema.Fields)
            {
                controlIndex++;
                if (BizObjectSchema.IsReservedProperty(field.Name))
                {
                    continue;
                }
                if (!BizObjectSchema.IsSheetLogicType(field.LogicType))
                {
                    continue;
                }
                cellIndex++;
                labelId          = "Label" + controlIndex;
                controlId        = "Control" + controlIndex;
                currentRowIsLarg = OThinker.H3.Data.DataLogicTypeConvertor.IsLargType(field.LogicType);
                nextRowIsLarg    = (controlIndex < schema.Fields.Length) ? OThinker.H3.Data.DataLogicTypeConvertor.IsLargType(schema.Fields[controlIndex].LogicType) : false;

                if (cellIndex % 2 == 1)
                {// 奇数或者是单独行,那么写入一个 TR
                    row = new HtmlGenericControl("div");
                    row.ClientIDMode = System.Web.UI.ClientIDMode.Static;
                    row.Attributes.Add("class", "row");
                    this.divSheet.Controls.Add(row);
                }
                colCss = currentRowIsLarg ? CSS10 : CSS4;

                // 行标题
                HtmlGenericControl rowTitle = new HtmlGenericControl("div");
                rowTitle.Attributes.Add("class", CSS2);
                Label lblTitle = new Label()
                {
                    Text = field.DisplayName
                };
                lblTitle.Attributes.Add("data-datafield", field.Name);
                rowTitle.Controls.Add(lblTitle);
                row.Controls.Add(rowTitle);

                HtmlGenericControl rowControl = new HtmlGenericControl("div");
                rowControl.Attributes.Add("class", colCss);
                HtmlGenericControl cellControl = this.GetCellControl(schema, field, "control" + controlIndex, string.Empty, string.Empty, false);
                if (cellControl != null)
                {
                    rowControl.Controls.Add(cellControl);
                }
                row.Controls.Add(rowControl);

                if (cellIndex % 2 == 1 && (currentRowIsLarg || nextRowIsLarg || controlIndex == schema.Fields.Length))
                {
                    cellIndex++;
                }
            }
        }
Esempio n. 24
0
        public override MvcViewContext LoadDataFields()
        {
            if (!this.ActionContext.IsOriginateMode)
            {
                String objectId = (String)ActionContext.BizObject.GetValue("ObjectID");
                //查询子流程员工回复附件
                string commomSql = " SELECT am.ObjectID,am.BizObjectId,am.FileName,ou.Name as OUName,ur.Name FROM OT_Attachment am " +
                                   " INNER JOIN OT_User ur ON am.CreatedBy = ur.ObjectID " +
                                   "INNER JOIN OT_OrganizationUnit ou ON ur.ParentID = ou.ObjectID WHERE BizObjectId IN " +
                                   "(SELECT BizObjectId FROM OT_InstanceContext ic WHERE ParentInstanceID = " +
                                   "(SELECT ObjectID FROM OT_InstanceContext WHERE BizObjectId = '" + objectId + "')) " +
                                   "AND DataField = 'ReplyAttach' ORDER BY ou.Name";

                System.Data.DataTable ReplyAttachDt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(commomSql);
                if (ReplyAttachDt.Rows.Count > 0)
                {
                    BizObject[]     bizObjects  = new BizObject[ReplyAttachDt.Rows.Count];
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("ReplyAttach").ChildSchema;
                    for (int i = 0; i < ReplyAttachDt.Rows.Count; i++)
                    {
                        bizObjects[i]               = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["FullName"]   = ReplyAttachDt.Rows[i]["Name"].ToString() + "(" + ReplyAttachDt.Rows[i]["OUName"].ToString() + ")";
                        bizObjects[i]["AttachName"] = ReplyAttachDt.Rows[i]["FileName"].ToString();
                        string filepath = "/Portal/ReadAttachment/Read?BizObjectSchemaCode=ExternalDocumentChild&BizObjectID=" + ReplyAttachDt.Rows[i]["BizObjectId"].ToString() + "&AttachmentID=" + ReplyAttachDt.Rows[i]["ObjectID"].ToString() + "&OpenMethod=0";
                        bizObjects[i]["FilePath"] = filepath;
                    }
                    this.ActionContext.InstanceData["ReplyAttach"].Value = bizObjects;
                }
                //查询子流程部门领导意见
                string departSuggessSql = "  SELECT OUName,UserName,Text,DataField FROM OT_Comment WHERE InstanceId IN " +
                                          " (SELECT ObjectID AS InstanceId FROM OT_InstanceContext ic WHERE ParentInstanceID =" +
                                          " (SELECT ObjectID FROM OT_InstanceContext WHERE BizObjectId = '" + objectId + "'))" +
                                          "  AND DataField = 'DepartSuggess'ORDER BY DataField";
                System.Data.DataTable departSuggessDt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(departSuggessSql);

                if (departSuggessDt.Rows.Count > 0)
                {
                    BizObject[]     bizObjects  = new BizObject[departSuggessDt.Rows.Count];
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("DepartmentSuggess").ChildSchema;
                    for (int i = 0; i < departSuggessDt.Rows.Count; i++)
                    {
                        bizObjects[i]             = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["FullName"] = departSuggessDt.Rows[i]["UserName"].ToString() + "(" + departSuggessDt.Rows[i]["OUName"].ToString() + ")";
                        bizObjects[i]["Suggess"]  = departSuggessDt.Rows[i]["Text"].ToString();
                    }
                    this.ActionContext.InstanceData["DepartmentSuggess"].Value = bizObjects;
                }

                //查询子流程部门员工意见
                string staffCommentsSql = "  SELECT OUName,UserName,Text,DataField FROM OT_Comment WHERE InstanceId IN " +
                                          " (SELECT ObjectID AS InstanceId FROM OT_InstanceContext ic WHERE ParentInstanceID =" +
                                          " (SELECT ObjectID FROM OT_InstanceContext WHERE BizObjectId = '" + objectId + "'))" +
                                          "  AND DataField = 'ygyj'ORDER BY DataField";
                System.Data.DataTable staffCommentsDt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(staffCommentsSql);

                if (staffCommentsDt.Rows.Count > 0)
                {
                    BizObject[]     bizObjects  = new BizObject[staffCommentsDt.Rows.Count];
                    BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("StaffComments").ChildSchema;
                    for (int i = 0; i < staffCommentsDt.Rows.Count; i++)
                    {
                        bizObjects[i]             = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["FullName"] = staffCommentsDt.Rows[i]["UserName"].ToString() + "(" + staffCommentsDt.Rows[i]["OUName"].ToString() + ")";
                        bizObjects[i]["Suggess"]  = staffCommentsDt.Rows[i]["Text"].ToString();
                    }
                    this.ActionContext.InstanceData["StaffComments"].Value = bizObjects;
                }
            }

            return(base.LoadDataFields());
        }
Esempio n. 25
0
        public override MvcViewContext LoadDataFields()
        {
            try
            {
                // 解决缓存问题
                //System.Data.DataTable dt = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                //        " SELECT * " +
                //        " FROM I_DKTbl " +
                //        " where ParentObjectID = '" + this.ActionContext.BizObjectID + "'" +
                //        " order By ParentIndex ");
                //if (dt.Rows.Count > 0)
                //{
                //    BizObject[] bizObjects = new BizObject[dt.Rows.Count];
                //    var i = 0;
                //    double QKConvertAmount = 0.0;
                //    foreach (DataRow dr in dt.Rows)
                //    {
                //        BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("DKTbl").ChildSchema;
                //        // 第一行
                //        bizObjects[i] = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                //        bizObjects[i]["QKSeq"] = dr["QKSeq"].ToString();
                //        bizObjects[i]["QKObjectID"] = dr["QKObjectID"].ToString();
                //        bizObjects[i]["QKSeqHidden"] = dr["QKSeqHidden"].ToString();
                //        bizObjects[i]["QKType"] = dr["QKType"].ToString();
                //        bizObjects[i]["QKTypeCode"] = dr["QKTypeCode"].ToString();
                //        bizObjects[i]["QKTarget"] = dr["QKTarget"].ToString();
                //        bizObjects[i]["QKTargetCode"] = dr["QKTargetCode"].ToString();
                //        bizObjects[i]["QKDate"] = Convert.ToDateTime(dr["QKDate"].ToString()).ToString("yyyy-MM-dd"); // 先转为日期,再格式化
                //        bizObjects[i]["ZJKX"] = dr["ZJKX"].ToString();
                //        bizObjects[i]["ZJMS"] = dr["ZJMS"].ToString();
                //        bizObjects[i]["QKAmount"] = dr["QKAmount"].ToString();
                //        bizObjects[i]["QKCurrency"] = dr["QKCurrency"].ToString();
                //        bizObjects[i]["QKRate"] = dr["QKRate"].ToString();
                //        bizObjects[i]["QKCurrencyCode"] = dr["QKCurrencyCode"].ToString();

                //        QKConvertAmount += Convert.ToDouble(dr["QKConvertAmount"].ToString());
                //        bizObjects[i]["SeqCnt"] = dr["SeqCnt"].ToString();
                //        bizObjects[i]["LJDKAmount"] = dr["LJDKAmount"].ToString();
                //        bizObjects[i]["LJDKAmountWB"] = dr["LJDKAmountWB"].ToString();
                //        bizObjects[i]["CurDKAmount"] = dr["CurDKAmount"].ToString();
                //        bizObjects[i]["CurDKCurrency"] = dr["CurDKCurrency"].ToString();
                //        bizObjects[i]["CurDKRate"] = dr["CurDKRate"].ToString();
                //        bizObjects[i]["Status"] = dr["Status"].ToString();
                //        i++;
                //    }
                //    var j = 0;
                //    foreach (DataRow dr in dt.Rows)
                //    {
                //        bizObjects[j++]["QKConvertAmount"] = QKConvertAmount;
                //    }
                //    this.ActionContext.InstanceData["DKTbl"].Value = bizObjects;
                //}

                // 获取取回子流程的版本号
                int versionBack = OThinker.H3.Controllers.AppUtility.Engine.WorkflowManager.GetWorkflowDefaultVersion("GetBackContract");
                this.ActionContext.InstanceData["WorkflowVersion_Back"].Value = versionBack;
                // 获取回退记录
                System.Data.DataTable dt_back = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                    " SELECT ins.OriginatorName Approver,ins.StartTime ApproveDate,ins.State Status,ins.ObjectID, " +
                    " gb.OldInstanceActivityName,gb.InstanceActivityName,c.[Text] Remark  " +
                    " FROM I_GetBackContract gb, OT_InstanceContext ins, OT_Comment c " +
                    " where gb.NeedInstanceId = '" + this.ActionContext.InstanceId + "' and gb.ObjectID = ins.BizObjectId and ins.ObjectID = c.InstanceId");
                if (dt_back.Rows.Count > 0)
                {
                    BizObject[] bizObjects = new BizObject[dt_back.Rows.Count];
                    var         i          = 0;
                    foreach (DataRow dr in dt_back.Rows)
                    {
                        BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("GetBackDKTbl").ChildSchema;
                        // 第一行
                        bizObjects[i]                            = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                        bizObjects[i]["Approver"]                = dr["Approver"].ToString();
                        bizObjects[i]["ApproveDate"]             = dr["ApproveDate"].ToString();
                        bizObjects[i]["Remark"]                  = dr["Remark"].ToString();
                        bizObjects[i]["OldInstanceActivityName"] = dr["OldInstanceActivityName"].ToString();
                        bizObjects[i]["InstanceActivityName"]    = dr["InstanceActivityName"].ToString();

                        var st = dr["Status"].ToString();
                        Dictionary <string, string> workItemDic = Common.getWorkItemId(dr["ObjectID"].ToString(), st);
                        foreach (var item in workItemDic)
                        {
                            Console.WriteLine(item.Key + item.Value);
                            if (item.Key.Equals("workItemId"))
                            {
                                bizObjects[i]["WorkItemId"] = item.Value;
                            }
                        }
                        bizObjects[i]["Status"] = st == "2" ? "审批中" : (st == "4" ? "已回退" : "");
                        i++;
                    }
                    this.ActionContext.InstanceData["GetBackDKTbl"].Value = bizObjects;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(base.LoadDataFields());
        }
Esempio n. 26
0
        public override MvcViewContext LoadDataFields()
        {
            //this.ActionContext.InstanceData["RejectFlg"].Value
            // 后台获取Url的参数(通过Request来获取)
            string url            = Request.Url.ToString();
            string ContractNo     = Common.getUrlParam(url, "ContractNo");
            string QKSubObjectIDs = Common.getUrlParam(url, "QKSubObjectIDs");

            if (!QKSubObjectIDs.Equals(""))
            {
                var arr = QKSubObjectIDs.Split(',');
                if (arr.Length > 0)
                {
                    // 获取传入的请款数据
                    var QKSeq    = "";
                    var Currency = "";
                    System.Data.DataTable dt_qs = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                        " SELECT top 1 qs.Currency,qs.Amount,q.QKSeq " +
                        " FROM I_QKSubTbl qs " +
                        " INNER JOIN I_QK q on qs.ParentObjectID = q.ObjectID and qs.ObjectID = '" + arr[0] + "'");
                    if (dt_qs.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt_qs.Rows)
                        {
                            QKSeq    = dr["QKSeq"].ToString();
                            Currency = dr["Currency"].ToString();
                        }
                    }
                    var contains = false;
                    // 原来有的资金计划明细
                    System.Data.DataTable dt_zjd = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(
                        " select pt.* " +
                        " from I_PlanTbl pt " +
                        " INNER JOIN I_ZJPlan p on pt.ParentObjectID = p.ObjectID and p.ContractNo =  '" + ContractNo + "'");
                    if (dt_zjd.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt_zjd.Rows)
                        {
                            var QKCurrency    = dr["QKCurrency"].ToString();
                            var QKCurrencyArr = QKCurrency.Split(':');
                            if (QKCurrencyArr[0].Equals("批次" + QKSeq) && QKCurrencyArr[1].Equals(Currency))
                            {
                                contains = true;
                            }
                        }
                    }
                    BizObject[] bizObjects = new BizObject[contains? dt_zjd.Rows.Count: (dt_zjd.Rows.Count + 1)];
                    // 给原来的数据赋好值
                    var j = 0;
                    if (dt_zjd.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt_zjd.Rows)
                        {
                            BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("PlanTbl").ChildSchema;
                            // 第一行
                            bizObjects[j]                   = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                            bizObjects[j]["Content"]        = dr["Content"];
                            bizObjects[j]["Amount"]         = dr["Amount"];
                            bizObjects[j]["QKCurrency"]     = dr["QKCurrency"];
                            bizObjects[j]["QKDetail"]       = dr["QKDetail"];
                            bizObjects[j]["ExpirationFrom"] = dr["ExpirationFrom"];
                            bizObjects[j]["ExpirationTo"]   = dr["ExpirationTo"];
                            bizObjects[j]["IsAfterDK"]      = dr["IsAfterDK"];
                            j++;
                        }
                    }
                    if (!contains)
                    {
                        foreach (DataRow dr in dt_qs.Rows)
                        {
                            BizObjectSchema childSchema = this.ActionContext.Schema.GetProperty("PlanTbl").ChildSchema;
                            // 第一行
                            bizObjects[j]               = new BizObject(this.ActionContext.Engine, childSchema, this.ActionContext.User.UserID);
                            bizObjects[j]["Content"]    = "";
                            bizObjects[j]["Amount"]     = dr["Amount"];
                            bizObjects[j]["QKCurrency"] = "批次" + dr["QKSeq"].ToString() + ":" + dr["Currency"].ToString();
                            bizObjects[j]["QKDetail"]   = getQKDetailByCurrency2(ContractNo, dr["QKSeq"].ToString(), dr["Currency"].ToString());
                        }
                    }
                    this.ActionContext.InstanceData["PlanTbl"].Value = bizObjects;
                }
            }


            return(base.LoadDataFields());
        }
        /// <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);
            }));
        }
        public JsonResult GetDataModelData(string DataModelCode, string QueryCode, string SortBy, int ShowCount, string BoundFiledList, string LinkFormat)
        {
            ActionResult result = new ActionResult(true);

            if (string.IsNullOrEmpty(BoundFiledList))
            {
                result.Message = "未设置绑定数据";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            BizObjectSchema schema = Engine.BizObjectManager.GetPublishedSchema(DataModelCode);

            DataModel.BizQuery query = Engine.BizObjectManager.GetBizQuery(QueryCode);
            if (schema != null && query != null)
            {
                OThinker.H3.BizBus.Filter.Filter filter = GetFilter(schema, "GetList", query);
                filter.FromRowNum = 1;
                filter.ToRowNum   = ShowCount;
                if (ShowCount <= 0)
                {
                    filter.ToRowNum = 5;
                }
                //SORTBY是正常的语法 Column1,Column2 DESC
                if (string.IsNullOrEmpty(SortBy))
                {
                    SortBy = schema.GetPropertyNames()[0] + " DESC";
                }
                string[] arrSortKey = SortBy.Split(',');
                List <OThinker.H3.BizBus.Filter.SortBy> list = new List <OThinker.H3.BizBus.Filter.SortBy>();
                foreach (string str in arrSortKey)
                {
                    if (string.IsNullOrEmpty(str))
                    {
                        continue;
                    }
                    string   str2  = str.Trim();
                    string[] ssarr = str2.Split(' ');
                    if (ssarr.Length == 0 || string.IsNullOrEmpty(ssarr[0]))
                    {
                        continue;
                    }
                    string sortitem = ssarr[0];
                    OThinker.H3.BizBus.Filter.SortDirection sd = OThinker.H3.BizBus.Filter.SortDirection.Ascending;
                    for (var k = 1; k < ssarr.Length; k++)
                    {
                        if (string.IsNullOrEmpty(ssarr[k]))
                        {
                            continue;
                        }
                        if (ssarr[k].ToLower() == "asc")
                        {
                            break;
                        }
                        if (ssarr[k].ToLower() == "desc")
                        {
                            sd = OThinker.H3.BizBus.Filter.SortDirection.Descending;
                            break;
                        }
                    }
                    filter.AddSortBy(sortitem, sd);
                }
                DataModel.BizObject[] objs = schema.GetList(
                    this.Engine.Organization,
                    this.Engine.MetadataRepository,
                    this.Engine.BizObjectManager,
                    this.UserValidator.UserID,
                    "GetList",
                    filter);
                // 开始绑定数据源
                DataTable tablesource = DataModel.BizObjectUtility.ToTable(schema, objs);

                List <object> tr = new List <object>();
                foreach (DataRow dr in tablesource.Rows)
                {
                    List <object> td = new List <object>();
                    foreach (string field in BoundFiledList.Split(','))
                    {
                        string[] arrFields = field.Split('|');
                        string   column    = arrFields[0];
                        int      len       = 0;
                        int.TryParse(arrFields[1], out len);
                        string format = arrFields[2];
                        if (!tablesource.Columns.Contains(column))
                        {
                            continue;
                        }
                        string fv = dr[column].ToString();
                        //格式化
                        if (!string.IsNullOrEmpty(format))
                        {
                            if (format.StartsWith("{0:"))
                            {   //{0:****}格式
                                if (tablesource.Columns[column].DataType == typeof(Decimal))
                                {
                                    fv = String.Format(format, Convert.ToDecimal(dr[column]));
                                }
                                if (tablesource.Columns[column].DataType == typeof(DateTime))
                                {
                                    fv = String.Format(format, Convert.ToDateTime(dr[column]));
                                }
                            }
                            else
                            {//****格式
                                if (tablesource.Columns[column].DataType == typeof(Decimal))
                                {
                                    fv = Convert.ToDecimal(dr[column]).ToString(format);
                                }
                                if (tablesource.Columns[column].DataType == typeof(DateTime))
                                {
                                    fv = Convert.ToDateTime(dr[column]).ToString(format);
                                }
                            }
                        }
                        //截取长度
                        if (len > 0 && fv.Length > len)
                        {
                            fv = fv.Substring(0, len);
                        }
                        string datalink = "";
                        //匹配链接参数
                        if (!string.IsNullOrEmpty(LinkFormat))
                        {
                            string[] paras    = LinkFormat.Split('{');
                            string   currlink = LinkFormat;
                            //如果包含有{}, pcol就是要找的替换格式字段
                            for (var p = 1; p < paras.Length; p++)
                            {
                                string pcol = paras[p].Split('}')[0];
                                if (tablesource.Columns.Contains(pcol))
                                {
                                    currlink = currlink.Replace("{" + pcol + "}", Convert.ToString(dr[pcol]));
                                }
                                else
                                {
                                    currlink = currlink.Replace("{" + pcol + "}", "");
                                }
                            }
                            //datalink = "href=\"" + currlink + "\"  target=\"_blank\"";
                            datalink = currlink;
                        }
                        var newRow = new
                        {
                            Text = fv,
                            Href = string.IsNullOrEmpty(datalink) ? "#" : datalink
                        };
                        td.Add(newRow);
                    }
                    tr.Add(td);
                }
                result.Extend = tr;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 树形菜单加载入口
        /// </summary>
        /// <returns></returns>
        public JsonResult DoAction()
        {
            List <AppTreeNode> childNodes       = new List <AppTreeNode>();
            string             Paramters        = Request["ActionName"];//操作的方法
            string             LoadTableAndView = Request["command"];
            string             ParentCode       = Request["id"] == null ? "root" : Request["id"];
            string             relationCode     = Request["Code"];
            string             NodeType         = Request["NodeType"];
            string             CurSchemeCode    = Request["SchemeCode"];

            string Codes = Request["Codes"];                                                       //表单对象编码,多个以分号隔开

            if (Paramters == "GetSheetDisplayNames" || LoadTableAndView == "GetSheetDisplayNames") //报表数据源计算函数规则设计器
            {
                #region 报表数据源计算函数规则设计器,数据源树形展示;
                List <string> li   = new List <string>();
                var           code = Codes.Split(';');
                if (code.Length == 1)
                {
                    li.Add(Codes.ToString());
                }
                else
                {
                    for (int i = 0; i < code.Length; i++)
                    {
                        li.Add(code[i].ToString());
                    }
                }

                childNodes = GetAppSchemaTrees(ParentCode, li);
                return(Json(childNodes, JsonRequestBehavior.AllowGet));

                #endregion
            }
            else
            {
                #region 初始化数据源展示菜单


                ShowSubsheetFiled = Request["ShowSubsheetFiled"] == "true" ? true : false;
                string CanCheckTypes = Request["CanCheckTypes"];//记录的是数据链接池的编码
                ShowCheckbox = Request["ShowCheckbox"] == "true" ? true : false;
                if (!string.IsNullOrEmpty(CanCheckTypes))
                {
                    CanCheckTypes = CanCheckTypes.TrimEnd(',');
                }
                if (string.IsNullOrEmpty(CanCheckTypes))
                {
                    CanCheckTypes = "Engine";//默认设置为H3引擎编码
                }

                //该方法是读取数据库中,数据表和视图的方法
                if (LoadTableAndView == "LoadTableAndView")
                {
                    #region 该方法是读取数据库中,数据表和视图的方法
                    //该方法是读取业务表单的站点
                    if (ParentCode == "root")
                    {
                        AppTreeNode appTreeTable = CreateAppTreeNode("DbTable", "数据表", "DbTable", TreeNodeType.AppPackge.ToString(), true, ParentCode, "fa fa-folder-open-o", true, false);
                        childNodes.Add(appTreeTable);
                        AppTreeNode appTreeView = CreateAppTreeNode("DbView", "视图", "DbView", TreeNodeType.AppPackge.ToString(), true, ParentCode, "fa fa-folder-open-o", true, false);
                        childNodes.Add(appTreeView);
                    }
                    else
                    {
                        //如果是数据表
                        if (ParentCode == "DbTable")
                        {
                            string[] tableNames = this.Engine.SettingManager.GetBizDbTableNames(CanCheckTypes);
                            foreach (var table in tableNames)
                            {
                                AppTreeNode appTreeTable = CreateAppTreeNode(table, table, table, TreeNodeType.AppMenu.ToString(), true, ParentCode, "fa fa-folder-open-o", true, false);
                                childNodes.Add(appTreeTable);
                            }
                        }
                        else if (ParentCode == "DbView") //如果是视图
                        {
                            string[] viewNames = this.Engine.SettingManager.GetBizDbViewNames(CanCheckTypes);
                            foreach (var view in viewNames)
                            {
                                AppTreeNode appTreeTable = CreateAppTreeNode(view, view, view, TreeNodeType.AppMenu.ToString(), true, ParentCode, "fa fa-folder-open-o", true, false);
                                childNodes.Add(appTreeTable);
                            }
                        }
                        else //否则是查询表的具体字段的
                        {
                            if (NodeType == "Field")
                            {
                            }
                            else
                            {
                                string newSql = "select * from " + ParentCode;
                                List <OThinker.Reporting.ReportWidgetColumn> columns = this.Engine.ReportQuery.GetSqlColumns(this.Engine, newSql, CanCheckTypes);
                                foreach (var col in columns)
                                {
                                    AppTreeNode appTreeTable = CreateAppTreeNode(col.ColumnName, col.ColumnName, col.ColumnName, TreeNodeType.Field.ToString(), true, ParentCode, "", true, false);
                                    childNodes.Add(appTreeTable);
                                }
                            }
                        }
                    }

                    return(Json(childNodes, JsonRequestBehavior.AllowGet));

                    #endregion
                }
                else
                {
                    #region 加载业务表单
                    //该方法是读取业务表单的站点
                    if (ParentCode == "root")
                    {
                        string NodePath = string.Empty;
                        if (!string.IsNullOrEmpty(CurSchemeCode))
                        {
                            FunctionNode  CheckedNode = this.Engine.FunctionAclManager.GetFunctionNodeByCode(CurSchemeCode);
                            List <string> parentCodes = new List <string>();
                            while (CheckedNode.ParentCode != "ProcessModel")
                            {
                                parentCodes.Add(CheckedNode.ParentCode);
                                CheckedNode = this.Engine.FunctionAclManager.GetFunctionNodeByCode(CheckedNode.ParentCode);
                            }
                            if (CheckedNode.ParentCode == "ProcessModel")
                            {
                                parentCodes.Add(CheckedNode.Code);
                            }
                            NodePath = string.Join(",", parentCodes);
                        }

                        //加载所有流程模型
                        List <AppTreeNode>  list    = new List <AppTreeNode>();
                        List <FunctionNode> funNode = this.Engine.FunctionAclManager.GetChildNodesByParentCode("ProcessModel");

                        //按照后台流程模型节点展示的顺序排序数据
                        funNode = funNode.OrderBy(s => s.DisplayName).OrderBy(s => s.SortKey).ToList();
                        AppTreeNode masterNode = null;
                        foreach (FunctionNode fn in funNode)
                        {
                            if (fn.ParentCode == "ProcessModel")
                            {
                                //判断是否该节点是否有子项
                                bool IsParentNode = false;
                                if (this.Engine.FunctionAclManager.GetChildNodesByParentCode(fn.Code).Count() > 0)
                                {
                                    IsParentNode = true;
                                }

                                AppTreeNode appTree = CreateAppTreeNode(fn.Code, fn.DisplayName, fn.Code, TreeNodeType.AppPackge.ToString(), IsParentNode, ParentCode, "fa fa-folder-open-o", true, false, NodePath);
                                //判断是否是主数据节点
                                if (fn.NodeType == OThinker.H3.Acl.FunctionNodeType.BizFolder)
                                {
                                    masterNode = appTree;
                                    continue;
                                }
                                childNodes.Add(appTree);
                            }
                        }
                        //主数据节点置顶
                        childNodes.Insert(0, masterNode);
                    }
                    else
                    {
                        //BizWorkflowPackage
                        List <FunctionNode> funNode = this.Engine.FunctionAclManager.GetChildNodesByParentCode(ParentCode);
                        List <FunctionNode> funnode = new List <FunctionNode>();
                        if (funNode != null)
                        {
                            funNode = funNode.OrderBy(i => i.DisplayName).ToList();
                            funNode = funNode.OrderBy(i => i.SortKey).ToList();
                        }
                        BizObjectSchema bizobjectSchema = null;
                        foreach (FunctionNode fun in funNode)
                        {
                            if (ParentCode == fun.ParentCode)
                            {
                                BizObjectSchema[] das = this.Engine.BizObjectManager.GetPublishedSchemas();

                                //说明是流程包
                                if (fun.NodeType == OThinker.H3.Acl.FunctionNodeType.BizWorkflowPackage)
                                {
                                    bizobjectSchema = this.Engine.BizObjectManager.GetPublishedSchema(fun.Code);
                                    if (bizobjectSchema != null)
                                    {
                                        //判断是否该节点是否有子项
                                        bool IsParentNode = false;
                                        foreach (var item in bizobjectSchema.Properties)
                                        {
                                            if (item.LogicType == OThinker.H3.Data.DataLogicType.BizObjectArray)
                                            {
                                                IsParentNode = true;
                                                break;
                                            }
                                        }
                                        AppTreeNode appTree = CreateAppTreeNode(fun.Code, fun.DisplayName, fun.Code, TreeNodeType.AppMenu.ToString(), IsParentNode, ParentCode, "", false, false);
                                        childNodes.Add(appTree);
                                    }
                                }
                                else if (fun.NodeType == OThinker.H3.Acl.FunctionNodeType.BizObject)
                                {
                                    BizObjectSchema bizobjectSchemas = this.Engine.BizObjectManager.GetPublishedSchema(fun.Code);
                                    if (bizobjectSchemas != null)
                                    {
                                        //判断是否该节点是否有子项
                                        bool IsParentNode = false;
                                        foreach (var item in bizobjectSchemas.Properties)
                                        {
                                            if (item.LogicType == OThinker.H3.Data.DataLogicType.BizObjectArray)
                                            {
                                                IsParentNode = true;
                                                break;
                                            }
                                        }
                                        AppTreeNode appTree = CreateAppTreeNode(fun.Code, fun.DisplayName, fun.Code, TreeNodeType.AppMenu.ToString(), IsParentNode, ParentCode, "", false, false);
                                        childNodes.Add(appTree);
                                    }
                                }
                                else
                                {
                                    //还是文件夹
                                    AppTreeNode appTree = CreateAppTreeNode(fun.Code, fun.DisplayName, fun.Code, TreeNodeType.AppGroup.ToString(), true, ParentCode, "fa fa-folder-open-o", true, false);
                                    childNodes.Add(appTree);
                                }
                            }
                        }

                        // 加载业务对象子元素
                        if (funNode.Count == 0)
                        {
                            string          SchemaCode = ParentCode;
                            BizObjectSchema sch        = this.Engine.BizObjectManager.GetPublishedSchema(SchemaCode);
                            if (sch != null)
                            {
                                PropertySchema[] properties = sch.Properties;
                                childNodes = GetTreeChildNodes(properties, ParentCode, false);
                            }
                        }
                    }



                    return(Json(childNodes, JsonRequestBehavior.AllowGet));

                    #endregion
                }
                #endregion
            }
        }
        /// <summary>
        /// 根据父编码,展示业务数据表单的字段
        /// </summary>
        /// <param name="ParentCode"></param>
        /// <param name="Codes"></param>
        /// <returns></returns>
        private List <AppTreeNode> GetAppSchemaTrees(string ParentCode, List <string> Codes)
        {
            List <AppTreeNode> childNodes = new List <AppTreeNode>();

            if (ParentCode == "root")//如果是根目录则展示根目录菜单
            {
                for (int i = 0; i < Codes.Count; i++)
                {
                    List <AppTreeNode> list    = new List <AppTreeNode>();
                    FunctionNode       funNode = this.Engine.FunctionAclManager.GetFunctionNodeByCode(Codes[i].ToString());
                    if (funNode != null)
                    {
                        AppTreeNode appTree = CreateAppTreeNode(funNode.Code, funNode.DisplayName, funNode.Code, TreeNodeType.AppPackge.ToString(), true, ParentCode, "fa fa-folder-open-o", true, false);
                        childNodes.Add(appTree);
                    }
                    else
                    {
                        BizObjectSchema sch = this.Engine.BizObjectManager.GetPublishedSchema(Codes[i].Substring(0, Codes[i].IndexOf("___")));
                        if (sch != null)
                        {
                            foreach (var pro in sch.Properties)
                            {
                                if (pro.LogicType == OThinker.H3.Data.DataLogicType.BizObjectArray)
                                {
                                    if (Codes[i].IndexOf(pro.Name) != -1)
                                    {
                                        AppTreeNode appTree = CreateAppTreeNode(pro.Name, pro.DisplayName, pro.Name, TreeNodeType.AppPackge.ToString(), true, ParentCode, "fa fa-folder-open-o", true, false);
                                        childNodes.Add(appTree);
                                    }
                                }
                            }
                        }
                        else
                        {
                        }
                    }
                }
            }
            else //否则根据父ID 加载子菜单
            {
                string          SchemaCode = ParentCode;
                BizObjectSchema sch        = this.Engine.BizObjectManager.GetPublishedSchema(SchemaCode);
                if (sch != null)
                {
                    PropertySchema[] properties = sch.Properties;
                    childNodes = GetTreeChildNodes(properties, ParentCode, true);
                }
                else
                {
                    BizObjectSchema schs = this.Engine.BizObjectManager.GetPublishedSchema(Codes[0]);
                    if (schs != null)
                    {
                        foreach (var code in schs.Properties)
                        {
                            if (code.LogicType == OThinker.H3.Data.DataLogicType.BizObjectArray)
                            {
                                if (code.Name == SchemaCode)
                                {
                                    childNodes = GetTreeChildNodes(code.ChildSchema.Properties, ParentCode, true);
                                }
                            }
                        }
                    }
                }
            }
            return(childNodes);
        }