Exemplo n.º 1
0
 public bool SaveDataSource(DataSourceDetailsModel request)
 {
     return(this.dbPlugin.Execute(context =>
     {
         try
         {
             //context.datasourcedetail.Where(x => x.Id == request.Id).Delete();
             //foreach (var svd in request.DataSourceTableObj)
             //{
             context.datasourcedetail.Add(new DataSourceDetails()
             {
                 ConnectionName = request.ConnectionType,
                 ConnectionString = "server=" + request.ServerName + ";port=" + "3306" + ";Database=" + request.Database + ";User="******";Password="******""
             });
             //}
             context.SaveChanges();
             return true;
         }
         catch (Exception ex)
         {
             return false;
         }
     }));
 }
Exemplo n.º 2
0
        public bool VerifyDataSource(DataSourceDetailsModel dataSource)
        {
            string connectionString = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};", dataSource.ServerName, dataSource.Database, dataSource.User, dataSource.Password);

            try
            {
                Helper helper = new Helper(connectionString, dataSource.ConnectionType);
                if (helper.IsSqlConnection)
                {
                    return(true);
                }
                else if (helper.IsMySqlConnection)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IActionResult VerifyDataSource(DataSourceDetailsModel dataSource)
        {
            var isValid = _datasourceconnectionService.VerifyDataSource(dataSource);

            if (isValid)
            {
                return(Ok(new CreateDataSourceResponse()
                {
                    Message = $"Connectin establish successfully.",
                    Success = true
                }));
            }
            else
            {
                return(BadRequest(new CreateDataSourceResponse()
                {
                    Message = $"Connectin string data not get successfully",
                    Success = false,
                    ConnectionString = ""
                }));
            }
        }
        public IActionResult SaveDataSource(DataSourceDetailsModel dataSource)
        {
            var isValid = _datasourceconnectionService.SaveDataSource(dataSource);

            if (isValid)
            {
                return(Ok(new CreateDataSourceResponse()
                {
                    Message = $"Save Data successfully.",
                    Success = true
                }));
            }
            else
            {
                return(BadRequest(new CreateDataSourceResponse()
                {
                    Message = $"Error",
                    Success = false,
                    ConnectionString = ""
                }));
            }
            //return _datasourceconnectionService.SaveDataSource(dataSource);
        }
 public bool VerifyDataSource(DataSourceDetailsModel dataSource)
 {
     return(_datasourceRepository.VerifyDataSource(dataSource));
 }
 public bool SaveDataSource(DataSourceDetailsModel dataSource)
 {
     return(_datasourceRepository.SaveDataSource(dataSource));
 }