/// <summary>
        /// 更新一个接口程序
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateSingleInterfaceProgramModel(InterfaceProgramModel model)
        {
            try
            {
                string SQLString = @"SQL\DocumentInterface\UpdateSingleInterfaceProgram.sql".ToFileContent(
                    model.ProgramID, model.ProgramName, model.OrderIndex, model.SvnUrl);

                MSSQLDataBaseServer SQLHelper = new MSSQLDataBaseServer("DocumentManageDB");

                int Result = SQLHelper.ExecuteNonQuery(SQLString);

                if (Result == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// 新增一个接口程序
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool InsertSingleInterfaceProgramModel(InterfaceProgramModel model)
        {
            try
            {
                string Value = string.Format("'{0}',0,{2},N'{1}',GETDATE()", model.SvnUrl, model.ProgramName, model.OrderIndex);

                string SQLString = @"SQL\DocumentInterface\InsertSingleInterfaceProgram.sql".ToFileContent(Value);

                MSSQLDataBaseServer SQLHelper = new MSSQLDataBaseServer("DocumentManageDB");

                int Result = SQLHelper.ExecuteNonQuery(SQLString);

                if (Result == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// 根据接口程序ID获取接口程序(不包含接口文档)
        /// </summary>
        /// <param name="parameterID"></param>
        /// <returns></returns>
        public InterfaceProgramModel SelectDocumentInterfaceProgram(int programID)
        {
            try
            {
                string SQLString = @"SQL\DocumentInterface\SelectDocumentInterfaceProgram.sql".ToFileContent(programID);

                MSSQLDataBaseServer SQLHelper = new MSSQLDataBaseServer("DocumentManageDB");

                DataSet DataTableSet = SQLHelper.ExecuteDataset(SQLString);

                if (DataTableSet == null || DataTableSet.Tables.Count < 1)
                {
                    return(null);
                }

                InterfaceProgramModel Model = new InterfaceProgramModel();

                List <InterfaceProgramModel> List = DataTableSet.Tables[0].ToList <InterfaceProgramModel>();

                if (List == null || List.Count != 1)
                {
                    return(null);
                }
                else
                {
                    Model = List[0];
                }

                return(Model);
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// 根据接口程序ID获取接口程序(包含接口文档)
        /// </summary>
        /// <param name="ProgramID"></param>
        /// <returns></returns>
        public InterfaceProgramModel SearchDocumentInterfaceProgram(int programID)
        {
            try
            {
                string SQLString = @"SQL\DocumentInterface\SearchDocumentInterfaceProgram.sql".ToFileContent(programID);

                MSSQLDataBaseServer SQLHelper = new MSSQLDataBaseServer("DocumentManageDB");

                DataSet DataTableSet = SQLHelper.ExecuteDataset(SQLString);

                if (DataTableSet == null || DataTableSet.Tables.Count < 1)
                {
                    return(null);
                }

                InterfaceProgramModel Model = new InterfaceProgramModel();

                List <InterfaceProgramModel>   InterfaceProgramList   = DataTableSet.Tables[0].ToList <InterfaceProgramModel>();
                List <InterfaceItemModel>      InterfaceItemList      = DataTableSet.Tables[1].ToList <InterfaceItemModel>();
                List <InterfaceParameterModel> InterfaceParameterList = DataTableSet.Tables[2].ToList <InterfaceParameterModel>();

                if (InterfaceParameterList == null)
                {
                    InterfaceParameterList = new List <InterfaceParameterModel>();
                }

                if (InterfaceProgramList == null || InterfaceProgramList.Count != 1)
                {
                    return(null);
                }
                else
                {
                    Model = InterfaceProgramList[0];
                }

                Model.InterfaceItemList = new List <InterfaceItemModel>();

                if (InterfaceItemList != null && InterfaceItemList.Count > 0)
                {
                    InterfaceItemList.ForEach(o =>
                    {
                        Model.InterfaceItemList.Add(o);
                        o.InputParameter  = new List <InterfaceParameterModel>();
                        o.OutputParameter = new List <InterfaceParameterModel>();
                        o.InputParameter.AddRange(InterfaceParameterList.FindAll(x => x.ParameterType == 1 && x.InterfaceID == o.InterfaceID));
                        o.OutputParameter.AddRange(InterfaceParameterList.FindAll(y => y.ParameterType == 2 && y.InterfaceID == o.InterfaceID));
                    });
                }


                return(Model);
            }
            catch
            {
                throw;
            }
        }
        public bool UpdateInterfaceProgram(InterfaceProgramModel model)
        {
            bool Result = false;

            try
            {
                Result = new DocumentInterfaceDAL().UpdateSingleInterfaceProgramModel(model);
            }
            catch (Exception e)
            {
                logger.Error(e.ToString());
            }

            return(Result);
        }
        public bool DeleteInterfaceProgram(int programID)
        {
            bool Result = false;

            try
            {
                InterfaceProgramModel model = new InterfaceProgramModel()
                {
                    ProgramID = programID
                };
                Result = new DocumentInterfaceDAL().DeleteSingleInterfaceProgramModel(model);
            }
            catch (Exception e)
            {
                logger.Error(e.ToString());
            }

            return(Result);
        }
Beispiel #7
0
 public bool UpdateDocumentInterfaceProgram(InterfaceProgramModel model)
 {
     return(new DocumentInterfaceBLL().UpdateInterfaceProgram(model));
 }
Beispiel #8
0
 public bool InsertDocumentInterfaceProgram(InterfaceProgramModel model)
 {
     return(new DocumentInterfaceBLL().InsertInterfaceProgram(model));
 }