示例#1
0
        internal Copyright_DTO_Create ReadFromValue(string CprValue)
        {
            ADO Ado = new ADO("defaultConnection");

            try
            {
                Copyright_DTO_Create dto = new Copyright_DTO_Create();

                Copyright_ADO      cAdo    = new Copyright_ADO();
                Copyright_DTO_Read readDTO = new Copyright_DTO_Read();
                readDTO.CprValue = CprValue;
                var retval = cAdo.Read(Ado, readDTO);
                if (retval.hasData)
                {
                    dto.CprCode  = retval.data[0].CprCode;
                    dto.CprValue = CprValue;
                    dto.CprUrl   = retval.data[0].CprUrl;
                }

                return(dto);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Ado.Dispose();
            }
        }
示例#2
0
        /// <summary>
        /// Creates a Copyright
        /// </summary>
        /// <param name="ado"></param>
        /// <param name="copyright"></param>
        /// <param name="ccnUsername"></param>
        /// <returns></returns>
        internal int Create(ADO ado, Copyright_DTO_Create copyright, string ccnUsername)
        {
            List <ADO_inputParams> inputParamList = new List <ADO_inputParams>()
            {
                new ADO_inputParams()
                {
                    name = "@CcnUsername", value = ccnUsername
                },
                new ADO_inputParams()
                {
                    name = "@CprCode", value = copyright.CprCode
                },
                new ADO_inputParams()
                {
                    name = "@CprValue", value = copyright.CprValue
                },
                new ADO_inputParams()
                {
                    name = "@CprUrl", value = copyright.CprUrl
                }
            };

            // A return parameter is required for the operation
            ADO_returnParam retParam = new ADO_returnParam();

            retParam.name  = "return";
            retParam.value = 0;

            //Attempting to create the new entity
            ado.ExecuteNonQueryProcedure("System_Settings_Copyright_Create", inputParamList, ref retParam);

            //Assign the returned value for checking and output
            return(retParam.value);
        }