Example #1
0
        private string createDesignInputString(DesignInputRequestData folder, string projectInfoID, string designInputType, string requestData)
        {
            var saveTmp = @"if exists(select 1 from S_D_Input where ID='{0}')
                                update S_D_Input set ParentID='{1}',FullID='{2}',Code = '{4}', Name='{5}',SynTime='{9}',SynData='{10}',SortIndex='{11}' where ID='{0}'
                            else
	                            insert into S_D_Input(ID,ParentID,FullID,ProjectInfoID,Code,Name,Type,State,SynID,SynTime,SynData,SortIndex) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')"    ;

            return(string.Format(saveTmp, folder.Id, folder.parentId, folder.FullID, projectInfoID, folder.Code, folder.name.Replace("'", "''"), designInputType,
                                 DataState.Normal.ToString(), "", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), requestData.Replace("'", "''"), folder.sort));
        }
Example #2
0
        private void addChildDesignInput(S_D_Input child, S_D_Input parent, List <S_D_Input> synData, StringBuilder sb)
        {
            if (string.IsNullOrEmpty(child.ID))
            {
                child.ID = GuidHelper.CreateGuid();
            }
            if (string.IsNullOrEmpty(child.ParentID))
            {
                child.ParentID = parent.ID;
            }
            if (string.IsNullOrEmpty(child.FullID))
            {
                child.FullID = parent.FullID + "." + child.ID;
            }
            if (string.IsNullOrEmpty(child.ProjectInfoID))
            {
                child.ProjectInfoID = parent.ProjectInfoID;
            }
            if (child.SortIndex == 0)
            {
                child.SortIndex = synData.Count(a => a.ParentID == parent.ID) + 1;
            }
            if (!synData.Exists(a => a.ID == child.ID))
            {
                synData.Add(child);
            }
            var param = new DesignInputRequestData();

            param.Id            = child.ID;
            param.name          = child.Name;
            param.FullID        = child.FullID;
            param.parentId      = child.ParentID;
            param.ProjectInfoID = child.ProjectInfoID;
            param.sort          = child.SortIndex;
            param.type          = 8;
            var queueSql = string.Format(this.SaveQueueSqlTmp, SynType.Save.ToString(), "S_D_Input", child.ID, child.Type
                                         , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), JsonHelper.ToJson <DesignInputRequestData>(param).Replace("'", "''")
                                         , this.BaseServerUrl + "folder/edit");

            sb.AppendLine(queueSql);
        }
