Ejemplo n.º 1
0
        public List <AppVersionDTO> SelectAppVersion(int aplicacion_id)
        {
            List <AppVersionDTO> listaAppVersiones = new List <AppVersionDTO>();
            StringBuilder        query             = new StringBuilder().Append(@"SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
							SELECT 
							ID,
							APLICACION_ID,
                            NUMERO,
                            RUTA_APLICACION
							FROM APPVERSION"                            );

            if (aplicacion_id != 0)
            {
                query.Append(" WHERE APLICACION_ID=@APLICACION_ID");
            }

            using (var con = ConectarDB())
            {
                con.Open();
                try
                {
                    using (SqlCommand command = new SqlCommand(query.ToString(), con))
                    {
                        if (aplicacion_id != 0)
                        {
                            command.Parameters.Add(new SqlParameter("@APLICACION_ID", aplicacion_id));
                        }

                        using (var reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                AppVersionDTO appVersion = new AppVersionDTO()
                                {
                                    AppVersion_id   = Convert.ToInt32(reader[0]),
                                    Aplicacion_id   = reader[1].ToString(),
                                    Numero          = reader[2].ToString(),
                                    Ruta_Aplicacion = reader[3].ToString()
                                };
                                listaAppVersiones.Add(appVersion);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("No se encontró el registro.");
                }
                finally
                {
                    con.Close();
                }
            }
            return(listaAppVersiones);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Crea una version de aplicacion
 /// </summary>
 /// <param name="appVersion"></param>
 /// <returns></returns>
 public ReturnMessage CreateAppVersion(AppVersionDTO appVersion)
 {
     try
     {
         //logica de negocio aquí
         AppVersionBehavior appVersionBehavior = new AppVersionBehavior();
         return(appVersionBehavior.CreateAppVersion(appVersion));
     }
     catch (Exception ex)
     {
         ReturnMessage message = new ReturnMessage();
         message.TipoMensaje = TipoMensaje.Error;
         message.Mensaje     = ex.Message;
         return(message);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Crea una estrategia
        /// </summary>
        /// <param name="aplicacion"></param>
        public ReturnMessage CreateAppVersion(AppVersionDTO appVersion)
        {
            ReturnMessage mensaje = new ReturnMessage();
            string        query   = @"SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
                            INSERT INTO APPVERSION (APLICACION_ID, NUMERO,RUTA_APLICACION) VALUES (@APLICACION_ID,@NUMERO,@RUTA_APLICACION)

                            SELECT @@IDENTITY AS 'Identity';";

            using (var con = ConectarDB())
            {
                con.Open();

                try
                {
                    using (SqlCommand command = new SqlCommand(query, con))
                    {
                        command.Parameters.Add(new SqlParameter("@APLICACION_ID", appVersion.Aplicacion_id));
                        command.Parameters.Add(new SqlParameter("@NUMERO", appVersion.Numero));
                        command.Parameters.Add(new SqlParameter("@RUTA_APLICACION", appVersion.Ruta_Aplicacion));

                        using (var reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                appVersion.AppVersion_id = Convert.ToInt32(reader[0]);
                            }
                        }
                    }

                    mensaje.Mensaje     = "La version se creó correctamente";
                    mensaje.TipoMensaje = TipoMensaje.Correcto;
                    mensaje.obj         = appVersion;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("No se pudo insertar");
                    mensaje.Mensaje     = ex.Message;
                    mensaje.TipoMensaje = TipoMensaje.Error;
                    mensaje.obj         = appVersion;
                }
                finally
                {
                    con.Close();
                }
                return(mensaje);
            }
        }
Ejemplo n.º 4
0
Archivo: Config.cs Proyecto: yienit/KST
        /// <summary>
        ///初始化,类库在加载时就使用配置文件对所有配置进行初始化
        /// </summary>
        static Config()
        {
            try
            {
                log.Debug(Constant.DEBUG_START);

                string configFilePath = AppDomain.CurrentDomain.BaseDirectory + Constant.CONFIG_FILE_NAME;

                // Basic
                connectionString = XmlUtil.ReadValue(configFilePath, XPATH_BASEC_DB_CONNECTION);
                maxLogFileCount = Convert.ToInt32(XmlUtil.ReadValue(configFilePath, XPATH_BASIC_MAX_LOG_FILE_COUNT));

                // Security
                apiSignSecretKey = XmlUtil.ReadValue(configFilePath, XPATH_SECURITY_API_AUTH_KEY);

                // Sms
                smsApiKey = XmlUtil.ReadValue(configFilePath, XPATH_SMS_API_KEY);
                captchaExpireTime = Convert.ToInt32(XmlUtil.ReadValue(configFilePath, XPATH_SECURITY_CAPTCHA_EXPIRE_TIME));
                smsRegTemplate = XmlUtil.ReadValue(configFilePath, XPATH_SMS_TEMPLATE_REG);
                smsGetPasswordTemplate = XmlUtil.ReadValue(configFilePath, XPATH_SMS_TEMPLATE_GET_PASSWORD);
                smsLoginTemplate = XmlUtil.ReadValue(configFilePath, XPATH_SMS_TEMPLATE_LOGIN);

                // AppVersion
                string pcVersion = XmlUtil.ReadValue(configFilePath, XPATH_APP_PC_VERSION);
                string pcDownloadUrl = XmlUtil.ReadValue(configFilePath, XPATH_APP_PC_URL);
                string pcChangeLog = XmlUtil.ReadValue(configFilePath, XPATH_APP_PC_CHANGE_LOG);
                pcVersionDTO = new AppVersionDTO(pcVersion, pcDownloadUrl, pcChangeLog);

                string androidVersion = XmlUtil.ReadValue(configFilePath, XPATH_APP_ANDROID_VERSION);
                string androidDownloadUrl = XmlUtil.ReadValue(configFilePath, XPATH_APP_ANDROID_URL);
                string androidChangeLog = XmlUtil.ReadValue(configFilePath, XPATH_APP_ANDROID_CHANGE_LOG);
                androidVersionDTO = new AppVersionDTO(androidVersion, androidDownloadUrl, androidChangeLog);

                string iosVersion = XmlUtil.ReadValue(configFilePath, XPATH_APP_IOS_VERSION);
                string iosDownloadUrl = XmlUtil.ReadValue(configFilePath, XPATH_APP_IOS_URL);
                string iosChangeLog = XmlUtil.ReadValue(configFilePath, XPATH_APP_IOS_CHANGE_LOG);
                iosVersionDTO = new AppVersionDTO(iosVersion, iosDownloadUrl, iosChangeLog);

                log.Debug(Constant.DEBUG_END);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
        }
 public ReturnMessage Post([FromBody] AppVersionDTO appVersion)
 {
     Controller.AppVersionController appVersionController = new Controller.AppVersionController();
     return(appVersionController.CreateAppVersion(appVersion));
 }
 // GET: AppVersion/Create
 public ReturnMessage Create([FromBody] AppVersionDTO appVersion)
 {
     ControllerVulkano.AppVersionController versionController = new ControllerVulkano.AppVersionController();
     return(versionController.CreateAppVersion(appVersion));
 }