コード例 #1
0
        public async Task <Response> SetColumns(GenerateColumns models)
        {
            Response res = new Response();

            try
            {
                var tabledata = await context.GenerateTables.FirstOrDefaultAsync(m => m.Id == models.GenerateTablesId);

                if (tabledata == null)
                {
                    res.Code    = 3;
                    res.Message = "该表存在无法添加字段";
                    return(res);
                }
                var data = context.GenerateColumns.FirstOrDefault(m => m.ColumnName == models.ColumnName);
                if (data != null)
                {
                    res.Code    = 3;
                    res.Message = "该字段已存在";
                    return(res);
                }
                models.GenerateTables = tabledata;
                await context.GenerateColumns.AddAsync(models);

                await context.SaveChangesAsync();

                res.Data = models.Id;
            }
            catch (Exception e)
            {
                res.Code    = 2;
                res.Message = e.Message;
            }
            return(res);
        }
コード例 #2
0
ファイル: SPGenerate.cs プロジェクト: hafsjold/snvrepos
    static void Main(string[] args)
    {
        InitParams(args);
        ReadandValidateGEN_XML();
        if (isGEN_XMLValid)
        {
            string l_ns = "http://www.hafsjold.dk/schema/hafsjold.xsd";
            XmlNamespaceManager l_nsMgr = new XmlNamespaceManager(docGEN_XML.NameTable);
            l_nsMgr.AddNamespace("mha", l_ns);

            System.Xml.XmlNode propertySets = docGEN_XML.SelectSingleNode("//mha:hafsjold/mha:propertySets", l_nsMgr);
            string             SVNRootPath;
            if (SVN == "Empty")
            {
                SVNRootPath = propertySets.Attributes["SVNRootPath"].Value;
            }
            else
            {
                SVNRootPath = SVN;
            }
            string ProjectPath = propertySets.Attributes["ProjectPath"].Value;
            string ProjectName = propertySets.Attributes["ProjectName"].Value;
            System.Xml.XmlNodeList propertySetList = docGEN_XML.SelectNodes("//mha:hafsjold/mha:propertySets/mha:propertySet", l_nsMgr);
            foreach (XmlNode propertySet in propertySetList)
            {
                XmlNode ClonepropertySet    = propertySet.CloneNode(true);
                string  ClonepropertySetXML = ClonepropertySet.OuterXml;
                string  CloneDocument       =
                    string.Format(@"<?xml version='1.0' encoding='utf-8'?>
                    <hafsjold xmlns='http://www.hafsjold.dk/schema/hafsjold.xsd'>
                        <propertySets SVNRootPath='{0}' ProjectPath='{1}' ProjectName='{2}'>
                            {3}
                        </propertySets>
                    </hafsjold>", SVNRootPath, ProjectPath, ProjectName, ClonepropertySetXML);
                System.Xml.XmlDocument CloneXmlDocument = new System.Xml.XmlDocument();
                CloneXmlDocument.LoadXml(CloneDocument);
                MemoryStream sXML = new MemoryStream();
                CloneXmlDocument.Save(sXML);

                string Function = propertySet.Attributes["Function"].Value;
                string ProgPath = propertySet.Attributes["ProgPath"].Value;
                string ProgName = propertySet.Attributes["ProgName"].Value;

                switch (Function)
                {
                case "SaveMetadata":
                    GenerateMetadata.GenerateMetadataMain(sXML);
                    break;

                case "Column":
                    GenerateColumns.MainGenerateColumns(sXML);
                    break;

                case "Type":
                    GenerateTypes.GenerateTypesMain(sXML);
                    break;

                case "List":
                    GenerateList.MainGenerateList(sXML);
                    break;
                }
            }
        }
    }
コード例 #3
0
 public async Task <Response> SetColumns(GenerateColumns models)
 {
     return(await _generateColumn.SetColumns(models));
 }