Example #3
0
        private string initVirtualDesignInput(string projectInfoID, DataTable sourceDt, List <S_D_Input> SynData)
        {
            var param = new DesignInputBatchRequestData();

            param.folders  = new List <DesignInputRequestData>();
            param.parentId = projectInfoID;
            var root = new DesignInputRequestData();

            root.Id       = GuidHelper.CreateGuid();
            root.children = new List <DesignInputRequestData>();
            root.name     = "设计输入资料";
            root.type     = 31;
            root.FullID   = root.Id;
            root.parentId = string.Empty;
            root.Code     = "Root";
            root.sort     = 0;
            SynData.Add(new S_D_Input()
            {
                ProjectInfoID = projectInfoID,
                Code          = root.Code,
                ID            = root.Id,
                FullID        = root.FullID,
                ParentID      = root.parentId,
                Name          = root.name,
                Type          = DesignInputType.Virtual.ToString()
            });
            param.folders.Add(root);

            var projectCatagory = new DesignInputRequestData();

            projectCatagory.Id       = GuidHelper.CreateGuid();
            projectCatagory.children = new List <DesignInputRequestData>();
            projectCatagory.name     = "项目资料";
            projectCatagory.type     = 8;
            projectCatagory.sort     = 0;
            projectCatagory.FullID   = root.Id + "." + projectCatagory.Id;
            projectCatagory.parentId = root.Id;
            projectCatagory.Code     = "Project";
            SynData.Add(new S_D_Input()
            {
                ProjectInfoID = projectInfoID,
                ID            = projectCatagory.Id,
                ParentID      = projectCatagory.parentId,
                FullID        = projectCatagory.FullID,
                Name          = projectCatagory.name,
                Code          = projectCatagory.Code,
                Type          = DesignInputType.Virtual.ToString()
            });
            root.children.Add(projectCatagory);

            var types = sourceDt.Select(" ProjectInfoID='" + projectInfoID + "'", "InputTypeIndex asc")
                        .Select(d => new { Catagory = d["Catagory"].ToString(), Type = d["InputType"].ToString(), SortIndex = d["InputTypeIndex"] }).Distinct().ToList();

            foreach (var item in types.Where(a => a.Catagory == projectCatagory.Code).ToList())
            {
                var typeCatagory = new DesignInputRequestData();
                typeCatagory.Id       = GuidHelper.CreateGuid();
                typeCatagory.name     = item.Type;
                typeCatagory.type     = 8;
                typeCatagory.sort     = 0;
                typeCatagory.FullID   = root.Id + "." + projectCatagory.Id + "." + typeCatagory.Id;
                typeCatagory.parentId = projectCatagory.Id;
                typeCatagory.Code     = item.Catagory;
                if (item.SortIndex != null && item.SortIndex != DBNull.Value)
                {
                    typeCatagory.sort = Convert.ToInt32(item.SortIndex);
                }
                SynData.Add(new S_D_Input()
                {
                    ProjectInfoID = projectInfoID,
                    ID            = typeCatagory.Id,
                    ParentID      = typeCatagory.parentId,
                    FullID        = typeCatagory.FullID,
                    Name          = typeCatagory.name,
                    Code          = typeCatagory.Code,
                    Type          = DesignInputType.Virtual.ToString()
                });
                projectCatagory.children.Add(typeCatagory);
            }
            var projectMajors = this.SQLHelpeProject.ExecuteScalar("select Major from S_I_ProjectInfo where id='" + projectInfoID + "'");

            if (projectMajors != DBNull.Value && projectMajors != null && !string.IsNullOrEmpty(projectMajors.ToString()))
            {
                var majorList = JsonHelper.ToList(projectMajors.ToString());
                var n         = 1;
                foreach (var majorDic in majorList)
                {
                    var majorCatagory = new DesignInputRequestData();
                    majorCatagory.Id       = GuidHelper.CreateGuid();
                    majorCatagory.children = new List <DesignInputRequestData>();
                    majorCatagory.name     = majorDic.GetValue("Name");
                    majorCatagory.type     = 8;
                    majorCatagory.FullID   = root.Id + "." + majorCatagory.Id;
                    majorCatagory.parentId = root.Id;
                    majorCatagory.Code     = majorDic.GetValue("Value");
                    majorCatagory.sort     = n++;
                    SynData.Add(new S_D_Input()
                    {
                        ProjectInfoID = projectInfoID,
                        ID            = majorCatagory.Id,
                        ParentID      = majorCatagory.parentId,
                        FullID        = majorCatagory.FullID,
                        Name          = majorCatagory.name,
                        Code          = majorCatagory.Code,
                        Type          = DesignInputType.Virtual.ToString()
                    });
                    root.children.Add(majorCatagory);

                    foreach (var item in types.Where(a => a.Catagory == majorCatagory.Code).ToList())
                    {
                        var typeCatagory = new DesignInputRequestData();
                        typeCatagory.Id       = GuidHelper.CreateGuid();
                        typeCatagory.name     = item.Type;
                        typeCatagory.type     = 8;
                        typeCatagory.sort     = 0;
                        typeCatagory.FullID   = root.Id + "." + majorCatagory.Id + "." + typeCatagory.Id;
                        typeCatagory.parentId = majorCatagory.Id;
                        typeCatagory.Code     = item.Catagory;
                        if (item.SortIndex != null && item.SortIndex != DBNull.Value)
                        {
                            typeCatagory.sort = Convert.ToInt32(item.SortIndex);
                        }
                        SynData.Add(new S_D_Input()
                        {
                            ProjectInfoID = projectInfoID,
                            ID            = typeCatagory.Id,
                            ParentID      = typeCatagory.parentId,
                            FullID        = typeCatagory.FullID,
                            Name          = typeCatagory.name,
                            Code          = typeCatagory.Code,
                            Type          = DesignInputType.Virtual.ToString()
                        });
                        majorCatagory.children.Add(typeCatagory);
                    }
                }
            }
            var queueSql = string.Format(this.SaveQueueSqlTmp, SynType.BatchSave.ToString(), "S_D_Input", "", ""
                                         , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), JsonHelper.ToJson <DesignInputBatchRequestData>(param).Replace("'", "''")
                                         , this.BaseServerUrl + "folder/editbatch");

            return(queueSql);
        }